public bool CanRun(Command command, User user, Channel channel, out string error) {
            error = null;

            if (channel.IsPrivate)
                return true;

            try {
                //is it a permission command?
                // if it is, check if the user has the correct role
                // if yes return true, if no return false
                if (command.Category == "Permissions")
                    if (user.Server.IsOwner || user.HasRole(PermissionHelper.ValidateRole(user.Server, PermissionsHandler.GetServerPermissionsRoleName(user.Server))))
                        return true;
                    else
                        throw new Exception($"You don't have the necessary role (**{PermissionsHandler._permissionsDict[user.Server].PermissionsControllerRole}**) to change permissions.");

                var permissionType = PermissionsHandler.GetPermissionBanType(command, user, channel);

                string msg;

                switch (permissionType) {
                    case PermissionsHandler.PermissionBanType.None:
                        return true;
                    case PermissionsHandler.PermissionBanType.ServerBanCommand:
                        msg = $"**{command.Text}** command has been banned from use on this **server**.";
                        break;
                    case PermissionsHandler.PermissionBanType.ServerBanModule:
                        msg = $"**{command.Category}** module has been banned from use on this **server**.";
                        break;
                    case PermissionsHandler.PermissionBanType.ChannelBanCommand:
                        msg = $"**{command.Text}** command has been banned from use on this **channel**.";
                        break;
                    case PermissionsHandler.PermissionBanType.ChannelBanModule:
                        msg = $"**{command.Category}** module has been banned from use on this **channel**.";
                        break;
                    case PermissionsHandler.PermissionBanType.RoleBanCommand:
                        msg = $"You do not have a **role** which permits you the usage of **{command.Text}** command.";
                        break;
                    case PermissionsHandler.PermissionBanType.RoleBanModule:
                        msg = $"You do not have a **role** which permits you the usage of **{command.Category}** module.";
                        break;
                    case PermissionsHandler.PermissionBanType.UserBanCommand:
                        msg = $"{user.Mention}, You have been banned from using **{command.Text}** command.";
                        break;
                    case PermissionsHandler.PermissionBanType.UserBanModule:
                        msg = $"{user.Mention}, You have been banned from using **{command.Category}** module.";
                        break;
                    default:
                        return true;
                }
                if (PermissionsHandler._permissionsDict[user.Server].Verbose) //if verbose - print errors
                    Task.Run(() => channel.SendMessage(msg));
                return false;
            } catch (Exception ex) {
                if (PermissionsHandler._permissionsDict[user.Server].Verbose) //if verbose - print errors
                    Task.Run(() => channel.SendMessage(ex.Message));
                return false;
            }
        }
Beispiel #2
0
        public static async Task MainAsync(Server server, Channel channel, User user, IEnumerable<string> args)
        {
            bool isError = false;
            string errorMessage = "";

            try
            {
                Color c = null;
                Role r = null;
                string colorName = null;

                if (args.FirstOrDefault() != null)
                    colorName = args.FirstOrDefault().ToLower();

                c = GetRoleColor(colorName);

                if (colorName != null && c != null)
                {

                    if ((r = GetRole(Capitalize(args.First().ToLower()), server.Roles)) != null)
                    {
                        await CheckForRolesAsync(user, server.Roles);
                        await user.AddRoles(r);
                    }
                    else
                    {
                        await CheckForRolesAsync(user, server.Roles);
                        string roleName = string.Format("{0}{1}", rolePrefix, Capitalize(colorName));
                        await user.AddRoles(await server.CreateRole(roleName, color: c));
                    }
                }
                else
                {
                    await channel.SendMessage(user.Mention + " Wrong colour input, check help for working colours.");
                }
            }
            catch (Exception ex)
            {
                isError = true;
                errorMessage = ex.Message.ToString();
            }

            if (isError)
                await channel.SendMessage(user.Mention + " " + errorMessage);

            await DeleteUnusedRolesAsync(server.Roles);
        }
