Пример #1
0
        protected override async Task UpdateInternal(DiscordLink plugin, DLEventType trigger, object data)
        {
            if (!(data is ChatSent message))
            {
                return;
            }

            // Remove the # character from the start.
            var channelLink = plugin.GetLinkForDiscordChannel(message.Tag.Substring(1));
            var channel     = channelLink?.DiscordChannel;
            var guild       = channelLink?.DiscordGuild;

            if (string.IsNullOrWhiteSpace(channel) || string.IsNullOrWhiteSpace(guild))
            {
                return;
            }

            if (channelLink.Direction == ChatSyncDirection.EcoToDiscord || channelLink.Direction == ChatSyncDirection.Duplex)
            {
                ForwardMessageToDiscordChannel(plugin, message, channel, guild, channelLink.HereAndEveryoneMentionPermission);
            }
        }