Пример #1
0
                public async Task SetAp()
                {
                    IDMChannel channel = await Context.Message.Author.GetOrCreateDMChannelAsync();

                    await channel.SendMessageAsync(
                        "`!event set ap <character alias> <action points>` sets the character's action points to the given value.");
                }
Пример #2
0
        private async Task ChannelsDescription()
        {
            //Display rules of this channel for x seconds
            var           channelData = _rules.Channel;
            StringBuilder sb          = new StringBuilder();

            foreach (var c in channelData)
            {
                sb.Append((await Context.Guild.GetTextChannelAsync(c.Id))?.Mention).Append(" - ").Append(c.Header).Append("\n");
            }
            string text = sb.ToString();

            IDMChannel dm = await Context.User.GetOrCreateDMChannelAsync();

            if (sb.ToString().Length > 2000)
            {
                await dm.SendMessageAsync(text.Substring(0, 2000));

                await dm.SendMessageAsync(text.Substring(2000, text.Length));
            }
            else
            {
                await dm.SendMessageAsync(text);
            }

            await Context.Message.DeleteAsync();
        }
Пример #3
0
        public async Task Ban(SocketGuildUser nTarget, [Remainder] string reason = null)
        {
            SocketGuildUser sender = this.Context.Guild.GetUser(this.Context.User.Id);

            if (!(sender.CheckUserIsStaff()))
            {
                return;
            }

            if (!sender.RoleSuperiorityCheck(nTarget))
            {
                return;
            }

            AkiraPunishmentModel model = new AkiraPunishmentModel(sender, nTarget, AkiraPunishmentModel.PunishmentType.BAN, reason);

            if (AkiraConfiguration.SendKickedUsersMessage)
            {
                IDMChannel channel = await nTarget.GetOrCreateDMChannelAsync();

                string toSend = $"I'm sorry to inform you but you have been banned from {this.Context.Guild.Name}{(string.IsNullOrEmpty(reason) ? "" : $" for: {nReason}")}.";

                if (!string.IsNullOrEmpty(AkiraConfiguration.AkiraDiscordInviteLink))
                {
                    toSend += $"\nYou may rejoin the server with the following link: {AkiraConfiguration.AkiraDiscordInviteLink} if unbanned.";
                }

                await channel.SendMessageAsync(toSend);
            }

            await this.Context.Guild.AddBanAsync(nTarget, reason : reason);
        }
Пример #4
0
                public async Task RemoveAdminrole()
                {
                    IDMChannel channel = await Context.Message.Author.GetOrCreateDMChannelAsync();

                    await channel.SendMessageAsync(
                        "`!guild add adminrole <role>` allows you to remove roles that was treated as admins of BattleBot in this guild.");
                }
Пример #5
0
        public async Task RequestData()
        {
            await Context.Channel.SendMessageAsync(
                "Hang on, I will DM you the JSON file once I have collected all of your account data.");

            //Create the temp directory if it doesn't exist
            if (!Directory.Exists("temp/"))
            {
                Directory.CreateDirectory("temp/");
            }

            //Get the user account in a single json file
            string json = JsonConvert.SerializeObject(UserAccountsManager.GetAccount((SocketGuildUser)Context.User),
                                                      Formatting.Indented);

            File.WriteAllText($"temp/{Context.User.Id}.json", json);

            //Get the user's dm and send the file
            IDMChannel dm = await Context.User.GetOrCreateDMChannelAsync();

            await dm.SendFileAsync($"temp/{Context.User.Id}.json", "Here is your user data, all in one JSON file!");

            //Delete the file
            File.Delete($"temp/{Context.User.Id}.json");
        }
Пример #6
0
        public async Task Attack()
        {
            IDMChannel channel = await Context.Message.Author.GetOrCreateDMChannelAsync();

            await channel.SendMessageAsync(
                "`!attack <character alias> <target-1 alias> ... <target-n alias>` the character will attempt to attack one or more targets according to the event ruleset. Yarrrrr! :crossed_swords:\nThis only works after the event has started.");
        }
Пример #7
0
        public async Task Block()
        {
            IDMChannel channel = await Context.Message.Author.GetOrCreateDMChannelAsync();

            await channel.SendMessageAsync(
                "`!block <character alias>` the character will block one attack this round. :shield:\nThis only works after the event has started.");
        }
Пример #8
0
                    public async Task DisableHealthPotion()
                    {
                        IDMChannel channel = await Context.Message.Author.GetOrCreateDMChannelAsync();

                        await channel.SendMessageAsync(
                            "`!event disable potion health` disables health potions and removes any existing health potions.");
                    }
Пример #9
0
                public async Task AddAdminrole()
                {
                    IDMChannel channel = await Context.Message.Author.GetOrCreateDMChannelAsync();

                    await channel.SendMessageAsync(
                        "`!guild add adminrole <role>` allows you to add roles from your guild that will be treated as admins of BattleBot in this guild.");
                }
Пример #10
0
                    public async Task SetPotion()
                    {
                        IDMChannel channel = await Context.Message.Author.GetOrCreateDMChannelAsync();

                        await channel.SendMessageAsync(
                            "`!event set order <command>` allows you to change the teams and characters for an event with these commands:\nevent set order teams");
                    }
Пример #11
0
                    public async Task SetOrderTeams()
                    {
                        IDMChannel channel = await Context.Message.Author.GetOrCreateDMChannelAsync();

                        await channel.SendMessageAsync(
                            "`!event set order teams [<team alias> ... <team alias>]` sets the order of teams regarding when they get their turns, if you enter this without any team aliases you will get a list of team aliases.");
                    }
Пример #12
0
                    public async Task SetHealthPotion()
                    {
                        IDMChannel channel = await Context.Message.Author.GetOrCreateDMChannelAsync();

                        await channel.SendMessageAsync(
                            "`!event set potion health <character alias> <amount>` sets the amount of health potions a character has.");
                    }
Пример #13
0
                    public async Task SetPotion()
                    {
                        IDMChannel channel = await Context.Message.Author.GetOrCreateDMChannelAsync();

                        await channel.SendMessageAsync(
                            "`!event set potion <command>` allows you to change the number of potions a character has for an event with these commands:\nevent set potion health");
                    }
Пример #14
0
                public async Task SetBaseheal()
                {
                    IDMChannel channel = await Context.Message.Author.GetOrCreateDMChannelAsync();

                    await channel.SendMessageAsync(
                        "`!event set baseheal <health>` sets the events's base heal to the given value.");
                }
Пример #15
0
                public async Task GuildHelp()
                {
                    IDMChannel channel = await Context.Message.Author.GetOrCreateDMChannelAsync();

                    await channel.SendMessageAsync(
                        "`!guild remove <command>` allows you to remove things such as admins and admin roles from a guild with these commands:\nguild remove adminrole");
                }
Пример #16
0
                public async Task Enable()
                {
                    IDMChannel channel = await Context.Message.Author.GetOrCreateDMChannelAsync();

                    await channel.SendMessageAsync(
                        "`!event enable <command>` allows you to enable certain things for an event with these commands:\nevent enable potion <command>");
                }
Пример #17
0
        public async Task Roll()
        {
            IDMChannel channel = await Context.Message.Author.GetOrCreateDMChannelAsync();

            await channel.SendMessageAsync(
                "`!roll <dice(s)>` Here you can simulate rolling dices!\nJust type !roll d<dice size>, for example !roll d10 for a d10 dice. You may also roll multiple dices at a time by typing !roll d10+d10.\nAdd, subtract, multiply or divide by changing the + for a -, * or /.");
        }
Пример #18
0
                    public async Task EnablePotion()
                    {
                        IDMChannel channel = await Context.Message.Author.GetOrCreateDMChannelAsync();

                        await channel.SendMessageAsync(
                            "`!event enable potion <command>` allows you to enable different potions for an event with these commands:\nevent enable potion health");
                    }
Пример #19
0
        public async Task Ward()
        {
            IDMChannel channel = await Context.Message.Author.GetOrCreateDMChannelAsync();

            await channel.SendMessageAsync(
                "`!ward <character alias> <target-1 alias> ... <target-n alias>` the character will attempt to ward one or more targets according to the event ruleset. :shield:\nThis only works after the event has started.");
        }
Пример #20
0
                    public async Task EnableHealthPotion()
                    {
                        IDMChannel channel = await Context.Message.Author.GetOrCreateDMChannelAsync();

                        await channel.SendMessageAsync(
                            "`!event enable potion health <min potions> <max potions>` enables health potions for the event and grants a randomly selected amount of health potions in the given range to existing characters.");
                    }
Пример #21
0
            public async Task Remove()
            {
                IDMChannel channel = await Context.Message.Author.GetOrCreateDMChannelAsync();

                await channel.SendMessageAsync(
                    "`!potion <command>` allows you use different potions during an event:\nevent health");
            }
Пример #22
0
                public async Task HideCharacter()
                {
                    IDMChannel channel = await Context.Message.Author.GetOrCreateDMChannelAsync();

                    await channel.SendMessageAsync(
                        "`!event hide character <character alias>` hides a character until they are revealed through some action or the reveal command.");
                }
Пример #23
0
            public async Task ChannelHelp()
            {
                IDMChannel channel = await Context.Message.Author.GetOrCreateDMChannelAsync();

                await channel.SendMessageAsync(
                    "`!channel <command>` allows you to moderate channels with these commands:\nchannel status\nchannel remove");
            }
