Documentation
¶
Overview ¶
Package translate is a Discord bot library to translate messages with Google Translate API.
import translate "github.com/StalkR/discordgo-translate"
Discord bot setup:
- create a new application: https://discordapp.com/developers/applications/me
- get client ID, required to add bot to server below
- click add bot
- get token, required to configure the bot
- add bot to server: https://discordapp.com/oauth2/authorize?&client_id=CLIENT_ID&scope=bot&permissions=0
Add a Google Translate API key and start the bot.
To translate a message into a given language, react to it with the desired language flag. The source language is automatically detected.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bot ¶
type Bot struct {
// contains filtered or unexported fields
}
A Bot represents a Discord Translate bot.
Example ¶
b := New("<Discord bot token>", "<Google Translate API token>")
if err := b.Start(); err != nil {
log.Fatal(err)
}
defer b.Close()
log.Printf("Discord Translate bot running - press CTRL-C to exit")
sc := make(chan os.Signal, 1)
signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt, os.Kill)
<-sc
func New ¶
New creates a new Discord Translate bot. Requires a Discord bot token and a Google Translate API key.
Click to show internal directories.
Click to hide internal directories.