Beispiel #3
0
        public async Task Run()
        {
            var cancelToken = _client.CancelToken;

            try
            {
                while (!_client.CancelToken.IsCancellationRequested)
                {
                    foreach (var settings in _settings.AllServers)
                    {
                        foreach (var feed in settings.Value.Feeds)
                        {
                            try {
                                Discord.Channel channel           = _client.GetChannel(feed.Value.ChannelId);
                                DateTimeOffset  newestArticleTime = feed.Value.LastUpdate;
                                XmlReader       r     = XmlNodeReader.Create(feed.Key);
                                SyndicationFeed posts = SyndicationFeed.Load(r);
                                r.Close();
                                foreach (SyndicationItem item in posts.Items)
                                {
                                    if (item.LastUpdatedTime.CompareTo(feed.Value.LastUpdate) > 0)
                                    {
                                        foreach (SyndicationLink link in item.Links) //reddit only has one link. It links to the comments of the post.
                                        {
                                            _client.Log.Info("Feed", $"New article: {item.Title}");
                                            Console.WriteLine(item.Title.Text);
                                            Console.WriteLine("Article written at " + feed.Value.LastUpdate);
                                            Console.WriteLine(link.Uri.OriginalString);
                                            await channel.SendMessage(link.Uri.OriginalString);
                                        }
                                        if (item.LastUpdatedTime.CompareTo(newestArticleTime) > 0)
                                        {
                                            newestArticleTime = item.LastUpdatedTime;
                                        }
                                    }
                                    else
                                    {
                                        // break; Would be fine the Threads were sorted.
                                        // might as well do nothing and be safe.
                                    }
                                }
                                if (feed.Value.LastUpdate.CompareTo(newestArticleTime) != 0)
                                {
                                    feed.Value.LastUpdate = newestArticleTime;
                                    Console.WriteLine("Setting Updatetime to newest Article " + feed.Value.LastUpdate);
                                    await _settings.Save(settings.Key, settings.Value);
                                }
                            }
                            catch (Exception ex) when(!(ex is TaskCanceledException))
                            {
                                _client.Log.Error("Feed", ex);
                            }
                        }
                        await Task.Delay(TIME_BETWEEN_UPDATES, cancelToken);
                    }
                }
            }
            catch (TaskCanceledException) { }
        }
Beispiel #4
0
 public  async void ExecuteCommand(Channel channel, Message message)
 {
     await channel.SendIsTyping();
     Thread.Sleep(5000);
     await
         channel.SendMessage(
             "What the f**k did you just f*****g say about me, you little bitch? I’ll have you know I graduated top of my class in the Navy Seals, and I’ve been involved in numerous secret raids on Al-Quaeda, and I have over 300 confirmed kills. I am trained in gorilla warfare and I’m the top sniper in the entire US armed forces. You are nothing to me but just another target. I will wipe you the f**k out with precision the likes of which has never been seen before on this Earth, mark my f*****g words. You think you can get away with saying that shit to me over the Internet? Think again, f****r. As we speak I am contacting my secret network of spies across the USA and your IP is being traced right now so you better prepare for the storm, maggot. The storm that wipes out the pathetic little thing you call your life. You’re f*****g dead, kid. I can be anywhere, anytime, and I can kill you in over seven hundred ways, and that’s just with my bare hands. Not only am I extensively trained in unarmed combat, but I have access to the entire arsenal of the United States Marine Corps and I will use it to its full extent to wipe your miserable ass off the face of the continent, you little shit. If only you could have known what unholy retribution your little “clever” comment was about to bring down upon you, maybe you would have held your f*****g tongue. But you couldn’t, you didn’t, and now you’re paying the price, you goddamn idiot. I will shit fury all over you and you will drown in it. You’re f*****g dead, kiddo.");
 }
Beispiel #5
0
        private static async Task <bool> ValidateQuery(Discord.Channel ch, string query)
        {
            if (string.IsNullOrEmpty(query.Trim()))
            {
                await ch.SendMessage("Please specify search parameters.");

                return(false);
            }
            return(true);
        }
Beispiel #6
0
        public static async Task ExecutePlaylist(IAudioClient voiceClient, List<string> playlist, Channel jamSessionChatChannel)
        {
            while (playlist.Count > 0)
            {
                string strCmdText;
                // TODO: Make this better
                Process cmdProcess = new Process();
                cmdProcess.StartInfo.FileName = "cmd.exe";
                cmdProcess.StartInfo.UseShellExecute = false;
                cmdProcess.StartInfo.RedirectStandardOutput = true;
                cmdProcess.StartInfo.RedirectStandardInput = true;
                cmdProcess.Start();

                /* Change for local/prod */
                //cmdProcess.StandardInput.WriteLine(@"del C:\Users\Tony\Desktop\Misc\DiscordBot\DiscordMusicBot\DiscordMusicBot\bin\assets\current.mp3");
                cmdProcess.StandardInput.WriteLine(@"del C:\MilliaBot\MilliaBot\assets\current.mp3");

                //cmdProcess.StartInfo.WorkingDirectory = @"cd C:\Users\Tony\Desktop\Misc\DiscordBot\DiscordMusicBot\DiscordMusicBot\bin\Debug";
                cmdProcess.StartInfo.WorkingDirectory = @"cd C:\MilliaBot\MilliaBot\Debug";

                strCmdText =
                    "youtube-dl -o ../assets/current.mp3 --extract-audio --audio-format mp3 " +
                    playlist.First();
                cmdProcess.StandardInput.WriteLine(strCmdText);

                await Task.Delay(5555);

                string file = "../assets/current.mp3";

                await jamSessionChatChannel.SendMessage("Now playing: " + playlist.First());
                if (playlist.Count > 1)
                {
                    await jamSessionChatChannel.SendMessage("Songs left in the playlist: " + playlist.Count);
                }

                await PlayMusic(voiceClient, file);

                if (playlist.Count > 0)
                    playlist.RemoveAt(0);
            }
        }
Beispiel #7
0
 public override void Execute(Server server, Discord.Channel channel, Discord.User user, string parameter, Dictionary <string, string> flags)
 {
     foreach (KeyValuePair <string, string> flag in flags)
     {
         //Welcome Flag
         if (flag.Key == "welcome")
         {
             server.Welcome = flag.Value;
             channel.SendMessage("A new welcome message has been set for this server!");
         }
     }
 }
Beispiel #8
0
        public override bool SendMessage(ChatItemId id, string message)
        {
            Discord.Channel c = GetChannelByDiscordChatId(id as DiscordChatId);
            if (c == null)
            {
                return(false);
            }

            c.SendMessage(message);

            return(true);
        }
Beispiel #9
0
        private async void PmLogs(CommandEventArgs e)
        {
            int messages = 5;

            try
            {
                messages = int.Parse(e.Args[0]);
            }
            catch (Exception)
            {
            }

            Discord.Channel chan = await _client.CreatePrivateChannel(GlobalSettings.Users.DevId);

            string[] logdata = File.ReadAllLines(Path.GetFullPath(@".\config\UmiBot.log"));

            for (int i = logdata.Count() - messages; i < logdata.Count(); i++)
            {
                await chan.SendMessage(logdata[i]);
            }
            await chan.SendMessage("Logs sent!");
        }
Beispiel #10
0
 private void registerBanCommand()
 {
     commands.CreateCommand("ban")
     .AddCheck((cm, u, ch) => u.ServerPermissions.Administrator)
     .Parameter("player", ParameterType.Required)
     .Parameter("reason", ParameterType.Required)
     .Do(async(e) =>
     {
         Discord.User target = e.Server.FindUsers(e.GetArg("player")).FirstOrDefault();
         if (getLogChannel(e.Server.Id) == "")
         {
             await e.Channel.SendMessage("You've gotta set a banlog channel with .setlogchannel first.");
             return;
         }
         Discord.Channel logChannel = e.Server.FindChannels(getLogChannel(e.Server.Id)).FirstOrDefault();
         await e.Server.Ban(target);
         await logChannel.SendMessage("Banned user **" + target.Name + "**. Reason given: " + e.GetArg("reason"));
     });
 }
Beispiel #11
0
        public static async Task HelpAsync(Server server, Channel channel, User user, IEnumerable<string> args)
        {
            bool isError = false;
            string errorMessage = "";

            try
            {
                Channel ch = await user.CreatePMChannel();
                await ch.SendMessage(WriteHelpMessage());
            }
            catch (Exception ex)
            {
                isError = true;
                errorMessage = ex.Message.ToString();
            }

            if (isError)
                await channel.SendMessage(user.Mention + " " + errorMessage);
        }
Beispiel #12
0
        /*
         * ██╗███╗   ██╗████████╗███████╗██████╗ ███╗   ██╗ █████╗ ██╗
         * ██║████╗  ██║╚══██╔══╝██╔════╝██╔══██╗████╗  ██║██╔══██╗██║
         * ██║██╔██╗ ██║   ██║   █████╗  ██████╔╝██╔██╗ ██║███████║██║
         * ██║██║╚██╗██║   ██║   ██╔══╝  ██╔══██╗██║╚██╗██║██╔══██║██║
         * ██║██║ ╚████║   ██║   ███████╗██║  ██║██║ ╚████║██║  ██║███████╗
         * ╚═╝╚═╝  ╚═══╝   ╚═╝   ╚══════╝╚═╝  ╚═╝╚═╝  ╚═══╝╚═╝  ╚═╝╚══════╝
         */
        // The following two functions adapted from code recieved from Katazz Trofee
        // Function to handle sending audio
        public async void SendAudio(Discord.Channel chnl, Discord.Channel txtchnl, Server server)
        {
            // Join a channel
            if (chnl.Type == ChannelType.Voice)
            {
                // We use GetService to find the AudioService that we installed earlier.
                // Join the Voice Channel, and return the IAudioClient.
                try
                {
                    vClient = await client.GetService <AudioService>().Join(chnl);
                }
                catch (Exception ex)
                {
                    // Display the exception if the client fails to join the voice channel.
                    Console.WriteLine($"[{server}] Failed to join voice channel: {ex}");
                }
            }
            // Play the queue.
            while (queue.Count != 0)
            {
                // Send the first item in the queue.
                await Task.Run(() => SendAudioTask(location + "/sounds/" + queue[0] + ".mp3"));

                // Remove the item that was just played from the queue.
                queue.RemoveAt(0);
            }
            //await Task.Run(() => SendAudioTask(filePath));
            if (badfile)
            {
                // If file is bad, inform the console and user. Then set the badfile flag.
                Console.WriteLine($"[{server}] Couldn't play soundbyte; Bad file {queue[0]}");
                await txtchnl.SendMessage("Bad file - " + queue[0].Substring(queue[0].LastIndexOf('/')));

                badfile = false;
            }
            // Leave the channel
            if (vClient != null)
            {
                await vClient.Disconnect();
            }
        }
Beispiel #13
0
 private void registerSayCommand()
 {
     commands.CreateCommand("say")
     .AddCheck((cm, u, ch) => u.ServerPermissions.Administrator)
     .Parameter("channel", ParameterType.Required)
     .Parameter("message", ParameterType.Required)
     .Do(async(e) =>
     {
         Discord.Channel channel = e.Server.FindChannels(e.GetArg("channel")).FirstOrDefault();
         int delay  = 0;
         int length = e.GetArg("message").Length;
         do
         {
             delay  += 333;
             length -= 5;
         } while (length >= 5);
         await channel.SendIsTyping();
         await Task.Delay(delay);
         await channel.SendMessage(e.GetArg("message"));
         discord.Log.Log(LogSeverity.Info, "Message sent", "Send message \"" + e.GetArg("message") + "\" on guild " + e.Server.Name + ".");
     });
 }
