From edf6c13f03cb9bb9fc8c90800e1432de2d384728 Mon Sep 17 00:00:00 2001 From: HekeHokkus Date: Thu, 28 Sep 2023 17:55:47 -0400 Subject: [PATCH] Update discord.go --- discord.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/discord.go b/discord.go index 6fb14534..b674ce9c 100644 --- a/discord.go +++ b/discord.go @@ -128,6 +128,8 @@ func (d *DiscordDaemon) run() { d.inviteChannelName = invChannel } } + d.bot.Activity.Name = "/" + app.config.Section("discord").Key("start_command").MustString("start") + d.bot.Activity.Type = dg.ActivityTypeGame defer d.deregisterCommands() defer d.bot.Close() @@ -339,6 +341,18 @@ func (d *DiscordDaemon) registerCommands() { }, }, }, + { + Name: "invite", + Description: "Send an invite to a discord user (admin only).", + Options: []*dg.ApplicationCommandOption{ + { + Type: dg.ApplicationCommandOptionUser, + Name: "user", + Description: "User to Invite", + Required: true, + }, + }, + }, } commands[1].Options[0].Choices = make([]*dg.ApplicationCommandOptionChoice, len(d.app.storage.lang.Telegram)) i := 0 @@ -504,6 +518,13 @@ func (d *DiscordDaemon) cmdLang(s *dg.Session, i *dg.InteractionCreate, lang str } } +func (d *DiscordDaemon) cmdInvite(s *dg.Session, i *dg.InteractionCreate, lang string) { + requestor := d.MustGetUser(channel.ID, i.Interaction.Member.User.ID, i.Interaction.Member.User.Discriminator, i.Interaction.Member.User.Username) + d.users[i.Interaction.Member.User.ID] = requestor + invuser := i.ApplicationCommandData().Options[0].StringValue() + // Check whether requestor is linked to the admin account +} + func (d *DiscordDaemon) messageHandler(s *dg.Session, m *dg.MessageCreate) { if m.GuildID != "" && d.channelName != "" { if d.channelID == "" {