Skip to content
Snippets Groups Projects
Commit c459f9db authored by Reviath's avatar Reviath
Browse files

Update welcome message command

parent 28a367c3
No related branches found
No related tags found
No related merge requests found
package commands
import (
"fmt"
"strings"
multiplexer "git.randomchars.net/Reviath/RemiliaScarlet/Multiplexer"
......@@ -33,13 +34,13 @@ func WelcomeMessageCommand(ctx CommandHandler.Context, _ []string) error {
return nil
}
err := db.QueryRow("SELECT message FROM welcomemessage WHERE guildid ='" + ctx.Guild.ID + "'").Scan(&tag.message)
err := db.QueryRow(fmt.Sprintf("SELECT message FROM welcomemessage WHERE guildid ='%s'", ctx.Guild.ID)).Scan(&tag.message)
if err == nil {
ctx.Reply("Hoş geldin mesajı zaten ayarlanmış, sıfırlamak için reset_welcome_message komutunu kullan.")
return nil
} else {
insert, err := db.Query("INSERT INTO welcomemessage (message, guildid) VALUES ('" + strings.Join(multiplexer.GetArgs(ctx.Message.Content, multiplexer.GetPrefix()), " ") + "', '" + ctx.Guild.ID + "')")
insert, err := db.Query(fmt.Sprintf("INSERT INTO welcomemessage (message, guildid) VALUES ('%s', '%s')", strings.Join(multiplexer.GetArgs(ctx.Message.Content, multiplexer.GetPrefix()), " "), ctx.Guild.ID))
if err != nil {
ctx.Reply("Bir hata oluştu.")
......@@ -64,13 +65,13 @@ func WelcomeMessageCommand(ctx CommandHandler.Context, _ []string) error {
return nil
}
err := db.QueryRow("SELECT message FROM welcomemessage WHERE guildid ='" + ctx.Guild.ID + "'").Scan(&tag.message)
err := db.QueryRow(fmt.Sprintf("SELECT message FROM welcomemessage WHERE guildid ='%s'", ctx.Guild.ID)).Scan(&tag.message)
if err == nil {
ctx.Reply("Welcome message is already existing (to reset, use reset_welcome_message command).")
return nil
} else {
insert, err := db.Query("INSERT INTO welcomemessage (message, guildid) VALUES ('" + strings.Join(multiplexer.GetArgs(ctx.Message.Content, multiplexer.GetPrefix()), " ") + "', '" + ctx.Guild.ID + "')")
insert, err := db.Query(fmt.Sprintf("INSERT INTO welcomemessage (message, guildid) VALUES ('%s', '%s')", strings.Join(multiplexer.GetArgs(ctx.Message.Content, multiplexer.GetPrefix()), " "), ctx.Guild.ID))
if err != nil {
ctx.Reply("An error occurred, please try again.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment