Added GetAFK/Default/Embed/Owner extension methods to IGuild
This commit is contained in:
@@ -8,5 +8,24 @@ namespace Discord.Extensions
|
|||||||
=> await guild.GetChannelAsync(id).ConfigureAwait(false) as ITextChannel;
|
=> await guild.GetChannelAsync(id).ConfigureAwait(false) as ITextChannel;
|
||||||
public static async Task<IVoiceChannel> GetVoiceChannelAsync(this IGuild guild, ulong id)
|
public static async Task<IVoiceChannel> GetVoiceChannelAsync(this IGuild guild, ulong id)
|
||||||
=> await guild.GetChannelAsync(id).ConfigureAwait(false) as IVoiceChannel;
|
=> await guild.GetChannelAsync(id).ConfigureAwait(false) as IVoiceChannel;
|
||||||
|
|
||||||
|
public static async Task<IVoiceChannel> GetAFKChannelAsync(this IGuild guild)
|
||||||
|
{
|
||||||
|
var afkId = guild.AFKChannelId;
|
||||||
|
if (afkId.HasValue)
|
||||||
|
return await guild.GetChannelAsync(afkId.Value).ConfigureAwait(false) as IVoiceChannel;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public static async Task<ITextChannel> GetDefaultChannelAsync(this IGuild guild)
|
||||||
|
=> await guild.GetChannelAsync(guild.DefaultChannelId).ConfigureAwait(false) as ITextChannel;
|
||||||
|
public static async Task<IVoiceChannel> GetEmbedChannelAsync(this IGuild guild)
|
||||||
|
{
|
||||||
|
var embedId = guild.EmbedChannelId;
|
||||||
|
if (embedId.HasValue)
|
||||||
|
return await guild.GetChannelAsync(embedId.Value).ConfigureAwait(false) as IVoiceChannel;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public static async Task<IGuildUser> GetOwnerAsync(this IGuild guild)
|
||||||
|
=> await guild.GetUserAsync(guild.OwnerId).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user