public static async Task StreamOffline(string beamId) { IMixerManager mixerManager = new MixerManager(); var stream = await mixerManager.GetChannelByName(beamId); var live = BotFiles.GetCurrentlyLiveBeamChannels().FirstOrDefault(x => x.Name == beamId); if (live == null) { return; } foreach (var message in live.ChannelMessages) { var serverFile = BotFiles.GetConfiguredServers().FirstOrDefault(x => x.Id == message.GuildId); if (serverFile == null) { continue; } if (serverFile.DeleteWhenOffline) { await DiscordHelper.DeleteMessage(message.GuildId, message.ChannelId, message.MessageId); } else { await DiscordHelper.SetOfflineStream(message.GuildId, serverFile.StreamOfflineMessage, message.ChannelId, message.MessageId); } BotFiles.DeleteLiveBeamChannel(beamId); } }