Esempio n. 1
0
        public async Task ClearAsync(int amount = 0)
        {
            if (amount == 0)
            {
                await ReplyAsync($"{Emotes.GetEmote("redmark")} Please specify how many messages you want to be cleared");

                return;
            }

            var msgs = await Context.Channel.GetMessagesAsync(amount + 1).Flatten(); //Get messages

            try
            {
                await Context.Channel.DeleteMessagesAsync(msgs); //Delete messages.

                if (amount == 1)
                {
                    await ReplyAsync($"{Emotes.GetEmote("greenmark")} {amount} message has been cleared");
                }
                else
                {
                    await ReplyAsync($"{Emotes.GetEmote("greenmark")} {amount} messages have been cleared.");
                }
            }
            catch
            {
                await ReplyAsync($"{Emotes.GetEmote("redmark")} An error has occurred. Please contact @temporis#6402 on discord.");
            }
        }
Esempio n. 2
0
        private async Task HandleCommandAsync(SocketMessage s)
        {
            var msg     = s as SocketUserMessage;
            var context = new SocketCommandContext(_client, msg);
            int argPos  = 0;

            if (context.Message.Author == _client.CurrentUser)
            {
                return;
            }
            if (msg.Content == null)
            {
                return;
            }

            if (msg.HasStringPrefix(Program.ConfigHelper.Bot.Prefix, ref argPos) || msg.HasMentionPrefix(_client.CurrentUser, ref argPos))
            {
                var result = await _service.ExecuteAsync(context, argPos);

                if (result.Error == CommandError.UnknownCommand)
                {
                    Console.WriteLine($"Unknown command sent in #{context.Channel.ToString()} in the server {context.Guild.ToString()}");
                    await context.Channel.SendMessageAsync($"{Emotes.GetEmote("redmark")} Unknown command. Do `{Program.ConfigHelper.Bot.Prefix}help` for a list of commands :)");
                }

                if (!result.IsSuccess && result.Error != CommandError.UnknownCommand)
                {
                    Console.WriteLine(result.ErrorReason);
                }
            }
        }
Esempio n. 3
0
        private static SelectMenuBuilder GetTargetMenu(PlayerFighter player)
        {
            var targets = player.SelectedMove.OnEnemy ? player.Enemies : player.Party;

            if ((player.SelectedMove.TargetType & TargetType.NoAim) == player.SelectedMove.TargetType || targets.Count <= 1)
            {
                return(null);
            }
            var team = targets.First().Party;

            List <SelectMenuOptionBuilder> options = new();

            foreach (var f in targets)
            {
                var emote = f.IsAlive ? null : Emotes.GetEmote("Dead");

                if (f.Stats.HP != 0 && 100 * f.Stats.HP / f.Stats.MaxHP <= 10)
                {
                    emote = Emote.Parse("<:Exclamatory:549529360604856323>");
                }

                options.Add(new SelectMenuOptionBuilder
                {
                    Label     = $"{f.Name}",
                    Value     = $"{options.Count}",
                    Emote     = emote,
                    IsDefault = player.HasSelected && team.IndexOf(f) == player.SelectedMove.TargetNr
                });
            }
            return(new SelectMenuBuilder($"{nameof(SelectTargetAction)}", options, "Select a Target"));
        }
Esempio n. 4
0
        public static MessageComponent GetControlComponent(bool PvP = false)
        {
            ComponentBuilder builder = new();

            if (PvP)
            {
                builder.WithButton("Join Team A", $"{nameof(JoinBattleAction)}.A", ButtonStyle.Success,
                                   Emotes.GetEmote("JoinBattle"));
                builder.WithButton("Join Team B", $"{nameof(JoinBattleAction)}.B", ButtonStyle.Success,
                                   Emotes.GetEmote("JoinBattle"));
            }
            else
            {
                builder.WithButton("Join", $"{nameof(JoinBattleAction)}", ButtonStyle.Success,
                                   Emotes.GetEmote("JoinBattle"));
            }

            builder.WithButton("Start", $"{nameof(StartBattleAction)}", ButtonStyle.Success,
                               Emotes.GetEmote("StartBattle"));
            return(builder.Build());
        }
Esempio n. 5
0
        public async Task KickAsync(SocketGuildUser user = null, [Remainder] string reason = null)
        {
            //TODO: Permission checking and some other stuff to make sure shit doesnt break...
            if (user == null)
            {
                await ReplyAsync($"{Emotes.GetEmote("redmark")}Who would you like me to kick?");

                return;
            }

            if (user == Context.User)
            {
                await ReplyAsync($"{Emotes.GetEmote("redmark")} You cant kick yourself!");

                return;
            }

            if (string.IsNullOrWhiteSpace(reason))
            {
                await ReplyAsync($"{Emotes.GetEmote("redmark")} Please provide a reason to kick the user."); //TODO: Emoji

                return;
            }

            try
            {
                await user.SendMessageAsync($"You have been kicked from the server `{Context.Guild.Name.ToString()}` for the reason `{reason}`");
                await ReplyAsync($"{Emotes.GetEmote("greenmark")} {user.Mention} has been kicked.");

                await user.KickAsync(reason);
            }
            catch
            {
                await ReplyAsync($"{Emotes.GetEmote("redmark")} An error occured. Are you trying to kick someone with a higher rank then the bot? If not please contact @temporis#6402 on discord."); //TODO: Emoji
            }
        }
Esempio n. 6
0
 public async Task TestMessageAsync()
 {
     await ReplyAsync($"{Emotes.GetEmote("redmark")} Placeholder");
 }
Esempio n. 7
0
        public async Task PutRoles([Remainder] ITextChannel channel)
        {
            var builder = new ComponentBuilder();

            builder.WithButton("Venus", $"^{nameof(ChangeAdeptAction)}.Venus", ButtonStyle.Primary, emote: Emotes.GetEmote(Element.Venus));
            builder.WithButton("Mars", $"^{nameof(ChangeAdeptAction)}.Mars", ButtonStyle.Primary, emote: Emotes.GetEmote(Element.Mars));
            builder.WithButton("Jupiter", $"^{nameof(ChangeAdeptAction)}.Jupiter", ButtonStyle.Primary, emote: Emotes.GetEmote(Element.Jupiter));
            builder.WithButton("Mercury", $"^{nameof(ChangeAdeptAction)}.Mercury", ButtonStyle.Primary, emote: Emotes.GetEmote(Element.Mercury));
            await channel.SendMessageAsync($"Choose from {Emotes.GetIcon(Element.Venus)}Venus, {Emotes.GetIcon(Element.Mars)}Mars, " +
                                           $"{Emotes.GetIcon(Element.Jupiter)}Jupiter, or {Emotes.GetIcon(Element.Mercury)}Mercury. You can change your role/element at any time.", components : builder.Build());
        }