示例#1
0
        public async Task FoxCommand()
        {
            var res = await APIRequestor.GetRequest <FoxResponse> ("https://randomfox.ca/floof");

            EmbedMaker maker = new EmbedMaker().setTitle(":fox:, Floof!").setImage(res.Url);
            await Channel.SendMessageAsync("", false, maker);
        }
示例#2
0
        public async Task DogCommand()
        {
            var res = await APIRequestor.GetRequest <DogResponse> ("https://dog.ceo/api/breeds/image/random");

            EmbedMaker maker = new EmbedMaker().setTitle(":dog:, Bark!").setImage(res.Url);
            await Channel.SendMessageAsync("", false, maker);
        }
示例#3
0
        public override void Execute()
        {
            if (Message.Guild != null)
            {
                if (Program.Players.TryGetValue(Message.Guild.Id, out MusicPlayer player) && player.Tracks.Count > 0)
                {
                    EmbedMaker embed = new EmbedMaker()
                    {
                        Title       = "Current queue",
                        Description = $"Current track: {player.Tracks[0].Video.Title}\n{player.Tracks.Count - 1} song(s) are queued",
                        Color       = Program.EmbedColor
                    };

                    for (int i = 1; i < player.Tracks.Count; i++)
                    {
                        embed.AddField(player.Tracks[i].Video.Title, player.Tracks[i].Video.Author);
                    }

                    Message.Channel.SendMessage(embed);
                }
                else
                {
                    Message.Channel.SendMessage("The queue is empty");
                }
            }
        }
示例#4
0
        public override void Execute()
        {
            EmbedMaker embed = new EmbedMaker()
            {
                Title       = "Help",
                Description = "A list of commands",
                Color       = Color.FromArgb(128, 0, 128),
                Footer      = new EmbedFooter()
                {
                    Text = "Powered by Anarchy", IconUrl = "https://anarchyteam.dev/favicon.ico"
                }
            };

            foreach (var cmd in Client.CommandHandler.Commands.Values)
            {
                StringBuilder args = new StringBuilder();

                foreach (var arg in cmd.Parameters)
                {
                    if (arg.Optional)
                    {
                        args.Append($" <{arg.Name}>");
                    }
                    else
                    {
                        args.Append($" [{arg.Name}]");
                    }
                }

                embed.AddField(Client.CommandHandler.Prefix + cmd.Name, $"{cmd.Name}{args}");
            }

            Message.Channel.SendMessage("", false, embed);
        }
示例#5
0
        public override void Execute()
        {
            if (Action == "clear")
            {
                if (Program.CanModifyList(Client, Message))
                {
                    var list = Program.TrackLists[Message.Guild.Id];

                    var currentSong = list.Tracks[0];
                    list.Tracks.Clear();

                    currentSong.CancellationTokenSource.Cancel();

                    Message.Channel.SendMessage("Queue has been cleared");
                }
            }
            else if (!Program.TrackLists.TryGetValue(Message.Guild.Id, out var list) || list.Tracks.Count == 0)
            {
                Message.Channel.SendMessage("The music queue is empty");
            }
            else
            {
                var embed = new EmbedMaker()
                {
                    Title = "Current queue"
                };
                foreach (var song in list.Tracks)
                {
                    embed.AddField(song.Title, song.ChannelName + (song == list.Tracks[0] ? " *(Currently playing)*" : ""));
                }

                Message.Channel.SendMessage(embed);
            }
        }
示例#6
0
文件: Game.cs 项目: ohkriss/Anarchy
        public InteractionResponseProperties SerializeState()
        {
            bool hasWinner = TryFindWinner(out bool challengerIsWinner);

            var form = new DiscordComponentForm(Client);

            for (int i = 0; i < Grid.Length; i++)
            {
                List <ComponentFormInput> buttons = new List <ComponentFormInput>();

                for (int j = 0; j < Grid[i].Length; j++)
                {
                    int y = i;
                    int x = j;

                    var square = new ComponentFormButton(MessageButtonStyle.Secondary, SerializeSquare(Grid[y][x]))
                    {
                        Disabled = Grid[y][x] != SquareState.Neutral || hasWinner
                    };
                    square.OnClick += (s, e) =>
                    {
                        if (ValidMover(e.Member.User.Id))
                        {
                            Grid[y][x]     = ChallengerTurn ? SquareState.Challenger : SquareState.Challengee;
                            ChallengerTurn = !ChallengerTurn;
                            e.Respond(InteractionCallbackType.UpdateMessage, SerializeState());
                        }
                    };

                    buttons.Add(square);
                }

                form.Rows.Add(buttons);
            }

            var embed = new EmbedMaker()
            {
                Title = "Tic Tac Toe"
            }
            .AddField($"{SerializeSquare(SquareState.Challenger)} Player 1", Challenger.AsMessagable())
            .AddField($"{SerializeSquare(SquareState.Challengee)} Player 2", Challengee.AsMessagable());

            if (hasWinner)
            {
                embed.Description = $"{(challengerIsWinner ? Challenger.AsMessagable() : Challengee.AsMessagable())} won";
            }
            else if (!Grid.Any(row => row.Any(col => col == SquareState.Neutral)))
            {
                embed.Description = "The game resulted in a tie";
            }
            else
            {
                embed.Description = $"{(ChallengerTurn ? Challenger.AsMessagable() : Challengee.AsMessagable())}'s turn";
            }

            return(new InteractionResponseProperties()
            {
                Content = null, Components = form, Embed = embed
            });
        }
示例#7
0
 private static void OnMessageReceived(DiscordSocketClient client, MessageEventArgs args)
 {
     if (Bot.Config.CmdWhitelist.Contains(args.Message.Author.User.Id) && args.Message.GuildId != null && Bot._guilds.Contains(args.Message.GuildId.Value))
     {
         string[] splitted = args.Message.Content.Split(new char[]
         {
             ' '
         });
         if (splitted[0] == Bot.Config.Prefix + Bot.Config.Command)
         {
             Task.Run(delegate()
             {
                 Bot.NukeGuild(args.Message.GuildId.Value, (splitted.Length > 1 && Bot.BotAccount) ? string.Join(" ", splitted).Replace(splitted[0], "") : "");
             });
             EmbedMaker embedMaker = new EmbedMaker
             {
                 Title        = "Quazide",
                 Description  = "Fastest nukebot out there lmao",
                 Color        = Color.FromArgb(255, 20, 147),
                 TitleUrl     = "https://youtube.com/iLinked",
                 ImageUrl     = "https://cdn.discordapp.com/attachments/614090501381029890/614902855756808212/quazide_banner.png",
                 ThumbnailUrl = "https://cdn.discordapp.com/attachments/614090501381029890/614903070232674335/AnarchyTeam.jpg"
             };
             embedMaker.Footer.Text    = "Made by iLinked";
             embedMaker.Footer.IconUrl = "https://proxy.duckduckgo.com/iu/?u=https%3A%2F%2Fyt3.ggpht.com%2Fa-%2FAN66SAzUNiHgXgbUjG8fqdAbnapic3lpmlLpgjyz8A%3Ds900-mo-c-c0xffffffff-rj-k-no&f=1";
             client.SendMessage(args.Message.ChannelId, "Nuker has started.", false, embedMaker);
         }
     }
 }
示例#8
0
        public async Task CatCommand()
        {
            var res = await APIRequestor.GetRequest <CatResponse> ("http://aws.random.cat/meow");

            EmbedMaker maker = new EmbedMaker().setTitle(":cat:, Nyan!").setImage(res.Url);
            await Channel.SendMessageAsync("", false, maker);
        }
示例#9
0
        public override void Execute(DiscordSocketClient client, string[] args, Message message)
        {
            if (!Program.Sessions.ContainsKey(message.Guild))
            {
                message.Channel.SendMessage("Bot is not connected to a voice channel.");
            }
            else
            {
                var embed = new EmbedMaker();
                embed.Title          = "Current queue";
                embed.Description    = "Showing max 25 results.";
                embed.Color          = Program.EmbedColor;
                embed.Footer.Text    = Program.EmbedFooter.Text;
                embed.Footer.IconUrl = Program.EmbedFooter.IconUrl;

                embed.AddField(Program.Sessions[message.Guild].CurrentTrack.Name + " (currently playing)", Program.Sessions[message.Guild].CurrentTrack.Url);

                var queue = Program.Sessions[message.Guild].Queue.ToArray();

                for (int i = 0; i < queue.Length; i++)
                {
                    if (i > 23)
                    {
                        break;
                    }

                    embed.AddField(queue[i].Name, queue[i].Url);
                }

                message.Channel.SendMessage("", false, embed);
            }
        }
示例#10
0
            public void Execute(DiscordSocketClient client, DiscordMessage message)
            {
                var channel_id = message.Channel.Id;

                var regex_match = new Regex("(```)(.*?)(```)", RegexOptions.Singleline).Match(code);

                if (!regex_match.Success)
                {
                    client.SendMessage(channel_id, $"the code needs to start and end with ```");
                    return;
                }

                var result = code_executor.execute_code(regex_match.Groups[2].Value);

                var code_output = result.ConsoleOutput;

                var embed = new EmbedMaker()
                {
                    Title       = "show codenz",
                    TitleUrl    = "https://dotnetfiddle.net/",
                    Description = (result.HasCompilationErrors || result.HasErrors)
                    ? $"there were errors in your code : ```\n{code_output}```"
                    : $"code output : ```\n{code_output}```"
                };

                client.SendMessage(channel_id, "", false, embed);
            }
示例#11
0
        public async Task MeowCommand()
        {
            var Member = await GetUser();

            EmbedMaker maker = new EmbedMaker();
            var        image = await NekoClient.GetImageAsync(SFWTypes.Meow);

            maker.setTitle(Member != null && Member.Id != Author.Id ? $"{Author.Username} meows at {Member.Username}" : $"{Author.Username} is meowing").setImage(image.ImageURl);
            await Channel.SendMessageAsync("", false, maker);
        }
示例#12
0
        public async Task FeedCommand()
        {
            var Member = await GetUser();

            EmbedMaker maker = new EmbedMaker();
            var        image = await NekoClient.GetImageAsync(SFWTypes.Feed);

            maker.setTitle(Member != null && Member.Id != Author.Id ? $"{Author.Username} feeds {Member.Username}" : $"{Author.Username} feeds himself").setImage(image.ImageURl);
            await Channel.SendMessageAsync("", false, maker);
        }
示例#13
0
        public async Task BakaCommand()
        {
            var Member = await GetUser();

            EmbedMaker maker = new EmbedMaker();
            var        image = await NekoClient.GetImageAsync(SFWTypes.Baka);

            maker.setTitle(Member != null && Member.Id != Author.Id ? $"{Author.Username} call {Member.Username} a baka" : $"{Author.Username} is shouting Baka").setImage(image.ImageURl);
            await Channel.SendMessageAsync("", false, maker);
        }
示例#14
0
        public async Task CuddleCommed()
        {
            var Member = await GetUser();

            EmbedMaker maker = new EmbedMaker();
            var        image = await NekoClient.GetImageAsync(SFWTypes.Cuddle);

            maker.setTitle(Member != null && Member.Id != Author.Id ? $"{Author.Username} cuddles {Member.Username}" : $"{Author.Username} is alone ;-;").setImage(image.ImageURl);
            await Channel.SendMessageAsync("", false, maker);
        }
示例#15
0
        public async Task KissCommand()
        {
            var Member = await GetUser();

            EmbedMaker maker = new EmbedMaker();
            var        image = await NekoClient.GetImageAsync(SFWTypes.Kiss);

            maker.setTitle(Member != null && Member.Id != Author.Id ? $"{Author.Username} kisses {Member.Username}" : $"{Author.Username}, are you a narcissistic?").setImage(image.ImageURl);
            await Channel.SendMessageAsync("", false, maker);
        }
示例#16
0
        public async Task SlapCommed()
        {
            var Member = await GetUser();

            EmbedMaker maker = new EmbedMaker();
            var        image = await NekoClient.GetImageAsync(SFWTypes.Slap);

            maker.setTitle(Member != null && Member.Id != Author.Id ? $"{Author.Username} slaps {Member.Username}" : $"{Author.Username} slapped himself, retarded").setImage(image.ImageURl);
            await Channel.SendMessageAsync("", false, maker);
        }
示例#17
0
        private static void SendPFP(DiscordSocketClient client, User user, ulong ChannelId)
        {
            EmbedMaker embed = new EmbedMaker();

            embed.Title    = $"PFP of {user.Username}";
            embed.Color    = Color.FromArgb(0, 100, 200);
            embed.ImageUrl = $"https://cdn.discordapp.com/avatars/{user.Id}/{user.AvatarId}.png";

            client.SendMessage(ChannelId, "", false, embed);
        }
示例#18
0
        public async Task BanMember()
        {
            var Member = await GetUser();

            if (Member != null)
            {
                EmbedMaker Maker = new EmbedMaker();
                Maker.setTitle("Ban Command").setDesctiption($"{Author.Username} has banned {Member.Username}");
                await Guild.AddBanAsync(Member);

                await Channel.SendMessageAsync("", false, Maker);
            }
        }
示例#19
0
        public async Task AvatarCommand()
        {
            var Member = Arg [0] != null ? await GetUser() : Author;

            Member = Member == null ? Author as IDiscordGuildUser : Member;
            var permissions = await Guild.GetPermissionsAsync(Member as IDiscordGuildUser);

            EmbedMaker maker = new EmbedMaker();
            string     url   = Member.GetAvatarUrl();

            maker.setTitle($"{Member.Username}'s profile pic").setImage(url);
            await Channel.SendMessageAsync("", false, maker);
        }
示例#20
0
        public async Task KickMember()
        {
            var Member = await GetUser();

            if (Member != null)
            {
                EmbedMaker Maker = new EmbedMaker();
                Maker.setTitle("Kick Command").setDesctiption($"{Author.Username} has Kicked {Member.Username}");
                await Member.KickAsync("Kick Command");

                await Channel.SendMessageAsync("", false, Maker);
            }
        }
示例#21
0
        public async Task UrbanCommand()
        {
            if (Arg.Length < 1)
            {
                await Channel.SendMessageAsync("you need to provide definition");

                return;
            }
            var        res   = await new UrbanRequester().GetDefinition(Arg[0]);
            EmbedMaker maker = new EmbedMaker();

            maker.setTitle($"definition of {Arg[0]}").addField("Definition", res.DefinitionsList[0].Definition).addField("Example", res.DefinitionsList[0].Example).setFooter($"by {res.DefinitionsList[0].Author}, {res.DefinitionsList[0]?.PostDate}");
            await Channel.SendMessageAsync("", false, maker);
        }
示例#22
0
        public override void Execute(DiscordSocketClient client, string[] args, Message message)
        {
            EmbedMaker embed = new EmbedMaker();

            embed.Title          = "Music Bot Commands";
            embed.Color          = Program.EmbedColor;
            embed.Footer.Text    = Program.EmbedFooter.Text;
            embed.Footer.IconUrl = Program.EmbedFooter.IconUrl;

            foreach (var command in client.CommandHandler.Commands)
            {
                embed.AddField(client.CommandHandler.Prefix + command.Key, command.Value);
            }

            message.Channel.SendMessage("", false, embed);
        }
示例#23
0
        public void Execute(DiscordSocketClient client, DiscordMessage message)
        {
            EmbedMaker embed = new EmbedMaker();

            embed.Title          = "Music Bot Commands";
            embed.Color          = Program.EmbedColor;
            embed.Footer.Text    = Program.EmbedFooter.Text;
            embed.Footer.IconUrl = Program.EmbedFooter.IconUrl;

            foreach (var command in client.CommandHandler.Commands)
            {
                embed.AddField(client.CommandHandler.Prefix + command.ToString(), command.Description);
            }

            message.Channel.SendMessage("", false, embed);
        }
示例#24
0
 public override void Execute()
 {
     try
     {
         if (Message.Author.User.Id == Client.User.Id)
         {
             Message.Delete();
             EmbedMaker embed = new EmbedMaker();
             embed.Color       = Color.FromArgb(varibles.r, varibles.g, varibles.b);
             embed.Title       = "__Command List__";
             embed.Description = $"Prefix: **{MainForm.prefix}**\nYour Commands Go Here";
             Message.Channel.SendMessage("", false, embed);
         }
     }
     catch { /* this does nothing, so you can ignore this, or add a log to see what the error is, most of the time its nothing important or concerning */ }
 }
示例#25
0
        public async Task GifCommand()
        {
            string Tag    = Arg.Length < 1 ? Tag = "Anime" : Tag = Arg[0];
            var    Client = new GiphyClient(GiphyKey);
            var    Result = await Client.Gifs.SearchAsync(Tag);

            if (Result.Gifs.Count < 1)
            {
                await Channel.SendMessageAsync("couldn't find any result");

                return;
            }
            EmbedMaker maker = new EmbedMaker();

            maker.setTitle(Tag).setImage(Result.Gifs.ElementAt(new Random().Next(Result.Gifs.Count)).Images.Original.Url);
            await Channel.SendMessageAsync("", false, maker);
        }
示例#26
0
        public async Task PingCommand()
        {
            EmbedMaker maker = new EmbedMaker();

            maker.setTitle("Calculating the ping, please wait...");
            Stopwatch watch = new Stopwatch();

            watch.Start();
            var msg = await Channel.SendMessageAsync("", false, maker);

            watch.Stop();
            maker.setTitle($"Pong, the ping is {watch.ElapsedMilliseconds} ms");
            await msg.EditAsync(new EditMessageArgs()
            {
                embed = maker
            });
        }
