This commit is contained in:
2019-02-20 21:54:21 +01:00
parent 70d91a84f3
commit 0b6433ce1d
7 changed files with 120 additions and 20 deletions

View File

@@ -4,8 +4,7 @@ using DSharpPlus.CommandsNext.Attributes;
namespace LaDOSE.DiscordBot.Command
{
public partial class Twitch
{
internal class Result
{
Dependencies dep;
@@ -32,5 +31,5 @@ namespace LaDOSE.DiscordBot.Command
}
}
}
}

View File

@@ -5,7 +5,7 @@ using DSharpPlus.CommandsNext.Attributes;
namespace LaDOSE.DiscordBot.Command
{
[RequireRolesAttribute("SuperAdmin")]
internal class Shutdown
public class Shutdown
{
private readonly Dependencies dep;
@@ -14,7 +14,6 @@ namespace LaDOSE.DiscordBot.Command
dep = d;
}
[Command("shutdown")]
public async Task ShutDownAsync(CommandContext ctx)

View File

@@ -0,0 +1,41 @@
using System.Threading.Tasks;
using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
namespace LaDOSE.DiscordBot.Command
{
public class Todo
{
private readonly Dependencies dep;
public Todo(Dependencies d)
{
dep = d;
}
[Command("todo")]
public async Task TwitchAsync(CommandContext ctx, string command,params string[] todo)
{
await ctx.TriggerTypingAsync();
switch (command.ToUpperInvariant())
{
case "ADD":
dep.TodoService.Add(todo[0]);
break;
case "LIST":
await ctx.RespondAsync($"{dep.TodoService.List()}");
break;
case "DEL":
int id;
if (int.TryParse(todo[0], out id))
{
await ctx.RespondAsync($"{dep.TodoService.Delete(id)}");
break;
};
await ctx.RespondAsync($"invalid id");
break;
}
await ctx.RespondAsync($"command : {command}, todo: {todo} ");
}
}
}

View File

@@ -4,23 +4,19 @@ using DSharpPlus.CommandsNext.Attributes;
namespace LaDOSE.DiscordBot.Command
{
public class Result
public class Twitch
{
private readonly Dependencies dep;
internal class Twitch
public Twitch(Dependencies d)
{
Dependencies dep;
public Twitch(Dependencies d)
{
this.dep = d;
}
dep = d;
}
[Command("twitch")]
public async Task TwitchAsync(CommandContext ctx)
{
await ctx.RespondAsync("https://www.twitch.tv/LaDOSETV");
}
[Command("twitch")]
public async Task TwitchAsync(CommandContext ctx)
{
await ctx.RespondAsync("https://www.twitch.tv/LaDOSETV");
}
}
}