Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Remilia Scarlet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Reviath
Remilia Scarlet
Commits
c459f9db
Commit
c459f9db
authored
Apr 16, 2021
by
Reviath
Browse files
Options
Downloads
Patches
Plain Diff
Update welcome message command
parent
28a367c3
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
commands/welcome_message.go
+5
-4
5 additions, 4 deletions
commands/welcome_message.go
with
5 additions
and
4 deletions
commands/welcome_message.go
+
5
−
4
View file @
c459f9db
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."
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment