This repository has been archived on 2024-12-22. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
elliebot/src/EllieBot/Modules/Searches/JokeCommands.cs
2024-06-18 23:55:36 +12:00

53 lines
No EOL
1.5 KiB
C#

#nullable disable
using EllieBot.Modules.Searches.Services;
namespace EllieBot.Modules.Searches;
public partial class Searches
{
[Group]
public partial class JokeCommands : EllieModule<SearchesService>
{
[Cmd]
public async Task Yomama()
=> await Response().Confirm(await _service.GetYomamaJoke()).SendAsync();
[Cmd]
public async Task Randjoke()
{
var (setup, punchline) = await _service.GetRandomJoke();
await Response().Confirm(setup, punchline).SendAsync();
}
[Cmd]
public async Task ChuckNorris()
=> await Response().Confirm(await _service.GetChuckNorrisJoke()).SendAsync();
[Cmd]
public async Task WowJoke()
{
if (!_service.WowJokes.Any())
{
await Response().Error(strs.jokes_not_loaded).SendAsync();
return;
}
var joke = _service.WowJokes[new EllieRandom().Next(0, _service.WowJokes.Count)];
await Response().Confirm(joke.Question, joke.Answer).SendAsync();
}
[Cmd]
public async Task MagicItem()
{
if (!_service.MagicItems.Any())
{
await Response().Error(strs.magicitems_not_loaded).SendAsync();
return;
}
var item = _service.MagicItems[new EllieRandom().Next(0, _service.MagicItems.Count)];
await Response().Confirm("✨" + item.Name, item.Description).SendAsync();
}
}
}