2017-10-26 00:55:04 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Threading.Tasks;
|
2017-09-15 22:56:03 +02:00
|
|
|
|
using Discord;
|
2017-04-17 16:58:48 +02:00
|
|
|
|
using Discord.Commands;
|
2018-05-03 00:56:06 +02:00
|
|
|
|
using Geekbot.net.Lib.ErrorHandling;
|
2017-04-17 16:58:48 +02:00
|
|
|
|
|
2018-05-03 00:56:06 +02:00
|
|
|
|
namespace Geekbot.net.Commands.Admin
|
2017-04-17 16:58:48 +02:00
|
|
|
|
{
|
|
|
|
|
public class Say : ModuleBase
|
|
|
|
|
{
|
2017-10-26 00:55:04 +02:00
|
|
|
|
private readonly IErrorHandler _errorHandler;
|
|
|
|
|
|
|
|
|
|
public Say(IErrorHandler errorHandler)
|
|
|
|
|
{
|
|
|
|
|
_errorHandler = errorHandler;
|
|
|
|
|
}
|
2017-12-29 01:53:50 +01:00
|
|
|
|
|
2017-09-15 22:56:03 +02:00
|
|
|
|
[RequireUserPermission(GuildPermission.Administrator)]
|
|
|
|
|
[Command("say", RunMode = RunMode.Async)]
|
|
|
|
|
[Summary("Say Something.")]
|
|
|
|
|
public async Task Echo([Remainder] [Summary("What?")] string echo)
|
2017-04-17 16:58:48 +02:00
|
|
|
|
{
|
2017-10-26 00:55:04 +02:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
await Context.Message.DeleteAsync();
|
|
|
|
|
await ReplyAsync(echo);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
2018-06-13 22:18:57 +02:00
|
|
|
|
await _errorHandler.HandleCommandException(e, Context);
|
2017-10-26 00:55:04 +02:00
|
|
|
|
}
|
2017-04-17 16:58:48 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|