Skip to content

Simple CLI tool that allows you to respond to stdin messages using chat (Discord, Telegram)

License

Notifications You must be signed in to change notification settings

erykksc/chatreply

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ChatReply

Example usage

Run the command and pipe input into its stdin

Tip: By default the messages are splitted by newline character
(In the example the '\' is used to escape '!' symbol)

echo "React to this message\!
 This is a second message" | go run chatreply.go

Bot starts to watching for reaction on the messages (indicated by the eyes emoji)

Watching for reaction on discord

Upon reacting to a message the eyes emoji dissapears
Tip: Both emoji reactions and text responses are supported

Reacting to discord message

And original messages including the replies are outputed to stdout in real time (once the program sees the reply)

Cli output with reaction

Installation

You can install it using go

go install github.com/erykksc/chatreply

Tip: Later on you can use this tool with "chatreply" command instead of "go run chatreply.go"

Configuration

From .dotfiles

You need to specify the providers and their configuration in $XDG_CONFIG_HOME/chatreply/conf.toml

The toml fields and syntax:

ActiveProvider = "discord"

[Discord]
UserID = "<YOUR-USER-ID>"
Token = "<YOUR-TOKEN>"

[Telegram]
ChatID = "<YOUR-CHAT-ID>"
Token = "<YOUR-API-TOKEN>"

Specify path

You can also specify the path of the .toml config file as an argument

chatreply -f "./config-file.toml"

Multimedia support

By default the tool will try to parse lines as file paths. For example:

echo "./images/orange.png" | chatreply

will make chatreply try to open "./images/orange.png" file and send it as an attachment to the chat.
On the output it will still be just text.

Tip: You can disable this behaviour using a "-text-only" flag

Example

Discord view

Discord with an open image

CLI view

Discord image cli output

Flags and arguments

❯ chatreply -h
Usage of chatreply:
  -f string
        Filepath of the config .toml file (default "$XDG_CONFIG_HOME/chatreply/conf.toml")
  -msg-sep string
        Separator between messages (default "\n")
  -out-sep string
        Separator between output messages (default "\n")
  -replies-count int
        Number of replies to wait per message for before exiting, -1 will wait indefinitely, allowing multiple replies per message (default 1)
  -s string
        Separator between message and emoji (default ":")
  -skip-replies
        Do not wait for replies, just send the messages
  -text-only
        Make all messages text only, disable trying to parse messages as multimedia
  -v    Sets logging level to Debug
  -watch-emoji string
        Emoji used to indicate the program is watching the message for a reply (default "👀")

About

Simple CLI tool that allows you to respond to stdin messages using chat (Discord, Telegram)

Topics

Resources

License

Stars

Watchers

Forks

Languages