Example #1
0
        private static void IrcIncomingMessage(IrcController controller, IrcMessage message)
        {
            ChannelMappingConfig channelMapping = _config.ChannelMappings.FirstOrDefault(mapping => mapping.IrcChannel.ToIrcLower() == message.Parameters[0].ToIrcLower());

            if (channelMapping != null)
            {
                DiscordChannel channel = _discord.GetChannelAsync(channelMapping.DiscordChannel).GetAwaiter().GetResult();

                if (channel != null)
                {
                    channel.SendMessageAsync($"**[IRC]** <*{message.SourceNick}*> {message.Parameters[1]}");
                }
            }
        }
Example #2
0
        private static async Task DiscordIncomingMessage(MessageCreateEventArgs discordMessage)
        {
            if (discordMessage.Author.IsBot)
            {
                return;
            }

            ChannelMappingConfig channelMapping = _config.ChannelMappings.FirstOrDefault(mapping => mapping.DiscordChannel == discordMessage.Channel.Id);

            if (channelMapping != null && _controller.Channels.Any(ch => ch.Name.ToIrcLower() == channelMapping.IrcChannel.ToIrcLower()))
            {
                _controller.SendPrivMsg(channelMapping.IrcChannel, $"[Discord] <{discordMessage.Message.Author.Username}#{discordMessage.Message.Author.Discriminator}> {discordMessage.Message.Content}");
            }
        }