2018-10-04 00:29:25 +02:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
using DSharpPlus.CommandsNext;
|
|
|
|
|
|
using DSharpPlus.CommandsNext.Attributes;
|
|
|
|
|
|
|
|
|
|
|
|
namespace LaDOSE.DiscordBot.Command
|
|
|
|
|
|
{
|
2019-03-16 12:22:52 +01:00
|
|
|
|
internal class Result
|
|
|
|
|
|
{
|
|
|
|
|
|
Dependencies dep;
|
2019-02-20 21:54:21 +01:00
|
|
|
|
|
2019-03-16 12:22:52 +01:00
|
|
|
|
public Result(Dependencies d)
|
2018-10-04 00:29:25 +02:00
|
|
|
|
{
|
2019-03-16 12:22:52 +01:00
|
|
|
|
this.dep = d;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-03-27 00:37:11 +01:00
|
|
|
|
//[RequireRolesAttribute("Staff")]
|
|
|
|
|
|
//[Command("update")]
|
|
|
|
|
|
//public async Task UpdateAsync(CommandContext ctx)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// //var tournament = await dep.ChallongeService.GetLastTournament();
|
|
|
|
|
|
// //await ctx.RespondAsync($"Mise à jour effectuée");
|
|
|
|
|
|
//}
|
2018-10-04 00:29:25 +02:00
|
|
|
|
|
2019-03-16 12:22:52 +01:00
|
|
|
|
[Command("last")]
|
|
|
|
|
|
public async Task LastAsync(CommandContext ctx)
|
|
|
|
|
|
{
|
2019-03-27 00:37:11 +01:00
|
|
|
|
var lastTournamentMessage = dep.WebService.GetLastChallonge();
|
2019-03-16 12:22:52 +01:00
|
|
|
|
await ctx.RespondAsync(lastTournamentMessage);
|
|
|
|
|
|
}
|
2018-10-04 20:53:36 +02:00
|
|
|
|
|
2019-03-16 12:22:52 +01:00
|
|
|
|
[RequireRolesAttribute("Staff")]
|
|
|
|
|
|
[Command("inscriptions")]
|
|
|
|
|
|
public async Task InscriptionsAsync(CommandContext ctx)
|
|
|
|
|
|
{
|
|
|
|
|
|
await ctx.TriggerTypingAsync();
|
|
|
|
|
|
var inscrits = dep.WebService.GetInscrits();
|
|
|
|
|
|
await ctx.RespondAsync(inscrits);
|
|
|
|
|
|
}
|
2018-10-04 20:53:36 +02:00
|
|
|
|
|
2019-03-16 12:22:52 +01:00
|
|
|
|
[RequireRolesAttribute("Staff")]
|
|
|
|
|
|
[Command("UpdateDb")]
|
|
|
|
|
|
public async Task UpdateDbAsync(CommandContext ctx)
|
|
|
|
|
|
{
|
|
|
|
|
|
await ctx.RespondAsync("Mise à jour des inscriptions en cours...");
|
|
|
|
|
|
await ctx.TriggerTypingAsync();
|
2018-10-04 01:32:33 +02:00
|
|
|
|
|
2019-03-16 12:22:52 +01:00
|
|
|
|
var status = dep.WebService.RefreshDb() ? "Ok" : "erreur";
|
2018-10-04 01:32:33 +02:00
|
|
|
|
|
2019-03-16 12:22:52 +01:00
|
|
|
|
await ctx.RespondAsync($"Status: {status}");
|
2018-10-04 00:29:25 +02:00
|
|
|
|
}
|
2019-03-16 12:22:52 +01:00
|
|
|
|
}
|
2018-10-04 00:29:25 +02:00
|
|
|
|
}
|