Archived
1
0
Fork 0

server stuff

This commit is contained in:
flash 2017-05-21 03:50:37 +02:00
parent 8a22b05cc4
commit 597c350b9c
3 changed files with 11 additions and 5 deletions

View file

@ -469,6 +469,7 @@ namespace Maki
server = servers.Find(x => x.Id == guild.Id);
server.Name = guild.Name;
server.OwnerId = guild.OwnerId ?? 0;
server.IconHash = guild.IconHash;
}
if (guild.Channels != null)
@ -538,8 +539,9 @@ namespace Maki
DiscordServer server = servers.Find(x => x.Id == guild.Id);
server.Name = guild.Name;
/*server.OwnerId = guild.OwnerId;
server.VoiceRegionId = guild.VoiceRegionId;
server.OwnerId = guild.OwnerId ?? 0;
server.IconHash = guild.IconHash;
/*server.VoiceRegionId = guild.VoiceRegionId;
server.AfkChannelId = guild.AfkChannelId;
server.AfkTimeout = guild.AfkTimeout;
server.EmbedEnabled = guild.EmbedEnabled;

View file

@ -14,12 +14,15 @@ namespace Maki
public string Name { get; internal set; }
public ulong OwnerId { get; internal set; }
internal string IconHash;
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 DiscordChannel[] TextChannels => client.channels.Where(x => x.Server == this && x.Type == DiscordChannelType.Text).OrderByDescending(x => x.Position).ToArray();
public DiscordChannel[] VoiceChannels => client.channels.Where(x => x.Server == this && x.Type == DiscordChannelType.Voice).OrderByDescending(x => x.Position).ToArray();
public DiscordRole[] Roles => client.roles.Where(x => x.Server == this).OrderByDescending(x => x.Position).ToArray();
public string Icon(string ext = @"png", int size = 128) => RestEndpoints.CDN_URL + $@"/icons/{Id}/{IconHash}.{ext}?size={size}";
internal DiscordServer(Discord discord, Guild guild)
{
@ -27,6 +30,7 @@ namespace Maki
Id = guild.Id;
Name = guild.Name;
OwnerId = guild.OwnerId ?? ulong.MinValue;
IconHash = guild.IconHash;
}
public DiscordRole CreateRole(string name = null, DiscordPermission perms = DiscordPermission.None, DiscordColour colour = null, bool hoist = false, bool mentionable = false)

View file

@ -25,7 +25,7 @@ namespace Maki
private string avatarHash;
public string Avatar(string ext = @"jpg", int size = 128) => RestEndpoints.CDN_URL + $@"/avatars/{Id}/{avatarHash}.{ext}?size={size}";
public string Avatar(string ext = @"png", int size = 128) => RestEndpoints.CDN_URL + $@"/avatars/{Id}/{avatarHash}.{ext}?size={size}";
internal DiscordUser(Discord discord, User user)
{