Пример #24
0
                public async Task Reveal()
                {
                    IDMChannel channel = await Context.Message.Author.GetOrCreateDMChannelAsync();

                    await channel.SendMessageAsync(
                        "`!event reveal <command>` allows you to reveal a character or a team for an event with these commands:\nevent reveal team\nevent reveal character");
                }
Пример #25
0
        public async Task MessageDeleted(Cacheable <IMessage, ulong> cache, ISocketMessageChannel channel)
        {
            try
            {
                SocketGuild guild  = ((SocketGuildChannel)channel).Guild;
                ServerList  server = ServerListsManager.GetServer(guild);
                if (cache.Id == server.RuleMessageId)
                {
                    //The rule reaction will be disabled and the owner of the guild will be notified.
                    server.RuleEnabled = false;

                    ServerListsManager.SaveServerList();

                    IDMChannel dm = await guild.Owner.GetOrCreateDMChannelAsync();

                    await dm.SendMessageAsync(
                        $"Your rule reaction on the Discord server **{guild.Name}** has been disabled due to the message being deleted.\n" +
                        "You can enable it again after setting a new reaction message with the command `setuprulesmessage` and then enabling the feature again with `togglerulereaction`.");
                }
            }
            catch (Exception ex)
            {
#if DEBUG
                Logger.Log(ex.ToString(), LogVerbosity.Error);
#else
                Logger.Log(ex.Message, LogVerbosity.Error);
#endif
            }
        }
Пример #26
0
                public async Task RevealTeam()
                {
                    IDMChannel channel = await Context.Message.Author.GetOrCreateDMChannelAsync();

                    await channel.SendMessageAsync(
                        "`!event reveal team <team alias>` reveals a team and all its characters.");
                }
Пример #27
0
        async Task Rules(IMessageChannel channel, int seconds = 60)
        {
            //Display rules of this channel for x seconds
            var          rule = _rules.Channel.First(x => x.Id == 0);
            IUserMessage m;
            IDMChannel   dm = await Context.User.GetOrCreateDMChannelAsync();

            if (rule == null)
            {
                m = await ReplyAsync(
                    "There is no special rule for this channel.\nPlease follow global rules (you can get them by typing `!globalrules`)");
            }
            else
            {
                m = await ReplyAsync(
                    $"{rule.Header}{(rule.Content.Length > 0 ? rule.Content : "There is no special rule for this channel.\nPlease follow global rules (you can get them by typing `!globalrules`)")}");
            }

            Task deleteAsync = Context.Message?.DeleteAsync();

            if (deleteAsync != null)
            {
                await deleteAsync;
            }

            if (seconds == -1)
            {
                return;
            }
            await Task.Delay(seconds * 1000);

            await m.DeleteAsync();
        }
Пример #28
0
                public async Task RevealCharacter()
                {
                    IDMChannel channel = await Context.Message.Author.GetOrCreateDMChannelAsync();

                    await channel.SendMessageAsync(
                        "`!event reveal character <character alias>` reveals a character.");
                }
Пример #29
0
        private async Task H(CommandInfo command)
        {
            string prefix = Context.Channel is IDMChannel ? Roki.Properties.Prefix : (await _config.GetGuildConfigAsync(Context.Guild.Id)).Prefix;

            if (command == null)
            {
                EmbedBuilder helpEmbed = new EmbedBuilder().WithOkColor()
                                         .WithTitle("Roki Help")
                                         .WithDescription(string.Format(@"Simple guide to find a command:
Use `{0}modules` command to see a list of all modules.
Then use `{0}commands <module>` to see a list of all the commands in that module (e.g. `{0}commands searches`).
After seeing the commands available in that module, you can use `{0}h <command>` to get help for a specific command (e.g. `{0}h weather`).", prefix));

                if (Context.Channel is IDMChannel)
                {
                    await Context.Channel.EmbedAsync(helpEmbed).ConfigureAwait(false);
                }
                else
                {
                    try
                    {
                        IDMChannel dm = await((IGuildUser)Context.User).GetOrCreateDMChannelAsync().ConfigureAwait(false);
                        await dm.EmbedAsync(helpEmbed).ConfigureAwait(false);
                    }
                    catch (Exception)
                    {
                        await Context.Channel.EmbedAsync(helpEmbed).ConfigureAwait(false);
                    }
                }
            }
            else
            {
                await HelpService.SendCommandInfo(command, Context, prefix);
            }
        }
Пример #30
0
                public async Task SetWard()
                {
                    IDMChannel channel = await Context.Message.Author.GetOrCreateDMChannelAsync();

                    await channel.SendMessageAsync(
                        "`!event set ward <character alias> <health> <duration>` adds a ward to the character with the given health and duration.");
                }