grim/wasdead
Clone
Summary
Browse
Changes
Graph
Don't output errors directly to the channel, commands should be handling that themselves
draft
2020-09-26, Gary Kramlich
c6d101eb5c05
Don't output errors directly to the channel, commands should be handling that themselves
package
discord
import
(
"fmt"
"bitbucket.org/rw_grim/wasdead/database"
)
type
SetChannelCmd
struct
{}
func
(
c
*
SetChannelCmd
)
Run
(
g
*
Globals
)
error
{
guild
,
err
:=
database
.
LoadGuild
(
g
.
msg
.
GuildID
)
if
err
!=
nil
{
return
err
}
resp
:=
fmt
.
Sprintf
(
"<#%s> is already set as the announcement channel"
,
g
.
msg
.
ChannelID
)
if
guild
.
Channel
!=
g
.
msg
.
ChannelID
{
guild
.
Channel
=
g
.
msg
.
ChannelID
guild
.
Save
()
resp
=
fmt
.
Sprintf
(
"Set <#%s> as the announcement channel"
,
g
.
msg
.
ChannelID
)
}
g
.
client
.
sendChannel
(
g
.
msg
.
ChannelID
,
resp
)
return
nil
}