summaryrefslogtreecommitdiff
path: root/DiscordBot/Program.cs
diff options
context:
space:
mode:
Diffstat (limited to 'DiscordBot/Program.cs')
-rw-r--r--DiscordBot/Program.cs58
1 files changed, 0 insertions, 58 deletions
diff --git a/DiscordBot/Program.cs b/DiscordBot/Program.cs
deleted file mode 100644
index 60febcd..0000000
--- a/DiscordBot/Program.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-using System;
-using System.IO;
-using System.Linq;
-using System.Net;
-using System.Threading.Tasks;
-using Discord;
-using Discord.Commands;
-using Discord.WebSocket;
-
-namespace DiscordBot
-{
- class Program
- {
- public static void Main(string[] args)
- => new Program().MainAsync().GetAwaiter().GetResult();
-
- private DiscordSocketClient _client;
- private CommandHandler cHandler;
-
- public async Task MainAsync()
- {
- _client = new DiscordSocketClient();
-
- _client.Log += Log;
-
-
- cHandler = new CommandHandler(_client, new CommandService());
- // Remember to keep token private or to read it from an
- // external source! In this case, we are reading the token
- // from an environment variable. If you do not know how to set-up
- // environment variables, you may find more information on the
- // Internet or by using other methods such as reading from
- // a configuration.
- await cHandler.InstallCommandsAsync();
-
- try
- {
- await _client.LoginAsync(TokenType.Bot,
- Environment.GetEnvironmentVariable("DiscordToken"));
- }
- catch
- {
- await _client.LoginAsync(TokenType.Bot, File.ReadAllText("Token"));
- }
-
- await _client.StartAsync();
-
- // Block this task until the program is closed.
- await Task.Delay(-1);
- }
-
- private Task Log(LogMessage msg)
- {
- Console.WriteLine(msg.ToString());
- return Task.CompletedTask;
- }
- }
-}