Exemplo n.º 1
0
        [RequireContext(ContextType.Guild)] //Cannot be requested via DM.
        public async Task GiveRadminAsync()
        {
            //Log the caller.
            string LogEntry      = $"{DateTime.Now.ToString()} requested by {Context.User.Id} - {Context.User.Username}";
            var    ReportChannel = Context.Guild.GetTextChannel(BotTools.GetReportingChannelUlong());
            var    Requestor     = Context.User as SocketGuildUser;
            var    caller        = Context.User as IGuildUser;

            //Check the Netbattler Role.
            if (caller.RoleIds.Contains(RoleModule.GetRole("Netbattler", Context.Guild).Id))
            {
                //Check to see if the user can accept DMs.
                try
                {
                    //Pivoting this to a complete message rather than


                    string RadminServer = BotTools.GetSettingString(BotTools.ConfigurationEntries.RadminCredentialString);

                    await Context.User.SendMessageAsync(RadminServer);              //Updated this to, instead of using a template, use a moderator-specified string in its entirety. -MMX 6/18/2021

                    await ReportChannel.SendMessageAsync("", embed : EmbedTool.UserRadminRequest(Requestor));
                    await ReplyAsync("You have e-mail.");
                }
                catch (Exception)
                {
                    await ReplyAsync("You currently have DMs disabled. Please enable DMs from users on the server to obtain the Radmin credentials.");

                    throw;
                }
            }
            else
            {
                await ReplyAsync("You are not authorized to obtain Radmin credentials. Use `!license` before attempting to use this command.");
            }
        }