-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
65 lines (53 loc) · 1.42 KB
/
Program.cs
File metadata and controls
65 lines (53 loc) · 1.42 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//Thanks for the help from CWS (Coding with Storm) Discord
using System;
using System.Threading.Tasks;
using Discord;
using Discord.WebSocket;
using Discord.Commands;
namespace Unimate
{
public class Program
{
// Convert our sync main to an async main.
public static void Main(string[] args) =>
new Program().Start().GetAwaiter().GetResult();
private DiscordSocketClient client;
private CommandHandler handler;
public async Task Start()
{
// Define the DiscordSocketClient
client = new DiscordSocketClient();
var token = "Token here";
// Login and connect to Discord.
await client.LoginAsync(TokenType.Bot, token);
await client.StartAsync();
client.Ready += async () =>
{
await client.SetGameAsync($"-help | In guilds: {client.Guilds.Count}");
};
client.JoinedGuild += async (e) =>
{
await client.SetGameAsync($"-help | In guilds: {client.Guilds.Count}");
};
client.LeftGuild += async (e) =>
{
await client.SetGameAsync($"-help | In guilds: {client.Guilds.Count}");
};
var map = new DependencyMap();
map.Add(client);
handler = new CommandHandler();
await handler.Install(map);
Console.WriteLine($"{DateTime.UtcNow}: YourBot initiated...");
await Task.Delay(-1);
}
private static Task DelayDelete()
{
return Task.Delay(-1);
}
private Task Log(LogMessage msg)
{
Console.WriteLine(msg.ToString());
return Task.CompletedTask;
}
}
}