Skip to content

Commit

Permalink
tests(discord): fix twitchLinkedUserId value null
Browse files Browse the repository at this point in the history
  • Loading branch information
sogehige committed Apr 3, 2024
1 parent 76cd672 commit e48f200
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/integrations/discord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -574,14 +574,15 @@ class Discord extends Integration {
async message(content: string, channel: DiscordJsTextChannel, author: DiscordJsUser, msg?: DiscordJs.Message) {
chatIn(`#${channel.name}: ${content} [${author.tag}]`);
if (msg) {
const twitchLinkedUserId = (await AppDataSource.getRepository(DiscordLink).findOneBy({ discordId: author.id, userId: Not(IsNull()) }))?.userId ?? null;
eventEmitter.emit(Types.onDiscordMessage, {
channelId: channel.id,
channelName: channel.name,
userName: author.tag,
userId: author.id,
userDisplayName: author.displayName,
message: content,
twitchLinkedUserId: (await AppDataSource.getRepository(DiscordLink).findOneByOrFail({ discordId: author.id, userId: Not(IsNull()) })).userId,
channelId: channel.id,
channelName: channel.name,
userName: author.tag,
userId: author.id,
userDisplayName: author.displayName,
message: content,
twitchLinkedUserId,
});
const broadcasterUsername = variables.get('services.twitch.broadcasterUsername') as string;
if (content === this.getCommand('!_debug')) {
Expand Down

0 comments on commit e48f200

Please sign in to comment.