29 lines
777 B
C#
29 lines
777 B
C#
using Discord;
|
|
using Discord.WebSocket;
|
|
|
|
public class Program
|
|
{
|
|
public static Task Main(string[] args) => new Program().MainAsync();
|
|
|
|
private DiscordSocketClient client;
|
|
|
|
public async Task MainAsync()
|
|
{
|
|
client = new DiscordSocketClient();
|
|
|
|
client.Log += Log;
|
|
|
|
// You can assign your bot token to a string, and pass that in to connect.
|
|
// This is, however, insecure, particularly if you plan to have your code hosted in a public repository.
|
|
var token = "token";
|
|
|
|
await client.LoginAsync(TokenType.Bot, token);
|
|
await client.StartAsync();
|
|
await Task.Delay(-1);
|
|
}
|
|
private Task Log(LogMessage msg)
|
|
{
|
|
Console.WriteLine(msg.ToString());
|
|
return Task.CompletedTask;
|
|
}
|
|
} |