-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSlashCommands.cs
28 lines (26 loc) · 1.45 KB
/
SlashCommands.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using DSharpPlus.Entities;
using DSharpPlus;
using DSharpPlus.SlashCommands;
namespace Pomodoro
{
public class SlashCommands : ApplicationCommandModule
{
[SlashCommand("start", "Inicia una sesión de estudio")]
public async Task StartCommand(
InteractionContext ctx,
[Option("estudio", "Minutos de estudio")] long workMinutes,
[Option("descanso", "Minutos de descanso")] long breakMinutes
)
{
await ctx.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, new DiscordInteractionResponseBuilder().WithContent($"Sesión de estudio iniciada! {Formatter.Emoji(DiscordEmoji.FromGuildEmote(ctx.Client, (long)Emotes.PepeReading))}"));
for (int i = 0; i < 4; i++)
{
await Task.Delay((int)workMinutes * 60000);
await ctx.Channel.SendMessageAsync($"{Formatter.Emoji(DiscordEmoji.FromGuildEmote(ctx.Client, (long)Emotes.PepeStop))} Descanso de {breakMinutes} minutos! {Formatter.Mention(ctx.User, true)}");
await Task.Delay((int)breakMinutes * 60000);
await ctx.Channel.SendMessageAsync($"{Formatter.Mention(ctx.User, true)} Fin del descanso! Progreso: {i + 1}/4");
}
await ctx.Channel.SendMessageAsync($"{Formatter.Mention(ctx.User, true)} Sesión de estudio finalizada! {Formatter.Emoji(DiscordEmoji.FromGuildEmote(ctx.Client, (long)Emotes.Gladge))}");
}
}
}