1
0

slash doesn't play well with new settings, experts say

This commit is contained in:
2022-05-07 11:05:45 +02:00
parent e8d5293911
commit fc1e2424db
2 changed files with 8 additions and 11 deletions

View File

@ -40,15 +40,15 @@ func SetCommand(
// add commands to the register
func CommandInit() {
SetCommand(
[]string{"/ggd audio", "/ggd tts"},
[]string{"ggd audio", "ggd tts"},
"*Attach a TTS version of the message on the channel*",
"`/ggd [audio|tts] hello everyone`",
"`ggd [audio|tts] hello everyone`",
MessageAudio)
SetCommand(
[]string{"/ggd voca"},
[]string{"ggd voca"},
"Play audio message in vocal channel",
"`/ggd voca let's go shopping`",
"`ggd voca let's go shopping`",
MessageVocal)
SetCommand(
@ -58,14 +58,14 @@ func CommandInit() {
MessagePing)
SetCommand(
[]string{"/ggd help", "/ggd info"},
[]string{"ggd help", "ggd info"},
"*Display the available list of commands*",
"`/ggd [help|info]`",
"`ggd [help|info]`",
MessageHelp)
SetCommand(
[]string{"/ggd hat", "/ggd chapeau", "/ggd chapo"},
[]string{"ggd hat", "ggd chapeau", "ggd chapo"},
"*Hand over a set of fancy hats*",
"`/ggd [hat|chapeau|chapo]`",
"`ggd [hat|chapeau|chapo]`",
MessageHat)
}

View File

@ -3,7 +3,6 @@ package core
import (
"bytes"
"fmt"
"log"
"math/rand"
"sort"
"strings"
@ -120,13 +119,11 @@ func MessagePing(s *discordgo.Session, m *discordgo.MessageCreate, message strin
// generate TTS version of the message and upload it to the channel
func MessageAudio(s *discordgo.Session, m *discordgo.MessageCreate, message string) {
log.Println("Messageaudio :", message)
var cleanMessage string = prepareTTSMessage(message)
filename, out := getAudioMessage(cleanMessage)
file := bytes.NewReader(out)
s.ChannelFileSend(m.ChannelID, filename, file)
// delete the receveid command after processing it. less clutter
log.Println("Messageaudio :", cleanMessage)
s.ChannelMessageDelete(m.ChannelID, m.ID)
}