public static async Task <IDiscordGuildChannel> FindChannelByIdAsync(IDiscordGuild guild, string id) { if (ulong.TryParse(id, out var channelId)) { return(await guild.GetChannelAsync(channelId)); } throw new InvalidEntityException("id"); }
public static Task <IDiscordGuildChannel> FindChannelByMentionAsync(IDiscordGuild guild, string id) { if (Mention.TryParse(id, out Mention m)) { if (m.Type == MentionType.CHANNEL) { return(guild.GetChannelAsync(m.Id)); } } return(Task.FromException <IDiscordGuildChannel>(new InvalidEntityException("id"))); }