[RequireContext(ContextType.Guild)] //Cannot be requested via DM. public async Task GiveHamachiAsync() { //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 { string HamachiServer = BotTools.GetSettingString(BotTools.ConfigurationEntries.HamachiServer); string HamachiPass = BotTools.GetSettingString(BotTools.ConfigurationEntries.HamachiPassword); await Context.User.SendMessageAsync($"**N1 Grand Prix Hamachi Server**\n```\nServer: {HamachiServer}\nPassword: {HamachiPass}\n```\n\nPlease ensure that your PC name on Hamachi matches your Nickname on the N1GP Discord to help make matchmaking easier.\n\n**DO NOT provide the N1 Grand Prix Hamachi server credentials to anyone outside the N1GP.**"); await ReportChannel.SendMessageAsync("", embed : EmbedTool.UserHamachiRequest(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 Hamachi credentials."); throw; } } else { await ReplyAsync("You are not authorized to obtain Hamachi credentials. Use `!license` before attempting to use this command."); } }
[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."); } }