Dad jokes are nice
This commit is contained in:
parent
ed7e22cfed
commit
b0d55bf77e
|
@ -24,6 +24,7 @@ namespace DeukBot4.MessageHandlers
|
|||
HandlePrivateMessage(message);
|
||||
ImageBackupHandler.Backup(message);
|
||||
DeltaHandler(message);
|
||||
DadJokeHandler(message);
|
||||
#pragma warning restore 4014
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -75,5 +76,34 @@ namespace DeukBot4.MessageHandlers
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
private static async Task DadJokeHandler(SocketMessage message)
|
||||
{
|
||||
if (!(message.Author is IGuildUser guildUser))
|
||||
return;
|
||||
string newName;
|
||||
var lower = message.Content.ToLowerInvariant();
|
||||
|
||||
if (lower.StartsWith("i'm "))
|
||||
{
|
||||
newName = message.Content.Remove(0, 4);
|
||||
}
|
||||
else if (lower.StartsWith("im "))
|
||||
{
|
||||
newName = message.Content.Remove(0, 3);
|
||||
}
|
||||
else if (lower.StartsWith("i am "))
|
||||
{
|
||||
newName = message.Content.Remove(0, 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
await message.Channel.SendMessageAsync($"Hi {newName}, i'm Deukbot");
|
||||
await guildUser.ModifyAsync(user => user.Nickname = newName);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue