public override async Task SendSimpleMessageAsync(string id, string text, KeyboardTypes keyboardType) { if (ulong.TryParse(id, out var userId) && !string.IsNullOrEmpty(text)) { var sendText = text + DiscordKeyboardBuilder.GetKeyboard(keyboardType); if (client.GetChannel(userId) is ISocketMessageChannel userChannel) { await userChannel.SendMessageAsync(sendText); } } else { throw new ArgumentException("Chat or text is invalid"); } }
public override async Task SendMusicMessageAsync(string id, string text, MusicTrack track, KeyboardTypes keyboardType) { var musicVersion = track.MusicVersions.SingleOrDefault(t => t.Extension == "ogg"); var sendText = text + DiscordKeyboardBuilder.GetKeyboard(keyboardType); if (musicVersion == null) { throw new ArgumentNullException($"В базе нет версии ogg трека - {track.Id}"); } if (ulong.TryParse(id, out var userId)) { if (client.GetChannel(userId) is ISocketMessageChannel userChannel) { await userChannel.SendFileAsync(musicVersion.TrackPath, sendText); } } else { throw new ArgumentException("Chat or text is invalid"); } }