private void OnPlayerChat(TShockAPI.Hooks.PlayerChatEventArgs args) { string message = Configs.ChatMessageFormat.Replace(Config.CHARACTER_NAME_FORMAT, args.Player.Name).Replace(Config.MESSAGE_FORMAT, args.RawText); //Console.WriteLine("OnPlayerChat: {0}", message); PostMessageToDiscord(message); }
private async void PlayerHooks_PlayerChat(TShockAPI.Hooks.PlayerChatEventArgs e) { try { var channel = await DiscordBot.GetChannelAsync(Config.DiscordChannelID); await DiscordBot.SendMessageAsync(channel, e.TShockFormattedText); } catch (Exception a) { TShock.Log.ConsoleError("DiscordBridge error when sending message to discord: {0}", a.Message); } }