Skip to content

Commit

Permalink
Add message when challenge is created
Browse files Browse the repository at this point in the history
  • Loading branch information
kriive committed Jan 21, 2024
1 parent 4e2797e commit b98dd82
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion discord/ctf.go
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ func (s *Server) handleNewChal(event *handler.CommandEvent) error {

// Create the channel with our custom permissions.
// No one but the current role members should see the channel.
_, err = s.client.Rest().CreateGuildChannel(*event.GuildID(), discord.GuildTextChannelCreate{
channel, err := s.client.Rest().CreateGuildChannel(*event.GuildID(), discord.GuildTextChannelCreate{
Name: chalName,
ParentID: parentChannel.ID(),
PermissionOverwrites: []discord.PermissionOverwrite{
Expand All @@ -525,6 +525,12 @@ func (s *Server) handleNewChal(event *handler.CommandEvent) error {
return Error(event, err)
}

_, err = s.client.Rest().CreateMessage(channel.ID(), discord.NewMessageCreateBuilder().SetEmbeds(messageEmbedSuccess(
"New challenge!", fmt.Sprintf("%s has created `%s`", event.User().String(), chalName))).Build())
if err != nil {
return Error(event, err)
}

Respond(event, "New channel created", fmt.Sprintf("Successfully added channel `%s`.", chalName))
return err
}

0 comments on commit b98dd82

Please sign in to comment.