34 lines
849 B
C#
34 lines
849 B
C#
using Discord.Managers;
|
|
|
|
namespace Discord
|
|
{
|
|
public class Client
|
|
{
|
|
public Action<Client>? Ready;
|
|
public Action<Client, Message>? MessageCreate;
|
|
|
|
public string Token;
|
|
public User? User;
|
|
public UserManager Users;
|
|
public ChannelManager Channels;
|
|
|
|
public REST.Client Rest;
|
|
private Gateway.Client Gateway;
|
|
|
|
public Client(string token)
|
|
{
|
|
this.Token = token;
|
|
this.Rest = new REST.Client(token);
|
|
this.Gateway = new Gateway.Client(this);
|
|
this.Users = new UserManager(this);
|
|
this.Channels = new ChannelManager(this);
|
|
}
|
|
|
|
public async Task Login()
|
|
{
|
|
User = await Users.Get("@me");
|
|
await Gateway.Connect();
|
|
await Gateway.EventLoop();
|
|
}
|
|
}
|
|
} |