Beispiel #14
0
        private async void GetMe(CommandEventArgs e)
        {
            // Discord caches images so we need to force a new image get
            var duck = DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;

            try
            {
                id = Read(e.Args[0]);

                if (String.IsNullOrWhiteSpace(id))
                {
                    throw new SystemException();
                }

                if (String.Compare(e.Args[0], "Risk", true) == 0)
                {
                    Discord.Channel chan = await _client.CreatePrivateChannel(GlobalSettings.Users.DevId);

                    await chan.SendMessage($"{e.User.Name} just used SS GET in {e.Server.Name}");
                }

                result = $"https://deresute.me/{id}/medium.png?{duck}";
            }
            catch (Exception)
            {
                if (Regex.IsMatch(e.Args[0], "^[0-9]{9}$"))
                {
                    result = $"https://deresute.me/{e.Args[0]}/medium.png?{duck}";
                }
                else
                {
                    result = "not found; try again (๑◕︵◕๑)";
                }
            }

            await e.Channel.SendMessage($"{result}");
        }
 public  async void ExecuteCommand(Channel channel, Message message)
 {
     try
     {
         var discordId = message.User.Id;
         var builder = new MySqlConnectionStringBuilder
         {
             Database = "mediabiz_DiscordBot",
             Server = "masonsciotti.com",
             Port = 3306,
             UserID = "mediabiz_msciott",
             Password = "******"
         };
         var conn = new MySqlConnection(builder.ConnectionString);
         conn.Open();
         var command =
             new MySqlCommand($"SELECT steam_id FROM SteamIdRegistration WHERE discord_id = {discordId}", conn);
         var steamId = command.ExecuteScalar();
         var latestMatchId =
             SteamWebAPI.Game()
                 .Dota2()
                 .IDOTA2Match()
                 .GetMatchHistory()
                 .Account(SteamIdentity.FromSteamID(((long) steamId)))
                 .GetResponse()
                 .Data.Matches.FirstOrDefault()?
                 .MatchID;
         await
             channel.SendMessage("Last match for " + message.User.Mention + ": http://www.dotabuff.com/matches/" +
                                 latestMatchId);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
     }
 }
Beispiel #16
0
 public  async void ExecuteCommand(Channel channel, Message message)
 {
     await channel.SendMessage("༼ ºل͜º ༽ºل͜º ༽ºل͜º ༽ HEY @everyone GET IN HERE ༼ ºل͜º༼ ºل͜º༼ ºل͜º ༽");
 }
Beispiel #17
0
 public  async void ExecuteCommand(Channel channel, Message message)
 {           
     await channel.SendMessage("https://45.media.tumblr.com/4b38cf29e942d17d2d9ffc761ecca2c0/tumblr_n2jgzxjXxT1tod5n6o1_400.gif");            
 }
Beispiel #18
0
 public async void ExecuteCommand(Channel channel, Message message)
 {
     await channel.SendMessage("http://i.imgur.com/Ek817Gh.jpg");
 }
Beispiel #19
0
 public  async void ExecuteCommand(Channel channel, Message message)
 {
     await channel.SendMessage("http://imgur.com/2RNaClP");
 }
Beispiel #20
0
        public async Task StopPoll(Channel ch)
        {
            NadekoBot.Client.MessageReceived -= Vote;
            Poll throwaway;
            PollCommand.ActivePolls.TryRemove(e.Server, out throwaway);
            try
            {
                var results = participants.GroupBy(kvp => kvp.Value)
                                .ToDictionary(x => x.Key, x => x.Sum(kvp => 1))
                                .OrderBy(kvp => kvp.Value);

                var totalVotesCast = results.Sum(kvp => kvp.Value);
                if (totalVotesCast == 0)
                {
                    await ch.SendMessage("📄 **No votes have been cast.**").ConfigureAwait(false);
                    return;
                }
                var closeMessage = $"--------------**POLL CLOSED**--------------\n" +
                                   $"📄 , here are the results:\n";
                closeMessage = results.Aggregate(closeMessage, (current, kvp) => current + $"`{kvp.Key}.` **[{answers[kvp.Key - 1]}]**" +
                                                                                 $" has {kvp.Value} votes." +
                                                                                 $"({kvp.Value * 1.0f / totalVotesCast * 100}%)\n");

                await ch.SendMessage($"📄 **Total votes cast**: {totalVotesCast}\n{closeMessage}").ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error in poll game {ex}");
            }
        }
