2017-04-14 22:18:22 +02:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Discord.Commands;
|
|
|
|
|
using Geekbot.net.Lib;
|
|
|
|
|
|
|
|
|
|
namespace Geekbot.net.Modules
|
|
|
|
|
{
|
|
|
|
|
[Group("admin")]
|
|
|
|
|
public class AdminCmd : ModuleBase
|
|
|
|
|
{
|
2017-04-18 11:00:38 +02:00
|
|
|
|
private readonly IRedisClient redis;
|
|
|
|
|
public AdminCmd(IRedisClient redisClient)
|
|
|
|
|
{
|
|
|
|
|
redis = redisClient;
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-17 16:58:48 +02:00
|
|
|
|
[RequireUserPermission(Discord.GuildPermission.Administrator)]
|
2017-04-14 22:18:22 +02:00
|
|
|
|
[Command("welcome"), Summary("Set a Welcome Message (use '$user' to mention the new joined user).")]
|
|
|
|
|
public async Task SetWelcomeMessage([Remainder, Summary("The message")] string welcomeMessage)
|
|
|
|
|
{
|
2017-04-17 16:58:48 +02:00
|
|
|
|
var key = Context.Guild.Id + "-welcomeMsg";
|
2017-04-18 11:00:38 +02:00
|
|
|
|
redis.Client.StringSet(key, welcomeMessage);
|
2017-04-17 16:58:48 +02:00
|
|
|
|
var formatedMessage = welcomeMessage.Replace("$user", Context.User.Mention);
|
|
|
|
|
await ReplyAsync("Welcome message has been changed\r\nHere is an example of how it would look:\r\n" +
|
|
|
|
|
formatedMessage);
|
2017-04-14 22:18:22 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|