Skip to content

Commit

Permalink
Send twitch chat source url
Browse files Browse the repository at this point in the history
  • Loading branch information
HitomaruKonpaku committed Nov 14, 2023
1 parent 7d02f60 commit e42e7d1
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { forwardRef, Inject, Injectable } from '@nestjs/common'
import { bold, inlineCode } from 'discord.js'
import { bold, hideLinkEmbed, hyperlink, inlineCode, spoiler } from 'discord.js'
import { ChatUserstate, Client } from 'tmi.js'
import { baseLogger } from '../../../../logger'
import { DiscordService } from '../../../discord/service/discord.service'
import { TrackTwitchChat } from '../../../track/model/track-twitch-chat.entity'
import { TrackTwitchChatService } from '../../../track/service/track-twitch-chat.service'
import { TwitchUtil } from '../../util/twitch.util'
import { TwitchUserService } from '../data/twitch-user.service'

@Injectable()
Expand Down Expand Up @@ -157,7 +158,11 @@ export class TwitchChatTrackingService {
return
}

const msgContent = `💬 ${bold(inlineCode(userstate['display-name']))} 📄 ${inlineCode(message)}`
const srcUsername = channel.replace(/^#/, '')
const srcUrl = TwitchUtil.getUserUrl(srcUsername)
const msgSrc = spoiler(hyperlink('src', hideLinkEmbed(srcUrl)))
const msgAuthor = bold(inlineCode(userstate['display-name']))
const msgContent = `${msgSrc} 💬 ${msgAuthor} 📄 ${inlineCode(message)}`
const content = [trackItem.discordMessage, msgContent]
.filter((v) => v)
.join('\n') || null
Expand Down

0 comments on commit e42e7d1

Please sign in to comment.