Prevent users from muting themselves
Why are users like this...
This commit is contained in:
parent
af39acfe03
commit
7e6da01a76
|
@ -202,7 +202,7 @@ namespace DeukBot4.MessageHandlers.CommandHandler
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var msg = await SilenceUser(user, span);
|
var msg = await SilenceUser(user, request.OriginalMessage.Author, span);
|
||||||
if (msg != null)
|
if (msg != null)
|
||||||
{
|
{
|
||||||
request.SendSimpleEmbed("Silence", msg);
|
request.SendSimpleEmbed("Silence", msg);
|
||||||
|
@ -216,20 +216,23 @@ namespace DeukBot4.MessageHandlers.CommandHandler
|
||||||
{
|
{
|
||||||
var guildChannel = (IGuildChannel)request.OriginalMessage.Channel;
|
var guildChannel = (IGuildChannel)request.OriginalMessage.Channel;
|
||||||
var user = await request.Parameters[0].AsDiscordGuildUser(guildChannel.Guild);
|
var user = await request.Parameters[0].AsDiscordGuildUser(guildChannel.Guild);
|
||||||
var msg = await SilenceUser(user, TimeSpan.FromHours(6));
|
var msg = await SilenceUser(user, request.OriginalMessage.Author, TimeSpan.FromHours(6));
|
||||||
if (msg != null)
|
if (msg != null)
|
||||||
{
|
{
|
||||||
request.SendSimpleEmbed("Silence", msg);
|
request.SendSimpleEmbed("Silence", msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task<string> SilenceUser(IGuildUser user, TimeSpan span)
|
private static async Task<string> SilenceUser(IGuildUser user, IUser author, TimeSpan span)
|
||||||
{
|
{
|
||||||
if (user.Id == Program.BotId)
|
if (user.Id == Program.BotId)
|
||||||
{
|
{
|
||||||
return "Stop trying to mute me.";
|
return "Stop trying to mute me.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (user.Id == author.Id)
|
||||||
|
return "You can't mute yourself...";
|
||||||
|
|
||||||
if (span.TotalHours > 24)
|
if (span.TotalHours > 24)
|
||||||
return "Can't mute for that long.";
|
return "Can't mute for that long.";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue