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

View File

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