25 lines
685 B
C#
25 lines
685 B
C#
|
using Foxcord.Gateway;
|
|||
|
using Serilog;
|
|||
|
using Foxcord.Rest;
|
|||
|
|
|||
|
Log.Logger = new LoggerConfiguration()
|
|||
|
.MinimumLevel.Verbose()
|
|||
|
.WriteTo.Console()
|
|||
|
.CreateLogger();
|
|||
|
|
|||
|
var client = new DiscordRestClient(Log.Logger, new DiscordRestClientOptions
|
|||
|
{
|
|||
|
Token = Environment.GetEnvironmentVariable("TOKEN")!
|
|||
|
});
|
|||
|
|
|||
|
var gatewayBot = await client.GatewayBotAsync();
|
|||
|
|
|||
|
var gateway = new DiscordGatewayClient(Log.Logger, new DiscordGatewayClientOptions
|
|||
|
{
|
|||
|
Token = Environment.GetEnvironmentVariable("TOKEN")!,
|
|||
|
Uri = gatewayBot.Url,
|
|||
|
Intents = GatewayIntent.Guilds | GatewayIntent.GuildMessages | GatewayIntent.MessageContent
|
|||
|
});
|
|||
|
|
|||
|
await gateway.ConnectAsync();
|
|||
|
await Task.Delay(-1);
|