Added check to ignore bot commands. (#1175)
Added the usual check to ignore bot commands in this sample CommandHandler as seen and approved in #1174.
This commit is contained in:
@@ -27,7 +27,7 @@ public async Task HandleCommandAsync(SocketMessage msg)
|
|||||||
var message = messageParam as SocketUserMessage;
|
var message = messageParam as SocketUserMessage;
|
||||||
if (message == null) return;
|
if (message == null) return;
|
||||||
int argPos = 0;
|
int argPos = 0;
|
||||||
if (!(message.HasCharPrefix('!', ref argPos) || message.HasMentionPrefix(_client.CurrentUser, ref argPos))) return;
|
if (!(message.HasCharPrefix('!', ref argPos) || message.HasMentionPrefix(_client.CurrentUser, ref argPos)) || message.Author.IsBot) return;
|
||||||
var context = new SocketCommandContext(_client, message);
|
var context = new SocketCommandContext(_client, message);
|
||||||
var result = await _commands.ExecuteAsync(context, argPos, _services);
|
var result = await _commands.ExecuteAsync(context, argPos, _services);
|
||||||
// Optionally, you may pass the result manually into your
|
// Optionally, you may pass the result manually into your
|
||||||
|
|||||||
Reference in New Issue
Block a user