-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathQuaverBot.cs
More file actions
50 lines (39 loc) · 1.19 KB
/
QuaverBot.cs
File metadata and controls
50 lines (39 loc) · 1.19 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
using System.Threading.Tasks;
using Discord;
using Discord.WebSocket;
using QuaverBot.Database;
using QuaverBot.Modules;
namespace QuaverBot;
public class QuaverBot
{
public static BotConfig Config;
public DiscordSocketClient Client;
public CommandHandler CommandHandler;
public QuaverBot(BotConfig args)
{
Config = args;
DatabaseManager.Initialize();
var clientConfig = new DiscordSocketConfig
{
LogLevel = LogSeverity.Debug,
MessageCacheSize = 1024,
GatewayIntents = GatewayIntents.AllUnprivileged | GatewayIntents.MessageContent | GatewayIntents.GuildMembers
};
Client = new DiscordSocketClient(clientConfig);
Client.Log += Logger.Log;
CommandHandler = new(Client);
Client.UserJoined += Mute.OnUserJoined;
}
public async Task MainAsync()
{
if (string.IsNullOrEmpty(Config.Token))
{
Logger.Critical("Token is empty", this);
return;
}
await CommandHandler.InstallCommandsAsync();
await Client.LoginAsync(TokenType.Bot, Config.Token);
await Client.StartAsync();
await Task.Delay(-1);
}
}