debug stuff i think
This commit is contained in:
parent
ec096e79c4
commit
0c2bab4a94
3 changed files with 23 additions and 12 deletions
|
@ -21,6 +21,12 @@ namespace Maki
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Discord : IDisposable
|
public class Discord : IDisposable
|
||||||
{
|
{
|
||||||
|
// temporary, whether gateway data should be written to a file
|
||||||
|
public bool LogGateway = false;
|
||||||
|
|
||||||
|
// temporary, whether rest data should be written to the console
|
||||||
|
public bool LogRest = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Discord Gateway/API version we're targeting
|
/// Discord Gateway/API version we're targeting
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -809,6 +815,8 @@ namespace Maki
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ShardManager_OnSocketMessage(GatewayShard shard, string text)
|
private void ShardManager_OnSocketMessage(GatewayShard shard, string text)
|
||||||
|
{
|
||||||
|
if (LogGateway)
|
||||||
{
|
{
|
||||||
if (!Directory.Exists("Json"))
|
if (!Directory.Exists("Json"))
|
||||||
Directory.CreateDirectory("Json");
|
Directory.CreateDirectory("Json");
|
||||||
|
@ -821,6 +829,7 @@ namespace Maki
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#region IDisposable
|
#region IDisposable
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,10 @@ namespace Maki
|
||||||
public string Name { get; internal set; }
|
public string Name { get; internal set; }
|
||||||
public ulong OwnerId { get; internal set; }
|
public ulong OwnerId { get; internal set; }
|
||||||
|
|
||||||
public DiscordMember Owner => Members.Where(x => x.User.Id == OwnerId).FirstOrDefault();
|
|
||||||
public DiscordMember[] Members => client.members.Where(x => x.Server == this).ToArray();
|
public DiscordMember[] Members => client.members.Where(x => x.Server == this).ToArray();
|
||||||
|
public DiscordMember Owner => Members.Where(x => x.User.Id == OwnerId).FirstOrDefault();
|
||||||
|
public DiscordMember Me => Members.Where(x => x.User == client.Me).FirstOrDefault();
|
||||||
|
|
||||||
public DiscordRole[] Roles => client.roles.Where(x => x.Server == this).ToArray();
|
public DiscordRole[] Roles => client.roles.Where(x => x.Server == this).ToArray();
|
||||||
|
|
||||||
internal DiscordServer(Discord discord, Guild guild)
|
internal DiscordServer(Discord discord, Guild guild)
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
using Maki.Structures.Rest;
|
using Maki.Structures.Rest;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
@ -112,6 +111,7 @@ namespace Maki.Rest
|
||||||
response.ErrorMessage = error.Message;
|
response.ErrorMessage = error.Message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (client.LogRest)
|
||||||
Console.WriteLine(response.RawResponse);
|
Console.WriteLine(response.RawResponse);
|
||||||
|
|
||||||
if (response.Status == 200)
|
if (response.Status == 200)
|
||||||
|
|
Reference in a new issue