public static async Task <IChannel> GetChannelAsync(ulong channelId, [CanBeNull] Client client, params ChannelType[] types) { client = client ?? DiscordEnvironment.CurrentClient; FactoryUtils.ValidateInEnv(client); return(await FactoryUtils.GetChannelAsync(_globalCache, "IChannel", null, json => { return CreateFromJson(json, null); }, (x, json, state) => { FactoryUtils.PopulateInstance(x, json, state); }, channelId, client, types)); }
public static new async Task <ServerTextChannel> GetAsync(ulong channelId, [CanBeNull] Client client) { return(await FactoryUtils.GetChannelAsync(_cache, "ServerTextChannel", null, json => new ServerTextChannel(json, channelId), Populate, channelId, client, ChannelType.ServerText)); }
public static async Task <ChannelCategory> GetAsync(ulong categoryId, [CanBeNull] Client client) { return(await FactoryUtils.GetChannelAsync(_cache, "ChannelCategory", null, json => new ChannelCategory(json.id, categoryId), Populate, categoryId, client, ChannelType.ServerCategory)); }
public static new async Task <DirectMessageTextChannel> GetAsync(ulong channelId, [CanBeNull] Client client) { return(await FactoryUtils.GetChannelAsync(_cache, "DirectMessageTextChannel", null, json => new DirectMessageTextChannel(json, channelId), Populate, channelId, client, ChannelType.DirectMessage, ChannelType.GroupDirectMessage)); }