Exemplo n.º 1
0
        private async Task <bool> CheckVoiceAndChannel(CommandContext ctx, LavalinkGuildConnection lvc)
        {
            if (lvc == null)
            {
                await CTX.RespondSanitizedAsync(ctx, "Not connected in this guild.");

                return(false);
            }

            var chn = ctx.Member?.VoiceState?.Channel;

            if (chn == null)
            {
                await CTX.RespondSanitizedAsync(ctx, "You need to be in a voice channel.");

                return(false);
            }
            if (chn != lvc.Channel)
            {
                await CTX.RespondSanitizedAsync(ctx, "You need to be in the same voice channel.");

                return(false);
            }
            return(true);
        }
Exemplo n.º 2
0
        public async Task Skip(CommandContext ctx)
        {
            var lavaConnection = ShimakazeBot.lvn?.GetGuildConnection(ctx.Guild);

            if (!await CheckVoiceAndChannel(ctx, lavaConnection))
            {
                return;
            }

            if (ShimakazeBot.playlists[ctx.Guild].songRequests.Count == 0)
            {
                await CTX.RespondSanitizedAsync(ctx, "Playlist is empty.");

                return;
            }

            if (lavaConnection.Channel.Users.Count() > 3 &&
                ctx.User.Id != ShimakazeBot.playlists[ctx.Guild].songRequests[0].requestMember.Id &&
                !ShimakazeBot.Client.CurrentApplication.Owners.Contains(ctx.User))
            {
                await CTX.RespondSanitizedAsync(ctx, "You can only skip songs you requested, use voteskip instead");

                return;
            }

            await SkipSong(ctx.Guild, ctx.Channel, lavaConnection);
        }
Exemplo n.º 3
0
        public async Task GoodMorning(CommandContext ctx, [RemainingText] string message)
        {
            DiscordEmoji goodMorningEmoji = DiscordEmoji.FromGuildEmote(
                ShimakazeBot.Client, ShimaConsts.GoodMorningEmojiId);

            if (!string.IsNullOrWhiteSpace(message))
            {
                await CTX.RespondSanitizedAsync(ctx, $"{goodMorningEmoji}/ {message}!", false, null,
                                                new List <IMention> {
                });

                return;
            }

            if (ctx.User.Id == 155038222794227712)
            {
                await CTX.RespondSanitizedAsync(ctx,
                                                $"We have finally awoken, that was slow, wasn't it?\n{goodMorningEmoji}/ everyone!");

                return;
            }

            if (ThreadSafeRandom.ThisThreadsRandom.Next(0, 2) == 1)
            {
                await CTX.RespondSanitizedAsync(ctx, $"You're finally awake? You're too slow! {goodMorningEmoji}/");
            }
            else
            {
                await CTX.RespondSanitizedAsync(ctx, $"{goodMorningEmoji}/ Wanna race? I won't lose!");
            }
        }
Exemplo n.º 4
0
        public async Task Dice(CommandContext ctx, [RemainingText] string suffix)
        {
            JObject response = await ShimaHttpClient.HttpGet($"https://rolz.org/api/?{suffix}.json");

            if (response == null)
            {
                await CTX.RespondSanitizedAsync(ctx, "The dice fell under the table...");

                return;
            }
            if (string.IsNullOrEmpty(response["result"].Value <string>()) ||
                response["result"].Value <string>().StartsWith("Error"))
            {
                await CTX.RespondSanitizedAsync(ctx, $"{response["result"].Value<string>()}" +
                                                "\nYou probably want to use the website for that one: https://rolz.org");

                return;
            }

            DateTime timestamp = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)
                                 .AddSeconds(response["timestamp"].Value <long>());
            DiscordEmbedBuilder embed = Utils.BaseEmbedBuilder(ctx, null,
                                                               null, null, null, timestamp)
                                        .WithAuthor(response["result"].Value <string>(), "https://rolz.org", "https://rolz.org/img/n3-d20.png")
                                        .AddField("Input", response["input"].Value <string>())
                                        .AddField("Details", response["details"].Value <string>());

            if (!string.IsNullOrWhiteSpace(response["code"].Value <string>()))
            {
                embed.AddField("Code", response["code"].Value <string>());
            }

            await CTX.RespondSanitizedAsync(ctx, null, false, embed);
        }
Exemplo n.º 5
0
        public async Task PressF(CommandContext ctx, [RemainingText] string unusedSuffix)
        {
            var DbItem = await ShimakazeBot.DbCtx.ShimaGeneric.FindAsync(ShimaConsts.DbPressFKey);

            int totalFCount;

            if (DbItem == null || !int.TryParse(DbItem.Value, out totalFCount))
            {
                totalFCount = 0;
            }
            DiscordEmbedBuilder embedBuilder = new DiscordEmbedBuilder()
                                               .WithTitle("🇫")
                                               .WithAuthor($"{(ctx.Guild == null ? ctx.User.Username : ctx.Member.DisplayName)}" +
                                                           " has paid their respects.", null, ctx.User.AvatarUrl)
                                               .WithDescription($"Today: **{++ShimakazeBot.DailyFCount}**" +
                                                                $"\nTotal: **{++totalFCount}**");

            await CTX.RespondSanitizedAsync(ctx, null, false, embedBuilder);

            if (DbItem == null)
            {
                await ShimakazeBot.DbCtx.ShimaGeneric.AddAsync(new ShimaGeneric
                {
                    Key   = ShimaConsts.DbPressFKey,
                    Value = totalFCount.ToString()
                });
            }
            else
            {
                DbItem.Value = totalFCount.ToString();
                ShimakazeBot.DbCtx.ShimaGeneric.Update(DbItem);
            }
            await ShimakazeBot.DbCtx.SaveChangesAsync();
        }
        public async Task SetMemberLevel(CommandContext ctx, [RemainingText] string text)
        {
            int requesterLevel = UserLevels.GetLevel(ctx.User.Id, ctx.Guild.Id);

            var textArray = text.Split(" ");
            int level;

            if (!int.TryParse(textArray[0], out level))
            {
                await CTX.RespondSanitizedAsync(ctx, $"{textArray[0]} is not a valid level.");

                return;
            }

            if (level >= requesterLevel)
            {
                await CTX.RespondSanitizedAsync(ctx, "You cannot assign a level higher than your own");

                return;
            }

            Dictionary <ulong, bool> idList = PrepareUserIdList(ctx.Message.MentionedUsers, textArray);

            ctx.Message.MentionedRoles.ToList().ForEach(role =>
            {
                if (!idList.ContainsKey(role.Id))
                {
                    idList.Add(role.Id, true);
                }
            });

            await SetLevelsFromList(ctx, idList, level, requesterLevel);
        }
Exemplo n.º 7
0
        public async Task RandomMeme(CommandContext ctx)
        {
            JObject response = await ShimaHttpClient.HttpGet(
                $"https://api.imgur.com/3/g/memes/viral/{ThreadSafeRandom.ThisThreadsRandom.Next(1,9)}",
                new AuthenticationHeaderValue("Client-ID", ShimakazeBot.Config.apiKeys.imgurClientId));

            JToken item = null;

            if (response != null && response["data"].HasValues)
            {
                int size = response["data"].Children().Count();
                item = response["data"].Children().ToArray()[ThreadSafeRandom.ThisThreadsRandom.Next(0, size)];
            }
            if (item == null)
            {
                await CTX.RespondSanitizedAsync(ctx, "The meme factory has stopped working 😩");

                return;
            }

            DateTime timestamp = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)
                                 .AddSeconds(item["datetime"].Value <long>());
            DiscordEmbedBuilder embed = Utils.BaseEmbedBuilder(ctx, null, item["title"].Value <string>(), null,
                                                               item["id"].Value <string>(), timestamp)
                                        .WithUrl(item["link"].Value <string>())
                                        .WithImageUrl(item["link"].Value <string>());

            if (!string.IsNullOrWhiteSpace(item["description"].Value <string>()))
            {
                embed.WithDescription(item["description"].Value <string>());
            }

            await CTX.RespondSanitizedAsync(ctx, null, false, embed);
        }
        private async Task SetLevelsFromList(CommandContext ctx, Dictionary <ulong, bool> idList, int level,
                                             int requesterLevel)
        {
            List <ulong> failedIDs = new List <ulong>();
            bool         isGlobal  = requesterLevel == (int)ShimaConsts.UserPermissionLevel.SHIMA_TEAM;

            foreach (var item in idList)
            {
                if (isGlobal || UserLevels.GetLevel(item.Key, ctx.Guild.Id) < requesterLevel)
                {
                    if (!await UserLevels.SetLevel(item.Key, ctx.Guild.Id, item.Value, level))
                    {
                        failedIDs.Add(item.Key);
                    }
                }
            }

            string response = $"Successfully assigned level to {idList.Count() - failedIDs.Count()} IDs";

            if (failedIDs.Count() > 0)
            {
                response += $"\nFailed to assign level to: {string.Join(", ", failedIDs)}";
            }

            await CTX.RespondSanitizedAsync(ctx, response);
        }
Exemplo n.º 9
0
        public async Task Warns(CommandContext ctx, [RemainingText] string suffix)
        {
            List <ulong> userIds = string.IsNullOrWhiteSpace(suffix) ?
                                   new List <ulong>()
            {
                ctx.User.Id
            } :
            Utils.GetIdListFromMessage(ctx.Message.MentionedUsers, suffix);

            if (userIds.Count == 0)
            {
                await CTX.RespondSanitizedAsync(ctx, "Please mention or type a user ID.");

                return;
            }
            if (ctx.Guild.Members.ContainsKey(userIds[0]))
            {
                RequireAdminAttribute adminCheck =
                    new RequireAdminAttribute("Only server admins are allowed to view warnings of other users.");
                if (ctx.User.Id != userIds[0] && !await adminCheck.ExecuteCheckAsync(ctx, false))
                {
                    return;
                }
                DiscordEmbedBuilder warnEmbed = Utils.BaseEmbedBuilder(ctx,
                                                                       $"Warnings for {ctx.Guild.Members[userIds[0]].DisplayName} ({userIds[0]})",
                                                                       ctx.Guild.Members[userIds[0]].AvatarUrl,
                                                                       null, ctx.Guild.Members[userIds[0]].Color);

                var warns = ShimakazeBot.DbCtx.GuildWarn.Where(g =>
                                                               g.UserId == userIds[0] && g.GuildId == ctx.Guild.Id
                                                               ).ToList();

                if (warns.Count() == 0)
                {
                    warnEmbed.WithDescription($"{ctx.Guild.Members[userIds[0]].DisplayName} has no warnings.");
                }
                else
                {
                    warns.ForEach(item => warnEmbed.AddField(item.TimeStamp.ToString(),
                                                             item.WarnMessage.Length > 1024 ? $"{item.WarnMessage.Take(1021)}..." : item.WarnMessage));
                }

                await CTX.RespondSanitizedAsync(ctx, null, false, warnEmbed);
            }
            else
            {
                int       id   = (int)userIds[0];
                GuildWarn warn = await ShimakazeBot.DbCtx.GuildWarn.FindAsync(id);

                if (warn != null)
                {
                    await CTX.RespondSanitizedAsync(ctx, $"{warn.TimeStamp} - {warn.WarnMessage}");
                }
                else
                {
                    await CTX.RespondSanitizedAsync(ctx, $"Unable to find member or ID **{id}**");
                }
            }
        }
Exemplo n.º 10
0
 public async Task GetChannelInfo(CommandContext ctx)
 {
     await CTX.RespondSanitizedAsync(ctx, $"Channel id: {ctx.Channel.Id}\n" +
                                     $"Server manage messages perms:" +
                                     $"{(ctx.Member.Guild.Permissions & Permissions.ManageMessages) != 0}\n" +
                                     $"Channel manage messages perms:" +
                                     $"{(ctx.Channel.PermissionsFor(ctx.Member) & Permissions.ManageMessages) != 0}");
 }
Exemplo n.º 11
0
        public async Task SetNickname(CommandContext ctx, [RemainingText] string nickname)
        {
            var bot = await ctx.Guild.GetMemberAsync(ctx.Client.CurrentUser.Id);

            await bot.ModifyAsync((member) => member.Nickname = nickname);

            await CTX.RespondSanitizedAsync(ctx, "Nickname " + (string.IsNullOrWhiteSpace(nickname) ?
                                                                $"removed.": $"changed to **{nickname}**."));
        }
