public void OnPrivateMessage(BanchoSendIrcMessageArgs args) { if (!_ps.TryGet(args.Message.ChannelTarget, out var target)) { args.Pr.Push(new Announce("This User is Offline!")); return; } Logger.Info( $"{LCol.RED}{args.Pr.User.UserName}", $"{LCol.PURPLE}( {args.Pr.User.Id} )", $"{LCol.YELLOW}(Private Message)", $"{LCol.WHITE}=>", $"{LCol.RED}{args.Pr.User.UserName}", $"{LCol.PURPLE}( {args.Pr.User.Id} )" ); var newMsg = new MessageStruct { Username = args.Pr.User.UserName, Message = _filter.Filter(args.Message.Message), ChannelTarget = args.Pr.User.UserName, SenderId = args.Pr.User.Id, }; target.Push(new SendIrcMessage(newMsg)); }
public void OnPublicMessage(BanchoSendIrcMessageArgs args) { Channel channel; switch (args.Message.ChannelTarget) { case "#spectator": channel = args.Pr.Spectator?.Channel; break; case "#multiplayer": channel = args.Pr.ActiveMatch?.Channel; break; default: _cs.TryGet(args.Message.ChannelTarget, out channel); break; } if (channel == null) { args.Pr.Push(new ChannelRevoked(args.Message.ChannelTarget)); return; } Logger.Info( $"{LCol.RED}{args.Pr.User.UserName}", $"{LCol.PURPLE}( {args.Pr.User.Id} )", $"{LCol.YELLOW}{args.Message.Message}", $"{LCol.WHITE}=>", $"{LCol.RED}{channel.Name}" ); args.Message.Username = args.Pr.User.UserName; args.Message.Message = _filter.Filter(args.Message.Message); channel.Push(new SendIrcMessage(args.Message), args.Pr); }