Beispiel #21
0
        public static async Task QueueSong(User queuer, Channel textCh, Channel voiceCh, string query, bool silent = false, MusicType musicType = MusicType.Normal)
        {
            if (voiceCh == null || voiceCh.Server != textCh.Server)
            {
                if (!silent)
                    await textCh.SendMessage("💢 You need to be in a voice channel on this server.\n If you are already in a voice channel, try rejoining.").ConfigureAwait(false);
                throw new ArgumentNullException(nameof(voiceCh));
            }
            if (string.IsNullOrWhiteSpace(query) || query.Length < 3)
                throw new ArgumentException("💢 Invalid query for queue song.", nameof(query));

            var musicPlayer = MusicPlayers.GetOrAdd(textCh.Server, server =>
            {
                float vol = SpecificConfigurations.Default.Of(server.Id).DefaultMusicVolume;
                var mp = new MusicPlayer(voiceCh, vol);


                Message playingMessage = null;
                Message lastFinishedMessage = null;
                mp.OnCompleted += async (s, song) =>
                {
                    if (song.PrintStatusMessage)
                    {
                        try
                        {
                            if (lastFinishedMessage != null)
                                await lastFinishedMessage.Delete().ConfigureAwait(false);
                            if (playingMessage != null)
                                await playingMessage.Delete().ConfigureAwait(false);
                            lastFinishedMessage = await textCh.SendMessage($"🎵`Finished`{song.PrettyName}").ConfigureAwait(false);
                            if (mp.Autoplay && mp.Playlist.Count == 0 && song.SongInfo.Provider == "YouTube")
                            {
                                await QueueSong(queuer.Server.CurrentUser, textCh, voiceCh, (await SearchHelper.GetRelatedVideoIds(song.SongInfo.Query, 4)).ToList().Shuffle().FirstOrDefault(), silent, musicType).ConfigureAwait(false);
                            }
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e);
                        }
                    }
                };
                mp.OnStarted += async (s, song) =>
                {
                    if (song.PrintStatusMessage)
                    {
                        var sender = s as MusicPlayer;
                        if (sender == null)
                            return;

                        try
                        {

                            var msgTxt = $"🎵`Playing`{song.PrettyName} `Vol: {(int)(sender.Volume * 100)}%`";
                            playingMessage = await textCh.SendMessage(msgTxt).ConfigureAwait(false);
                        }
                        catch { }
                    }
                };
                return mp;
            });
            Song resolvedSong;
            try
            {
                musicPlayer.ThrowIfQueueFull();
                resolvedSong = await Song.ResolveSong(query, musicType).ConfigureAwait(false);

                musicPlayer.AddSong(resolvedSong, queuer.Name);
            }
            catch (PlaylistFullException)
            {
                await textCh.SendMessage($"🎵 `Queue is full at {musicPlayer.MaxQueueSize}/{musicPlayer.MaxQueueSize}.` ");
                throw;
            }
            if (!silent)
            {
                var queuedMessage = await textCh.SendMessage($"🎵`Queued`{resolvedSong.PrettyName} **at** `#{musicPlayer.Playlist.Count + 1}`").ConfigureAwait(false);
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
                Task.Run(async () =>
                                {
                                    await Task.Delay(10000).ConfigureAwait(false);
                                    try
                                    {
                                        await queuedMessage.Delete().ConfigureAwait(false);
                                    }
                                    catch { }
                                }).ConfigureAwait(false);
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
            }
        }
Beispiel #22
0
        private async Task QueueSong(Channel textCh, Channel voiceCh, string query, bool silent = false, MusicType musicType = MusicType.Normal)
        {
            if (voiceCh == null || voiceCh.Server != textCh.Server)
            {
                if (!silent)
                    await textCh.SendMessage("💢 You need to be in a voice channel on this server.\n If you are already in a voice channel, try rejoining.");
                throw new ArgumentNullException(nameof(voiceCh));
            }
            if (string.IsNullOrWhiteSpace(query) || query.Length < 3)
                throw new ArgumentException("💢 Invalid query for queue song.", nameof(query));

            var musicPlayer = MusicPlayers.GetOrAdd(textCh.Server, server =>
            {
                float? vol = null;
                float throwAway;
                if (DefaultMusicVolumes.TryGetValue(server.Id, out throwAway))
                    vol = throwAway;
                var mp = new MusicPlayer(voiceCh, vol);


                Message playingMessage = null;
                Message lastFinishedMessage = null;
                mp.OnCompleted += async (s, song) =>
                {
                    if (song.PrintStatusMessage)
                    {
                        try
                        {
                            if (lastFinishedMessage != null)
                                await lastFinishedMessage.Delete();
                            if (playingMessage != null)
                                await playingMessage.Delete();
                            lastFinishedMessage = await textCh.SendMessage($"🎵`Finished`{song.PrettyName}");
                        }
                        catch { }
                    }
                };
                mp.OnStarted += async (s, song) =>
                {
                    if (song.PrintStatusMessage)
                    {
                        var sender = s as MusicPlayer;
                        if (sender == null)
                            return;

                        try
                        {

                            var msgTxt = $"🎵`Playing`{song.PrettyName} `Vol: {(int)(sender.Volume * 100)}%`";
                            playingMessage = await textCh.SendMessage(msgTxt);
                        }
                        catch { }
                    }
                };
                return mp;
            });
            var resolvedSong = await Song.ResolveSong(query, musicType);
            resolvedSong.MusicPlayer = musicPlayer;

            musicPlayer.AddSong(resolvedSong);
            if (!silent)
            {
                var queuedMessage = await textCh.SendMessage($"🎵`Queued`{resolvedSong.PrettyName} **at** `#{musicPlayer.Playlist.Count}`");
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
                Task.Run(async () =>
                {
                    await Task.Delay(10000);
                    try
                    {
                        await queuedMessage.Delete();
                    }
                    catch { }
                });
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
            }
        }
Beispiel #23
0
 public  async void ExecuteCommand(Channel channel, Message message)
 {
    await channel.SendMessage("https://www.youtube.com/watch?v=qlQItNqYg80");
 }
Beispiel #24
0
 public  void ExecuteCommand(Channel channel, Message message)
 {
     channel.SendMessage("http://i.imgur.com/gmIkoPP.gifv");
 }
Beispiel #25
0
 async public void ExecuteCommand(Channel channel, Message message)
 {
     await channel.SendMessage("!Matt");
 }
Beispiel #26
0
 async public void ExecuteCommand(Channel channel, Message message)
 {
     await channel.SendMessage("https://i.redd.it/1orjrm27jscx.jpg");
 }
 public  async void ExecuteCommand(Channel channel, Message message)
 {
     await channel.SendIsTyping();
     Thread.Sleep(5000);
     await channel.SendMessage(@"Whatever kid. Oh I'm sorry did I f*****g trigger you? Were you f*****g triggered you little cry baby? F**k off. Literally saying not a f*****g word to you and you're gonna f*****g mute me because you have a problem with me just f*****g talking shit in all chat? Honestly go f**k yourself to the highest f*****g caliber you f*****g asshole. So sick of little f*****g bitches like you who f*****g have a f*****g opinion like you're f*****g sitting over there like, oh I'm some f*****g problem to you because I'm not even f*****g saying a f*****g word to you. F**k off. Call it what you f*****g asshole? Hormonal? Kid you're a f*****g bullshitter. You're a f*****g bullshitter. Go f**k yourself. You ain't f*****g nothing. You ain't f*****g anyone. You ain't got a f*****g clue in your f*****g head who I am or what I'm f*****g about. That I'm f*****g calling these f*****g kids tryhards, has your f*****g panties in a bunch for what? For what? For f*****g what kid? Honestly I'm f*****g sick of kids like you. Literally go f**k yourself. Go f**k yourself and everything that you f*****g stand for because I'm gonna tell you right now, you don't stand for shit kid. You don't stand for f*****g shit. Please. Yeah, talk in all chat. Yeah like anybody f*****g cares kid go find a f*****g friend to talk to, right? Because you can't f*****g talk to me, you can't f*****g treat me like a f*****g person. You ain't f*****g real kid. You ain't f*****g real. You ain't got a f*****g real f*****g bone in your f*****g body kid. So go f*****g all chat, and make some f*****g friends. Alright? You can make some f*****g friends because ""Oh, this guy's hormonal,"" pffft ""Uh I'm gonna mute him, "" pffft f**k off. You're literally a f*****g cancer on this f*****g world kid. Never f*****g forget it.");
 }
Beispiel #28
0
 async public void ExecuteCommand(Channel channel, Message message)
 {
     await channel.SendMessage("https://www.youtube.com/watch?v=kN5cqf63kb8");
 }
Beispiel #29
0
        public async void PromptUser(ulong userId, string message, Channel channel, Action<Message> promptResponse)
        {
            await channel.SendMessage(message);

            var prompt = new Prompt(userId, promptResponse);
            PendingPrompts.Add(prompt);
        }
Beispiel #30
0
 public  async void ExecuteCommand(Channel channel, Message message)
 {
     await channel.SendMessage("Notice me senpai (◕‿◕✿)");
 }
Beispiel #31
0
 public async void ExecuteCommand(Channel channel, Message message)
 {
     await channel.SendMessage(HelperMethods.PickAnAyy());
 }
Beispiel #32
0
 public  async void ExecuteCommand(Channel channel, Message message)
 {
     await channel.SendMessage("➤ Good game, well played.");
 }
Beispiel #33
0
 public  async void ExecuteCommand(Channel channel, Message message)
 {
     //await channel.SendMessage("http://dota2.cyborgmatt.com/greg/");   
     await channel.SendMessage("https://media.giphy.com/media/l41lI72Me7ojwCPSM/giphy.gif");
 }
Beispiel #34
0
 public  void ExecuteCommand(Channel channel, Message message)
 {
     channel.SendMessage(
         "👌👀👌👀👌👀👌👀👌👀 good shit go౦ԁ sHit👌 thats ✔ some good👌👌shit right👌👌there👌👌👌 right✔there ✔✔if i do ƽaү so my self 💯 i say so 💯 thats what im talking about right there right there (chorus: ʳᶦᵍʰᵗ ᵗʰᵉʳᵉ) mMMMMᎷМ💯 👌👌 👌НO0ОଠOOOOOОଠଠOoooᵒᵒᵒᵒᵒᵒᵒᵒᵒ👌 👌👌 👌 💯 👌 👀 👀 👀 👌👌Good shit");
 }
		public async void SendImage(Channel channel)
		{
			if (images.Count == 0)
				return;
			await channel.SendMessage(images.GetRandom());
		}
        public async void RemoveMessages(Discord.Server server)
        {
            if (server.Id != DiscordIds.AtlasId)
            {
                SettingsRepo      settingsRepo = new SettingsRepo(new SettingsContext());
                Discord.Channel   channel      = server.GetChannel(settingsRepo.GetLfgChannel(server.Id));
                Discord.Message[] temp         = await channel.DownloadMessages(100);

                bool found = false;
                try
                {
                    while (temp.Length > 1 && temp.Last().Text != "queue has been cleared!")
                    {
                        await channel.DeleteMessages(temp);

                        found = true;
                        temp  = await channel.DownloadMessages(100);
                    }
                }
                catch
                {
                    found = true;
                }
                if (found == true)
                {
                    await channel.SendMessage("Queue has been cleared!");
                }
            }
            else if (server.Id == DiscordIds.AtlasId)
            {
                List <Channel> channels = new List <Channel>();
                foreach (var channel in server.TextChannels)
                {
                    if (channel.Name.Contains("queue"))
                    {
                        channels.Add(channel);
                    }
                }
                foreach (var channel in channels)
                {
                    Discord.Message[] temp = await channel.DownloadMessages();

                    bool found = false;
                    try
                    {
                        while (temp.Length > 1 && temp.Last().Text != "queue has been cleared!")
                        {
                            await channel.DeleteMessages(temp);

                            found = true;
                            temp  = await channel.DownloadMessages();
                        }
                    }
                    catch
                    {
                        found = true;
                    }
                    if (found)
                    {
                        await channel.SendMessage("Queue has been cleared!");
                    }
                }
            }
        }
Beispiel #37
0
 public  async void ExecuteCommand(Channel channel, Message message)
 {
     var matt = channel.Server.FindUsers("Matt", true);
     await channel.SendMessage("Hey " + matt.FirstOrDefault()?.Mention + " - F**k you.");
 }
Beispiel #38
0
 public  async void ExecuteCommand(Channel channel, Message message)
 {
     await channel.SendMessage("http://bit.ly/1ZMIDnF");
 }
Beispiel #39
0
 async public void ExecuteCommand(Channel channel, Message message)
 {
     await channel.SendMessage("http://i.imgur.com/XHBa71T.jpg");
 }
Beispiel #40
0
 public  async void ExecuteCommand(Channel channel, Message message)
 {
     await channel.SendMessage("https://i.imgur.com/dAoVxaM.jpg");
 }