Files
nadekobot/src/NadekoBot/Modules/Administration/PlayingRotate/PlayingRotateCommands.cs
Kwoth 021e7978da * dev: Greet stuff moved to its own table in the database. GreetSettings
* fix: Fixed placeholders not working
* fix: Fixed some countries in countries.yml for hangman game
* add: Added custom status overload for \`.adpl\`
* dev: Removed some unused strings
* fix: Fixed postgres support in Nadeko
* remove: Removed mysql support, it was broken for a while and some queries weren't compiling.
* dev: Updated image library
* fix: Some command strings fixed and clarified
2024-09-15 22:44:37 +00:00

68 lines
1.8 KiB
C#

#nullable disable
using NadekoBot.Modules.Administration.Services;
namespace NadekoBot.Modules.Administration;
public partial class Administration
{
[Group]
public partial class PlayingRotateCommands : NadekoModule<PlayingRotateService>
{
[Cmd]
[OwnerOnly]
public async Task RotatePlaying()
{
if (_service.ToggleRotatePlaying())
await Response().Confirm(strs.ropl_enabled).SendAsync();
else
await Response().Confirm(strs.ropl_disabled).SendAsync();
}
[Cmd]
[OwnerOnly]
public Task AddPlaying([Leftover] string status)
=> AddPlaying(ActivityType.CustomStatus, status);
[Cmd]
[OwnerOnly]
public async Task AddPlaying(ActivityType statusType, [Leftover] string status)
{
await _service.AddPlaying(statusType, status);
await Response().Confirm(strs.ropl_added).SendAsync();
}
[Cmd]
[OwnerOnly]
public async Task ListPlaying()
{
var statuses = _service.GetRotatingStatuses();
if (!statuses.Any())
await Response().Error(strs.ropl_not_set).SendAsync();
else
{
var i = 1;
await Response()
.Confirm(strs.ropl_list(string.Join("\n\t",
statuses.Select(rs => $"`{i++}.` *{rs.Type}* {rs.Status}"))))
.SendAsync();
}
}
[Cmd]
[OwnerOnly]
public async Task RemovePlaying(int index)
{
index -= 1;
var msg = await _service.RemovePlayingAsync(index);
if (msg is null)
return;
await Response().Confirm(strs.reprm(msg)).SendAsync();
}
}
}