public async Task RCreate(params string[] args) { switch (args.Length) { case 0: await ReplyAsync("", false, new EmbedBuilder { Title = "Insufficient Parameters", Description = $"Command Syntax: `{await SqliteClass.PrefixGetter(Context.Guild.Id)}catcreate <name>`", Color = Color.Red }.WithCurrentTimestamp()); return; default: { var joined = string.Join(' ', args); var _rchannel = await Context.Guild.CreateCategoryChannelAsync(joined); await ReplyAsync("", false, new EmbedBuilder { Title = "Channel creation successful!", Description = $"Successfully created category `{_rchannel.Name}` (ID: {_rchannel.Id})", Color = Blurple }.WithCurrentTimestamp()); break; } } }
public async Task Pre(params string[] args) { if (args.Length == 0) { await ReplyAsync("", false, new EmbedBuilder { Title = "Existing Prefix", Description = $"The current prefix is {await SqliteClass.PrefixGetter(Context.Guild.Id)}", Color = Blurple, Footer = new EmbedFooterBuilder { Text = $"Do {await SqliteClass.PrefixGetter(Context.Guild.Id)}prefix <prefix> to change it!" } }.WithCurrentTimestamp()); return; } await SqliteClass.PrefixAdder(Context.Guild.Id, args[0]); await ReplyAsync("", false, new EmbedBuilder { Title = "Prefix Updated", Description = $"The updated prefix is `{await SqliteClass.PrefixGetter(Context.Guild.Id)}`", Color = Blurple, Footer = new EmbedFooterBuilder { Text = "Bot nickname updated to reflect prefix changes" } }.WithCurrentTimestamp()); await Context.Guild.CurrentUser.ModifyAsync(async dood => dood.Nickname = $"[{await SqliteClass.PrefixGetter(Context.Guild.Id)}] Hermes"); }
public async Task SuggestCommand(params string[] args) { if (args.Length == 0) { await ReplyAsync("", false, new EmbedBuilder { Title = "Insufficient Arguments", Description = $"The way to use the command is `{await SqliteClass.PrefixGetter(Context.Guild.Id)}botsuggest <suggestions-for-Hermes-to-improve>", Color = Color.Red }.WithCurrentTimestamp()); } var join = string.Join(' ', args); await(Program.Client.GetChannel(755640198662062220) as SocketTextChannel).SendMessageAsync("", false, new EmbedBuilder { Title = $"New suggestion from {Context.User} in {Context.Guild.Name}!", Description = $"Here it goes:\n```\n{join}```", Color = Blurple }.AddField($"By {Context.User}", $"**ID**: {Context.User.Id}\n**Mention**: {Context.User.Mention}\n**Server ID**: {Context.Guild.Id}") .WithCurrentTimestamp().Build()); await ReplyAsync("Your suggestion has been noted!"); }
public async Task ReDescChannel(params string[] args) { if (args.Length == 0) { await ReplyAsync("", false, new EmbedBuilder { Title = "Insufficient Parameters!", Description = $"The way to use the command is \n`{await SqliteClass.PrefixGetter(Context.Guild.Id)}channeldesc <#channel> <new-channel-name>`", Color = Color.Red }.WithCurrentTimestamp()); return; } var cha = GetChannel(args[0]); if (cha == null) { cha = Context.Channel as SocketGuildChannel; var argsL = args.ToList(); argsL.Insert(0, ""); args = argsL.ToArray(); } var bchname = string.Join(' ', args.Skip(1)); await(cha as SocketTextChannel).ModifyAsync(d => d.Topic = bchname); await ReplyAsync("", false, new EmbedBuilder { Title = "Channel Description Updated!!", Description = $"<#{cha.Id}> is now set with its new topic!!!", Color = Blurple }.WithCurrentTimestamp()); return; }
public async Task EMDEL(params string[] args) { if (args.Length == 0) { await ReplyAsync("", false, new EmbedBuilder { Title = "What emoji to delete?", Description = $"The way to run this cmd is `{await SqliteClass.PrefixGetter(Context.Guild.Id)}emdelete emote_name`", Color = Color.Red }.WithCurrentTimestamp()); return; } if (await GetEmote(args[0]) == null) { await ReplyAsync("", false, new EmbedBuilder { Title = "What emoji to delete?", Description = $"Couldn't parse `{args[0]}` as an emote", Color = Color.Red }.WithCurrentTimestamp()); return; } var i = await GetEmote(args[0]); await Context.Guild.DeleteEmoteAsync(i); await ReplyAsync(embed : new EmbedBuilder { Title = "Emoji Deleted Successfully!", Description = $"The emoji was deleted :/", Color = Blurple }.WithCurrentTimestamp()); }
public async Task CreateRole(params string[] args) { switch (args.Length) { case 0 or 1: await ReplyAsync("", false, new EmbedBuilder { Title = "Insufficient Parameters", Description = $"The way to use the command is \n`{await SqliteClass.PrefixGetter(Context.Guild.Id)}move <@role-to-be-moved> <@role-to-be-placed-below>`", Color = Color.Red }.WithCurrentTimestamp()); return; } var rlD = GetRole(args[0]); var rlA = GetRole(args[1]); if (rlD == null || rlA == null) { await ReplyAsync("", false, new EmbedBuilder { Title = "Couldn't find the role", Description = $"The way to use the command is \n`{await SqliteClass.PrefixGetter(Context.Guild.Id)}move <@role-to-be-moved> <@role-to-be-placed-below>`", Color = Color.Red }.WithCurrentTimestamp()); return; } if (((Context.User as SocketGuildUser).Roles.Max().Position <= rlA.Position || (Context.User as SocketGuildUser).Roles.Max().Position <= rlD.Position) && Context.Guild.OwnerId != Context.User.Id && devids.All(k => k != Context.User.Id)) { await ReplyAsync("", false, new EmbedBuilder { Title = "Oops!", Description = "You're below the roles you want to move!", Color = Color.Red }.WithCurrentTimestamp()); return; } await ReplyAsync("", false, new EmbedBuilder { Title = "Role Moved Successfully", Description = $"{rlD.Mention} was placed below {rlA.Mention}!", Color = Blurple }.WithCurrentTimestamp()); await Context.Guild.ReorderRolesAsync(new List <ReorderRoleProperties> { new(rlD.Id, rlA.Position) });
public async Task RCreate(params string[] args) { switch (args.Length) { case 0 or 1: await ReplyAsync("", false, new EmbedBuilder { Title = "Insufficient Parameters", Description = $"The way to use the command is `{await SqliteClass.PrefixGetter(Context.Guild.Id)}movetocat <channel> <channel>`", Color = Color.Red }.WithCurrentTimestamp()); return; default: if (GetChannel(args[0]) is not INestedChannel chan) { await InvalidChannel(args[0]); return; } if (GetChannel(args[1]) is not INestedChannel chan2) { await InvalidChannel(args[1]); return; } await chan.ModifyAsync(channel => { channel.CategoryId = chan2.CategoryId; }); // Console.WriteLine(string.Join('\n', Context.Guild.Channels.OrderBy(k => k.Position).Select(k => k.Name))); await ReplyAsync("", false, new EmbedBuilder { Title = "Successfully moved channel!", Description = $"Channel <#{chan.Id}> was successfully moved below <#{chan2.Id}>", Color = Blurple }.WithCurrentTimestamp()); break; } async Task InvalidChannel(string channel) { await ReplyAsync("", false, new EmbedBuilder { Title = "Invalid channel", Description = $"Couldn't parse {channel} as channel", Color = Color.Red }.WithCurrentTimestamp()); } }
public async Task CreateRole(params string[] args) { switch (args.Length) { case 0 or 1: await ReplyAsync("", false, new EmbedBuilder { Title = "Insufficient Parameters", Description = $"The way to use the command is \n`{await SqliteClass.PrefixGetter(Context.Guild.Id)}duplicate <@role-to-be-duplicated> <@role-to-be-placed-below>`", Color = Color.Red }.WithCurrentTimestamp()); return; } var rlD = GetRole(args[0]); var rlA = GetRole(args[1]); if (rlD == null || rlA == null) { await ReplyAsync("", false, new EmbedBuilder { Title = "Couldn't find the role", Description = $"The way to use the command is \n`{await SqliteClass.PrefixGetter(Context.Guild.Id)}duplicate <@role-to-be-duplicated> <@role-to-be-placed-below>`", Color = Color.Red }.WithCurrentTimestamp()); return; } if (((Context.User as SocketGuildUser).Roles.Max().Position <= rlA.Position || (Context.User as SocketGuildUser).Roles.Max().Position <= rlD.Position) && Context.Guild.OwnerId != Context.User.Id && devids.All(k => k != Context.User.Id)) { await ReplyAsync("", false, new EmbedBuilder { Title = "Oops!", Description = "You're below the roles you want to duplicate and place!", Color = Color.Red }.WithCurrentTimestamp()); return; } var newlyMadeRole = await Context.Guild.CreateRoleAsync(rlD.Name + "~1", rlD.Permissions, rlD.Color, rlD.IsHoisted, rlD.IsMentionable); await Context.Guild.ReorderRolesAsync(new List <ReorderRoleProperties> { new(newlyMadeRole.Id, rlA.Position) });
public async Task RenameChannel(params string[] args) { if (args.Length == 0 || args.Length == 1) { await ReplyAsync("", false, new EmbedBuilder { Title = "Insufficient Parameters!", Description = $"The way to use the command is \n`{await SqliteClass.PrefixGetter(Context.Guild.Id)}channelrename <#channel> <new-channel-name>`", Color = Color.Red }.WithCurrentTimestamp()); return; } if (GetChannel(args[0]) == null) { await ReplyAsync("", false, new EmbedBuilder { Title = "Invalid channel", Description = $"`{args[0]}` could not be parsed as a channel!", Color = Color.Red }.WithCurrentTimestamp()); return; } var bchname = string.Join('-', args.Skip(1)); if (!Regex.IsMatch(bchname, "[a-zA-Z0-9-_]{2,100}")) { await ReplyAsync("", false, new EmbedBuilder { Title = "Invalid arguement", Description = $"`{bchname}` is an invalid channel name, as it either ~ \n1) Contains invalid characters\n 2) Is too long", Color = Color.Red }.WithCurrentTimestamp()); return; } var cha = GetChannel(args[0]); await cha.ModifyAsync(i => i.Name = bchname); await ReplyAsync("", false, new EmbedBuilder { Title = "Channel Name Updated!!", Description = $"<#{cha.Id}> is now updated!!!", Color = Blurple }.WithCurrentTimestamp()); }
public async Task EmRename(params string[] args) { if (args.Length < 2 || await GetEmote(args[0]) == null) { await ReplyAsync("", false, new EmbedBuilder { Title = "What emoji and what name?", Description = $"Command Syntax: `{await SqliteClass.PrefixGetter(Context.Guild.Id)}emrename old_emote new_emote_name`", Color = Color.Red }.WithCurrentTimestamp()); return; } var em = await GetEmote(args[0]); var strj = string.Join('_', args.Skip(1)); var regex = new Regex("[^a-zA-Z0-9_]"); if (strj.Length >= 32 || strj.Length < 2 || regex.IsMatch(strj)) { await ReplyAsync("", false, new EmbedBuilder { Title = "Invalid emote name!", Description = "The emote name must contain only letters, numbers, and underscores and has to be at least 2 and at max 32 characters in length.", Color = Color.Red }.WithCurrentTimestamp()); return; } await Context.Guild.ModifyEmoteAsync(em, k => k.Name = strj); await ReplyAsync(embed : new EmbedBuilder { Title = "Emoji Renamed Successfully!", Description = $"The emoji was renamed to `{strj}`", Color = Blurple }.WithCurrentTimestamp()); }
public async Task CatRename(params string[] args) { if (args.Length < 2) { await ReplyAsync("", false, new EmbedBuilder { Title = "Insufficient Parameters!", Description = $"Command Syntax: \n`{await SqliteClass.PrefixGetter(Context.Guild.Id)}categoryrename <old-category-name> <new-category-name>`", Color = Color.Red }.WithCurrentTimestamp()); return; } var alf = GetCategory(args[0]); if (alf == null) { await ReplyAsync("", false, new EmbedBuilder { Title = "Invalid category", Description = $"`{args[0]}` could not be parsed as a category!", Color = Color.Red }.WithCurrentTimestamp()); return; } await alf.ModifyAsync(x => x.Name = string.Join(' ', args.Skip(1))); await ReplyAsync("", false, new EmbedBuilder { Title = "Rename successful!", Description = $"Your category was renamed to `{string.Join(' ', args.Skip(1))}`", Color = Blurple }.WithCurrentTimestamp()); }
public async Task gstartCommand(params string[] args) { if (args.Length < 4) { await ReplyAsync("", false, new EmbedBuilder() { Title = "Insufficient Arguments", Description = $"The way to use the command is `{await SqliteClass.PrefixGetter(Context.Guild.Id)}gstart <time> <winners> <role> <title>`", Color = Color.Red }.WithCurrentTimestamp()); return; } // Okay then, he's done it right :/ var noNitro = false; var time = args[0]; var winners = args[1]; var roles = args[2]; var title = string.Join(' ', args.Skip(3)); var isValidTime = time.Last() switch { 'h' or 'H' or 'm' or 'M' or 'd' or 'D' or 's' or 'S' => true, _ => false } && int.TryParse(string.Join("", args[0].SkipLast(1)), out _);
public async Task RemovePerms(params string[] args) { switch (args.Length) { case 0 or 1: await ReplyAsync("", false, new EmbedBuilder { Title = "Insufficient Parameters", Description = $"The way to use the command is \n`{await SqliteClass.PrefixGetter(Context.Guild.Id)}removeperms <@role/id> <Permission>`", Color = Color.Red }.WithCurrentTimestamp()); return; } var roleA = GetRole(args[0]); if (roleA == null) { await ReplyAsync("", false, new EmbedBuilder { Title = "That role is invalid", Description = $"The way to use the command is \n`{await SqliteClass.PrefixGetter(Context.Guild.Id)}removeperms <@role/id> <Permission>`", Color = Color.Red }.WithCurrentTimestamp()); return; } if (Context.Guild.CurrentUser.Roles.All(idk => idk.CompareTo(roleA) < 0)) { await ReplyAsync("", false, new EmbedBuilder { Title = "Hey, thats above me", Description = $"The bot's highest role => {Context.Guild.CurrentUser.Roles.Max().Name}\nThe role you wish to delete => {roleA.Name}", Color = Color.Red }.WithCurrentTimestamp()); return; } if (!(Context.User as SocketGuildUser).Roles.Any(rl => rl.Position > roleA.Position) && Context.Guild.OwnerId != Context.User.Id && devids.All(k => k != Context.User.Id)) { await ReplyAsync("", false, new EmbedBuilder { Title = "Oops!", Description = "You're below the role you want to edit!", Color = Color.Red }.WithCurrentTimestamp()); return; } var gp = GetPermission(args[1]); if (gp.Item2 == false) { await ReplyAsync("", false, new EmbedBuilder { Title = "That permission is invalid", Description = $"The list of permissions is ~ ```{string.Join('\n', Enum.GetNames(typeof(GuildPermission)))}```", Color = Color.Red }.WithCurrentTimestamp()); return; } await roleA.ModifyAsync(rl => rl.Permissions = EditPerm(roleA, gp.Item1, false)); await ReplyAsync("", false, new EmbedBuilder { Title = "Permission removed From Role!", Description = $"Permission `{args[1]}` revoked from `{roleA.Name.ToUpper()}`", Color = Blurple }.WithCurrentTimestamp()); }
public async Task ChannelPermEdit(params string[] args) { bool roleOrNot; PermValue ovr; if (args.Length == 0) { await ReplyAsync("", false, new EmbedBuilder { Title = "Insufficient Parameters!", Description = $"Command Syntax: \n`{await SqliteClass.PrefixGetter(Context.Guild.Id)}channelperms <#channel> <@role/@member> <Permission> <yes,no,inherit>`", Color = Color.Red }.WithCurrentTimestamp()); return; } var channe = GetCategory(args[0]); if (channe == null) { await ReplyAsync("", false, new EmbedBuilder { Title = "Invalid category name", Description = $"`{args[0]}` could not be parsed as category!", Color = Color.Red }.WithCurrentTimestamp()); return; } switch (args.Length) { case 0 or 1 or 2 or 3: await ReplyAsync("", false, new EmbedBuilder { Title = "Insufficient Parameters!", Description = $"Command Syntax: \n`{await SqliteClass.PrefixGetter(Context.Guild.Id)}categoryperms <#channel> <@role/@member> <Permission> <yes,no,inherit>`", Color = Color.Red }.WithCurrentTimestamp()); return; } SocketUser sus = await GetUser(args[1]); var srl = GetRole(args[1]); switch (sus) { case null when srl == null: await ReplyAsync("", false, new EmbedBuilder { Title = "Invalid Role/User", Description = $"We couldn't find any role or user called `{args[1]}`", Color = Color.Red }.WithCurrentTimestamp()); return; case null: roleOrNot = true; break; default: { if (srl == null) { roleOrNot = false; } else { await ReplyAsync("", false, new EmbedBuilder { Title = "Multiple Possibilities Detected", Description = $"Given `{args[1]}`, we found both a Role and a User.\n**Role Found:**\n{srl.Mention}\n**User Found**\n{sus.Mention}\nPlease use a mention instead of a search query!", Color = Color.Red }.WithCurrentTimestamp()); return; } break; } } /* * if (Context.Message.MentionedRoles.Any()) * { * roleOrNot = true; * srl = Context.Message.MentionedRoles.First(); * } else if (Context.Message.MentionedUsers.Any()) * { * roleOrNot = false; * sus = Context.Message.MentionedUsers.First(); * } * else * { * await ReplyAsync("", false, new EmbedBuilder * { * Title = "No User/Role Mentioned", * Description = $"We couldn't find any role or user mentioned!", * Color = Color.Red * }.WithCurrentTimestamp()); * return; * }*/ var prm_ = GetChannelPermission(args[2]); if (prm_.Item2 == false) { await ReplyAsync("", false, new EmbedBuilder { Title = "That permission is invalid", Description = $"Valid permissions include ~ ```{string.Join('\n', Enum.GetNames(typeof(ChannelPermission)))}```", Color = Color.Red }.WithCurrentTimestamp()); return; } var prm = prm_.Item1; Console.WriteLine(prm); var inh = args[3].ToLower(); switch (inh) { case "yes" or "true" or "postive" or "y": ovr = PermValue.Allow; break; case "no" or "false" or "negative" or "n": ovr = PermValue.Deny; break; case "inherit" or "i": ovr = PermValue.Inherit; break; default: await ReplyAsync("", false, new EmbedBuilder { Title = "That overwrite type is invalid", Description = "For assigning the permission, use `y`, `yes`, `positive` or `true`.\nFor Inheriting use `i` or `inherit`\nAnd for revoking use `n`, `no`, `negative` or `false` as the last parameter for the command", Color = Color.Red }.WithCurrentTimestamp()); return; } OverwritePermissions op; if (roleOrNot) { op = channe.GetPermissionOverwrite(srl) != null ? (OverwritePermissions)channe.GetPermissionOverwrite(srl) : new OverwritePermissions(); op = GetOP(prm, ovr, op); await channe.AddPermissionOverwriteAsync(srl, op); } else { op = channe.GetPermissionOverwrite(sus) != null ? (OverwritePermissions)channe.GetPermissionOverwrite(sus) : new OverwritePermissions(); ; op = GetOP(prm, ovr, op); await channe.AddPermissionOverwriteAsync(sus, op); } await ReplyAsync("", false, new EmbedBuilder { Title = "Overwrite added successfully!", Description = $"Channel Overwrite added for <#{channe.Id}>", Color = Blurple }.AddField("Overwrite Details", $"For: {(roleOrNot ? srl.Mention : sus.Mention)}\nPermission: {prm}\nValue: {ovr}") .WithCurrentTimestamp()); }
public async Task RCreate(params string[] args) { switch (args.Length) { case 0: await ReplyAsync("", false, new EmbedBuilder { Title = "Insufficient Parameters", Description = $"Command Syntax: `{await SqliteClass.PrefixGetter(Context.Guild.Id)}chcreate <category?> <name>`", Color = Color.Red }.WithCurrentTimestamp()); return; case 1: if (!Regex.IsMatch(args[0], "[a-zA-Z0-9-_]{2,100}")) { await ReplyAsync("", false, new EmbedBuilder { Title = "Invalid channel re-name", Description = $"`{args[0]}` is an invalid channel name, as it either ~ \n1) Contains invalid characters\n 2) Is too long", Color = Color.Red }.WithCurrentTimestamp()); return; } var channel = await Context.Guild.CreateTextChannelAsync(args[0]); await ReplyAsync("", false, new EmbedBuilder { Title = "Channel creation successful!", Description = $"Successfully created channel <#{channel.Id}> (ID: {channel.Id})", Color = Blurple }.WithCurrentTimestamp()); return; default: var cat = GetCategory(args[0]); if (cat == null) { var bchname = string.Join('-', args); if (!Regex.IsMatch(bchname, "[a-zA-Z0-9-_]{2,100}")) { await ReplyAsync("", false, new EmbedBuilder { Title = "Invalid channel re-name", Description = $"`{bchname}` is an invalid channel name, as it either ~ \n1) Contains invalid characters\n 2) Is too long", Color = Color.Red }.WithCurrentTimestamp()); return; } var _rchannel = await Context.Guild.CreateTextChannelAsync(bchname); await ReplyAsync("", false, new EmbedBuilder { Title = "Channel creation successful!", Description = $"Successfully created channel <#{_rchannel.Id}> (ID: {_rchannel.Id})", Color = Blurple }.WithCurrentTimestamp()); return; } var _bchname = string.Join('-', args.Skip(1)); if (!Regex.IsMatch(_bchname, "[a-zA-Z0-9-_]{2,100}")) { await ReplyAsync("", false, new EmbedBuilder { Title = "Invalid channel re-name", Description = $"`{_bchname}` is an invalid channel name, as it either ~ \n1) Contains invalid characters\n 2) Is too long", Color = Color.Red }.WithCurrentTimestamp()); return; } var po = cat.PermissionOverwrites; var _channel = await Context.Guild.CreateTextChannelAsync(_bchname, properties => properties.CategoryId = cat.Id); await _channel.SyncPermissionsAsync(); await ReplyAsync("", false, new EmbedBuilder { Title = "Channel creation successful!", Description = $"Successfully created channel <#{_channel.Id}> (ID: {_channel.Id})", Color = Blurple }.WithCurrentTimestamp()); break; } }
public async Task HelpC(params string[] args) { if (args.Length == 0) { EmbedBuilder helpAuto = new EmbedBuilder { Title = "RoleX Command Help", Color = Blurple } .WithAuthor("RoleX", Context.Client.CurrentUser.GetAvatarUrl()) .WithFooter("Made by DJ001 (ID: 701029647760097361) and SLENDER (ID: 615873008959225856)") .WithCurrentTimestamp(); foreach (var aa in CustomCommandService.Modules) { if (aa.Key == "Developer") { continue; } helpAuto.AddField(aa.Key, aa.Value); } helpAuto.AddField("Need more help?", $"Read our Documentation [here](https://rolex.gitbook.io/rolex/ \"Weird Easter Egg\")\n or join [our support server](https://discord.com/invite/3Uq4WF2RFZ \"Probably weirder one\")!\nFor command-wise help, do `{await SqliteClass.PrefixGetter(Context.Guild.Id)}help <commandname/modulename>`"); await ReplyAsync(embed : helpAuto); return; } else { var cmd = args[0]; var prefixure = await SqliteClass.PrefixGetter(Context.Guild.Id); var commandSelected = Commands.FirstOrDefault(x => (x.CommandName.ToLower() == cmd.ToLower() || x.Alts.Any(x => x.ToLower() == cmd.ToLower())) && x.CommandDescription != ""); if (commandSelected == null) { var modSelected = CustomCommandService.Modules.Keys.FirstOrDefault(x => x.ToLower().Contains(cmd.ToLower())); if (modSelected == null) { await ReplyAsync("", false, new EmbedBuilder { Title = "Theres no such command or module", Description = $"`{args[0]}` isnt a command or a module!", Color = Color.Red }.WithCurrentTimestamp()); return; } List <string> LS = new List <string>(); Commands.FindAll(c => c.ModuleName == modSelected).ForEach(async x => LS.Add($"`{await SqliteClass.PrefixGetter(Context.Guild.Id)}{x.CommandName}`")); await ReplyAsync("", false, new EmbedBuilder { Title = $"Module Help for {modSelected}", Fields = new List <EmbedFieldBuilder> { new EmbedFieldBuilder { Name = "Description", Value = CustomCommandService.Modules[modSelected] }, new EmbedFieldBuilder { Name = "Commands", Value = $"{string.Join("\n", LS)}" } }, Color = Blurple }.WithCurrentTimestamp()); return; } var aliasStr = prefixure + string.Join($", {prefixure}", commandSelected.Alts); var embeds = new EmbedBuilder(); embeds.AddField("Command", "`" + commandSelected.CommandName + '`'); embeds.AddField("Description", commandSelected.CommandDescription, true); if (!string.IsNullOrEmpty(commandSelected.CommandHelpMessage)) { embeds.AddField("Usage", $"`{prefixure}{commandSelected.CommandHelpMessage}`"); } if (!string.IsNullOrEmpty(commandSelected.example)) { embeds.AddField("Example", $"`{prefixure}{commandSelected.example}`"); } if (commandSelected.Alts.Count > 0) { embeds.AddField("Aliases", aliasStr); } embeds.AddField("Links", "[Support Server](https://discord.com/invite/3Uq4WF2RFZ) | [Invite link](https://tiny.cc/RoleXAdmin)"); embeds.Footer = new EmbedFooterBuilder { Text = "Help Command by RoleX" }; embeds.Color = Blurple; if (commandSelected.CommandName == "help") { embeds.ThumbnailUrl = "https://tiny.cc/spidermanmeme"; } await ReplyAsync("", false, embeds); } }
public async Task AliasCommand(params string[] args) { if (args.Length == 0 || args.Length == 1) { /* * await ReplyAsync("", false, new EmbedBuilder * { * Title = "Insufficient Parameters", * Description = $"The way to use the command is `{await SqliteClass.PrefixGetter(Context.Guild.Id)}alias <alias-name> <cmd-and-parameters>`", * Color = Color.Red * }.WithCurrentTimestamp());*/ var paginatedMessage = new PaginatedMessage(new PaginatedAppearanceOptions { FooterFormat = $"Do {await SqliteClass.PrefixGetter(Context.Guild.Id)}help alias to know more about adding aliases" }, Context.Channel, new PaginatedMessage.MessagePage("Error :/")); var loembb = (await SqliteClass.GuildAliasGetter(Context.Guild.Id)).Select(k => new EmbedFieldBuilder { Name = k.Item1, Value = $"`{k.Item2}`" }).ToList(); if (!loembb.Any()) { await ReplyAsync("", false, new EmbedBuilder { Title = "No aliases yet", Description = "Add aliases using `alias add <alias-name> <cmd-and-parameters>`", Color = Blurple }); return; } paginatedMessage.SetPages("Here's a list of aliases that your server has", loembb, 7); await paginatedMessage.Resend(); return; } switch (args[0]) { case "add" or "+": { if (args.Length == 2) { await ReplyAsync("", false, new EmbedBuilder { Title = "Insufficient Parameters", Description = $"Command Syntax: `{await SqliteClass.PrefixGetter(Context.Guild.Id)}alias + <alias-name> <cmd-and-parameters>`", Color = Color.Red }.WithCurrentTimestamp()); return; } var cmdAlias = args[1]; var cmd = string.Join(' ', args.Skip(2)); cmd = cmd.Replace("^", "\\^").Replace("|", "\\|"); await SqliteClass.AliasAdder(Context.Guild.Id, cmdAlias, cmd); await ReplyAsync("", false, new EmbedBuilder { Title = $"Successfully added alias {cmdAlias}", Description = "Run `alias` to find the list of aliases in your guild!", Color = Blurple }); break; } case "remove" or "-": { var didItExist = await SqliteClass.AliasRemover(Context.Guild.Id, args[1]) != 0; if (!didItExist) { await ReplyAsync("", false, new EmbedBuilder { Title = "No such alias", Description = "Run `alias` to find the list of aliases in your guild!", Color = Blurple }); } else { await ReplyAsync("", false, new EmbedBuilder { Title = "Deleted alias", Description = "Run `alias` to find the list of aliases in your guild!", Color = Blurple }); } break; } default: { await ReplyAsync("", false, new EmbedBuilder { Title = "Invalid Parameters", Description = $"The way to add aliases is \n`{await SqliteClass.PrefixGetter(Context.Guild.Id)}alias + <alias-name> <cmd-and-parameters>`\nand removing is\n`{await SqliteClass.PrefixGetter(Context.Guild.Id)}alias - <alias-name>`", Color = Color.Red }.WithCurrentTimestamp()); break; } } }
public async Task EMDEL(params string[] args) { if (args.Length < 2) { await ReplyAsync("", false, new EmbedBuilder { Title = "What emoji to steal?", Description = $"Command Syntax: `{await SqliteClass.PrefixGetter(Context.Guild.Id)}emsteal server_id <emoji_id>, <emoji2_id>, <emoji3_id>...`", Color = Color.Red }.WithCurrentTimestamp()); return; } var fax = ulong.TryParse(args[0], out var gid); if (!fax) { var gg = Program.Client.GetGuild(gid); if (gg != null) { await gg.DownloadUsersAsync(); } if (gg?.GetUser(Context.User.Id) == null) { await ReplyAsync("", false, new EmbedBuilder { Title = "What server do I steal from?", Description = "Enter the server ID, and ensure Hermes is in the server", Color = Color.Red }.WithCurrentTimestamp()); return; } } var joined = string.Join(' ', args.Skip(1)).Replace(" ", ""); var emojis = joined.Split(','); var ems = await ReplyAsync("Starting the process of stealing emojis..."); if (emojis.Length > 14 && !await SqliteClass.PremiumOrNot(Context.Guild.Id)) { await ReplyAsync("", false, new EmbedBuilder { Title = "Too many emotes!", Description = "Because your server isn't [premium](https://rolex.gitbook.io/rolex/rolex-premium), you're limited to 15 emotes.", Color = Color.Red }.WithCurrentTimestamp()); return; } if (emojis.Length > 29) { await ReplyAsync("", false, new EmbedBuilder { Title = "Too many emotes!", Description = "Thank you for supporting Hermes by using Premium, but you're limited to 30 emotes (compared to 15 for non-Premium).\n Thanks again!", Color = Color.Red }.WithCurrentTimestamp()); return; } WebClient wc = new(); foreach (var emoji in emojis) { var emote = await GetEmote(emoji, Program.Client.GetGuild(gid)); if (emote == null) { await ems.ModifyAsync(k => k.Content = ems.Content + $"\nSkipped {emoji}"); continue; } var dd = await wc.DownloadDataTaskAsync(emote.Url); var ms = new MemoryStream(dd); var ae = await Context.Guild.CreateEmoteAsync(emote.Name, new Image(ms)); await ems.ModifyAsync(k => k.Content = ems.Content + $"\nSuccessfully added {ae}"); // Never be in a hurry await Task.Delay(200); await ms.DisposeAsync(); } await ems.ModifyAsync(k => k.Content = ems.Content + "\nFinished successfully!"); }
public async Task ChangeRole(params string[] args) { if (args.Length < 2) { await ReplyAsync("", false, new EmbedBuilder { Title = "Insufficient Parameters", Description = $"The way to use the command is `{await SqliteClass.PrefixGetter(Context.Guild.Id)}color <@role> <color>`", Color = Color.Red }.WithCurrentTimestamp()); return; } var role = GetRole(args[0]); if (role == null) { await ReplyAsync("", false, new EmbedBuilder { Title = "That role is invalid", Description = $"I couldn't parse `{args[0]}` as a role!", Color = Color.Red }.WithCurrentTimestamp()); return; } if (!(Context.User as SocketGuildUser).Roles.Any(rl => rl.Position > role.Position) && Context.Guild.OwnerId != Context.User.Id && Context.User.Id != 701029647760097361 && Context.User.Id != 615873008959225856) { await ReplyAsync("", false, new EmbedBuilder { Title = "Oops!", Description = "You're below the role you want to edit!", Color = Color.Red }.WithCurrentTimestamp()); return; } if (args[1].ToLower() == "none" || args[1].ToLower() == "invisible") { await role.ModifyAsync(x => x.Color = new Color()); await ReplyAsync("", false, new EmbedBuilder { Title = "Done!!", Description = $"The role {role.Name}'s color is removed!", Color = Blurple }.WithCurrentTimestamp()); return; } System.Drawing.ColorConverter c = new System.Drawing.ColorConverter(); System.Drawing.Color col = new System.Drawing.Color(); bool hasC = false; var hArgs1 = args[1][0] != '#' ? $"#{args[1]}" : args[1]; if (Regex.IsMatch(hArgs1, "^(#[0-9A-Fa-f]{3})$|^(#[0-9A-Fa-f]{6})$")) { col = (System.Drawing.Color)c.ConvertFromString(hArgs1); hasC = true; } else { System.ComponentModel.TypeConverter.StandardValuesCollection svc = (System.Drawing.ColorConverter.StandardValuesCollection)c.GetStandardValues(); foreach (System.Drawing.Color o in svc) { if (o.Name.Equals(args[1], StringComparison.OrdinalIgnoreCase)) { col = (System.Drawing.Color)c.ConvertFromString(args[1]); hasC = true; } } } if (hasC == false) { await ReplyAsync("", false, new EmbedBuilder { Title = "What color??", Description = $"Couldn't parse `{args[1]}` as a color!", Color = Color.Red }.WithCurrentTimestamp()); return; } await role.ModifyAsync(x => x.Color = new Color(col.R, col.G, col.B)); await ReplyAsync("", false, new EmbedBuilder { Title = "Done!!", Description = $"The role {role.Name} is now set to the color of this embed!", Color = new Color(col.R, col.G, col.B) == new Color(255, 255, 255) ? new Color(254, 254, 254) : new Color(col.R, col.G, col.B) }.WithCurrentTimestamp()); return; }
public async Task RCreate(params string[] args) { switch (args.Length) { case 0: await ReplyAsync("", false, new EmbedBuilder { Title = "Insufficient Parameters", Description = $"The way to use the command is `{await SqliteClass.PrefixGetter(Context.Guild.Id)}rcreate <name> <color?>`", Color = Color.Red }.WithCurrentTimestamp()); return; case 1: var role = await Context.Guild.CreateRoleAsync(args[0], null, null, false, null); await ReplyAsync("", false, new EmbedBuilder { Title = "Role creation successful!", Description = $"Successfully created role <@&{role.Id}> (ID: {role.Id})", Color = Blurple }.WithCurrentTimestamp()); return; case 2: var rle = await Context.Guild.CreateRoleAsync(args[0], null, null, false, null); var c = new ColorConverter(); var col = new System.Drawing.Color(); var hasC = false; var hArgs1 = args[1][0] != '#' ? $"#{args[1]}" : args[1]; if (Regex.IsMatch(hArgs1, "^(#[0-9A-Fa-f]{3})$|^(#[0-9A-Fa-f]{6})$")) { col = (System.Drawing.Color)c.ConvertFromString(hArgs1); hasC = true; } else { var svc = (TypeConverter.StandardValuesCollection)c.GetStandardValues(); foreach (System.Drawing.Color o in svc) { if (o.Name.Equals(args[1], StringComparison.OrdinalIgnoreCase)) { col = (System.Drawing.Color)c.ConvertFromString(args[1]); hasC = true; } } } if (hasC == false) { await ReplyAsync("", false, new EmbedBuilder { Title = "What color??", Description = $"Couldn't parse `{args[1]}` as a color!", Color = Color.Red }.WithCurrentTimestamp()); return; } await rle.ModifyAsync(x => x.Color = new Color(col.R, col.G, col.B)); await ReplyAsync("", false, new EmbedBuilder { Title = "Role creation successful!", Description = $"Successfully created role <@&{rle.Id}> (ID: {rle.Id})", Color = Blurple }.WithCurrentTimestamp()); return; } }
public async Task HelpC(params string[] args) { if (args.Length == 0) { var helpAuto = new EmbedBuilder { Title = "Hermes Command Help", Color = Blurple } .WithAuthor("Hermes", Context.Client.CurrentUser.GetAvatarUrl()) .WithFooter("Made by DJ001 (ID: 701029647760097361) and SLENDER (ID: 615873008959225856)") .WithCurrentTimestamp(); foreach (var aa in CustomCommandService.Modules) { if (aa.Key == "Developer") { continue; } helpAuto.AddField(aa.Key, aa.Value); } helpAuto.AddField("Need more help?", $"Read our Documentation [here](https://rolex.gitbook.io/rolex/ \"Weird Easter Egg\")\n or join [our support server](https://www.youtube.com/watch?v=dQw4w9WgXcQ \"Probably weirder one\")!\nFor command-wise help, do `{await SqliteClass.PrefixGetter(Context.Guild.Id)}help <commandname/modulename>`"); await ReplyAsync(embed : helpAuto); return; } var cmd = args[0]; var prefixure = await SqliteClass.PrefixGetter(Context.Guild.Id); var commandSelected = Commands.FirstOrDefault(x => (x.CommandName.ToLower() == cmd.ToLower() || x.Alts.Any(x => x.ToLower() == cmd.ToLower())) && x.CommandDescription != ""); if (commandSelected == null) { var modSelected = CustomCommandService.Modules.Keys.FirstOrDefault(x => x.ToLower().Contains(cmd.ToLower())); if (modSelected == null || modSelected == "Developer" && devids.All(id => Context.User.Id != id)) { await ReplyAsync("", false, new EmbedBuilder { Title = "There's no such command or module", Description = $"`{args[0]}` isnt a command or a module!", Color = Color.Red }.WithCurrentTimestamp()); return; } var LS = new List <string>(); Commands.FindAll(c => c.ModuleName == modSelected).ForEach(async x => LS.Add($"`{await SqliteClass.PrefixGetter(Context.Guild.Id)}{x.CommandName}`")); await ReplyAsync("", false, new EmbedBuilder { Title = $"Module Help for {modSelected}", Fields = new List <EmbedFieldBuilder> { new() { Name = "Description", Value = CustomCommandService.Modules[modSelected] }, new() { Name = "Commands", Value = $"{string.Join("\n", LS)}" } },
public async Task EMDEL(params string[] args) { if (args.Length == 0) { await ReplyAsync("", false, new EmbedBuilder { Title = "Emoji not provided", Description = $"Command Syntax: `{await SqliteClass.PrefixGetter(Context.Guild.Id)}emdelete emote_name`", Color = Color.Red }.WithCurrentTimestamp()); return; } if (await GetEmote(args[0]) == null) { await ReplyAsync("", false, new EmbedBuilder { Title = "Emoji not provided?", Description = $"Couldn't parse `{args[0]}` as an emote", Color = Color.Red }.WithCurrentTimestamp()); return; } var i = await GetEmote(args[0]); var cros = Emote.Parse("<a:cros:859032986166362152>"); var tickk = Emote.Parse("<a:tick:782831523400908832>"); var gc = Guid.NewGuid(); var cb = new ComponentBuilder().WithButton("", $"{gc}Tick", ButtonStyle.Secondary, tickk) .WithButton("", $"{gc}Cros", ButtonStyle.Secondary, cros); await Context.Channel.SendMessageAsync( $"Are you sure you want to delete {i}?\nThis is a potentially destructive action.", component : cb.Build()); var cancelSource = new CancellationTokenSource(); cancelSource.CancelAfter(15000); var Interaction = await InteractionHandler.NextButtonAsync( k => k.Data.CustomId.Contains(gc.ToString()) && k.User.Id == Context.User.Id, cancelSource.Token); if (Interaction == null) { await ReplyAsync("No response received!"); return; } await Interaction.AcknowledgeAsync(); var isTick = Interaction.Data.CustomId.Contains("Tick"); if (!isTick) { await Context.Channel.SendMessageAsync("", false, new EmbedBuilder { Title = "Alright then...", Color = Blurple, ImageUrl = "https://i.imgur.com/RBC7KUt.png" }.WithCurrentTimestamp().Build()); return; } var in_ = i.Name; await Context.Guild.DeleteEmoteAsync(i); await ReplyAsync("", false, new EmbedBuilder { Title = "Action successful!", Description = $"`:{in_}:` was deleted successfully!", Color = Blurple }.WithCurrentTimestamp()); }
public async Task RNick(params string[] args) { if (args.Length == 0 || args.Length == 1) { await ReplyAsync("", false, new EmbedBuilder { Title = "Insufficient Parameters!", Description = $"The way to use the command is \n`{await SqliteClass.PrefixGetter(Context.Guild.Id)}nick <@User> <new-user-nickname>`", Color = Color.Red }.WithCurrentTimestamp()); return; } if (await GetUser(args[0]) == null) { await ReplyAsync("", false, new EmbedBuilder { Title = "Invalid user", Description = $"`{args[0]}` could not be parsed as user!", Color = Color.Red }.WithCurrentTimestamp()); return; } var bchname = string.Join(' ', args.Skip(1)); if (bchname.Length < 0 || bchname.Length > 32) { await ReplyAsync("", false, new EmbedBuilder { Title = "Invalid user nickname", Description = $"`{bchname}` is an invalid name, as it either ~ \n1) Contains non-allowed characters\n 2) Is too long", Color = Color.Red }.WithCurrentTimestamp()); return; } var cha = await GetUser(args[0]); if (cha.Hierarchy >= (Context.User as SocketGuildUser).Hierarchy && cha.Id != Context.User.Id) { await ReplyAsync("", false, new EmbedBuilder { Title = "Specified user is above you", Description = "You do not have sufficient permissions to nickname this user", Color = Color.Red }.WithCurrentTimestamp()); return; } if (cha.Hierarchy >= Context.Guild.CurrentUser.Hierarchy) { await ReplyAsync("", false, new EmbedBuilder { Title = "Oops, that person is above me ", Description = "I don't have sufficient permissions to ban them", Color = Color.Red }.WithCurrentTimestamp()); return; } await cha.ModifyAsync(i => i.Nickname = bchname); await ReplyAsync("", false, new EmbedBuilder { Title = "Nickname Updated!!", Description = $"<@{cha.Id}> is now set!!!", Color = Blurple }.WithCurrentTimestamp()); }
public async Task Additive(params string[] args) { switch (args.Length) { case 0 or 1: await ReplyAsync("", false, new EmbedBuilder { Title = "Insufficient Parameters", Description = $"The way to use the command is `{await SqliteClass.PrefixGetter(Context.Guild.Id)}add <@user> <@role>`", Color = Color.Red }.WithCurrentTimestamp()); return; } SocketUser uzi; SocketRole role; if (Context.Message.MentionedRoles.Any() && Context.Message.MentionedUsers.Any()) { role = Context.Message.MentionedRoles.First(); uzi = Context.Message.MentionedUsers.First(); } else if (Context.Message.MentionedUsers.Any()) { uzi = Context.Message.MentionedUsers.First(); short aa; if (args[0].Contains(uzi.Id.ToString())) { aa = 1; } else { aa = 0; } role = GetRole(args[aa]); if (role == null) { await ReplyAsync("", false, new EmbedBuilder { Title = "What role!?", Description = $"We couldn't parse `{aa}` as role!?", Color = Color.Red }.WithCurrentTimestamp()); return; } } else if (Context.Message.MentionedRoles.Any()) { role = Context.Message.MentionedRoles.First(); short aa; if (args[0].Contains(role.Id.ToString())) { aa = 1; } else { aa = 0; } uzi = await GetUser(args[aa]); if (uzi == null) { await ReplyAsync("", false, new EmbedBuilder { Title = "What user!?", Description = $"We couldn't parse `{aa}` as user!?", Color = Color.Red }.WithCurrentTimestamp()); return; } } else { if (await GetUser(args[0]) != null && GetRole(args[0]) == null) { uzi = await GetUser(args[0]); role = GetRole(args[1]); if (role == null) { await ReplyAsync("", false, new EmbedBuilder { Title = "What role!?", Description = $"We couldn't parse `{args[1]}` as role!?", Color = Color.Red }.WithCurrentTimestamp()); return; } } else if (GetRole(args[0]) != null && await GetUser(args[0]) == null) { role = GetRole(args[0]); uzi = await GetUser(args[1]); if (uzi == null) { await ReplyAsync("", false, new EmbedBuilder { Title = "What user!?", Description = $"We couldn't parse `{args[1]}` as user!?", Color = Color.Red }.WithCurrentTimestamp()); return; } } else if ((GetRole(args[0]) != null && await GetUser(args[0]) != null) || (GetRole(args[1]) != null && await GetUser(args[1]) != null)) { await ReplyAsync("", false, new EmbedBuilder { Title = "Multiple Possibilities Detected", Description = $"Given {(await GetUser(args[0]) == null ? args[1] : args[0])}\n**Role Found:**\n{(GetRole(args[0]) == null ? GetRole(args[1]).Mention : GetRole(args[0]).Mention)}\n**User Found**\n{((await GetUser(args[0])) == null ? (await GetUser(args[1])).Mention : (await GetUser(args[0])).Mention)}\nPlease use a mention instead of a search query, or put # after the user's name so we can find them!!", Color = Color.Red, }.WithCurrentTimestamp()); return; } else { await ReplyAsync("", false, new EmbedBuilder { Title = "What user and role!?", Description = $"We couldn't parse either!?", Color = Color.Red }.WithCurrentTimestamp()); return; } if (role.Position >= (Context.User as SocketGuildUser).Roles.Max().Position&& Context.User.Id != 701029647760097361 && Context.User.Id != 615873008959225856) { await ReplyAsync("", false, new EmbedBuilder { Title = "Could not add role", Description = $"Your highest role, **{(Context.User as SocketGuildUser).Roles.Max().Name}** is below the role you wish to give, **{role.Name}**", Color = Color.Red }.WithCurrentTimestamp()); return; } if (Context.Guild.CurrentUser.Roles.All(idk => idk.CompareTo(role) < 0)) { await ReplyAsync("", false, new EmbedBuilder { Title = "Specified role is above me!", Description = $"The bot's highest role => {Context.Guild.CurrentUser.Roles.Max().Name}\nThe role you wish to add => {role.Name}", Color = Color.Red }.WithCurrentTimestamp()); return; } if ((uzi as SocketGuildUser).Roles.Any(a => a.Id == role.Id)) { await(uzi as SocketGuildUser).RemoveRoleAsync(role); await ReplyAsync("", false, new EmbedBuilder { Title = $"Removed {role} from {uzi}!", Description = $"Role removal successful!", Color = Blurple }.WithCurrentTimestamp()); } else { await(uzi as SocketGuildUser).AddRoleAsync(role); await ReplyAsync("", false, new EmbedBuilder { Title = $"Added {role} to {uzi}!", Description = $"Role addition successful!", Color = Blurple }.WithCurrentTimestamp()); } return; } }
public async Task DeShowWh(params string[] args) { var allGWH = (await Context.Guild.GetWebhooksAsync()).ToList(); if (args.Length == 0) { if (allGWH.Count == 0) { await ReplyAsync("", false, new EmbedBuilder { Title = "No webhook found in your server!", Description = $"If you want to make a Webhook, run `{await SqliteClass.PrefixGetter(Context.Guild.Id)}addwh`", Color = Color.Red }.WithCurrentTimestamp()); return; } var emb = new EmbedBuilder { Title = "All Guild Webhooks", Description = "*Below is the complete list of webhooks in your server*", Color = Blurple }.WithCurrentTimestamp(); for (var i = 0; i < allGWH.Count; i++) { var rw = allGWH[i]; emb.Fields.Add(new EmbedFieldBuilder { Name = $"{i + 1}) " + rw.Name, Value = $"Channel: <#{rw.ChannelId}>\nCreated By: {rw.Creator.Mention}\nAvatar: [link]({(string.IsNullOrEmpty(rw.GetAvatarUrl()) ? "https://discord.com/assets/6debd47ed13483642cf09e832ed0bc1b.png" : rw.GetAvatarUrl())})" }); } await ReplyAsync("", false, emb); return; } var chn = GetChannel(args[0]); if (chn == null) { var emb = new EmbedBuilder { Title = "We couldn't parse the channel!", Description = $"Does `{args[0]}` even exist??", Color = Blurple }.WithCurrentTimestamp(); /*for (int i = 0; i < allGWH.Count; i++) * { * Discord.Rest.RestWebhook rw = allGWH[i]; * emb.AddField($"{i + 1}) " + rw.Name, $"Channel: <#{rw.ChannelId}>\nCreated By: {rw.Creator.Mention}\nAvatar: [link]({(string.IsNullOrEmpty(rw.GetAvatarUrl()) ? "https://discord.com/assets/6debd47ed13483642cf09e832ed0bc1b.png" : rw.GetAvatarUrl())})"); * } * await ReplyAsync("", false, emb); * return;*/ } else { var idc = (await(chn as SocketTextChannel).GetWebhooksAsync()).ToList(); if (idc.Count == 0) { await ReplyAsync("", false, new EmbedBuilder { Title = "No webhook found in dat channel", Description = $"Really, how do you guys manage?\nIf you wanna make a Webhook, run `{await SqliteClass.PrefixGetter(Context.Guild.Id)}addwh`", Color = Color.Red }.WithCurrentTimestamp()); return; } /*var paginatedMessage = new PaginatedMessage(PaginatedAppearanceOptions.Default, Context.Channel, new PaginatedMessage.MessagePage("Loading...")) { * Title = "All Channel Webhooks", * Color = Blurple, * Timestamp = DateTimeOffset.Now * };*/ var embedFieldBuilders = idc.Select((webhook, i) => new EmbedFieldBuilder { Name = $"{i + 1}) " + webhook.Name, Value = $"Channel: <#{webhook.ChannelId}>\nCreated By: {webhook.Creator.Mention}\nAvatar: [link]({(string.IsNullOrEmpty(webhook.GetAvatarUrl()) ? "https://discord.com/assets/6debd47ed13483642cf09e832ed0bc1b.png" : webhook.GetAvatarUrl())})" }); /* * paginatedMessage.SetPages($"*Below is the complete list of webhooks the channel <#{chn.Id}>*", embedFieldBuilders, null); * await paginatedMessage.Resend();*/ await ReplyAsync("", false, new EmbedBuilder { Title = "All Webhooks in your channel!", Fields = embedFieldBuilders.Take(15).ToList(), Footer = new EmbedFooterBuilder { Text = "Only 15 are supported as of now" }, Color = Blurple }.WithCurrentTimestamp() ); } }
public async Task RRaddCommand(params string[] args) { switch (args.Length) { case 0 or 1 or 2: await ReplyAsync("", false, new EmbedBuilder { Title = "Insufficient Parameters", Description = $"The way to use the command is `{await SqliteClass.PrefixGetter(Context.Guild.Id)}readd <link-to-message> <emoji> <role>`", Color = Color.Red }.WithCurrentTimestamp()); return; } var reg = new Regex(@"^https:\/\/discord.com\/channels\/[0-9]{17,18}\/[0-9]{17,18}\/[0-9]{17,18}$"); if (!reg.IsMatch(args[0])) { await ReplyAsync("", false, new EmbedBuilder { Title = "Which message?", Description = $"Couldn't parse `{args[0]}` as a Discord Message link", Color = Color.Red }.WithCurrentTimestamp()); return; } var dry = args[0].Replace(@"https://discord.com/channels/", "").Split('/'); var chnlid = ulong.Parse(dry[1]); var msgid = ulong.Parse(dry[2]); var channel = Context.Guild.GetTextChannel(chnlid); if (channel == null) { await ReplyAsync("", false, new EmbedBuilder { Title = "Which message?", Description = $"Couldn't parse `{args[0]}` as a Discord Message link\nHint: We cannot find the channel. This might be due to Permissions, or that Channel (and Message) is from another server.", Color = Color.Red }.WithCurrentTimestamp()); return; } var message = await channel.GetMessageAsync(msgid); if (message == null) { await ReplyAsync("", false, new EmbedBuilder { Title = "Which message?", Description = $"Couldn't parse `{args[0]}` as a Discord Message link\nHint: We cannot find the message. This might be due to deletion or permissions.", Color = Color.Red }.WithCurrentTimestamp()); return; } var isEmote = Emote.TryParse(args[1], out var emz); IEmote em = emz; if (isEmote == false) { var el = new Emoji(args[1]); if (el == null) { await ReplyAsync("", false, new EmbedBuilder { Title = "Which emote?", Description = $"Couldn't parse `{args[1]}` as an emote :(", Color = Color.Red }.WithCurrentTimestamp()); return; } em = el; } var role = GetRole(args[2]); if (role == null) { await ReplyAsync("", false, new EmbedBuilder { Title = "Which role?", Description = $"Couldn't parse `{args[2]}` as a role :(", Color = Color.Red }.WithCurrentTimestamp()); return; } var reros = await SqliteClass.GetReactRoleAsync( $"SELECT * FROM reactroles WHERE ChannelID = {chnlid} AND MessageID = {msgid}"); SqliteClass.ReactRole rero; if (reros.Count == 0) { rero = new SqliteClass.ReactRole { ChannelId = chnlid, MessageId = msgid, GuildId = Context.Guild.Id, Emojis = new List <string> { em.ToString() }, Roles = new List <ulong> { role.Id }, BlackListedRoles = new ulong[] { }, WhiteListedRoles = new ulong[] { }, Unique = false, SelfDestructTime = DateTime.MinValue }; } else { rero = reros[0]; rero.Roles.Add(role.Id); rero.Emojis.Add(em.ToString()); } await SqliteClass.AddOrUpdateReactRole(rero); await message.AddReactionAsync(em); await ReplyAsync("", false, new EmbedBuilder { Title = "Reaction Role added successfully!", Description = $"[Jump]({args[0]})", Color = Blurple }.WithCurrentTimestamp()); }