-
Notifications
You must be signed in to change notification settings - Fork 2
/
DiscordWrapper.cs
33 lines (33 loc) · 980 Bytes
/
DiscordWrapper.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
using System;
using System.Text;
using System.Collections.Generic;
using XCommas.Net.Objects;
using System.Threading.Tasks;
using Discord;
using Discord.WebSocket;
class DiscordWrapper
{
string _token, _msg;
DiscordSocketClient _client;
public DiscordWrapper(string token) { _token = token; }
public async Task SendMessage(string msg)
{
_msg = msg;
_client = new DiscordSocketClient();
await _client.LoginAsync(TokenType.Bot, _token);
await _client.StartAsync();
_client.Ready += _client_Ready;
//await Task.Delay(-1);
}
private async Task _client_Ready()
{
var guild = _client.GetGuild(9264831251669); //TODO: guild id Discord SERVER ID
if (guild != null)
{
var channel = guild.GetTextChannel(935498646094293); //TODO: Discord CHANNEL ID
await channel.SendMessageAsync(_msg);
}
_client.Dispose();
//Environment.Exit(0);
}
}