make the test program work again
This commit is contained in:
parent
ca02bba839
commit
af80136e57
2 changed files with 8 additions and 20 deletions
|
@ -36,11 +36,11 @@
|
|||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Newtonsoft.Json.10.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
|
||||
<HintPath>$(SolutionDir)\packages\Newtonsoft.Json.10.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="websocket-sharp, Version=1.0.2.59611, Culture=neutral, PublicKeyToken=5660b08a1845a91e, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\WebSocketSharp.1.0.3-rc11\lib\websocket-sharp.dll</HintPath>
|
||||
<HintPath>$(SolutionDir)\packages\WebSocketSharp.1.0.3-rc11\lib\websocket-sharp.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -12,17 +12,8 @@ namespace MakiTest
|
|||
string[] tokenInfo = File.ReadAllLines("token.txt");
|
||||
string token = tokenInfo[0] ?? string.Empty;
|
||||
DiscordTokenType type = (tokenInfo[1] ?? string.Empty) == "user" ? DiscordTokenType.User : DiscordTokenType.Bot;
|
||||
string username = string.Empty;
|
||||
string password = string.Empty;
|
||||
string mfaCode = null;
|
||||
|
||||
if (tokenInfo.Length >= 5)
|
||||
{
|
||||
username = tokenInfo[2];
|
||||
password = tokenInfo[3];
|
||||
mfaCode = tokenInfo[4];
|
||||
}
|
||||
else if (string.IsNullOrEmpty(token))
|
||||
if (string.IsNullOrEmpty(token))
|
||||
throw new Exception("Please set a token or login details.");
|
||||
|
||||
using (ManualResetEvent mre = new ManualResetEvent(false))
|
||||
|
@ -30,10 +21,7 @@ namespace MakiTest
|
|||
{
|
||||
Console.CancelKeyPress += (s, e) => { e.Cancel = true; mre.Set(); };
|
||||
|
||||
if (!string.IsNullOrEmpty(token))
|
||||
client.Connect(token, type);
|
||||
else
|
||||
client.Connect(username, password, mfaCode);
|
||||
client.Connect(token, type);
|
||||
|
||||
client.OnReady += (me) => Console.WriteLine($"Connected as {me.NameWithTag} ({me.Id})!");
|
||||
client.OnServerCreate += (serv) => Console.WriteLine($"Server {serv.Name} ({serv.Id}) created.");
|
||||
|
@ -48,13 +36,13 @@ namespace MakiTest
|
|||
client.OnMemberAdd += (member) => Console.WriteLine($"{member.NameWithTag} ({member.User.Id}) joined {member.Server.Name} ({member.Server.Id}).");
|
||||
client.OnMemberRemove += (member) => Console.WriteLine($"{member.NameWithTag} ({member.User.Id}) left {member.Server.Name} ({member.Server.Id}).");
|
||||
client.OnMemberUpdate += (member) => Console.WriteLine($"{member.NameWithTag} ({member.User.Id}) was updated for {member.Server.Name} ({member.Server.Id}).");
|
||||
client.OnMessageCreate += (msg) => Console.WriteLine($"{msg.Sender.NameWithTag} ({msg.Sender.User.Id}) in {msg.Channel.Server.Name} ({msg.Channel.Server.Id}) #{msg.Channel.Name} ({msg.Channel.Id}) {msg.Id}: {msg.Text}");
|
||||
client.OnMessageUpdate += (msg) => Console.WriteLine($"{msg.Sender.NameWithTag} ({msg.Sender.User.Id}) in {msg.Channel.Server.Name} ({msg.Channel.Server.Id}) #{msg.Channel.Name} ({msg.Channel.Id}) {msg.Id}: {msg.Text}");
|
||||
client.OnMessageDelete += (msg) => Console.WriteLine($"{msg.Sender.NameWithTag} ({msg.Sender.User.Id}) in {msg.Channel.Server.Name} ({msg.Channel.Server.Id}) #{msg.Channel.Name} ({msg.Channel.Id}) {msg.Id}");
|
||||
client.OnMessageCreate += (msg) => Console.WriteLine($"{msg.User.NameWithTag} ({msg.User.Id}) in {msg.Channel.Server.Name} ({msg.Channel.Server.Id}) #{msg.Channel.Name} ({msg.Channel.Id}) {msg.Id}: {msg.Text}");
|
||||
client.OnMessageUpdate += (msg) => Console.WriteLine($"{msg.User.NameWithTag} ({msg.User.Id}) in {msg.Channel.Server.Name} ({msg.Channel.Server.Id}) #{msg.Channel.Name} ({msg.Channel.Id}) {msg.Id}: {msg.Text}");
|
||||
client.OnMessageDelete += (msg) => Console.WriteLine($"{msg.User.NameWithTag} ({msg.User.Id}) in {msg.Channel.Server.Name} ({msg.Channel.Server.Id}) #{msg.Channel.Name} ({msg.Channel.Id}) {msg.Id}");
|
||||
client.OnRoleCreate += (role) => Console.WriteLine($"Role {role.Name} ({role.Id}) created in {role.Server.Name} ({role.Server.Id}).");
|
||||
client.OnRoleUpdate += (role) => Console.WriteLine($"Role {role.Name} ({role.Id}) updated in {role.Server.Name} ({role.Server.Id}).");
|
||||
client.OnRoleDelete += (role) => Console.WriteLine($"Role {role.Name} ({role.Id}) deleted in {role.Server.Name} ({role.Server.Id}).");
|
||||
client.OnTypingStart += (user, chan) => Console.WriteLine($"{user.NameWithTag} ({user.User.Id}) started typing in #{chan.Name} ({chan.Id}) in {user.Server.Name} ({user.Server.Id})");
|
||||
client.OnTypingStart += (user, chan) => Console.WriteLine($"{user.NameWithTag} ({user.Id}) started typing in #{chan.Name} ({chan.Id}) in {chan.Server.Name} ({chan.Server.Id})");
|
||||
client.OnPresenceUpdate += (user) => Console.WriteLine($"Presence of {user.NameWithTag} ({user.User.Id}) update for {user.Server.Name} ({user.Server.Id}).");
|
||||
client.OnUserUpdate += (user) => Console.WriteLine($"{user.NameWithTag} ({user.Id}) updated.");
|
||||
|
||||
|
|
Reference in a new issue