Disabled >pick, >plant and >cleverbot
This commit is contained in:
parent
5d12e48f44
commit
adb1e570dd
@ -46,9 +46,9 @@ namespace NadekoBot.Modules.Games
|
|||||||
{
|
{
|
||||||
_log = LogManager.GetCurrentClassLogger();
|
_log = LogManager.GetCurrentClassLogger();
|
||||||
var sw = Stopwatch.StartNew();
|
var sw = Stopwatch.StartNew();
|
||||||
|
#if !GLOBAL_NADEKO
|
||||||
NadekoBot.Client.MessageReceived += PotentialFlowerGeneration;
|
NadekoBot.Client.MessageReceived += PotentialFlowerGeneration;
|
||||||
|
#endif
|
||||||
using (var uow = DbHandler.UnitOfWork())
|
using (var uow = DbHandler.UnitOfWork())
|
||||||
{
|
{
|
||||||
var conf = uow.BotConfig.GetOrCreate();
|
var conf = uow.BotConfig.GetOrCreate();
|
||||||
@ -101,7 +101,7 @@ namespace NadekoBot.Modules.Games
|
|||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
|
#if !GLOBAL_NADEKO
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
public async Task Pick()
|
public async Task Pick()
|
||||||
@ -159,7 +159,7 @@ namespace NadekoBot.Modules.Games
|
|||||||
}
|
}
|
||||||
plantedFlowers.AddOrUpdate(Context.Channel.Id, new List<IUserMessage>() { msg }, (id, old) => { old.Add(msg); return old; });
|
plantedFlowers.AddOrUpdate(Context.Channel.Id, new List<IUserMessage>() { msg }, (id, old) => { old.Add(msg); return old; });
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
[RequireUserPermission(GuildPermission.ManageMessages)]
|
[RequireUserPermission(GuildPermission.ManageMessages)]
|
||||||
|
@ -68,24 +68,40 @@ namespace NadekoBot.Services
|
|||||||
{
|
{
|
||||||
|
|
||||||
var usrMsg = msg as SocketUserMessage;
|
var usrMsg = msg as SocketUserMessage;
|
||||||
if (usrMsg == null)
|
if (usrMsg == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!usrMsg.IsAuthor())
|
if (!usrMsg.IsAuthor())
|
||||||
UserMessagesSent.AddOrUpdate(usrMsg.Author.Id, 1, (key, old) => ++old);
|
UserMessagesSent.AddOrUpdate(usrMsg.Author.Id, 1, (key, old) => ++old);
|
||||||
|
|
||||||
if (msg.Author.IsBot || !NadekoBot.Ready) //no bots
|
if (msg.Author.IsBot || !NadekoBot.Ready) //no bots
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var guild = (msg.Channel as SocketTextChannel)?.Guild;
|
var guild = (msg.Channel as SocketTextChannel)?.Guild;
|
||||||
|
|
||||||
if (guild != null && guild.OwnerId != msg.Author.Id)
|
if (guild != null && guild.OwnerId != msg.Author.Id)
|
||||||
{
|
|
||||||
//todo split checks into their own modules
|
|
||||||
if (Permissions.FilterCommands.InviteFilteringChannels.Contains(msg.Channel.Id) ||
|
|
||||||
Permissions.FilterCommands.InviteFilteringServers.Contains(guild.Id))
|
|
||||||
{
|
{
|
||||||
if (usrMsg.Content.IsDiscordInvite())
|
//todo split checks into their own modules
|
||||||
|
if (Permissions.FilterCommands.InviteFilteringChannels.Contains(msg.Channel.Id) ||
|
||||||
|
Permissions.FilterCommands.InviteFilteringServers.Contains(guild.Id))
|
||||||
|
{
|
||||||
|
if (usrMsg.Content.IsDiscordInvite())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await usrMsg.DeleteAsync().ConfigureAwait(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
catch (HttpException ex)
|
||||||
|
{
|
||||||
|
_log.Warn("I do not have permission to filter invites in channel with id " + msg.Channel.Id, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var filteredWords = Permissions.FilterCommands.FilteredWordsForChannel(msg.Channel.Id, guild.Id).Concat(Permissions.FilterCommands.FilteredWordsForServer(guild.Id));
|
||||||
|
var wordsInMessage = usrMsg.Content.ToLowerInvariant().Split(' ');
|
||||||
|
if (filteredWords.Any(w => wordsInMessage.Contains(w)))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -94,60 +110,45 @@ namespace NadekoBot.Services
|
|||||||
}
|
}
|
||||||
catch (HttpException ex)
|
catch (HttpException ex)
|
||||||
{
|
{
|
||||||
_log.Warn("I do not have permission to filter invites in channel with id " + msg.Channel.Id, ex);
|
_log.Warn("I do not have permission to filter words in channel with id " + msg.Channel.Id, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var filteredWords = Permissions.FilterCommands.FilteredWordsForChannel(msg.Channel.Id, guild.Id).Concat(Permissions.FilterCommands.FilteredWordsForServer(guild.Id));
|
BlacklistItem blacklistedItem;
|
||||||
var wordsInMessage = usrMsg.Content.ToLowerInvariant().Split(' ');
|
if ((blacklistedItem = Permissions.BlacklistCommands.BlacklistedItems.FirstOrDefault(bi =>
|
||||||
if (filteredWords.Any(w => wordsInMessage.Contains(w)))
|
(bi.Type == BlacklistItem.BlacklistType.Server && bi.ItemId == guild?.Id) ||
|
||||||
|
(bi.Type == BlacklistItem.BlacklistType.Channel && bi.ItemId == msg.Channel.Id) ||
|
||||||
|
(bi.Type == BlacklistItem.BlacklistType.User && bi.ItemId == msg.Author.Id))) != null)
|
||||||
{
|
{
|
||||||
try
|
return;
|
||||||
{
|
|
||||||
await usrMsg.DeleteAsync().ConfigureAwait(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
catch (HttpException ex)
|
|
||||||
{
|
|
||||||
_log.Warn("I do not have permission to filter words in channel with id " + msg.Channel.Id, ex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
#if !GLOBAL_NADEKO
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var cleverbotExecuted = await Games.CleverBotCommands.TryAsk(usrMsg);
|
||||||
|
|
||||||
BlacklistItem blacklistedItem;
|
if (cleverbotExecuted)
|
||||||
if ((blacklistedItem = Permissions.BlacklistCommands.BlacklistedItems.FirstOrDefault(bi =>
|
return;
|
||||||
(bi.Type == BlacklistItem.BlacklistType.Server && bi.ItemId == guild?.Id) ||
|
}
|
||||||
(bi.Type == BlacklistItem.BlacklistType.Channel && bi.ItemId == msg.Channel.Id) ||
|
catch (Exception ex) { _log.Warn(ex, "Error in cleverbot"); }
|
||||||
(bi.Type == BlacklistItem.BlacklistType.User && bi.ItemId == msg.Author.Id))) != null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
#endif
|
||||||
{
|
try
|
||||||
var cleverbotExecuted = await Games.CleverBotCommands.TryAsk(usrMsg);
|
{
|
||||||
|
// maybe this message is a custom reaction
|
||||||
|
var crExecuted = await CustomReactions.TryExecuteCustomReaction(usrMsg).ConfigureAwait(false);
|
||||||
|
|
||||||
if (cleverbotExecuted)
|
//if it was, don't execute the command
|
||||||
return;
|
if (crExecuted)
|
||||||
}
|
return;
|
||||||
catch (Exception ex) { _log.Warn(ex, "Error in cleverbot"); }
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
try
|
string messageContent = usrMsg.Content;
|
||||||
{
|
|
||||||
// maybe this message is a custom reaction
|
|
||||||
var crExecuted = await CustomReactions.TryExecuteCustomReaction(usrMsg).ConfigureAwait(false);
|
|
||||||
|
|
||||||
//if it was, don't execute the command
|
var sw = new Stopwatch();
|
||||||
if (crExecuted)
|
sw.Start();
|
||||||
return;
|
|
||||||
}
|
|
||||||
catch { }
|
|
||||||
|
|
||||||
string messageContent = usrMsg.Content;
|
|
||||||
|
|
||||||
var sw = new Stopwatch();
|
|
||||||
sw.Start();
|
|
||||||
var exec = await ExecuteCommand(new CommandContext(_client.MainClient, usrMsg), messageContent, DependencyMap.Empty, MultiMatchHandling.Best);
|
var exec = await ExecuteCommand(new CommandContext(_client.MainClient, usrMsg), messageContent, DependencyMap.Empty, MultiMatchHandling.Best);
|
||||||
var command = exec.CommandInfo;
|
var command = exec.CommandInfo;
|
||||||
var permCache = exec.PermissionCache;
|
var permCache = exec.PermissionCache;
|
||||||
|
Loading…
Reference in New Issue
Block a user