Exemplo n.º 12
0
 public async Task Hug(CommandContext ctx)
 {
     if (ctx.User.Id == 155038222794227712)
     {
         await CTX.RespondSanitizedAsync(ctx, $"*hugs {ctx.User.Mention} with lots of love ♥♥♥*");
     }
     else
     {
         await CTX.RespondSanitizedAsync(ctx, $"*hugs {ctx.User.Mention} in a friendly manner*");
     }
 }
Exemplo n.º 13
0
        private async void EventEnded(object sender, ElapsedEventArgs e)
        {
            EventInTimer tEvent = (EventInTimer)sender;

            tEvent.Elapsed -= EventEnded;
            tEvent.Stop();

            if (events.Count() > 0)
            {
                events.Remove(tEvent);
            }

            if (tEvent.dbEvent == null)
            {
                ShimakazeBot.Client.Logger.Log(LogLevel.Error,
                                               LogSources.TIMER_EVENT_EVENT, "Timer had no event attached");
                return;
            }

            var channel = await ShimakazeBot.Client.GetChannelAsync(tEvent.dbEvent.ChannelId);

            var eType = tEvent.dbEvent.Type;
            DiscordEmbedBuilder embedBuilder = new DiscordEmbedBuilder()
                                               .WithAuthor(ShimakazeBot.Client.CurrentUser.Username, null, ShimakazeBot.Client.CurrentUser.AvatarUrl)
                                               .WithColor(eType == EventType.REMINDER ? DiscordColor.Purple : DiscordColor.HotPink)
                                               .WithTimestamp(tEvent.dbEvent.EventTime)
                                               .WithTitle(eType == EventType.REMINDER ?
                                                          "Here's your reminder~~" : "Event Time! - イベント タイム!")
                                               .WithFooter($"Event #{tEvent.dbEvent.Id}")
                                               .WithDescription((string.IsNullOrWhiteSpace(tEvent.dbEvent.Message) ?
                                                                 "*No message.*" : tEvent.dbEvent.Message));

            if (eType == EventType.EVENT)
            {
                embedBuilder.AddField("Created by", $"<@{tEvent.dbEvent.UserId}>");
            }

            List <ulong> mentionUserIds = tEvent.dbEvent.MentionUserIdList.ToList();
            List <ulong> mentionRoleIds = tEvent.dbEvent.MentionRoleIdList.ToList();

            if (tEvent.dbEvent.Type == EventType.REMINDER)
            {
                mentionUserIds.Insert(0, tEvent.dbEvent.UserId);
            }
            string mentionString =
                (mentionUserIds.Count() > 0 ? $"<@{ string.Join("> <@", mentionUserIds)}> " : "") +
                (mentionRoleIds.Count() > 0 ? $" <@&{ string.Join("> <@&", mentionRoleIds)}> " : "");

            await CTX.SendSanitizedMessageAsync(channel, mentionString, false, embedBuilder);

            ShimakazeBot.DbCtx.TimedEvents.RemoveRange(
                ShimakazeBot.DbCtx.TimedEvents.Where(tE => tE.Id == tEvent.dbEvent.Id));
            await ShimakazeBot.DbCtx.SaveChangesAsync();
        }
Exemplo n.º 14
0
        public async Task LeaveServer(CommandContext ctx)
        {
            if (!ShimakazeBot.Client.CurrentApplication.Owners.Contains(ctx.User))
            {
                await CTX.RespondSanitizedAsync(ctx,
                                                "Ok, I understand... I'm no longer wanted here. I'm sorry 😢\n*Runs away*");
            }
            ShimakazeBot.SendToDebugRoom(
                $"Left **{ctx.Guild.Name}** ({ctx.Guild.Id}). Triggered by **{ctx.User.Username}** ({ctx.User.Id})");

            await ctx.Guild.LeaveAsync();
        }
Exemplo n.º 15
0
        public async Task Emote(CommandContext ctx, [RemainingText] string message)
        {
            try
            {
                await CTX.RespondSanitizedAsync(ctx,
                                                DiscordEmoji.FromName(ShimakazeBot.Client, $":{message}:").Url);

                return;
            }
            catch { }

            ulong emoteId;

            try
            {
                if (ulong.TryParse(message, out emoteId))
                {
                    await CTX.RespondSanitizedAsync(ctx,
                                                    DiscordEmoji.FromGuildEmote(ShimakazeBot.Client, emoteId).Url);

                    return;
                }
            }
            catch { }

            if (string.IsNullOrWhiteSpace(message))
            {
                await CTX.RespondSanitizedAsync(ctx, "❓");

                return;
            }

            int index = message.LastIndexOf(":");

            if (index == -1)
            {
                await CTX.RespondSanitizedAsync(ctx, "That's not a discord emote, or one I can find.");

                return;
            }

            string endPart  = message.Substring(index + 1);
            int    endIndex = endPart.IndexOf(">");

            if (endIndex == -1 || !ulong.TryParse(endPart.Substring(0, endIndex), out emoteId))
            {
                await CTX.RespondSanitizedAsync(ctx, "That's not a discord emote.");

                return;
            }

            await CTX.RespondSanitizedAsync(ctx, "https://cdn.discordapp.com/emojis/" + $"{emoteId}.png");
        }
Exemplo n.º 16
0
        public async Task UrbanDictionary(CommandContext ctx, [RemainingText] string suffix)
        {
            if (string.IsNullOrWhiteSpace(suffix))
            {
                await CTX.RespondSanitizedAsync(ctx, ctx.User.Mention +
                                                ", If you actually tell me what word you want to look up that'll be great.");

                return;
            }
            JObject response = await ShimaHttpClient.HttpGet(
                $"http://api.urbandictionary.com/v0/define?term={suffix}");

            JToken item = null;

            if (response != null && response["list"].HasValues)
            {
                var items = response["list"].Children().ToList().OrderByDescending(i => i["thumbs_up"].Value <int>());
                item = items.First();
            }
            if (item == null)
            {
                await CTX.RespondSanitizedAsync(ctx, "I burnt all the dictionaries because they were too slow 🔥🔥🔥");

                return;
            }
            DiscordEmbedBuilder embed = Utils.BaseEmbedBuilder(ctx, null, item["word"].Value <string>(), null,
                                                               $"{item["thumbs_up"].Value<string>()}👍 - {item["thumbs_down"].Value<string>()}👎",
                                                               item["written_on"].Value <DateTime>())
                                        .WithUrl(item["permalink"].Value <string>());

            if (item["definition"].Value <string>().Length > 2048)
            {
                embed.WithDescription(item["definition"].Value <string>().Substring(0, 2042) + " [...]");
            }
            else
            {
                embed.WithDescription(item["definition"].Value <string>());
            }
            if (!string.IsNullOrWhiteSpace(item["example"].Value <string>()))
            {
                if (item["example"].Value <string>().Length > 1024)
                {
                    embed.AddField("Example", item["example"].Value <string>().Substring(0, 1018) + " [...]");
                }
                else
                {
                    embed.AddField("Example", item["example"].Value <string>());
                }
            }

            await CTX.RespondSanitizedAsync(ctx, null, false, embed);
        }
Exemplo n.º 17
0
        public async Task YesNo(CommandContext ctx, [RemainingText] string choice)
        {
            JObject response = await ShimaHttpClient.HttpGet($"https://yesno.wtf/api/?force={choice}");

            if (response == null)
            {
                await CTX.RespondSanitizedAsync(ctx, "**No.**\nThe api broke.");

                return;
            }

            await CTX.RespondSanitizedAsync(ctx, response["image"]?.Value <string>());
        }
Exemplo n.º 18
0
        public async Task Inspire(CommandContext ctx)
        {
            JObject response = await ShimaHttpClient.HttpGet("https://inspirobot.me/api?generate=true");

            if (response == null)
            {
                await CTX.RespondSanitizedAsync(ctx, "help viscocchi");

                return;
            }

            await CTX.RespondSanitizedAsync(ctx, $"|| {response["data"]?.Value<string>()} ||");
        }
Exemplo n.º 19
0
        public async Task YoMomma(CommandContext ctx)
        {
            JObject response = await ShimaHttpClient.HttpGet("https://api.yomomma.info");

            if (response == null)
            {
                await CTX.RespondSanitizedAsync(ctx, "Yo momma so fat she broke the api.");

                return;
            }

            await CTX.RespondSanitizedAsync(ctx, response["joke"]?.Value <string>());
        }
Exemplo n.º 20
0
        public async Task UselessFact(CommandContext ctx)
        {
            JObject response = await ShimaHttpClient.HttpGet("https://uselessfacts.jsph.pl/random.json?language=en");

            if (response == null)
            {
                await CTX.RespondSanitizedAsync(ctx, "I've run out of useless facts ☹️");

                return;
            }

            await CTX.RespondSanitizedAsync(ctx, response["text"]?.Value <string>());
        }
Exemplo n.º 21
0
        public async Task VoteSkip(CommandContext ctx)
        {
            var lavaConnection = ShimakazeBot.lvn?.GetGuildConnection(ctx.Guild);

            if (!await CheckVoiceAndChannel(ctx, lavaConnection))
            {
                return;
            }

            if (ShimakazeBot.playlists[ctx.Guild].songRequests.Count == 0)
            {
                await CTX.RespondSanitizedAsync(ctx, "Playlist is empty.");

                return;
            }

            if (lavaConnection.Channel.Users.Count() <= 3)
            {
                ShimakazeBot.playlists[ctx.Guild].voteSkip = new VoteSkip(ctx.Message, ctx.Member);
                await SkipSong(ctx.Guild, ctx.Channel, lavaConnection, true);

                return;
            }
            if (ShimakazeBot.playlists[ctx.Guild].voteSkip != null)
            {
                await CTX.RespondSanitizedAsync(ctx, "Vote skip already requested: " +
                                                ShimakazeBot.playlists[ctx.Guild].voteSkip.message.JumpLink);

                return;
            }

            var reactionEmote = DiscordEmoji.FromName(ShimakazeBot.Client, $":{ShimaConsts.VoteSkipEmote}:");

            ShimakazeBot.playlists[ctx.Guild].voteSkip = new VoteSkip(
                await CTX.RespondSanitizedAsync(ctx,
                                                $"{ctx.Member.Mention} requested a voteskip on" +
                                                $" **{ShimakazeBot.playlists[ctx.Guild].songRequests[0].track.Title}**" +
                                                $"\nReact with {reactionEmote} to vote.",
                                                false, null, new List <IMention> {
            }),
                ctx.Member
                );
            try
            {
                await ShimakazeBot.playlists[ctx.Guild].voteSkip.message.CreateReactionAsync(reactionEmote);
            }
            catch (Exception e)
            {
                await CTX.RespondSanitizedAsync(ctx, e.Message);
            }
        }
Exemplo n.º 22
0
        public async Task DisplayServerInfo(CommandContext ctx)
        {
            var textChannels = string.Join(", ",
                                           from channel in ctx.Guild.Channels.Values
                                           where channel.Type is ChannelType.Text
                                           select channel.Name);

            if (textChannels.Length > 1018)
            {
                textChannels = "Too many to list!";
            }
            var voiceChannels = string.Join(", ",
                                            from channel in ctx.Guild.Channels.Values
                                            where channel.Type is ChannelType.Voice
                                            select channel.Name);

            if (voiceChannels.Length > 1018)
            {
                voiceChannels = "Too many to list!";
            }
            var roles = string.Join(", ",
                                    from role in ctx.Guild.Roles.Values
                                    select role.Name);

            if (roles.Length > 1018)
            {
                roles = "Too many to list!";
            }
            var serverInfo = new DiscordEmbedBuilder()
                             .WithAuthor($"Information requested by {ctx.Message.Author.Username}", "",
                                         $"{ctx.Message.Author.AvatarUrl}")
                             .WithTimestamp(DateTime.Now)
                             .WithColor(new DiscordColor("#3498db"))
                             .AddField($"Server name", $"{ctx.Guild.Name} [{ctx.Guild.Id}]")
                             .AddField($"Server owner", $@"{ctx.Guild.Owner.Mention} [{ctx.Guild.Owner.Id}]")
                             .AddField($"Members", $"```{ctx.Guild.Members.Count}```", true)
                             .AddField($"Text Channels",
                                       $"```{ctx.Guild.Channels.Values.Count(chn => chn.Type == ChannelType.Text)}```", true)
                             .AddField($"Voice Channels",
                                       $"```{ctx.Guild.Channels.Values.Count(chn => chn.Type == ChannelType.Voice)}```", true)
                             .AddField($"Text Channels", $"```{textChannels}```")
                             .AddField($"Voice Channels", $"```{voiceChannels}```")
                             .AddField($"AFK-channel", $"```{ctx.Guild.AfkChannel.Name} [{ctx.Guild.AfkChannel.Id}]```")
                             .AddField($"Current Region", $"```{ctx.Guild.VoiceRegion.Name}```", true)
                             .AddField($"Total Roles", $"```{ctx.Guild.Roles.Count}```", true)
                             .AddField($"Roles", $"```{roles}```")
                             .WithThumbnail($"{ctx.Guild.IconUrl}");

            await CTX.RespondSanitizedAsync(ctx, "", false, serverInfo.Build());
        }
Exemplo n.º 23
0
        public async Task EightBall(CommandContext ctx, [RemainingText] string ignoredQuestion)
        {
            if (string.IsNullOrWhiteSpace(ignoredQuestion))
            {
                await CTX.RespondSanitizedAsync(ctx, ctx.User.Mention +
                                                ", I mean I can shake this 8ball all I want but without a question it's kinda dumb.");

                return;
            }
            await CTX.RespondSanitizedAsync(ctx, null, false,
                                            Utils.BaseEmbedBuilder(ctx, null as DiscordUser, "The magic 8 ball says")
                                            .WithDescription($"{ FunConsts.Random8BallChoice()}")
                                            .WithTimestamp(null));
        }
Exemplo n.º 24
0
        public async Task Loop(CommandContext ctx, [RemainingText] string loopString)
        {
            var lavaConnection = ShimakazeBot.lvn?.GetGuildConnection(ctx.Guild);

            if (!await CheckVoiceAndChannel(ctx, lavaConnection))
            {
                return;
            }

            int loopCount = 0;

            if (string.IsNullOrWhiteSpace(loopString))
            {
                loopCount = 1;
            }
            else if (!int.TryParse(loopString, out loopCount) ||
                     loopCount < 0 || loopCount > ShimaConsts.MaxSongLoopCount)
            {
                await CTX.RespondSanitizedAsync(ctx,
                                                $"Please type a number between **0** and **{ShimaConsts.MaxSongLoopCount}**");

                return;
            }
            if (ShimakazeBot.playlists[ctx.Guild].songRequests.Count > 0)
            {
                if (ShimakazeBot.playlists[ctx.Guild].loopCount > 0 && loopCount == 0)
                {
                    await CTX.RespondSanitizedAsync(ctx,
                                                    $"**{ShimakazeBot.playlists[ctx.Guild].songRequests[0].track.Title}** will no longer loop.");
                }
                else if (loopCount > 0)
                {
                    await CTX.RespondSanitizedAsync(ctx,
                                                    $"Set **{ShimakazeBot.playlists[ctx.Guild].songRequests[0].track.Title}** " +
                                                    $"to loop {loopCount} time{(loopCount > 1 ? "s" : "")}.");
                }
                else
                {
                    await CTX.RespondSanitizedAsync(ctx, "Playlist will continue to **not** loop.");

                    return;
                }
                ShimakazeBot.playlists[ctx.Guild].loopCount = loopCount;
            }
            else
            {
                await CTX.RespondSanitizedAsync(ctx, "Playlist is empty, request a song first.");
            }
        }
Exemplo n.º 25
0
        public async Task SetGlobalLevel(CommandContext ctx, [RemainingText] string text)
        {
            var textArray = text.Split(" ");
            int level;

            if (!int.TryParse(textArray[0], out level))
            {
                await CTX.RespondSanitizedAsync(ctx, $"{textArray[0]} is not a valid level.");

                return;
            }

            await SetLevelsFromList(ctx, PrepareUserIdList(ctx.Message.MentionedUsers, textArray),
                                    level, (int)ShimaConsts.UserPermissionLevel.SHIMA_TEAM);
        }
Exemplo n.º 26
0
        public async Task Advice(CommandContext ctx)
        {
            JObject response = await ShimaHttpClient.HttpGet("https://api.adviceslip.com/advice");

            if (response == null)
            {
                await CTX.RespondSanitizedAsync(ctx, "I've run out of advice ☹️");

                return;
            }
            await CTX.RespondSanitizedAsync(ctx, null, false,
                                            Utils.BaseEmbedBuilder(ctx, null, response["slip"]?["advice"]?.Value <string>(), null,
                                                                   $"#{response["slip"]?["id"]?.Value<string>()}")
                                            .WithTimestamp(null));
        }
Exemplo n.º 27
0
 public async Task Kiss(CommandContext ctx)
 {
     if (ctx.User.Id == 155038222794227712)
     {
         await CTX.RespondSanitizedAsync(ctx, $"*gives {ctx.User.Mention} a lovers kiss ♥♥♥*");
     }
     else if (ThreadSafeRandom.ThisThreadsRandom.Next(0, 1000) < 5)
     {
         await CTX.RespondSanitizedAsync(ctx, $"{ctx.User.Mention} you Baka!" +
                                         "\n*gives him a small kiss on the cheek ♥*");
     }
     else
     {
         await CTX.RespondSanitizedAsync(ctx, "I'm not going to kiss you!");
     }
 }
Exemplo n.º 28
0
        public async Task ClearPlaylist(CommandContext ctx)
        {
            var lavaConnection = ShimakazeBot.lvn?.GetGuildConnection(ctx.Guild);

            if (!await CheckVoiceAndChannel(ctx, lavaConnection))
            {
                return;
            }

            ShimakazeBot.playlists[ctx.Guild].loopCount    = 0;
            ShimakazeBot.playlists[ctx.Guild].songRequests = new List <SongRequest>
            {
                ShimakazeBot.playlists[ctx.Guild].songRequests[0]
            };
            await CTX.RespondSanitizedAsync(ctx, "Playlist cleared.");
        }
Exemplo n.º 29
0
        public async Task FancyInsult(CommandContext ctx)
        {
            JObject response = await ShimaHttpClient.HttpGet($"http://quandyfactory.com/insult/json/");

            if (response == null)
            {
                await CTX.RespondSanitizedAsync(ctx, "Damned as thou art, thou hast broken the api.");

                return;
            }

            await CTX.RespondSanitizedAsync(ctx, null, false,
                                            Utils.BaseEmbedBuilder(ctx, null as DiscordUser, response["insult"]?.Value <string>())
                                            .WithTimestamp(null)
                                            .WithImageUrl(FunConsts.FancyInsultImage));
        }
Exemplo n.º 30
0
        public async Task List(CommandContext ctx)
        {
            if (!ShimakazeBot.playlists.ContainsKey(ctx.Guild))
            {
                await CTX.RespondSanitizedAsync(ctx, "No playlist. Try making Shima join voice first.");
            }
            else
            {
                if (ShimakazeBot.playlists[ctx.Guild].songRequests.Count > 0)
                {
                    int    i   = 0;
                    var    lvc = ShimakazeBot.lvn?.GetGuildConnection(ctx.Guild);
                    string msg = "";
                    foreach (var req in ShimakazeBot.playlists[ctx.Guild].songRequests)
                    {
                        if (i == 0)
                        {
                            msg += lvc == null ? "Starting with " :
                                   (ShimakazeBot.playlists[ctx.Guild].isPaused ?
                                    "***PAUSED*** " : "Now playing ");
                        }
                        else if (i > 10)
                        {
                            msg += $"\n*And {ShimakazeBot.playlists[ctx.Guild].songRequests.Count - 11} more...*";
                            break;
                        }
                        else
                        {
                            msg += $"\n{i}. ";
                        }
                        msg += $"**{req.track.Title}** Requested by *{req.requester}*";
                        if (i == 0 && ShimakazeBot.playlists[ctx.Guild].loopCount > 0)
                        {
                            msg += $" ({ShimakazeBot.playlists[ctx.Guild].loopCount} " +
                                   $"loop{(ShimakazeBot.playlists[ctx.Guild].loopCount > 1 ? "s" : "")} remaining)";
                        }
                        i++;
                    }

                    await CTX.RespondSanitizedAsync(ctx, msg);
                }
                else
                {
                    await CTX.RespondSanitizedAsync(ctx, "Playlist is empty.");
                }
            }
        }