-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.cs
65 lines (55 loc) · 1.86 KB
/
bot.cs
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
using DSharpPlus;
using DSharpPlus.CommandsNext;
using DSharpPlus.EventArgs;
using DSharpPlus.Interactivity.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using DSharpPlus.Interactivity;
using System.Threading.Tasks;
using Vidlunnia_tushi_discord;
using Vidlunnia_tushi_discord.Commands;
namespace Відлуння_beta1
{
internal class bot
{
public static DiscordClient Client { get; set; }
public static CommandsNextExtension Comands { get; set; }
static async Task Main(string[] args)
{
var jsonReader = new JsonReader();
await jsonReader.ReadJSON();
var discordConfig = new DiscordConfiguration()
{
Intents = DiscordIntents.All,
Token = jsonReader.token,
TokenType = TokenType.Bot,
AutoReconnect = true,
};
Client = new DiscordClient(discordConfig);
Client.UseInteractivity(new InteractivityConfiguration()
{
Timeout =TimeSpan.FromMinutes(5)
});
Client.Ready += Client_Ready;
var commandsConfig = new CommandsNextConfiguration()
{
StringPrefixes = new string[] { jsonReader.prefix },
EnableMentionPrefix = true,
EnableDms = true,
EnableDefaultHelp = false,
};
Comands = Client.UseCommandsNext(commandsConfig);
Comands.RegisterCommands<FirstCommand>();
await Client.ConnectAsync();
await Task.Delay(-1);
}
private static Task Client_Ready(DiscordClient sender, ReadyEventArgs args)
{
return Task.CompletedTask;
}
}
}