public async Task SendPrivateMessage([Summary("The user to send the message to.")] IUser user = null, [Remainder] string message = null) { if (user == null || message == null) { await ReplyAsync("**Syntax:** " + Guild.Load(Context.Guild.Id).Prefix + "send privatemessage [@User] [Message]"); return; } await user.GetOrCreateDMChannelAsync().Result.SendMessageAsync(message); AdminLog.Log(Context.User.Id, Context.Message.Content, Context.Guild.Id); EmbedAuthorBuilder eab = new EmbedAuthorBuilder() .WithName("to: @" + user.Username); EmbedFooterBuilder efb = new EmbedFooterBuilder() .WithText("Message Sent to @" + user.Username + " | Sent by @" + Context.User.Username); EmbedBuilder eb = new EmbedBuilder() .WithAuthor(eab) .WithTitle("from: @" + Context.User.Username) .WithColor(new Color(181, 81, 215)) .WithDescription(message) .WithFooter(efb) .WithCurrentTimestamp(); await ReplyAsync("", false, eb.Build()); }
public async Task SendChannelMessage([Summary("The channel id to send the message to.")] ITextChannel channel, [Remainder] string message = null) { if (channel == null || message == null) { await ReplyAsync("**Syntax:** " + Guild.Load(Context.Guild.Id).Prefix + "send channelmessage [Channel ID] [Message]"); return; } await channel.SendMessageAsync(message); AdminLog.Log(Context.User.Id, Context.Message.Content, Context.Guild.Id); EmbedAuthorBuilder eab = new EmbedAuthorBuilder() .WithName("Log Message"); EmbedFooterBuilder efb = new EmbedFooterBuilder() .WithText("Message sent to " + channel.Mention + " | Sent by @" + Context.User.Username); EmbedBuilder eb = new EmbedBuilder() .WithAuthor(eab) .WithTitle("Author: @" + Context.User.Username) .WithColor(new Color(181, 81, 215)) .WithDescription(message) .WithFooter(efb) .WithCurrentTimestamp(); await ReplyAsync("", false, eb.Build()); }
public async Task Say([Remainder, Summary("The text to echo")] string echo) { await ReplyAsync(echo); AdminLog.Log(Context.User.Id, Context.Message.Content, Context.Guild.Id); await Context.Message.DeleteAsync(); }
public async Task SetWelcomeMessage([Remainder] string message = null) { if (message == null) { StringBuilder sb = new StringBuilder() .Append("**Syntax:** " + Guild.Load(Context.Guild.Id).Prefix + "setwelcome [Welcome Message]\n\n") .Append("```Available Flags\n") .Append("---------------\n") .Append("User Flags:\n") .Append("{USER.MENTION} - @" + Context.User.Username + "\n") .Append("{USER.USERNAME} - " + Context.User.Username + "\n") .Append("{USER.DISCRIMINATOR} - " + Context.User.Discriminator + "\n") .Append("{USER.AVATARURL} - " + Context.User.GetAvatarUrl() + "\n") .Append("{USER.ID} - " + Context.User.Id + "\n") .Append("{USER.CREATEDATE} - " + Context.User.UserCreateDate() + "\n") .Append("{USER.JOINDATE} - " + Context.User.GuildJoinDate() + "\n") .Append("---------------\n") .Append("Guild Flags:\n") .Append("{GUILD.NAME} - " + Context.Guild.Name + "\n") .Append("{GUILD.OWNER.USERNAME} - " + Context.Guild.GetOwnerAsync().Result.Username + "\n") .Append("{GUILD.OWNER.MENTION} - @" + Context.Guild.GetOwnerAsync().Result.Username + "\n") .Append("{GUILD.OWNER.ID} - " + Context.Guild.GetOwnerAsync().Result.Id + "\n") .Append("{GUILD.PREFIX} - " + Guild.Load(Context.Guild.Id).Prefix + "\n") .Append("```"); await ReplyAsync(sb.ToString()); AdminLog.Log(Context.User.Id, Context.Message.Content, Context.Guild.Id); return; } Guild.UpdateGuild(Context.Guild.Id, welcomeMessage: message); await ReplyAsync("Welcome message has been changed successfully by " + Context.User.Mention + "\n\n**SAMPLE WELCOME MESSAGE**\n" + Guild.Load(Context.Guild.Id).WelcomeMessage.ModifyStringFlags(Context.User as SocketGuildUser)); }
public async Task EditFooter(IUser user, [Remainder] string footer) { if (user == null || footer == null) { await ReplyAsync("**Syntax:** " + Guild.Load(Context.Guild.Id).Prefix + "editfooter [@User] [Footer]"); return; } List <(string, string)> queryParams = new List <(string, string)>() { ("@footerText", footer) }; DatabaseActivity.ExecuteNonQueryCommand( "UPDATE users SET footerText=@footerText WHERE id='" + user.Id + "';", queryParams); AdminLog.Log(Context.User.Id, Context.Message.Content, Context.Guild.Id, user.Id); var eb = new EmbedBuilder() .WithDescription(Context.User.Username + " updated " + user.Mention + "'s footer successfully.") .WithColor(Color.DarkGreen); var message = await ReplyAsync("", false, eb.Build()); Context.Message.DeleteAfter(10); message.DeleteAfter(10); }
public async Task ToggleChannelAwardingEXPStatus(SocketTextChannel channel = null) { SocketTextChannel workingWithChannel = channel ?? Context.Channel as SocketTextChannel; if (channel == null) { await ReplyAsync("Syntax: " + Guild.Load(Context.Guild.Id).Prefix + "toggleexpawarding [#channel]"); return; } bool value = !Channel.Load(workingWithChannel.Id).AwardingEXP; var queryParams = new List <(string, string)>() { ("@awardingEXP", value.ToOneOrZero().ToString()) }; DatabaseActivity.ExecuteNonQueryCommand("UPDATE channels SET awardingEXP=@awardingEXP WHERE channelID='" + workingWithChannel.Id + "';", queryParams); AdminLog.Log(Context.User.Id, Context.Message.Content, Context.Guild.Id); if (value) { await ReplyAsync(Context.User.Mention + ", this channel will award EXP to the users who's messages are typed here."); } else { await ReplyAsync(Context.User.Mention + ", this channel will no longer award EXP to the users who's messages are typed here."); } }
public async Task SetDatabaseName([Remainder] string value) { Configuration.UpdateConfiguration(databaseName: value); AdminLog.Log(Context.User.Id, Context.Message.Content, Context.Guild.Id); await Configuration.Load().LogChannelId.GetTextChannel().SendMessageAsync("Database Name has been changed by " + Context.User.Mention + " to " + value); }
public async Task ToggleEXPAwardingReactionsPoster() { Configuration.UpdateConfiguration(awardingEXPReactPostEnabled: !Configuration.Load().AwardingEXPReactPostEnabled); AdminLog.Log(Context.User.Id, Context.Message.Content, Context.Guild.Id); await Configuration.Load().LogChannelId.GetTextChannel().SendMessageAsync("EXP awarding has been toggled by " + Context.User.Mention + " (enabled: " + Configuration.Load().AwardingEXPReactPostEnabled.ToYesNo() + ")"); }
public async Task AddQuote([Remainder] string quote = null) { EmbedBuilder eb; if (quote == null) { eb = new EmbedBuilder { Title = "Invalid Syntax", Description = "**Syntax:** " + Guild.Load(Context.Guild.Id).Prefix + "addquote [quote] (@creator)", Color = new Color(210, 47, 33) }; await ReplyAsync("", false, eb.Build()); return; } Quote.AddQuote(quote, Context.User.Id, Context.Guild.Id); AdminLog.Log(Context.User.Id, Context.Message.Content, Context.Guild.Id); eb = new EmbedBuilder() .WithDescription(Context.User.Mention + " Quote Added") .WithColor(33, 210, 47); await ReplyAsync("", false, eb.Build()); }
public async Task SetPrefix(string prefix) { Guild.UpdateGuild(Context.Guild.Id, prefix: prefix); AdminLog.Log(Context.User.Id, Context.Message.Content, Context.Guild.Id); await ReplyAsync(Context.User.Mention + " has updated the Prefix to: " + prefix); }
public async Task SetDefaultWebsiteName([Remainder] string name = null) { StringConfiguration.UpdateConfiguration(websiteName: name); AdminLog.Log(Context.User.Id, Context.Message.Content, Context.Guild.Id); await Configuration.Load().LogChannelId.GetTextChannel().SendMessageAsync("DefaultWebsiteName has been changed by " + Context.User.Mention + " to " + name); }
public async Task SendMessageToAllGuilds([Remainder] string message = null) { if (message == null) { await ReplyAsync("**Syntax:** " + Guild.Load(Context.Guild.Id).Prefix + "globalmessage [message]\n" + "This will post an embed message to all guilds. It's main purpose is to inform guild owners of updates and changes."); return; } AdminLog.Log(Context.User.Id, Context.Message.Content, Context.Guild.Id); EmbedBuilder eb = new EmbedBuilder() { Title = "Announcement from " + Context.User.Username, Color = new Color(User.Load(Context.User.Id).AboutR, User.Load(Context.User.Id).AboutG, User.Load(Context.User.Id).AboutB), Description = message }.WithCurrentTimestamp(); foreach (SocketGuild g in DiscordBot.Bot.Guilds) { await Guild.Load(g.Id).LogChannelID.GetTextChannel().SendMessageAsync("", false, eb.Build()); } await Configuration.Load().LogChannelId.GetTextChannel().SendMessageAsync("", false, eb.WithFooter("Message sent to all guilds").Build()); }
public async Task SetGlobalLogChannel(SocketTextChannel channel) { Configuration.UpdateConfiguration(logChannelId: channel.Id); AdminLog.Log(Context.User.Id, Context.Message.Content, Context.Guild.Id); await Configuration.Load().LogChannelId.GetTextChannel().SendMessageAsync(Context.User.Mention + " has updated \"LogChannelID\" to: " + channel.Mention); }
public async Task SendSyntax() { await ReplyAsync("**Syntax:** " + Guild.Load(Context.Guild.Id).Prefix + "editconfig [command] [command syntax]\n```INI\n" + "Available Commands\n" + "-----------------------------\n" + "[ 1] clearactivity\n" + "[ 2] setgame [type] [message]\n" + "[a.] [type] -> [none] [playing] [listening] [watching]\n" + "[ 3] setstreaming [stream url] [message]\n" + "[ 4] status [status]\n" + "[a.] [status] -> [online] [donotdisturb] [idle] [invisible]\n" + "[ 5] toggleunknowncommand\n" + "[ 6] leaderboardamount [number of users to display]\n" + "[ 7] quotelevel [level]\n" + "[ 8] prefixlevel [level]\n" + "[ 9] rgblevel [level]\n" + "[10] senpaichance [number 1-100]\n" + "[11] globallogchannel [channel mention / channel id]\n" + "[12] rule34 [max number for random to use]\n" + "[13] minlengthforexp [string length for exp gain]\n" + "[14] leaderboardtrophyurl [link]\n" + "[15] leaderboardembedcolor [uint id]\n" + "[16] toggleexpawarding\n" + "[17] toggleshowallawards\n" + "[18] awardsiconurl [link]\n" + "[19] toggleawardingexpmention\n" + "[20] toggleexpreactawarding\n" + "[21] toggleexpreactpostawarding\n" + "```"); AdminLog.Log(Context.User.Id, Context.Message.Content, Context.Guild.Id); }
public async Task ShowBotConfig() { AdminLog.Log(Context.User.Id, Context.Message.Content, Context.Guild.Id); EmbedBuilder eb = new EmbedBuilder() .WithTitle("Bot Configuration") .WithFooter("Bot Owner permissions required to change these variables!"); eb.WithDescription("```INI\n" + "[ 1] Developer [ " + (Configuration.Load().Developer.GetUser().Username ?? "Melissa") + " ]\n" + "[ 2] Developer ID [ " + Configuration.Load().Developer + " ]\n" + "[ 3] Activity Name [ " + (Configuration.Load().ActivityName ?? "") + " ]\n" + "[ 4] Activity Type [ " + (((ActivityType)Configuration.Load().ActivityType).ToString() ?? "") + " ]\n" + "[ 5] Activity Stream [ " + Configuration.Load().ActivityStream + " ]\n" + "[ 6] Status [ " + Configuration.Load().Status + " ]\n" + "[ 7] Unknown Command Enabled [ " + Configuration.Load().UnknownCommandEnabled.ToYesNo() + " ]\n" + "[ 8] Awarding EXP Enabled [ " + Configuration.Load().AwardingEXPEnabled.ToYesNo() + " ]\n" + "[ 9] Leaderboard Amount [ " + Configuration.Load().LeaderboardAmount + " ]\n" + "[10] Quote Level Requirement [ " + Configuration.Load().QuoteLevelRequirement + " ]\n" + "[11] Prefix Level Requirement [ " + Configuration.Load().PrefixLevelRequirement + " ]\n" + "[12] RGB Level Requirement [ " + Configuration.Load().RGBLevelRequirement + " ]\n" + "[13] Senpai Chance Rate [ " + Configuration.Load().SenpaiChanceRate + "/100 ]\n" + "[14] Global Log Channel [ #" + (Configuration.Load().LogChannelId.GetTextChannel().Name ?? "UNDEFINED") + " ]\n" + "[15] Global Log Channel ID [ " + Configuration.Load().LogChannelId + " ]\n" + "[16] Respects [ " + Configuration.Load().Respects + " ]\n" + "[17] Min Length For EXP [ " + Configuration.Load().MinLengthForEXP + " ]\n" + "[18] Max Rule34 Gamble ID [ " + Configuration.Load().MaxRuleXGamble + " ]\n" + "[19] Showing All Awards [ " + Configuration.Load().ShowAllAwards.ToYesNo() + "]\n" + "```"); await ReplyAsync("", false, eb.Build()); }
public async Task ShowGuildConfig() { AdminLog.Log(Context.User.Id, Context.Message.Content, Context.Guild.Id); try { EmbedBuilder eb = new EmbedBuilder() .WithTitle("Guild Configuration") .WithFooter("Guild Configuration can be edited by Guild Owner/Administrator"); eb.WithDescription("```INI\n" + "[ 1] Prefix [ " + (Guild.Load(Context.Guild.Id).Prefix ?? "UNDEFINED") + " ]\n" + "[ 2] Welcome Channel [ #" + (Guild.Load(Context.Guild.Id).WelcomeChannelID.GetTextChannel().Name ?? "UNDEFINED") + " ]\n" + "[ 3] Welcome Channel ID [ " + (Guild.Load(Context.Guild.Id).WelcomeChannelID) + " ]\n" + "[ 4] Log Channel [ #" + (Guild.Load(Context.Guild.Id).LogChannelID.GetTextChannel().Name ?? "UNDEFINED") + " ]\n" + "[ 5] Log Channel ID [ " + (Guild.Load(Context.Guild.Id).LogChannelID) + " ]\n" + "[ 6] Bot Channel [ #" + (Guild.Load(Context.Guild.Id).BotChannelID.GetTextChannel().Name ?? "UNDEFINED") + " ]\n" + "[ 7] Bot Channel ID [ " + (Guild.Load(Context.Guild.Id).BotChannelID) + " ]\n" + "[ 8] Senpai Enabled [ " + Guild.Load(Context.Guild.Id).SenpaiEnabled.ToYesNo() + " ]\n" + "[ 9] Quotes Enabled [ " + Guild.Load(Context.Guild.Id).QuotesEnabled.ToYesNo() + " ]\n" + "[10] NSFW Commands Enabled [ " + Guild.Load(Context.Guild.Id).NSFWCommandsEnabled.ToYesNo() + " ]\n" + "[11] Rule34 Channel [ #" + (Guild.Load(Context.Guild.Id).RuleGambleChannelID.GetTextChannel().Name ?? "UNDEFINED") + " ]\n" + "[12] Rule34 Channel ID [ " + (Guild.Load(Context.Guild.Id).RuleGambleChannelID) + " ]\n" + "```"); await ReplyAsync("", false, eb.Build()); } catch (Exception e) { await ReplyAsync( "It appears that your Guild Configuration has not been set-up completely. Please complete all the steps before using this command."); await new LogMessage(LogSeverity.Warning, "ShowConfigModule", e.Message).PrintToConsole(); } }
public async Task ToggleUc() { Configuration.UpdateConfiguration(unknownCommandEnabled: !Configuration.Load().UnknownCommandEnabled); AdminLog.Log(Context.User.Id, Context.Message.Content, Context.Guild.Id); await Configuration.Load().LogChannelId.GetTextChannel().SendMessageAsync("UnknownCommand has been toggled by " + Context.User.Mention + " (enabled: " + Configuration.Load().UnknownCommandEnabled.ToYesNo() + ")"); }
public async Task KillProgram(string confirmation = null) { if (confirmation.ToUpperInvariant() != "CONFIRM") { await ReplyAsync("**Please confirm by entering the TwoAuth code as follows:** " + Guild.Load(Context.Guild.Id).Prefix + "die confirm\n" + "Issuing this command will log the Bot out and terminate the process."); return; } AdminLog.Log(Context.User.Id, Context.Message.Content, Context.Guild.Id); EmbedBuilder eb = new EmbedBuilder { Title = "", Color = new Color(User.Load(Context.User.Id).AboutR, User.Load(Context.User.Id).AboutG, User.Load(Context.User.Id).AboutB), Description = "" }.AddField("", ""); await ReplyAsync("", false, eb.Build()); await DiscordBot.Bot.LogoutAsync(); Environment.Exit(0); }
public async Task ToggleShowingAllAwards() { Configuration.UpdateConfiguration(showAllAwards: !Configuration.Load().ShowAllAwards); AdminLog.Log(Context.User.Id, Context.Message.Content, Context.Guild.Id); await Configuration.Load().LogChannelId.GetTextChannel().SendMessageAsync("Showing All Awards has been toggled by " + Context.User.Mention + " (enabled: " + Configuration.Load().ShowAllAwards.ToYesNo() + ")"); }
public async Task ToggleAwardingEXPMention() { Configuration.UpdateConfiguration(awardingEXPMentionUser: !Configuration.Load().AwardingEXPMentionUser); AdminLog.Log(Context.User.Id, Context.Message.Content, Context.Guild.Id); await Configuration.Load().LogChannelId.GetTextChannel().SendMessageAsync("AwardingEXPMentionUser has been toggled by " + Context.User.Mention + " (enabled: " + Configuration.Load().AwardingEXPMentionUser.ToYesNo() + ")"); }
public async Task SendWelcomeMessage(SocketGuildUser user) { await Guild.Load(Context.Guild.Id).WelcomeChannelID.GetTextChannel().SendMessageAsync(Guild.Load(Context.Guild.Id).WelcomeMessage.ModifyStringFlags(user)); AdminLog.Log(Context.User.Id, Context.Message.Content, Context.Guild.Id, user.Id); await Guild.Load(Context.Guild.Id).LogChannelID.GetTextChannel().SendMessageAsync("A welcome message for " + user.Mention + " has been posted. (Forced by: " + Context.User.Mention + ")"); }
public async Task ShowAllConfigs() { AdminLog.Log(Context.User.Id, Context.Message.Content, Context.Guild.Id); await ShowBotConfig().ConfigureAwait(false); await ShowGuildConfig().ConfigureAwait(false); await ShowStringConfiguration().ConfigureAwait(false); }
public async Task SetRule34Max(int value) { int oldValue = Configuration.Load().MaxRuleXGamble; Configuration.UpdateConfiguration(maxRuleXGamble: value); AdminLog.Log(Context.User.Id, Context.Message.Content, Context.Guild.Id); await Configuration.Load().LogChannelId.GetTextChannel().SendMessageAsync(Context.User.Mention + " has updated the Rule34 Max to: " + value + " (was: " + oldValue + ")"); }
public async Task SetInvisible() { Configuration.UpdateConfiguration(status: UserStatus.Invisible); await DiscordBot.Bot.SetStatusAsync(UserStatus.Invisible); AdminLog.Log(Context.User.Id, Context.Message.Content, Context.Guild.Id); await ReplyAsync("Status updated to Invisible, " + Context.User.Mention); }
public async Task SetLeaderboardAmount(int value) { int oldValue = Configuration.Load().LeaderboardAmount; Configuration.UpdateConfiguration(leaderboardAmount: value); AdminLog.Log(Context.User.Id, Context.Message.Content, Context.Guild.Id); await Configuration.Load().LogChannelId.GetTextChannel().SendMessageAsync(Context.User.Mention + " has updated the Leaderboard amount to: " + value + " (was: " + oldValue + ")"); }
public async Task ChangeRGBPrice(int levelRequirement) { int oldLevel = Configuration.Load().RGBLevelRequirement; Configuration.UpdateConfiguration(rgbLevelRequirement: levelRequirement); AdminLog.Log(Context.User.Id, Context.Message.Content, Context.Guild.Id); await Configuration.Load().LogChannelId.GetTextChannel().SendMessageAsync("**" + Context.User.Mention + "** has updated the RGB level to **" + levelRequirement + "** coins. (Was: **" + oldLevel + "**)"); }
public async Task ChangeSenpaiChance(int chanceValue) { int oldChance = Configuration.Load().SenpaiChanceRate; Configuration.UpdateConfiguration(senpaiChanceRate: chanceValue); AdminLog.Log(Context.User.Id, Context.Message.Content, Context.Guild.Id); await Configuration.Load().LogChannelId.GetTextChannel().SendMessageAsync("**" + Context.User.Mention + "** has updated the senpai chance to **" + chanceValue + "%**. (Was: **" + oldChance + "%**)"); }
public async Task SetRequiredMessageLengthForCoins(int value) { int oldValue = Configuration.Load().MinLengthForEXP; Configuration.UpdateConfiguration(minLengthForEXP: value); AdminLog.Log(Context.User.Id, Context.Message.Content, Context.Guild.Id); await Configuration.Load().LogChannelId.GetTextChannel().SendMessageAsync(Context.User.Mention + " has updated the MinLengthForCoin amount to: " + value + " (was: " + oldValue + ")"); }
public async Task SetLeaderboardEmbedColor(uint colorId) { uint oldValue = Configuration.Load().LeaderboardEmbedColor; Configuration.UpdateConfiguration(leaderboardEmbedColor: colorId); AdminLog.Log(Context.User.Id, Context.Message.Content, Context.Guild.Id); await Configuration.Load().LogChannelId.GetTextChannel().SendMessageAsync(Context.User.Mention + " has updated the Leaderboard Embed Color ID to: " + colorId + " (was: " + oldValue + ")"); }
public async Task SetAwardsIconUrl(string link) { string oldValue = Configuration.Load().AwardsIconUrl; Configuration.UpdateConfiguration(awardsIconUrl: link); AdminLog.Log(Context.User.Id, Context.Message.Content, Context.Guild.Id); await Configuration.Load().LogChannelId.GetTextChannel().SendMessageAsync(Context.User.Mention + " has updated the Awards Icon URL to: " + link + " (was: " + oldValue + ")"); }