Fix the bots
This commit is contained in:
@@ -3,31 +3,31 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using DSharpPlus.CommandsNext;
|
||||
using DSharpPlus.CommandsNext.Attributes;
|
||||
using LaDOSE.DiscordBot.Service;
|
||||
using LaDOSE.DTO;
|
||||
|
||||
namespace LaDOSE.DiscordBot.Command
|
||||
{
|
||||
public class BotEvent
|
||||
public class BotEvent : BaseCommandModule
|
||||
{
|
||||
private readonly Dependencies dep;
|
||||
|
||||
public BotEvent(Dependencies d)
|
||||
private WebService dep;
|
||||
public BotEvent(WebService d)
|
||||
{
|
||||
dep = d;
|
||||
}
|
||||
|
||||
[RequireRolesAttribute("Staff")]
|
||||
[RequireRolesAttribute(RoleCheckMode.Any, "Staff")]
|
||||
[Command("newevent")]
|
||||
public async Task NewEventAsync(CommandContext ctx, string command)
|
||||
{
|
||||
|
||||
await ctx.RespondAsync(dep.WebService.RestService.CreateBotEvent(command).ToString());
|
||||
await ctx.RespondAsync(dep.RestService.CreateBotEvent(command).ToString());
|
||||
}
|
||||
[RequireRolesAttribute("Staff")]
|
||||
[RequireRolesAttribute(RoleCheckMode.Any,"Staff")]
|
||||
[Command("staffs")]
|
||||
public async Task StaffAsync(CommandContext ctx)
|
||||
{
|
||||
BotEventDTO currentEvent = dep.WebService.RestService.GetLastBotEvent();
|
||||
BotEventDTO currentEvent = dep.RestService.GetLastBotEvent();
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
|
||||
var present = currentEvent.Results.Where(x => x.Result).ToList();
|
||||
@@ -40,19 +40,19 @@ namespace LaDOSE.DiscordBot.Command
|
||||
await ctx.RespondAsync(stringBuilder.ToString());
|
||||
|
||||
}
|
||||
[RequireRolesAttribute("Staff")]
|
||||
[RequireRolesAttribute(RoleCheckMode.Any, "Staff")]
|
||||
[Command("present")]
|
||||
public async Task PresentAsync(CommandContext ctx)
|
||||
{
|
||||
await ctx.RespondAsync(dep.WebService.RestService.ResultBotEvent(new DTO.BotEventSendDTO() { DiscordId = ctx.Member.Id.ToString(), DiscordName = ctx.Member.DisplayName, Present = true }).ToString());
|
||||
await ctx.RespondAsync(dep.RestService.ResultBotEvent(new DTO.BotEventSendDTO() { DiscordId = ctx.Member.Id.ToString(), DiscordName = ctx.Member.DisplayName, Present = true }).ToString());
|
||||
|
||||
|
||||
}
|
||||
[RequireRolesAttribute("Staff")]
|
||||
[RequireRolesAttribute(RoleCheckMode.Any, "Staff")]
|
||||
[Command("absent")]
|
||||
public async Task AbsentAsync(CommandContext ctx)
|
||||
{
|
||||
await ctx.RespondAsync(dep.WebService.RestService.ResultBotEvent(new DTO.BotEventSendDTO() { DiscordId = ctx.Member.Id.ToString(), DiscordName = ctx.Member.DisplayName, Present = false }).ToString());
|
||||
await ctx.RespondAsync(dep.RestService.ResultBotEvent(new DTO.BotEventSendDTO() { DiscordId = ctx.Member.Id.ToString(), DiscordName = ctx.Member.DisplayName, Present = false }).ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,14 +9,14 @@ using DSharpPlus.Entities;
|
||||
namespace LaDOSE.DiscordBot.Command
|
||||
{
|
||||
|
||||
public class Hokuto
|
||||
public class Hokuto : BaseCommandModule
|
||||
{
|
||||
private readonly Dependencies dep;
|
||||
|
||||
private static List<string> Games = new List<string> { "2X", "3.3", "Karnov" };
|
||||
private static Random r = new Random();
|
||||
public Hokuto(Dependencies d)
|
||||
public Hokuto()
|
||||
{
|
||||
dep = d;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -9,16 +9,16 @@ using DSharpPlus.CommandsNext.Attributes;
|
||||
|
||||
namespace LaDOSE.DiscordBot.Command
|
||||
{
|
||||
public class Public
|
||||
public class Public : BaseCommandModule
|
||||
{
|
||||
private readonly Dependencies dep;
|
||||
|
||||
private static List<string> Quotes { get; set; }
|
||||
private static List<string> Questions { get; set; }
|
||||
private static List<string> Answers { get; set; }
|
||||
private Random rnd { get; set; }
|
||||
public Public(Dependencies d)
|
||||
public Public()
|
||||
{
|
||||
dep = d;
|
||||
|
||||
rnd = new Random(DateTime.Now.Millisecond);
|
||||
}
|
||||
|
||||
@@ -65,9 +65,17 @@ namespace LaDOSE.DiscordBot.Command
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
for (int i = 0; i < s.Length - 1; i++)
|
||||
{
|
||||
response += s[i] + Answers[rnd.Next(Answers.Count - 1)];
|
||||
if (s[i] == "" && i==0)
|
||||
{
|
||||
response += Answers[rnd.Next(Answers.Count - 1)];
|
||||
}
|
||||
else
|
||||
{
|
||||
response += s[i] + "***" + Answers[rnd.Next(Answers.Count - 1)].ToLower() + "***";
|
||||
}
|
||||
}
|
||||
response += s[s.Length - 1];
|
||||
}
|
||||
|
||||
@@ -1,45 +1,45 @@
|
||||
using System.Threading.Tasks;
|
||||
using DSharpPlus.CommandsNext;
|
||||
using DSharpPlus.CommandsNext.Attributes;
|
||||
//using System.Threading.Tasks;
|
||||
//using DSharpPlus.CommandsNext;
|
||||
//using DSharpPlus.CommandsNext.Attributes;
|
||||
|
||||
namespace LaDOSE.DiscordBot.Command
|
||||
{
|
||||
internal class Result
|
||||
{
|
||||
Dependencies dep;
|
||||
//namespace LaDOSE.DiscordBot.Command
|
||||
//{
|
||||
// internal class Result : BaseCommandModule
|
||||
// {
|
||||
// Dependencies dep;
|
||||
|
||||
public Result(Dependencies d)
|
||||
{
|
||||
this.dep = d;
|
||||
}
|
||||
// public Result(Dependencies d)
|
||||
// {
|
||||
// this.dep = d;
|
||||
// }
|
||||
|
||||
|
||||
//[Command("last")]
|
||||
//public async Task LastAsync(CommandContext ctx)
|
||||
//{
|
||||
// var lastTournamentMessage = dep.WebService.GetLastChallonge();
|
||||
// await ctx.RespondAsync(lastTournamentMessage);
|
||||
//}
|
||||
// //[Command("last")]
|
||||
// //public async Task LastAsync(CommandContext ctx)
|
||||
// //{
|
||||
// // var lastTournamentMessage = dep.WebService.GetLastChallonge();
|
||||
// // await ctx.RespondAsync(lastTournamentMessage);
|
||||
// //}
|
||||
|
||||
//[RequireRolesAttribute("Staff")]
|
||||
//[Command("inscriptions")]
|
||||
//public async Task InscriptionsAsync(CommandContext ctx)
|
||||
//{
|
||||
// await ctx.TriggerTypingAsync();
|
||||
// var inscrits = dep.WebService.GetInscrits();
|
||||
// await ctx.RespondAsync(inscrits);
|
||||
//}
|
||||
// //[RequireRolesAttribute("Staff")]
|
||||
// //[Command("inscriptions")]
|
||||
// //public async Task InscriptionsAsync(CommandContext ctx)
|
||||
// //{
|
||||
// // await ctx.TriggerTypingAsync();
|
||||
// // var inscrits = dep.WebService.GetInscrits();
|
||||
// // await ctx.RespondAsync(inscrits);
|
||||
// //}
|
||||
|
||||
[RequireRolesAttribute("Staff")]
|
||||
[Command("UpdateDb")]
|
||||
public async Task UpdateDbAsync(CommandContext ctx)
|
||||
{
|
||||
await ctx.RespondAsync("Mise à jour des inscriptions en cours...");
|
||||
await ctx.TriggerTypingAsync();
|
||||
// [RequireRolesAttribute(RoleCheckMode.Any,"Staff")]
|
||||
// [Command("UpdateDb")]
|
||||
// public async Task UpdateDbAsync(CommandContext ctx)
|
||||
// {
|
||||
// await ctx.RespondAsync("Mise à jour des inscriptions en cours...");
|
||||
// await ctx.TriggerTypingAsync();
|
||||
|
||||
var status = dep.WebService.RefreshDb() ? "Ok" : "erreur";
|
||||
// var status = dep.WebService.RefreshDb() ? "Ok" : "erreur";
|
||||
|
||||
await ctx.RespondAsync($"Status: {status}");
|
||||
}
|
||||
}
|
||||
}
|
||||
// await ctx.RespondAsync($"Status: {status}");
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -1,25 +1,25 @@
|
||||
using System.Threading.Tasks;
|
||||
using DSharpPlus.CommandsNext;
|
||||
using DSharpPlus.CommandsNext.Attributes;
|
||||
//using System.Threading.Tasks;
|
||||
//using DSharpPlus.CommandsNext;
|
||||
//using DSharpPlus.CommandsNext.Attributes;
|
||||
|
||||
namespace LaDOSE.DiscordBot.Command
|
||||
{
|
||||
[RequireRolesAttribute("SuperAdmin")]
|
||||
public class Shutdown
|
||||
{
|
||||
private readonly Dependencies dep;
|
||||
//namespace LaDOSE.DiscordBot.Command
|
||||
//{
|
||||
// [RequireRolesAttribute(RoleCheckMode.Any,"SuperAdmin")]
|
||||
// public class Shutdown : BaseCommandModule
|
||||
// {
|
||||
// private readonly Dependencies dep;
|
||||
|
||||
public Shutdown(Dependencies d)
|
||||
{
|
||||
dep = d;
|
||||
}
|
||||
// public Shutdown(Dependencies d)
|
||||
// {
|
||||
// dep = d;
|
||||
// }
|
||||
|
||||
|
||||
[Command("shutdown")]
|
||||
public async Task ShutDownAsync(CommandContext ctx)
|
||||
{
|
||||
await ctx.RespondAsync("Hasta la vista, baby");
|
||||
dep.Cts.Cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
// [Command("shutdown")]
|
||||
// public async Task ShutDownAsync(CommandContext ctx)
|
||||
// {
|
||||
// await ctx.RespondAsync("Hasta la vista, baby");
|
||||
// dep.Cts.Cancel();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
Reference in New Issue
Block a user