public override async Task Execute() { var message = ChatMessage.Current; var channel = message.Channel; if (!AkyBot.HasPermission(channel, GuildPermission.EmbedLinks)) { await ChatMessage.SendError(message, "I don't have Embed Links Permission!"); return; } var guild = (channel as SocketGuildChannel).Guild; var emotes = guild.Emotes.ToList(); if (emotes.Count == 0) { await ChatMessage.SendError(message, "this server does not have any emotes!"); return; } var emotesList = emotes.Select(emote => emote.ToString()).ToArray(); var list = string.Join(" ", emotesList); string info = $"For a bigger version of an emote, use {new BigEmote().Usage}"; var embed = new EmbedBuilder() .WithTitle($"Server Emotes - {emotes.Count}") .WithDescription(list + '\n' + info) .WithColor(AkyBot.EmbedColor); await ChatMessage.Send(message, null, embed.Build()); }
public override async Task Execute() { var message = ChatMessage.Current; var channel = message.Channel; if (!AkyBot.HasPermission(channel as SocketGuildChannel, GuildPermission.EmbedLinks)) { await ChatMessage.SendError(message, "I don't have Embed Links Permission!"); return; } var user = ChatMessage.FindUser(0, true); if (user == null) { await ChatMessage.SendError(message, "user cannot be found!"); return; } var avatarURL = user.DisplayAvatarURL(); var embed = new EmbedBuilder() .WithTitle($"{user.Tag()}'s Avatar") .WithImageUrl(avatarURL) .WithColor(AkyBot.EmbedColor); await ChatMessage.Send(message, null, embed.Build()); }
public override async Task Execute() { var message = ChatMessage.Current; var channel = message.Channel; if (!AkyBot.HasPermission(channel, GuildPermission.EmbedLinks)) { await ChatMessage.SendError(message, "I don't have Embed Links Permission!"); return; } var guild = (channel as SocketGuildChannel).Guild; var roles = guild.Roles.ToList(); roles.Sort(); roles.RemoveAt(0); // Removes the @everyone role if (roles.Count == 0) { await ChatMessage.SendError(message, "this server does not have any roles!"); return; } var rolesList = roles.Select(role => role.Name).ToArray(); var list = string.Join(", ", rolesList); var embed = new EmbedBuilder() .WithTitle($"Server Roles - {roles.Count}") .WithDescription(list) .WithColor(AkyBot.EmbedColor); await ChatMessage.Send(message, null, embed.Build()); }
public override async Task Execute() { var message = ChatMessage.Current; var args = ChatMessage.Args; var author = message.Author; var channel = message.Channel as SocketGuildChannel; var member = author.GetMember(channel.Guild); if (!member.GuildPermissions.Has(GuildPermission.KickMembers)) { await ChatMessage.SendError(message, "you do not have Kick Members Permission."); return; } if (!AkyBot.HasPermission(channel, GuildPermission.KickMembers, false)) { await ChatMessage.SendError(message, "I do not have Kick Memebers Permission!"); return; } if (args.Length == 0) { await ChatMessage.SendError(message, "you have to specify a user!"); return; } var userToKick = ChatMessage.FindUser(args[0]); if (userToKick == null) { await ChatMessage.SendError(message, "user cannot be found!"); return; } if (userToKick == author) { await ChatMessage.SendError(message, "you can't kick yourself."); return; } if (userToKick == AkyBot.Client.CurrentUser) { await ChatMessage.SendError(message, "why do you wanna kick me? That's rude..."); return; } var memberToKick = userToKick.GetMember(channel.Guild); try { await memberToKick.KickAsync(); } catch (HttpException) { await ChatMessage.SendError(message, "I cannot kick that person!"); return; } await ChatMessage.SendReply(message, $"{userToKick.Username} has been kicked."); }
public override async Task Execute() { var message = ChatMessage.Current; var channel = message.Channel; if (!AkyBot.HasPermission(channel, GuildPermission.EmbedLinks)) { await ChatMessage.SendError(message, "I don't have Embed Links Permission!"); return; } var args = ChatMessage.Args; var user1 = ChatMessage.FindUser(0); var user2 = ChatMessage.FindUser(1); if (user1 == null || user2 == null) { await ChatMessage.SendError(message, "you have to type or mention 2 users!"); return; } var name1 = user1.Username; var name2 = user2.Username; if (name1 == name2) { await ChatMessage.SendError(message, "both names cannot be equal."); return; } ulong[] ids = new ulong[] { user1.Id, user2.Id }; Array.Sort(ids); int score = 0; bool exists = await AkyBot.Databases.LoveCalculator.ContainsNames(ids); if (exists) { score = await AkyBot.Databases.LoveCalculator.GetScore(ids); } else { score = GenerateScore(); await AkyBot.Databases.LoveCalculator.AddNames(ids, score); } string comment = GetComment(score); string resultStr = $"> **{name1}**\n> **{name2}**\n{score}% - {comment}"; var resultEmbed = new EmbedBuilder() .WithTitle("💗 Calculating 💗") .WithColor(AkyBot.EmbedColor) .WithDescription(resultStr); await ChatMessage.Send(message, null, resultEmbed.Build()); }
public override async Task Execute() { var message = ChatMessage.Current; var args = ChatMessage.Args; var author = message.Author; var channel = message.Channel as SocketGuildChannel; var member = author.GetMember(channel.Guild); if (!member.GuildPermissions.Has(GuildPermission.KickMembers)) { await ChatMessage.SendError(message, "you do not have Kick Members Permission."); return; } if (!AkyBot.HasPermission(channel, GuildPermission.BanMembers, false)) { await ChatMessage.SendError(message, "I do not have Ban Memebers Permission!"); return; } var userToBan = ChatMessage.FindUser(args[0]); if (userToBan == null) { await ChatMessage.SendError(message, "user cannot be found!"); return; } if (userToBan == author) { await ChatMessage.SendError(message, "you can't ban yourself."); return; } if (userToBan == AkyBot.Client.CurrentUser) { await ChatMessage.SendError(message, "why do you wanna ban me? That's rude..."); return; } var memberToBan = userToBan.GetMember(channel.Guild); var banAsync = memberToBan.BanAsync(); if (banAsync.Exception != null) { await ChatMessage.SendError(message, "I cannot ban that person!"); return; } await banAsync; await ChatMessage.SendReply(message, $"{userToBan.Username} has been banned from {channel.Guild.Name}."); }
public override async Task Execute() { var message = ChatMessage.Current; var channel = message.Channel; if (!AkyBot.HasPermission(channel, GuildPermission.EmbedLinks)) { await ChatMessage.SendError(message, "I don't have Embed Links Permission!"); return; } await ChatMessage.SendReply(message, $"hey there! You can invite the bot by clicking [here]({AkyBot.InviteURL})! Have fun! :3"); }
public override async Task Execute() { var message = ChatMessage.Current; var channel = message.Channel; var args = ChatMessage.Args; if (!AkyBot.HasPermission(channel as SocketGuildChannel, GuildPermission.ManageMessages)) { await ChatMessage.SendError(message, "I don't have Manage Messages Permission!"); return; } var author = message.Author; var guild = (channel as SocketGuildChannel).Guild; var member = author.GetMember(guild); bool hasChannelPermission = member.GetPermissions(channel as IGuildChannel).Has(ChannelPermission.ManageMessages); bool hasServerPermission = member.GuildPermissions.Has(GuildPermission.ManageMessages); bool hasPermission = hasChannelPermission && hasServerPermission; if (!hasServerPermission) { await ChatMessage.SendError(message, "you don't have permission to do that!"); return; } if (args.Length == 0) { await ChatMessage.SendError(message, "enter a number of messages to delete."); return; } short deleteCount = ParseDeleteCount(args[0]); if (deleteCount <= 0) { await ChatMessage.SendError(message, "enter a number of messages to delete."); return; } await message.DeleteAsync(); var messages = await channel.GetMessagesAsync(deleteCount).FlattenAsync(); await(channel as SocketTextChannel).DeleteMessagesAsync(messages); }
public override async Task Execute() { var message = ChatMessage.Current; var channel = message.Channel; if (!AkyBot.HasPermission(channel, GuildPermission.EmbedLinks)) { await ChatMessage.SendError(message, "I don't have Embed Links Permission!"); return; } var guild = (channel as SocketGuildChannel).Guild; var name = guild.Name; var dateCreated = guild.CreatedAt.ToString("f", DateTimeFormatInfo.CurrentInfo); var owner = guild.Owner.GetUser().Tag(); var region = guild.VoiceRegionId.ToUpper(); var roles = guild.Roles.ToArray().Length; var totalMembers = guild.Users.Count; var onlineMembers = GetOnlineMembers(guild); var offlineMembers = totalMembers - onlineMembers; var textChannels = guild.TextChannels.Count; var voiceChannels = guild.VoiceChannels.Count; var verificationLevel = guild.VerificationLevel.ToString(); var id = guild.Id.ToString(); EmbedBuilder embed = new EmbedBuilder() .WithTitle("- Server Info -") .WithColor(AkyBot.EmbedColor) .AddField("Server Name:", name) .AddField("Date Created:", dateCreated) .AddField("Owner:", owner) .AddField("Region:", region) .AddField($"Roles: {roles}", $"To see a list with all roles use {new Roles().Usage}.") .AddField($"Members: {totalMembers}", $"{onlineMembers} Online | {offlineMembers} Offline") .AddField("Text Channels:", textChannels) .AddField("Voice Channels:", voiceChannels) .AddField("Verification Level:", verificationLevel) .AddField("Server ID:", id); await ChatMessage.Send(message, null, embed.Build()); }
public override async Task Execute() { var message = ChatMessage.Current; var channel = message.Channel; if (!AkyBot.HasPermission(channel, GuildPermission.EmbedLinks)) { await ChatMessage.SendError(message, "I don't have Embed Links Permission!"); return; } var id = AkyBot.Client.CurrentUser.Id.ToString(); var dateCreated = AkyBot.Client.CurrentUser.CreatedAt.ToString("f", DateTimeFormatInfo.CurrentInfo); var embed = new EmbedBuilder() .WithTitle("- Bot Info -") .AddField("Creator:", AkyBot.Info.Creator) .AddField("Avatar by ", AkyBot.Info.AvatarCreator) .AddField("GitHub:", AkyBot.Info.GitHub) .AddField("Date Created:", dateCreated) .WithFooter($"ID: {id}") .WithColor(AkyBot.EmbedColor); await ChatMessage.Send(message, null, embed.Build()); }
public override async Task Execute() { var message = ChatMessage.Current; var channel = message.Channel; if (!AkyBot.HasPermission(channel, GuildPermission.AttachFiles)) { await ChatMessage.SendError(message, "I don't have Attach Files Permission!"); return; } var typing = channel.EnterTypingState(); var guild = (channel as SocketGuildChannel).Guild; var emoteTxt = ChatMessage.Args[0]; var emote = guild.Emotes.ToList().Single(e => e.ToString() == emoteTxt); if (emote == null) { await ChatMessage.SendError(message, "unable to find custom emote! Make sure it's in this server!"); typing.Dispose(); return; } var emoteURL = emote.Url; var fileName = emote.Name + ".png"; using (var client = new HttpClient()) { var response = await client.GetByteArrayAsync(emoteURL); using (var stream = new MemoryStream(response)) { await ChatMessage.SendFile(message, stream, fileName); } } typing.Dispose(); }
public override async Task Execute() { var message = ChatMessage.Current; if (!AkyBot.HasPermission(message.Channel as SocketGuildChannel, GuildPermission.ManageRoles)) { await ChatMessage.SendError(message, "I don't have Manage Roles Permission!"); return; } var args = ChatMessage.Args; var guild = (message.Channel as SocketGuildChannel).Guild; var authorMember = message.Author.GetMember(guild); if (!authorMember.GuildPermissions.Has(GuildPermission.ManageRoles)) { await ChatMessage.SendError(message, "you do not have permission to do that!"); return; } string search = string.Join(string.Empty, args); var user = ChatMessage.FindUser(search, false); if (user == null) { await ChatMessage.SendError(message, "user cannot be found!"); return; } if (user == AkyBot.Client.CurrentUser) { await ChatMessage.SendError(message, "I'm not even muted."); return; } if (user == message.Author) { await ChatMessage.SendError(message, "you are not muted."); return; } var member = user.GetMember(guild); if (member.GuildPermissions.Has(GuildPermission.Administrator)) { await ChatMessage.SendError(message, "that user is a mod / admin and is not even muted."); return; } IRole muteRole = guild.Roles.ToList().FirstOrDefault(role => role.Name == AkyBot.MuteRoleName); if (muteRole == null || (muteRole != null && !member.Roles.ToList().Contains(muteRole))) { await ChatMessage.SendError(message, "that user is not muted!"); return; } RequestOptions opts = new RequestOptions() { AuditLogReason = "UnMuted" }; await member.RemoveRoleAsync(muteRole, opts); await AkyBot.Databases.MutedMembers.RemoveMember(member); await ChatMessage.SendReply(message, $"{member.DisplayName()}has been unmuted."); }
public override async Task Execute() { var message = ChatMessage.Current; if (!AkyBot.HasPermission(message.Channel as SocketGuildChannel, GuildPermission.ManageRoles)) { await ChatMessage.SendError(message, "I don't have Manage Roles Permission!"); return; } var args = ChatMessage.Args; var guild = (message.Channel as SocketGuildChannel).Guild; var authorMember = message.Author.GetMember(guild); if (!authorMember.GuildPermissions.Has(GuildPermission.ManageRoles)) { await ChatMessage.SendError(message, "you do not have permission to do that!"); return; } string search = string.Join(string.Empty, args); var user = ChatMessage.FindUser(search, false); if (user == null) { await ChatMessage.SendError(message, "user cannot be found!"); return; } if (user == AkyBot.Client.CurrentUser) { await ChatMessage.SendError(message, "you can't mute me."); return; } if (user == message.Author) { await ChatMessage.SendError(message, "you can't mute yourself."); return; } var member = user.GetMember(guild); if (member.GuildPermissions.Has(GuildPermission.Administrator)) { await ChatMessage.SendError(message, "that user is a mod / admin and connot be muted!"); return; } IRole muteRole = guild.Roles.ToList().FirstOrDefault(role => role.Name == AkyBot.MuteRoleName); if (muteRole != null && member.Roles.ToList().Contains(muteRole)) { await ChatMessage.SendError(message, "that user is already muted."); return; } if (muteRole == null) { muteRole = await guild.CreateRoleAsync(AkyBot.MuteRoleName, new GuildPermissions()); var channels = guild.Channels.ToList(); for (int i = 0; i < channels.Count; i++) { var channel = channels[i]; await channel.AddPermissionOverwriteAsync(muteRole, new OverwritePermissions(sendMessages : PermValue.Deny, addReactions : PermValue.Deny)); } } RequestOptions opts = new RequestOptions() { AuditLogReason = "Muted" }; await member.AddRoleAsync(muteRole, opts); await ChatMessage.SendReply(message, $"{member.DisplayName()} has been muted."); }
public override async Task Execute() { var message = ChatMessage.Current; var channel = message.Channel; if (!AkyBot.HasPermission(channel, GuildPermission.EmbedLinks)) { await ChatMessage.SendError(message, "I don't have Embed Links Permission!"); return; } var user = ChatMessage.FindUser(0, true); if (user == null) { await ChatMessage.SendError(message, "user cannot be found!"); return; } if (user == AkyBot.Client.CurrentUser) { await new BotInfo().Execute(); return; } var id = user.Id.ToString(); var guild = (channel as SocketGuildChannel).Guild; var member = user.GetMember(guild); var tag = user.Tag(); var nickname = member.Nickname; var dateCreated = user.CreatedAt.ToString("f", DateTimeFormatInfo.CurrentInfo); var dateJoined = member.JoinedAt.Value.ToString("f", DateTimeFormatInfo.CurrentInfo); var status = user.Status.ToString(); var activity = string.Empty; if (user.Activity != null) { activity = user.Activity.Type.ToString() + ' ' + user.Activity.Name; } var memberRoles = member.Roles.ToList(); memberRoles.Remove(memberRoles.Single(role => role == guild.EveryoneRole)); var rolesList = memberRoles.Select(role => role.Name).ToList(); rolesList.Sort(); var roles = string.Join(", ", rolesList); if (rolesList.Count == 0) { roles = "None"; } var embed = new EmbedBuilder(); embed.WithTitle("- User Info -"); embed.AddField("Username:"******"Nickname:", nickname); } embed.AddField("Date Created:", dateCreated) .AddField("Date Joined:", dateJoined) .AddField("Status:", status); if (activity != string.Empty) { embed.AddField("Activity:", activity); } embed.AddField("Roles:", roles); embed.WithFooter($"ID: {id}"); embed.WithColor(AkyBot.EmbedColor); embed.WithThumbnailUrl(user.DisplayAvatarURL()); await ChatMessage.Send(message, null, embed.Build()); }
public override async Task Execute() { var message = ChatMessage.Current; var channel = message.Channel; var args = ChatMessage.Args; bool sfw = await AkyBot.Databases.SFWGuilds.ContainsGuild((channel as SocketGuildChannel).Guild); if (!AkyBot.HasPermission(channel, GuildPermission.EmbedLinks)) { await ChatMessage.SendError(message, "I don't have Embed Links Permission!"); return; } var author = ChatMessage.Current.Author; if (!ChatMessage.HasArgs) { string info = "***__Info Commands__***\n"; info += GetCommands(CommandCategory.Info); string moderation = "***__Moderation Commands__***\n"; moderation += GetCommands(CommandCategory.Moderation); string fun = "***__Fun Commands__***\n"; fun += GetCommands(CommandCategory.Fun); string animeActions = "***__Anime Action Commands__***\n"; //animeActions += "soon...\n\n"; animeActions += GetCommands(CommandCategory.AnimeActions); string nsfw = "***__NSFW Commands__***\n"; nsfw += GetCommands(CommandCategory.NSFW); if (sfw) { nsfw = string.Empty; } string extraHelp = $"> You can also use **{AkyBot.Prefix}{new Help().Trigger} <command>**"; var helpEmbed = new EmbedBuilder() .WithTitle("- Help -") .WithDescription(info + moderation + fun + animeActions + nsfw + extraHelp) .WithColor(AkyBot.EmbedColor) .WithFooter($"Requested by {author.Username}", author.GetAvatarUrl()); await ChatMessage.Send(message, null, helpEmbed.Build()); } else { Command cmd = AkyBot.CommandsList.FirstOrDefault(c => c.Trigger == args[0]); if (cmd == null) { await ChatMessage.SendError(message, $"command \"{args[0]}\" doesn't exist!"); return; } if (cmd.Category == CommandCategory.Admin) { return; } if (cmd.Category == CommandCategory.NSFW && sfw) { return; } var embed = new EmbedBuilder() .WithTitle($"Help for [ {cmd.Trigger} ]") .WithDescription($"\n{cmd.Description}\n\nUsage: {cmd.Usage}") .WithAuthor(message.Author) .WithColor(AkyBot.EmbedColor); await ChatMessage.Send(message, null, embed.Build()); } }
public override async Task Execute() { var message = ChatMessage.Current; var author = message.Author; var channel = message.Channel; var typing = channel.EnterTypingState(); bool done = false; if (!AkyBot.HasPermission(channel, GuildPermission.EmbedLinks)) { typing.Dispose(); await ChatMessage.SendError(message, "I don't have Embed Links Permission!"); return; } string gifMessage = string.Empty; var mentionedUsers = ChatMessage.Current.MentionedUsers; if (mentionedUsers.Count == 0) { typing.Dispose(); await ChatMessage.SendError(message, "you have to mention a user!"); return; } if (mentionedUsers.Count == 1) { if (mentionedUsers.First() == AkyBot.Client.CurrentUser) { gifMessage = BotTagged; done = true; } else if (mentionedUsers.First() == author) { gifMessage = SelfTagged; done = true; } } if (!done) { string[] tags = mentionedUsers.Select(x => "**" + x.Username + "**").ToArray(); gifMessage = string.Join(", ", tags) + YouHaveBeenX + author.Username + "!"; done = true; } string url = $"https://api.tenor.com/v1/search?tag=anime_{Action}"; string json = await GetJSON(url); if (json == string.Empty) { typing.Dispose(); await ChatMessage.SendError(message, "there was an error with the API! Please try again later."); return; } List <TenorGif> gifs = JsonConvert.DeserializeObject <List <TenorGif> >(json); gifs.Randomize(); TenorGif gif = gifs[0]; string gifURL = gif.media[0].gif_url; var gifEmbed = new EmbedBuilder() .WithDescription(gifMessage) .WithColor(AkyBot.EmbedColor) .WithImageUrl(gifURL); typing.Dispose(); await ChatMessage.Send(message, null, gifEmbed.Build()); }