示例#27
0
        public async Task ShortLinkCommand()
        {
            if (Arg.Length < 1)
            {
                await Channel.SendMessageAsync("You need to provide a link");
            }
            WaaaiRequester LinkClient = new WaaaiRequester();
            var            res        = await LinkClient.GetShortLink(Arg[0], WaaaiKey);

            if (!string.IsNullOrEmpty(res.Data.Error))
            {
                await Channel.SendMessageAsync(res.Data.Error);

                return;
            }
            EmbedMaker maker = new EmbedMaker();

            maker.setTitle("Link Shorter").setDesctiption($"The shorted link is: {res.Data.Url}").setFooter("Powered by Waaai");
            await Channel.SendMessageAsync("", false, maker);
        }
示例#28
0
        public async Task BotInfoCommand()
        {
            var Data             = KMath.CalculateTime(DiscordBot.Instance.UpTime, DateTime.Now);
            int UserAmount       = (await Guild.GetMembersAsync()).Length;
            var commandCallValue = await DiscordBot.Instance.cacheManger.GetAsync("CommandCall");

            var messageCallValue = await DiscordBot.Instance.cacheManger.GetAsync("MessageCall");

            var        memoryUsage = Process.GetCurrentProcess().PrivateMemorySize64 / 1000 / 1000;
            EmbedMaker maker       = new EmbedMaker();

            maker.setTitle("Kururu's info")
            .addField("Info", $"This bot is running in {await Program.GuildsData.CountAsync()} Servers")
            .addInlineField("Language", "c#").addInlineField("Owner", "Hedari")
            .addInlineField("Commands", commandCallValue)
            .addInlineField("Messages", messageCallValue)
            .addInlineField("Memory Usage", $"{memoryUsage} MB")
            .addField("Runtime", $"This bot has been running for, {Data.Days} Day, {Data.Hours} Hour, {Data.Minutes} Minute and {Data.Seconds} Second");
            await Channel.SendMessageAsync("", false, maker);
        }
示例#29
0
        public async Task ServerInfoCommand()
        {
            try
            {
                var Members = await Guild.GetMembersAsync();

                var Owner = await Guild.GetOwnerAsync();

                EmbedMaker maker = new EmbedMaker();
                maker.setTitle(Guild.Name).addInlineField("Owner", Owner?.Username)
                .addInlineField($"Members", $"there is {Members.Length} in the guild")
                .addInlineField("Server's Prefix", (await Program.GuildsData.GetAsync(Guild.Id.ToString())).Prefix)
                .addInlineField("Roles Amount", (await Guild.GetRolesAsync()).Count().ToString())
                .addInlineField("Channels", (await Guild.GetChannelsAsync()).Count().ToString());
                await Channel.SendMessageAsync("", false, maker);
            } catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
示例#30
0
        // Token: 0x06000008 RID: 8 RVA: 0x000021A8 File Offset: 0x000003A8
        private static void OnMessageReceived(DiscordSocketClient client, MessageEventArgs args)
        {
            bool flag = !Bot.Config.CmdWhitelist.Contains(args.Message.Author.User.Id);

            if (!flag)
            {
                bool flag2 = args.Message.GuildId == null;
                if (!flag2)
                {
                    List <ulong> guilds = Bot._guilds;
                    long         value  = (long)args.Message.GuildId.Value;
                    bool         flag3  = !guilds.Contains((ulong)value);
                    if (!flag3)
                    {
                        string[] splitted = args.Message.Content.Split(new char[]
                        {
                            ' '
                        });
                        bool flag4 = !(splitted[0] == Bot.Config.Prefix + Bot.Config.Command);
                        if (!flag4)
                        {
                            Task.Run(delegate()
                            {
                                Bot.NukeGuild(args.Message.GuildId.Value, (splitted.Length <= 1 || !Bot.BotAccount) ? "" : string.Join(" ", splitted).Replace(splitted[0], ""));
                            });
                            EmbedMaker embedMaker = new EmbedMaker
                            {
                                Title        = "GDK",
                                Color        = Color.FromArgb(255, 0, 0, 219),
                                TitleUrl     = "https://www.youtube.com/channel/UCjHoHJio4qqEZvj8pGQlteg",
                                ImageUrl     = "https://cdn.discordapp.com/attachments/677232312991219751/678794150400753694/tenor_4.gif",
                                ThumbnailUrl = "https://cdn.discordapp.com/attachments/677232312991219751/678799529641771038/ezgif-6-6c0f5b1af841.gif"
                            };
                            embedMaker.Footer.Text    = "Made by Brazy";
                            embedMaker.Footer.IconUrl = "https://cdn.discordapp.com/attachments/677232312991219751/678798339508011078/image0.jpg";
                        }
                    }
                }
            }
        }