Phillip England
Does your team use groupme? Are you constantly having to use google translate to ensure everyone on your team can read messages? Introducing: translation-bot! A quick and easy way to auto-translate groupme messages using deepl.com's translation API.
translation-bot enables your groupme memeber to auto-translate their messages by prefixing a message with $spanish or $english depending on what lanugage they want to translate their message to. Codebase can be modified to fit more languages if needed.
1git clone https://github.com/phillip-england/translation-bot <target-directory>
1go mod tidy
1touch .env
1DEEPL_API_KEY=your deepl.com api key for translation (they offer a free tier)
2PORT=port to serve on
3YOUR_BOT_ID=your groupme bot ID (more on this in next section)
4YOUR_GROUP_ID=your groupme group ID (more on this in next section)
1var groupmeBotID string
2if groupID == os.Getenv("TESTING_GROUP_ID") {
3 groupmeBotID = os.Getenv("TESTING_BOT_ID")
4}
5if groupID == os.Getenv("SOUTHROADS_LEADERSHIP_GROUP_ID") {
6 groupmeBotID = os.Getenv("SOUTHROADS_LEADERSHIP_BOT_ID")
7}
8if groupID == os.Getenv("KITCHEN_LEADERSHIP_GROUP_ID") {
9 groupmeBotID = os.Getenv("KITCHEN_LEADERSHIP_BOT_ID")
10}
11if groupID == os.Getenv("FOH_OPERATIONS_GROUP_ID") {
12 groupmeBotID = os.Getenv("FOH_OPERATIONS_BOT_ID")
13}
14if groupID == os.Getenv("SUPPLY_ORDER_GROUP_ID") {
15 groupmeBotID = os.Getenv("SUPPLY_ORDER_BOT_ID")
16}
To fit based on the .env file I provided above, modify to the following:
1var groupmeBotID string
2if groupID == os.Getenv("YOUR_GROUP_ID") {
3 groupmeBotID = os.Getenv("YOUR_BOT_ID")
4}
Simply add more .env varialbes to add additional groups your bot can post to.
1go run main.go
For more information on how to use the groupme api or the deepl translation api, check the following links: