public async Task TakeAwayRole([Remainder] string role) { var config = GuildConfig.GetGuildConfig(Context.Guild.Id); var user = Context.User as SocketGuildUser; var embed = new EmbedBuilder() .WithColor(new Color(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3)) .WithFooter(Bot.Internal.Utilities.GetFormattedLocaleMsg("CommandFooter", Context.User.Username)); if (config == null) { embed.WithDescription("This server doesn't have any self roles set."); } else { if (config.SelfRoles.Contains(role)) { embed.WithDescription($"Removed your **{role}** role."); var r = Context.Guild.Roles.FirstOrDefault(x => x.Name == role); await user.RemoveRoleAsync(r); } else { embed.WithDescription("That role isn't in the self roles list for this server. Remember that this command is cAsE sEnSiTiVe!"); } } await ReplyAsync("", false, embed); }
public async Task SetTextIntoConfigLol([Remainder] string msg) { var config = GuildConfig.GetGuildConfig(Context.Guild.Id) ?? GuildConfig.CreateGuildConfig(Context.Guild.Id); var embed = new EmbedBuilder(); embed.WithDescription( $"Set this guild's leaving message to:\n\n ```{msg}```\n\nSending a test welcome message to <#{config.WelcomeChannel}>"); embed.WithColor(new Color(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3)); embed.WithFooter(Bot.Internal.Utilities.GetFormattedLocaleMsg("CommandFooter", Context.User.Username)); config.LeavingMessage = msg; GuildConfig.SaveGuildConfig(); await SendMessage(embed); if (config.WelcomeChannel != 0) { var a = config.LeavingMessage.Replace("{UserMention}", Context.User.Mention); var b = a.Replace("{ServerName}", Context.Guild.Name); var c = b.Replace("{UserName}", Context.User.Username); var d = c.Replace("{OwnerMention}", Context.Guild.Owner.Mention); var e = d.Replace("{UserTag}", Context.User.DiscriminatorValue.ToString()); var channel = Context.Guild.GetTextChannel(config.WelcomeChannel); var embed2 = new EmbedBuilder(); embed2.WithDescription(e); embed2.WithColor(new Color(config.WelcomeColour1, config.WelcomeColour2, config.WelcomeColour3)); embed2.WithFooter($"Guild Owner: {Context.Guild.Owner.Username}#{Context.Guild.Owner.Discriminator}"); embed2.WithThumbnailUrl(Context.Guild.IconUrl); await channel.SendMessageAsync("", false, embed2); } }
public static async Task Welcome(SocketGuildUser user) { var config = GuildConfig.GetGuildConfig(user.Guild.Id); if (config.WelcomeChannel != 0) { var a = config.WelcomeMessage.Replace("{UserMention}", user.Mention); a = a.Replace("{ServerName}", user.Guild.Name); a = a.Replace("{UserName}", user.Username); a = a.Replace("{OwnerMention}", user.Guild.Owner.Mention); a = a.Replace("{UserTag}", user.DiscriminatorValue.ToString()); var channel = user.Guild.GetTextChannel(config.WelcomeChannel); var embed = new EmbedBuilder(); embed.WithDescription(a); embed.WithColor(new Color(config.WelcomeColour1, config.WelcomeColour2, config.WelcomeColour3)); embed.WithThumbnailUrl(user.Guild.IconUrl); await channel.SendMessageAsync("", false, embed); } if (user.Guild.Id == 419612620090245140) { await user.ModifyAsync(x => { x.Nickname = $"{user.Username}.cs"; }); } }
public async Task CloseTicket(SocketGuildUser user) { var config = GuildConfig.GetGuildConfig(Context.Guild.Id); if (config == null) { return; } var supportChannel = Context.Guild.Channels.FirstOrDefault(c => c.Name == $"{config.SupportChannelName}-{user.Id}"); if (config.CanCloseOwnTicket == false) { await ReplyAsync("This server doesn't allow you to close your own ticket!"); } else { if (supportChannel == null) { await ReplyAsync("You don't have a support channel made."); } else { await supportChannel.DeleteAsync(); await ReplyAsync($"Your ticket - \"{supportChannel.Name}\" - has been deleted."); } } }
public async Task TakeRole([Remainder] string role) { var config = GuildConfig.GetGuildConfig(Context.Guild.Id); var roleList = new List <string>(); var embed = new EmbedBuilder() .WithColor(new Color(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3)) .WithFooter(Bot.Internal.Utilities.GetFormattedLocaleMsg("CommandFooter", Context.User.Username)); foreach (var roleName in config.SelfRoles) { roleList.Add(roleName.ToLower()); } if (roleList.Contains(role.ToLower())) { var r = Context.Guild.Roles.FirstOrDefault(x => x.Name.ToLower() == role.ToLower()); embed.WithDescription($"Removed your **{r.Name}** role."); await(Context.User as SocketGuildUser).RemoveRoleAsync(r); } else { embed.WithDescription( "That role isn't in the self roles list for this server. Remember that this command is cAsE sEnSiTiVe!"); } await ReplyAsync("", false, embed); }
public static async Task DeleteSupportChannel(Cacheable <IUserMessage, ulong> cache, ISocketMessageChannel ch, SocketReaction s) { var channel = s.Channel as SocketGuildChannel; //allow us to send a message var config = GuildConfig.GetGuildConfig(channel.Guild .Id); //get the config so we can see the support channel name. (and embed colour) var embed = new EmbedBuilder() //create the embedded message. .WithColor(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3) .WithDescription($"Ticket marked as solved by {s.User.Value.Mention}! Closing in 45 seconds.") .WithAuthor(s.User.Value); if (channel.Name.Contains($"{config.SupportChannelName}-{s.UserId}") && s.Emote.Equals(new Emoji("☑")) ) //check if a user made the reaction in a support ticket, //check if the emote is `☑` and then delete the channel. { if (s.UserId != 320942091049893888 && s.UserId != 410547925597421571 ) //check if the id of the person who made the reaction is NOT SIVA-dev or SIVA public. { await ch.SendMessageAsync("", false, embed); //send the embedded message defined above. Thread.Sleep(45000); //wait 45 seconds (45000ms) await channel.DeleteAsync(); //delete the channel } } }
public static async Task HandleRoleUpdate(SocketRole roleBefore, SocketRole roleAfter) { var config = GuildConfig.GetGuildConfig(roleAfter.Guild.Id); var loggingChannel = roleAfter.Guild.GetTextChannel(config.ServerLoggingChannel); var embed = new EmbedBuilder() .WithDescription( "**Name**\n" + $" **Before**: {roleBefore.Name}\n" + $" **After**: {roleAfter.Name}\n" + "**Colour**\n" + $" **Before**: ({roleBefore.Color.R}, {roleBefore.Color.G}, {roleBefore.Color.B})\n" + $" **After**: ({roleAfter.Color.R}, {roleAfter.Color.G}, {roleAfter.Color.B})\n" + "**Mentionable**\n" + $" **Before**: {roleBefore.IsMentionable}\n" + $" **After**: {roleAfter.IsMentionable}\n" + "**Displayed Separately**\n" + $" **Before**: {roleBefore.IsHoisted}\n" + $" **After**: {roleAfter.IsHoisted}\n" + $"**Time**: {DateTime.UtcNow} UTC") .WithAuthor(roleAfter.Guild.Owner) .WithThumbnailUrl("https://content.mycutegraphics.com/graphics/pencil/sharp-pencil.png") .WithColor(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3); await loggingChannel.SendMessageAsync("", false, embed); }
public static async Task HandleUserUpdate(SocketUser userBefore, SocketUser userAfter) { var uB = userBefore as SocketGuildUser; var uA = userAfter as SocketGuildUser; var config = GuildConfig.GetGuildConfig(uB.Guild.Id); var loggingChannel = uB.Guild.GetTextChannel(config.ServerLoggingChannel); var embed = new EmbedBuilder() .WithDescription( $"**Name**\n" + $" **Before**: {uB.Username}\n" + $" **After**: {uA.Username}\n" + $"**Nickname**\n" + $" **Before**: {uB.Nickname})\n" + $" **After**: {uA.Nickname}\n" + $"**Profile Pic**\n" + $" **Before**: {uB.GetAvatarUrl()}\n" + $" **After**: {uA.GetAvatarUrl()}\n" + $"**Discriminator**\n" + $" **Before**: {uB.Discriminator}\n" + $" **After**: {uA.Discriminator}\n" + $"**Time**: {DateTime.UtcNow} UTC") .WithAuthor(uA.Guild.Owner) .WithThumbnailUrl("https://content.mycutegraphics.com/graphics/pencil/sharp-pencil.png") .WithColor(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3); await loggingChannel.SendMessageAsync("", false, embed); }
public async Task CreateConfigIfOneDoesntExist(ulong serverId = 0) { if (serverId == 0) { serverId = Context.Guild.Id; } var g = Program._client.GetGuild(serverId); var embed = Helpers.CreateEmbed(Context, $"Created a config for the guild `{g.Name}! ({serverId})`"); var targetConfig = GuildConfig.GetGuildConfig(serverId); var serverIds = new List <ulong>(); foreach (var server in Program._client.Guilds) { serverIds.Add(server.Id); } if (targetConfig == null && serverIds.Contains(serverId)) { GuildConfig.CreateGuildConfig(serverId); } else { embed.WithDescription( $"Couldn't create a config for {serverId}. Either they already have a config, or I don't have access to that server."); } await Helpers.SendMessage(Context, embed); }
public async Task GetSelfRoleListForServer() { var config = GuildConfig.GetGuildConfig(Context.Guild.Id); var embed = new EmbedBuilder() .WithColor(new Color(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3)) .WithFooter(Bot.Internal.Utilities.GetFormattedLocaleMsg("CommandFooter", Context.User.Username)); if (config == null) { embed.WithDescription("This server doesn't have any self-assignable roles."); } else { config.SelfRoles.Sort(); string roles = "\n"; foreach (var role in config.SelfRoles) { roles += $"**{role}**\n"; } embed.WithTitle("Roles you can self-assign: "); embed.WithDescription(roles); } await ReplyAsync("", false, embed); }
public async Task SetRoleInConfig([Remainder] string role) { var config = GuildConfig.GetGuildConfig(Context.Guild.Id) ?? GuildConfig.CreateGuildConfig(Context.Guild.Id); config.SupportRole = role; GuildConfig.SaveGuildConfig(); await ReplyAsync($"`{role}` set as the role to manage tickets."); }
public async Task AddChannelToConfig(string arg) { var config = GuildConfig.GetGuildConfig(Context.Guild.Id) ?? GuildConfig.CreateGuildConfig(Context.Guild.Id); config.SupportChannelName = arg; GuildConfig.SaveGuildConfig(); await ReplyAsync($"{arg} set as the Support channel name."); }
public async Task AddBooleanToJson(bool arg) { var config = GuildConfig.GetGuildConfig(Context.Guild.Id) ?? GuildConfig.CreateGuildConfig(Context.Guild.Id); config.CanCloseOwnTicket = arg; GuildConfig.SaveGuildConfig(); var embed = Helpers.CreateEmbed(Context, $"{arg} set as the Support Ticket `CanCloseOwnTicket` option."); await Helpers.SendMessage(Context, embed); }
public static async Task Autorole(SocketGuildUser user) { var config = GuildConfig.GetGuildConfig(user.Guild.Id); if (config.Autorole != null || config.Autorole != "") { var targetRole = user.Guild.Roles.FirstOrDefault(r => r.Name == config.Autorole); await user.AddRoleAsync(targetRole); } }
public async Task ListDonatorMentions() { var config = GuildConfig.GetGuildConfig(Context.Guild.Id); var embed = new EmbedBuilder() .WithDescription($"Nobody has donated yet! Maybe you'll be the first? Use `{config.CommandPrefix}donate` to get to there.") .WithColor(new Color(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3)) .WithFooter(Bot.Utilities.GetFormattedLocaleMsg("CommandFooter", Context.User.Username)); await ReplyAsync("", false, embed); }
public async Task SendWMSGToUser() { var config = GuildConfig.GetGuildConfig(Context.Guild.Id) ?? GuildConfig.CreateGuildConfig(Context.Guild.Id); var embed = new EmbedBuilder(); embed.WithDescription($"The welcome message for this server is: `{config.WelcomeMessage}`"); embed.WithColor(new Color(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3)); await SendMessage(embed); }
public static async Task GuildUtils(SocketGuild s) { var config = GuildConfig.GetGuildConfig(s.Id) ?? GuildConfig.CreateGuildConfig(s.Id); if (Config.bot.Blacklist.Contains(s.Owner.Id)) { await s.LeaveAsync(); return; } var Bots = 0; var Users = 0; foreach (var user in s.Users) { if (user.IsBot) { Bots += 1; } else { Users += 1; } } if (Bots > Users) { var greemDm = await _client.GetUser(Config.bot.BotOwner).GetOrCreateDMChannelAsync(); await greemDm.SendMessageAsync("", false, new EmbedBuilder() .WithDescription( $"Server {s.Name} is potentially harmful. They have {Bots} bots and {Users} users. Consider making the bot leave.") .WithColor(Config.bot.DefaultEmbedColour)); } var dmChannel = await s.Owner.GetOrCreateDMChannelAsync(); var embed = new EmbedBuilder(); embed.WithTitle($"Thanks for adding me to your server, {s.Owner.Username}!"); embed.WithDescription( "For quick information, visit the wiki: https://github.com/greemdotcs/greemdotcs.github.io/wiki \nNeed quick help? Visit the SIVA-dev server and create a support ticket: https://discord.gg/ubXaT6u \nTo get started, use the command `$h`. Follow that with a module to get a list of commands!"); embed.WithThumbnailUrl(s.IconUrl); embed.WithFooter("Still need help? Visit the SIVA-dev server linked above."); embed.WithColor(Config.bot.DefaultEmbedColour); await dmChannel.SendMessageAsync("", false, embed); config.GuildOwnerId = s.Owner.Id; GuildConfig.SaveGuildConfig(); }
public async Task CheckIfServerIsVerified() { var config = GuildConfig.GetGuildConfig(Context.Guild.Id); var embed = new EmbedBuilder() .WithColor(new Color(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3)) .WithFooter(Bot.Utilities.GetFormattedLocaleMsg("CommandFooter", Context.User.Username)); embed.WithDescription(config.VerifiedGuild ? "This server is verified! Greem thanks you for your generosity. (Unless this is a server Greem owns)" : $"This server isn't verified. Donate on my Patreon to unlock cool perks! (Plus you can brag to your friends about it.)\n\n{patreonLink}"); await ReplyAsync("", false, embed); }
public async Task SetGuildPrefix([Remainder] string prefix) { var config = GuildConfig.GetGuildConfig(Context.Guild.Id) ?? GuildConfig.CreateGuildConfig(Context.Guild.Id); var embed = new EmbedBuilder(); embed.WithDescription("Done."); embed.WithFooter(Bot.Utilities.GetFormattedLocaleMsg("CommandFooter", Context.User.Username)); embed.WithColor(new Color(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3)); config.CommandPrefix = prefix; GuildConfig.SaveGuildConfig(); await SendMessage(embed); }
public async Task AddStringToList([Remainder] string role) { var config = GuildConfig.GetGuildConfig(Context.Guild.Id); var embed = new EmbedBuilder() .WithDescription($"Added the {role} to the Config.") .WithFooter(Bot.Internal.Utilities.GetFormattedLocaleMsg("CommandFooter", Context.User.Username)) .WithColor(new Color(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3)); config.SelfRoles.Add(role); GuildConfig.SaveGuildConfig(); await SendMessage(embed); }
public async Task Leveling(bool arg) { var config = GuildConfig.GetGuildConfig(Context.Guild.Id) ?? GuildConfig.CreateGuildConfig(Context.Guild.Id); var embed = new EmbedBuilder(); embed.WithFooter(Bot.Utilities.GetFormattedLocaleMsg("CommandFooter", Context.User.Username)); embed.WithColor(new Color(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3)); embed.WithDescription(arg ? "Enabled leveling for this server." : "Disabled leveling for this server."); config.Leveling = arg; GuildConfig.SaveGuildConfig(); await SendMessage(embed); }
public async Task SetIdIntoConfig(SocketGuildChannel chnl) { var config = GuildConfig.GetGuildConfig(Context.Guild.Id) ?? GuildConfig.CreateGuildConfig(Context.Guild.Id); var embed = new EmbedBuilder(); embed.WithDescription($"Set this guild's welcome channel to #{chnl}."); embed.WithColor(new Color(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3)); embed.WithFooter(Bot.Internal.Utilities.GetFormattedLocaleMsg("CommandFooter", Context.User.Username)); config.WelcomeChannel = chnl.Id; GuildConfig.SaveGuildConfig(); await SendMessage(embed); }
public static async Task HandleChannelDelete(SocketChannel chnl) { var config = GuildConfig.GetGuildConfig((chnl as SocketTextChannel).Guild.Id); var loggingChannel = (chnl as SocketTextChannel).Guild.GetTextChannel(config.ServerLoggingChannel); var embed = new EmbedBuilder() .AddField("Channel Name", (chnl as SocketGuildChannel).Name) .WithTitle("Channel Deleted") .AddField("Time", DateTime.UtcNow + " UTC") .WithThumbnailUrl("https://openclipart.org/image/2400px/svg_to_png/91861/Remove-349235435.png") .WithAuthor((chnl as SocketGuildChannel).Guild.Owner) .WithColor(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3); await loggingChannel.SendMessageAsync("", false, embed); }
public static async Task HandleBans(SocketUser user, SocketGuild server) { var config = GuildConfig.GetGuildConfig(server.Id); var loggingChannel = server.GetTextChannel(config.ServerLoggingChannel); var embed = new EmbedBuilder() .AddField("User", $"{user.Username}#{user.Discriminator}") .WithTitle("User Banned") .AddField("Time", DateTime.UtcNow + " UTC") .WithThumbnailUrl("https://pbs.twimg.com/media/C9kEEmbXUAEX3r6.png") .WithAuthor(user) .WithColor(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3); await loggingChannel.SendMessageAsync("", false, embed); }
public static async Task HandleChannelCreate(SocketChannel chnl) { var config = GuildConfig.GetGuildConfig((chnl as SocketTextChannel).Guild.Id); var loggingChannel = (chnl as SocketTextChannel).Guild.GetTextChannel(config.ServerLoggingChannel); var embed = new EmbedBuilder() .AddField("Channel Name", (chnl as SocketGuildChannel).Name) .WithTitle("Channel Created") .AddField("Time", DateTime.UtcNow + " UTC") .WithThumbnailUrl("https://vignette.wikia.nocookie.net/uncyclopedia/images/b/b2/Plus_sign.png/revision/latest?cb=20101129042826") .WithAuthor((chnl as SocketGuildChannel).Guild.Owner) .WithColor(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3); await loggingChannel.SendMessageAsync("", false, embed); }
public static async Task HandleRoleDelete(SocketRole role) { var config = GuildConfig.GetGuildConfig(role.Guild.Id); var loggingChannel = role.Guild.GetTextChannel(config.ServerLoggingChannel); var embed = new EmbedBuilder() .AddField("Name", role.Name) .AddField("ID", role.Id) .WithTitle("Role Deleted") .AddField("Time", DateTime.UtcNow + " UTC") .WithThumbnailUrl("https://lh3.googleusercontent.com/G2jzG8a6-GAA4yhxx3XMJfPXsm6_pluyeEWKr9I5swUGF62d2xo_Qg3Kdnu00HAmDQ=s180") .WithAuthor(role.Guild.Owner) .WithColor(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3); await loggingChannel.SendMessageAsync("", false, embed); }
internal static async Task HandleMessages(SocketMessage s) { var msg = s as SocketUserMessage; var context = new SocketCommandContext(_client, msg); if (msg == null) { Console.WriteLine($"{s} not cared for as it's null (for whatever reason)"); return; } //Console.WriteLine($"Var msg: {msg}"); //Console.WriteLine($"Var s: {s}"); //Console.WriteLine($"Var context: {context}"); if (context.Guild == null) { var user = await context.User.GetOrCreateDMChannelAsync(); await user.SendMessageAsync("Commands are not available in DMs."); } var config = GuildConfig.GetGuildConfig(context.Guild.Id) ?? GuildConfig.CreateGuildConfig(context.Guild.Id); config.GuildOwnerId = context.Guild.Owner.Id; GuildConfig.SaveGuildConfig(); if (config.Leveling) { await Leveling.UserSentMessage((SocketGuildUser)context.User, (SocketTextChannel)context.Channel); } if (context.Guild.Id == 385902350432206849) { if (msg.Content.Contains("🎷") || msg.Content.Contains("🎺")) { if (msg.Author.Id == 360493978371751937) { await msg.DeleteAsync(); var msgObj = await context.Channel.SendMessageAsync(context.User.Mention + " no"); Thread.Sleep(5000); await msgObj.DeleteAsync(); } } } }
public static async Task HandleServerUpdate(SocketGuild server, SocketGuild guild) { var config = GuildConfig.GetGuildConfig(server.Id); var loggingChannel = guild.GetTextChannel(config.ServerLoggingChannel); var embed = new EmbedBuilder() .AddField("Name", guild.Name) .AddField("Region", guild.VoiceRegionId) .AddField("Owner", $"{guild.Owner.Username}#{guild.Owner.Discriminator}") .WithTitle("Server Updated") .AddField("Time", DateTime.UtcNow + " UTC") .WithThumbnailUrl("https://autisable.com/wp-content/uploads/2016/12/8b9f927f763b78de890fdff3bf5041bda5210d4e_updatestamp.png") .WithAuthor(guild.Owner) .WithColor(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3); await loggingChannel.SendMessageAsync("", false, embed); }
public async Task SetIntIntoConfig(int arg1, int arg2, int arg3) { var config = GuildConfig.GetGuildConfig(Context.Guild.Id) ?? GuildConfig.CreateGuildConfig(Context.Guild.Id); config.WelcomeColour1 = arg1; config.WelcomeColour2 = arg2; config.WelcomeColour3 = arg3; GuildConfig.SaveGuildConfig(); var embed = new EmbedBuilder(); embed.WithColor(new Color(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3)); embed.WithDescription(Bot.Internal.Utilities.GetFormattedLocaleMsg("WelcomeColourText", arg1, arg2, arg3)); embed.WithFooter(Bot.Internal.Utilities.GetFormattedLocaleMsg("CommandFooter", Context.User.Username)); await SendMessage(embed); }
public async Task GetCustomCommandsForServer() { var config = GuildConfig.GetGuildConfig(Context.Guild.Id); string commandList = ""; foreach (string value in config.CustomCommands.Keys) { commandList += $"**{value}**\n"; } var embed = new EmbedBuilder() .WithDescription(commandList) .WithColor(new Color(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3)) .WithTitle($"Custom Commands available for {Context.Guild.Name}") .WithFooter(Bot.Internal.Utilities.GetFormattedLocaleMsg("CommandFooter", Context.User.Username)); await ReplyAsync("", false, embed); }