示例#1
0
        public async Task ShowTag(string tagName)
        {
            if (string.IsNullOrWhiteSpace(tagName))
            {
                await ReplyAsync("You need to use this with some more input...\n" +
                                 "Try the `help tag` command to get more information on how to use this command.");

                return;
            }
            var guildAcc = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id);
            var response = TagFunctions.GetTag(tagName, guildAcc);

            await ReplyAsync(response);
        }
示例#2
0
        public async Task Client_UserJoined_ForRoleOnJoin(SocketGuildUser arg)
        {
            var guid = GlobalGuildAccounts.GetGuildAccount(arg.Guild.Id);

            if (guid.RoleOnJoin == null)
            {
                return;
            }

            var roleToGive = arg.Guild.Roles
                             .SingleOrDefault(x => x.Name.ToString() == $"{guid.RoleOnJoin}");

            await arg.AddRoleAsync(roleToGive);
        }
示例#3
0
        public async Task RemovePrefix([Remainder] string PrefiksDoUsunięcia)
        {
            var guildAcc = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id);
            var response = $"Nie udało mi się usunąć prefiksu... Może `{PrefiksDoUsunięcia}` nie jest prefiksem?";

            if (guildAcc.Prefixes.Contains(PrefiksDoUsunięcia))
            {
                var prefixes = guildAcc.Prefixes.ToList();
                prefixes.Remove(PrefiksDoUsunięcia);
                guildAcc.Modify(g => g.SetPrefixes(prefixes));
                response = $"Pomyślnie usunąłem `{PrefiksDoUsunięcia}` z listy prefiksów!";
            }
            await ReplyAsync(response);
        }
示例#4
0
        public async Task RemovePrefix([Remainder] string prefix)
        {
            var guildAcc = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id);
            var response = $"Failed to remove the Prefix... Was `{prefix}` really a prefix?";

            if (guildAcc.Prefixes.Contains(prefix))
            {
                var prefixes = guildAcc.Prefixes.ToList();
                prefixes.Remove(prefix);
                guildAcc.Modify(g => g.SetPrefixes(prefixes));
                response = $"Successfully removed `{prefix}` as possible prefix!";
            }

            await ReplyAsync(response);
        }
示例#5
0
        public async Task AddWelcomeMessage([Remainder] string message)
        {
            var guildAcc = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id);
            var response = $"Failed to add this Welcome Message...";

            if (!guildAcc.WelcomeMessages.Contains(message))
            {
                var messages = guildAcc.WelcomeMessages.ToList();
                messages.Add(message);
                guildAcc.Modify(g => g.SetWelcomeMessages(messages));
                response = $"Successfully added ```\n{message}\n``` as Welcome Message!";
            }

            await ReplyAsync(response);
        }
示例#6
0
        public async Task RemoveWelcomeMessage(int messageIndex)
        {
            var guildAcc = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id);
            var messages = guildAcc.WelcomeMessages.ToList();
            var response = $"Failed to remove this Welcome Message... Use the number shown in `welcome list` next to the `#` sign!";

            if (messages.Count > messageIndex - 1)
            {
                messages.RemoveAt(messageIndex - 1);
                guildAcc.Modify(g => g.SetWelcomeMessages(messages));
                response = $"Successfully removed message #{messageIndex} as possible Welcome Message!";
            }

            await ReplyAsync(response);
        }
示例#7
0
        public async Task <Embed> ListAsync(ulong guildId)
        {
            var config    = GlobalGuildAccounts.GetGuildAccount(guildId);
            var cmdPrefix = config.CommandPrefix;

            try
            {
                var descriptionBuilder = new StringBuilder();

                var player = _lavaShardClient.GetPlayer(guildId);
                if (player == null)
                {
                    return(await EmbedHandler.CreateErrorEmbed("Music Queue", $"Could not aquire music player.\nAre you using the music service right now? See `{cmdPrefix}h m` for proper usage."));
                }

                if (player.IsPlaying)
                {
                    if (player.Queue.Count < 1 && player.CurrentTrack != null)
                    {
                        return(await EmbedHandler.CreateBasicEmbed($"Now Playing: {player.CurrentTrack.Title}", "There are no other items in the queue."));
                    }
                    else
                    {
                        var trackNum = 2;
                        foreach (LavaTrack track in player.Queue.Items)
                        {
                            if (trackNum == 2)
                            {
                                descriptionBuilder.Append($"Up Next: [{track.Title}]({track.Uri})\n"); trackNum++;
                            }
                            else
                            {
                                descriptionBuilder.Append($"#{trackNum}: [{track.Title}]({track.Uri})\n"); trackNum++;
                            }
                        }
                        return(await EmbedHandler.CreateBasicEmbed("Music Playlist", $"Now Playing: [{player.CurrentTrack.Title}]({player.CurrentTrack.Uri})\n{descriptionBuilder.ToString()}"));
                    }
                }
                else
                {
                    return(await EmbedHandler.CreateErrorEmbed("Music Queue", "Player doesn't seem to be playing anything right now. If this is an error, Please contact Stage in the Kaguya support server."));
                }
            }
            catch (Exception ex)
            {
                return(await EmbedHandler.CreateErrorEmbed("Music, List", ex.Message));
            }
        }
示例#8
0
        public static async Task Slowmode(SocketMessage s)
        {
            var msg     = s as SocketUserMessage;
            var context = new ShardedCommandContext(_client, msg);
            var config  = GlobalGuildAccounts.GetGuildAccount(context.Guild.Id);

            if (config.IsSlowModeEnabled)
            {
                if (context.User is IGuildUser user && user.GuildPermissions.ManageChannels)
                {
                    return;
                }
                if (msg == null)
                {
                    return;
                }
                if (msg.Channel == msg.Author.GetOrCreateDMChannelAsync())
                {
                    return;
                }
                if (msg.Author.IsBot)
                {
                    return;
                }

                var userAcc = GlobalUserAccounts.GetUserAccount(msg.Author.Id);

                DateTime now = DateTime.UtcNow;

                if (now < userAcc.LastMessage.AddSeconds(config.SlowModeCooldown))
                {
                    var difference1    = now - userAcc.LastMessage;
                    var time           = new TimeSpan((long)config.SlowModeCooldown * 10000000);
                    var difference     = time - difference1;
                    var timeSpanString = string.Format("{0:%s} seconds", difference);
                    await msg.DeleteAsync();

                    var dm = await context.User.GetOrCreateDMChannelAsync();

                    await dm.SendMessageAsync(
                        $"Slow down! You can send a message in **{timeSpanString}** in **{context.Guild.Name}**.");
                }
                else
                {
                    userAcc.LastMessage = now;
                }
            }
        }
示例#9
0
        public async Task SetChannelToBeIgnoredByFilter(string type, SocketGuildChannel chnl = null)
        {
            var guildUser = Context.User as SocketGuildUser;

            if (!guildUser.GuildPermissions.Administrator)
            {
                string description =
                    $"{Global.ENo} **|** You Need the **Administrator** Permission to do that {Context.User.Username}";
                var errorEmbed = EmbedHandler.CreateEmbed(Context, "Error", description,
                                                          EmbedHandler.EmbedMessageType.Exception);
                await ReplyAndDeleteAsync("", embed : errorEmbed);

                return;
            }

            var config = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id);
            var embed  = new EmbedBuilder();

            embed.WithColor(Global.NayuColor);
            switch (type)
            {
            case "add":
            case "Add":
                config.NoFilterChannels.Add(chnl.Id);
                embed.WithDescription($"Added <#{chnl.Id}> to the list of ignored channels for Filter.");
                break;

            case "rem":
            case "Rem":
                config.NoFilterChannels.Remove(chnl.Id);
                embed.WithDescription($"Removed <#{chnl.Id}> from the list of ignored channels for Filter.");
                break;

            case "clear":
            case "Clear":
                config.NoFilterChannels.Clear();
                embed.WithDescription("List of channels to be ignored by Filter has been cleared.");
                break;

            default:
                embed.WithDescription(
                    $"Valid types are `add`, `rem`, and `clear`. Syntax: `n!fi {{add/rem/clear}} [channelMention]`");
                break;
            }

            GlobalUserAccounts.SaveAccounts(Context.Guild.Id);
            await SendMessage(Context, embed.Build());
        }
示例#10
0
        public async Task Echo([Remainder] string message)
        {
            var config = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id);

            if (config.MassPingChecks)
            {
                if (message.Contains("@everyone") || message.Contains("@here"))
                {
                    return;
                }
            }

            var embed = EmbedHandler.CreateEmbed(Context, "Echo!", message, EmbedHandler.EmbedMessageType.Success);

            await SendMessage(Context, embed);
        }
        public async Task ListLeaveMessages()
        {
            var leaveMessages = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id).LeaveMessages;
            var embB          = new EmbedBuilder().WithTitle("Nie mam ustawionych jeszcze żadnych wiadomości pożegnalnych... jeśli chcesz żeby reszta serwera wiedziała o naszej \"stracie\", dodaj kilka ;)");

            if (leaveMessages.Count > 0)
            {
                embB.WithTitle("Przykładowe wiadomości pożegnalne");
            }

            for (var i = 0; i < leaveMessages.Count; i++)
            {
                embB.AddField($"Przykład #{i + 1}:", leaveMessages[i]);
            }
            await ReplyAsync("", false, embB.Build());
        }
        public async Task ListWelcomeMessages()
        {
            var welcomeMessages = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id).WelcomeMessages;
            var embB            = new EmbedBuilder().WithTitle("Nie mam ustawionych jeszcze żadnych wiadomości powitalnych... jeśli chcesz żeby nowi ludzie byli szczęśliwi, dodaj kilka ;)");

            if (welcomeMessages.Count > 0)
            {
                embB.WithTitle("Wiadomości powitalne:");
            }

            for (var i = 0; i < welcomeMessages.Count; i++)
            {
                embB.AddField($"Przykład #{i + 1}:", welcomeMessages[i]);
            }
            await ReplyAsync("", false, embB.Build());
        }
示例#13
0
        public async Task ListWelcomeMessages()
        {
            var welcomeMessages = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id).WelcomeMessages;
            var embB            = new EmbedBuilder().WithTitle("No Welcome Messages set yet... add some if you want to greet incoming people! =)");

            if (welcomeMessages.Count > 0)
            {
                embB.WithTitle("Possible Welcome Messages:");
            }

            for (var i = 0; i < welcomeMessages.Count; i++)
            {
                embB.AddField($"Message #{i + 1}:", welcomeMessages[i]);
            }
            await ReplyAsync("", false, embB.Build());
        }
示例#14
0
        public async Task ListLeaveMessages()
        {
            var leaveMessages = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id).LeaveMessages;
            var embB          = new EmbedBuilder().WithTitle("No Leave Messages set yet... add some if you want a message to be shown if someone leaves.");

            if (leaveMessages.Count > 0)
            {
                embB.WithTitle("Possible Leave Messages:");
            }

            for (var i = 0; i < leaveMessages.Count; i++)
            {
                embB.AddField($"Message #{i + 1}:", leaveMessages[i]);
            }
            await ReplyAsync("", false, embB.Build());
        }
示例#15
0
        public async Task SetChannelToBeIgnoredByFilter(string type, SocketGuildChannel chnl = null)
        {
            var guser = Context.User as SocketGuildUser;

            if (guser.GuildPermissions.ManageMessages)
            {
                var config = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id);
                var embed  = new EmbedBuilder();
                embed.WithColor(37, 152, 255);
                switch (type)
                {
                case "add":
                case "Add":
                    config.NoFilterChannels.Add(chnl.Id);
                    GlobalGuildAccounts.SaveAccounts();
                    embed.WithDescription($"Added <#{chnl.Id}> to the list of ignored channels for Filter.");
                    break;

                case "rem":
                case "Rem":
                    config.NoFilterChannels.Remove(chnl.Id);
                    GlobalGuildAccounts.SaveAccounts();
                    embed.WithDescription($"Removed <#{chnl.Id}> from the list of ignored channels for Filter.");
                    break;

                case "clear":
                case "Clear":
                    config.NoFilterChannels.Clear();
                    GlobalGuildAccounts.SaveAccounts();
                    embed.WithDescription("List of channels to be ignored by Filter has been cleared.");
                    break;

                default:
                    embed.WithDescription($"Valid types are `add`, `rem`, and `clear`. Syntax: `w!fi {{add/rem/clear}} [channelMention]`");
                    break;
                }

                await Context.Channel.SendMessageAsync("", embed : embed.Build());
            }
            else
            {
                var embed = new EmbedBuilder();
                embed.WithColor(37, 152, 255);
                embed.Title = $":x:  | You Need the Administrator Permission to do that {Context.User.Username}";
                await ReplyAndDeleteAsync("", embed : embed.Build(), timeout : TimeSpan.FromSeconds(5));
            }
        }
示例#16
0
文件: Owner.cs 项目: Phytal/Wsashi
        public async Task VerifyGuildById(ulong guildId = 0)
        {
            var id = guildId;

            if (id == 0)
            {
                id = Context.Guild.Id;
            }
            var config = GlobalGuildAccounts.GetGuildAccount(id);

            config.VerifiedGuild = true;
            var embed = new EmbedBuilder()
                        .WithDescription("Successfully verified this server.")
                        .WithColor(37, 152, 255);

            await ReplyAsync("", embed : embed.Build());
        }
        private static bool CheckPrefix(ref int argPos, SocketCommandContext context)
        {
            var prefixes  = GlobalGuildAccounts.GetGuildAccount(context.Guild.Id).Prefixes;
            var tmpArgPos = 0;
            var success   = prefixes.Any(pre =>
            {
                if (context.Message.Content.StartsWith(pre))
                {
                    tmpArgPos = pre.Length + 1;
                    return(true);
                }
                return(false);
            });

            argPos = tmpArgPos;
            return(success);
        }
        public async Task RbpStatus()
        {
            var rbp = GlobalGuildAccounts.GetGuildAccount(Context.Guild).RoleByPhraseSettings;

            var phrases   = rbp.Phrases.Any() ? string.Join("\n", rbp.Phrases.Select(p => $"({rbp.Phrases.IndexOf(p)}) - {p}")) : "No phrases stored\nAdd one with `rbp addPhrase YOUR-PHRASE`";
            var roles     = rbp.RolesIds.Any() ? string.Join("\n", rbp.RolesIds.Select(r => $"({rbp.RolesIds.IndexOf(r)}) - {Context.Guild.GetRole(r).Name}")) : "No roles stored\nAdd one with `rbp addRole @SomeRole`";
            var relations = rbp.Relations.Any() ? string.Join("\n", rbp.Relations.Select(r => $"Phrase {r.PhraseIndex} => Role {r.RoleIdIndex}")) : "No relations created\nAdd one with `rbp addRelation PHRASE-ID ROLE-ID`";

            var embed = new EmbedBuilder();

            embed.WithTitle($"Role Assignments for {Context.Guild.Name}");
            embed.AddField("Phrases", phrases);
            embed.AddField("Roles", roles);
            embed.AddField("Relations", relations);

            await Context.Channel.SendMessageAsync("", embed : embed.Build());
        }
示例#19
0
                          public async Task ServerInfo(string guildName = null)
        {
            //Meh Just Some Local Variables OwO
            var    guild         = Context.Guild;
            var    roles         = guild.Roles;
            var    users         = guild.Users;
            int    usercount     = users.Count(x => x.IsBot == false);
            var    gusersnobot   = users.Where(x => x.IsBot == false);
            var    gusersbotonly = users.Where(x => x.IsBot == true);
            var    config        = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id);
            var    owner         = guild.Owner;
            string afkname       = null;

            if (guild.AFKChannel != null)

            {
                afkname = guild.AFKChannel.Name;
            }

            var embed = new EmbedBuilder();

            embed.WithTitle("Server Info");
            embed.AddField(guild.Name, guild.CreatedAt.ToString("dd'/'MM'/'yyyy hh:mm:ss tt"));
            embed.WithColor(240, 98, 146);
            embed.WithThumbnailUrl(guild.IconUrl);
            embed.AddField("› Owner", owner.ToString(), inline: true);                                             //Server Owner.
            embed.AddField("› Members", guild.MemberCount.ToString(), inline: true);                               //User Count.
            embed.AddField("› Bots", $"{gusersbotonly.Count()}", inline: true);                                    //Bot Count.
            embed.AddField("› Verification Level", guild.VerificationLevel.ToString(), inline: true);              //Level Of Server Verification.
            embed.AddField("› Shard ID", Context.Client.ShardId, inline: true);                                    // Shard ID.
            embed.AddField("› Text Channels", guild.TextChannels.Count.ToString(), inline: true);                  //Text Channel Count.
            embed.AddField("› Voice Channels", guild.VoiceChannels.Count.ToString(), inline: true);                //Voice Channel Count.
            embed.AddField("› Region", guild.VoiceRegionId.ToString(), inline: true);                              //Region Of The Server.
            embed.AddField("› Roles", (guild.Roles.Count - 1).ToString(), inline: true);                           //How Many Roles The Server Has.
            embed.AddField("› Emoji", Context.Guild.Emotes.Count.ToString(), inline: true);                        //Emoji Count.
            embed.AddField("› Default Notifications", guild.DefaultMessageNotifications.ToString(), inline: true); // Personal
            int    seconds = guild.AFKTimeout;
            string minutes = ((seconds % 3600) / 60).ToString();

            embed.AddField("› AFK Timeout", minutes + " minutes", inline: true);  //AFK Timeout Set For The Server.
            embed.AddField("› AFK Channel", afkname ?? "None Set", inline: true); //AFK Channel For The Server.
            //embed.AddField("› Verified Guild", config.VerifiedGuild, inline: true);
            embed.WithFooter($"#{guild.Id.ToString()}");                          //Footer Of The Embed As Unique Server ID

            await Context.Channel.SendMessageAsync("", embed : embed.Build());    //Send The Embed Where The Command Was Excuted.
        }
示例#20
0
        public static async Task EvaluateMessage(IGuild guild, string message, IGuildUser sender)
        {
            var guildSettings = GlobalGuildAccounts.GetGuildAccount(guild);

            var triggeredPhrases = guildSettings.RoleByPhraseSettings.Phrases.Where(message.Contains).ToList();

            if (!triggeredPhrases.Any())
            {
                return;
            }

            var roleIdsToGet = new List <ulong>();

            foreach (var phrase in triggeredPhrases)
            {
                var phraseIndex = guildSettings.RoleByPhraseSettings.Phrases.IndexOf(phrase);
                var roleIds     = guildSettings.RoleByPhraseSettings.Relations
                                  .Where(r => r.PhraseIndex == phraseIndex)
                                  .Select(r => guildSettings.RoleByPhraseSettings.RolesIds.ElementAt(r.RoleIdIndex))
                                  .ToList();

                foreach (var roleId in roleIds)
                {
                    if (roleIdsToGet.Contains(roleId))
                    {
                        continue;
                    }
                    roleIdsToGet.Add(roleId);
                }
            }

            foreach (var roleId in roleIdsToGet)
            {
                if (sender.RoleIds.Contains(roleId))
                {
                    continue;
                }
                var role = guild.GetRole(roleId);
                if (role is null)
                {
                    continue;
                }
                await sender.AddRoleAsync(role);
            }
        }
示例#21
0
文件: Economy.cs 项目: Phytal/Wsashi
        public async Task AddPotatos(uint Money, IGuildUser user, [Remainder] string arg = "")
        {
            var        config        = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id);
            SocketUser target        = null;
            var        mentionedUser = Context.Message.MentionedUsers.FirstOrDefault();

            target = mentionedUser ?? Context.User;
            var userAccount = GlobalUserAccounts.GetUserAccount((SocketUser)user);

            userAccount.Money += Money;
            GlobalUserAccounts.SaveAccounts();

            var embed = new EmbedBuilder();

            embed.WithColor(37, 152, 255);
            embed.WithTitle($":white_check_mark:  | **{Money}** {config.Currency} were added to " + target.Username + "'s account.");
            await Context.Channel.SendMessageAsync("", embed : embed.Build());
        }
示例#22
0
        public async Task CustomCommandList()
        {
            var config = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id);
            var cmds   = config.CustomCommands;
            var embed  = new EmbedBuilder().WithTitle("No custom commands set up yet... add some!");

            if (cmds.Count > 0)
            {
                embed.WithTitle("Here are all available custom commands:");
            }

            foreach (var cmd in cmds)
            {
                embed.AddField(cmd.Key, cmd.Value, true);
            }

            await SendMessage(Context, embed.Build());
        }
示例#23
0
        public async Task GetPrefixForServer()
        {
            var    config = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id);
            string prefix;

            switch (config)
            {
            case null:
                prefix = "w!";
                break;

            default:
                prefix = config.CommandPrefix;
                break;
            }

            await Context.Channel.SendMessageAsync($"The prefix for this server is {prefix}.");
        }
示例#24
0
        public async Task ShowRichesPeople(int page = 1)
        {
            if (page < 1)
            {
                await ReplyAsync("Are you really trying that right now? ***REALLY?***");

                return;
            }

            var config       = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id);
            var guildUserIds = Context.Guild.Users.Select(user => user.Id);
            var accounts     = GlobalUserAccounts.GetFilteredAccounts(acc => guildUserIds.Contains(acc.Id));

            const int usersPerPage = 9;
            // Calculate the highest accepted page number => amount of pages we need to be able to fit all users in them
            // (amount of users) / (how many to show per page + 1) results in +1 page more every time we exceed our usersPerPage
            var lastPageNumber = 1 + (accounts.Count / (usersPerPage + 1));

            if (page > lastPageNumber)
            {
                await ReplyAsync($"There are not that many pages...\nPage {lastPageNumber} is the last one...");

                return;
            }

            // Sort the accounts descending by currency
            var ordered = accounts.OrderByDescending(acc => acc.Taiyaki).ToList();

            var embB = new EmbedBuilder()
                       .WithTitle($"{config.Currency} Leaderboard:")
                       .WithFooter($"Page {page}/{lastPageNumber}");

            page--;
            for (var i = 1; i <= usersPerPage && i + usersPerPage * page <= ordered.Count; i++)
            {
                var account = ordered[i - 1 + usersPerPage * page];
                var user    = Global.Client.GetUser(account.Id);
                embB.WithColor(Global.NayuColor);
                embB.AddField($"#{i + usersPerPage * page} {user.Username}", $"{account.Taiyaki} {config.Currency}",
                              true);
            }

            await ReplyAsync("", false, embB.Build());
        }
示例#25
0
        public async Task Promote(string rank, IGuildUser user = null)
        {
            var config = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id);
            var guser  = Context.User as SocketGuildUser;

            if (guser.GuildPermissions.ManageRoles)
            {
                try
                {
                    if (rank == "admin" || rank == "administrator")
                    {
                        var role = Context.Guild.Roles.FirstOrDefault(x => x.Name == config.AdminRoleName);;
                        await user.AddRoleAsync(role);
                        await ReplyAsync(":confetti_ball:   | " + Context.User.Mention + " promoted " + user.Mention + " to the " + config.AdminRoleName + " rank! Congratulations!");
                    }
                    if (rank == "mod" || rank == "moderator")
                    {
                        var role = Context.Guild.Roles.FirstOrDefault(x => x.Name == config.ModRoleName);;
                        await user.AddRoleAsync(role);
                        await ReplyAsync(":confetti_ball:   | " + Context.User.Mention + " promoted " + user.Mention + " to the " + config.ModRoleName + " rank! Congratulations!");
                    }
                    if (rank == "helper")
                    {
                        var role = Context.Guild.Roles.FirstOrDefault(x => x.Name == config.HelperRoleName);;
                        await user.AddRoleAsync(role);
                        await ReplyAsync(":confetti_ball:   | " + Context.User.Mention + " promoted " + user.Mention + " to the " + config.HelperRoleName + " rank! Congratulations!");
                    }
                }
                catch
                {
                    var embed = new EmbedBuilder();
                    embed.WithColor(37, 152, 255);
                    embed.WithTitle(":hand_splayed:  | Please say who and what you want to promote the user to. Ex: w!promote <rank> <@username>");
                    await ReplyAndDeleteAsync("", embed : embed.Build(), timeout : TimeSpan.FromSeconds(5));
                }
            }
            else
            {
                var embed = new EmbedBuilder();
                embed.WithColor(37, 152, 255);
                embed.Title = $":x:  | You need the Manange Roles Permission to do that {Context.User.Username}";
                await ReplyAndDeleteAsync("", embed : embed.Build(), timeout : TimeSpan.FromSeconds(5));
            }
        }
示例#26
0
        public async Task SetRoleOnJoin(string role = null)
        {
            string text;
            var    guild = GlobalGuildAccounts.GetGuildAccount(Context.Guild);

            if (role == null)
            {
                guild.RoleOnJoin = null;
                text             = $"No one will get role on join from me!";
            }
            else
            {
                guild.RoleOnJoin = role;
                text             = $"Everyone will now be getting {role} role on join!";
            }

            GlobalGuildAccounts.SaveAccounts(Context.Guild.Id);
            await ReplyAsync(text);
        }
示例#27
0
        public async Task AddTaiyakis(uint Taiyaki, IGuildUser user)
        {
            var        config = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id);
            SocketUser target;
            var        mentionedUser = Context.Message.MentionedUsers.FirstOrDefault();

            target = mentionedUser ?? Context.User;
            var userAccount = GlobalUserAccounts.GetUserAccount((SocketUser)user);

            userAccount.Taiyaki += Taiyaki;
            GlobalUserAccounts.SaveAccounts(userAccount.Id);

            var embed = new EmbedBuilder();

            embed.WithColor(Global.NayuColor);
            embed.WithTitle(
                $"✅  **|** **{Taiyaki}** {config.Currency} were added to " + target.Username + "'s account.");
            await SendMessage(Context, embed.Build());
        }
示例#28
0
        public async Task LewdIMGChannel(ITextChannel channel)
        {
            var guser = Context.User as SocketGuildUser;

            if (guser.GuildPermissions.Administrator)
            {
                var guildAcc = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id);
                guildAcc.AutoLewdChannel = channel.Id;
                GlobalGuildAccounts.SaveAccounts(Context.Guild.Id);
                await ReplyAsync("The AutoLewd-Channel has been set to " + channel.Mention);
            }
            else
            {
                var embed = new EmbedBuilder();
                embed.WithColor(37, 152, 255);
                embed.Title = $":x:  | You Need the Administrator Permission to do that {Context.User.Username}";
                var use = await ReplyAndDeleteAsync("", embed : embed.Build(), timeout : TimeSpan.FromSeconds(5));
            }
        }
        public async Task SetRoleOnJoin(string NazwaRoli = null)
        {
            string text;
            var    guild = GlobalGuildAccounts.GetGuildAccount(Context.Guild);

            if (NazwaRoli == null)
            {
                guild.RoleOnJoin = null;
                text             = $"Role początkowe nie będą przydzielane! :triumph:";
            }
            else
            {
                guild.RoleOnJoin = NazwaRoli;
                text             = $"Wszyscy nowi będą dostawać rolę {NazwaRoli} odrazu na wstępie!";
            }

            GlobalGuildAccounts.SaveAccounts(Context.Guild.Id);
            await ReplyAsync(text);
        }
示例#30
0
        public static RoleByPhraseOperationResult AddPhrase(IGuild guild, string phrase)
        {
            var guildSettings = GlobalGuildAccounts.GetGuildAccount(guild);

            try
            {
                guildSettings.RoleByPhraseSettings.AddPhrase(phrase);
                GlobalGuildAccounts.SaveAccounts();
                return(RoleByPhraseOperationResult.Success);
            }
            catch (PhraseAlreadyAddedException)
            {
                return(RoleByPhraseOperationResult.AlreadyExists);
            }
            catch (Exception)
            {
                return(RoleByPhraseOperationResult.Failed);
            }
        }