Exemplo n.º 1
0
        public async Task Gif_is_a_gif()
        {
            var gif = await GiphyController.GetRandomGif("test");

            Assert.That(gif, Does.StartWith("http"));
            Assert.That(gif, Does.EndWith("/giphy.gif"));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Tells disbott what to do with incoming commands
        /// </summary>
        /// <param name="messageParam"></param>
        /// <returns></returns>
        public async Task HandleCommand(SocketMessage messageParam)
        {
            // Don't process the command if it was a System Message
            var message = messageParam as SocketUserMessage;

            if (message == null)
            {
                return;
            }
            // Create a number to track where the prefix ends and the command begins
            int argPos = 0;

            // Determine if the message is a command, based on if it starts with '!' or a mention prefix
            if (message.HasMentionPrefix(_client.CurrentUser, ref argPos))
            {
                // Create a Command Context
                var context = new CommandContext(_client, message);
                // Execute the command. (result does not indicate a return value,
                // rather an object stating if the command executed succesfully)
                var result = await _commands.ExecuteAsync(context, argPos);

                if (!result.IsSuccess)
                {
                    await message.Channel.SendMessageAsync(result.ErrorReason);
                }
                if (Constants.DANKMODEACTIVATED == true)
                {
                    var value = await GiphyController.GetRandomGif("Dank");

                    await message.Channel.SendMessageAsync(value);
                }
            }

            if (message.Author.Id != _client.CurrentUser.Id)
            {
                // MessageCount Record
                MessageCountController.MessageRecord(message.Author.Id);
            }
        }
Exemplo n.º 3
0
        public async Task Giphy([Remainder] string search = null)
        {
            var value = await GiphyController.GetRandomGif(search);

            await ReplyAsync(value);
        }