Skip to content

Commit

Permalink
feat: notification camera & stream start/end (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuimarudev authored Feb 19, 2024
1 parent 1f5da4c commit 5b5f1c7
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/voice/room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,35 @@ export default class Room {

await this.speak(message);
}

if (
oldState &&
oldState.channel_id === this.voiceChannelId &&
newState.channel_id === this.voiceChannelId
) {
let content = "";

if (oldState.self_stream !== newState.self_stream)
content = `画面配信を${newState.self_stream ? "開始" : "終了"}`;

if (oldState.self_video !== newState.self_video)
content = `カメラ配信を${newState.self_video ? "開始" : "終了"}`;

const message = constructSpeakableMessage(
`${
members.get(newState.guild_id, newState.user_id)?.nick ??
users.get(newState.user_id)?.global_name ??
users.get(newState.user_id)?.username ??
"不明なユーザー"
}${content}しました`,
newState.user_id,
newState.guild_id,
);

if (!message) return;

await this.speak(message);
}
}
}

Expand Down

0 comments on commit 5b5f1c7

Please sign in to comment.