Ejemplo n.º 1
0
        public async Task HandleCompleteMissionCommand(CommandContext context)
        {
            if (MissionModel.IsMissionChannel(context.Channel.Id, context.Guild.Id))
            {
                ITextChannel channel = context.Channel as ITextChannel;
                if (channel != null)
                {
                    await context.Channel.SendEmbedAsync(channel.Topic);
                }
                await context.Channel.SendEmbedAsync(MissionSettingsModel.TestimonialPrompt);

                await context.Channel.SendEmbedAsync(MissionSettingsModel.FileReportPrompt);
            }
            else
            {
                await context.Channel.SendEmbedAsync("Could not verify this channel as a mission channel!", true);
            }
        }
Ejemplo n.º 2
0
        public async Task HandleCloseMissionCommand(CommandContext context)
        {
            string channelname = context.Channel.Name;
            ulong? channelId   = null;

            if (context.Args[1].Equals("this"))
            {
                channelId = context.Channel.Id;
            }
            else if (context.Message.MentionedChannels.Count > 0)
            {
                channelId = new List <SocketGuildChannel>(context.Message.MentionedChannels)[0].Id;
            }
            else if (ulong.TryParse(context.Args[1], out ulong parsedChannelId))
            {
                channelId = parsedChannelId;
            }

            if (channelId != null)
            {
                if (MissionModel.IsMissionChannel((ulong)channelId, context.Guild.Id))
                {
                    await MissionModel.DeleteMission((ulong)channelId, context.Guild.Id);

                    if ((ulong)channelId != context.Channel.Id)
                    {
                        await context.Channel.SendEmbedAsync("Successfully deleted mission channel!", false);
                    }
                    await SettingsModel.SendDebugMessage(string.Format("Closed mission {0}", channelname), DebugCategories.missions);
                }
                else
                {
                    await context.Channel.SendEmbedAsync("Could not verify this channel as a mission channel! Ask an admin to delete it.", true);
                }
            }
            else
            {
                await context.Channel.SendEmbedAsync("Second argument must specify a channel!", true);
            }
        }