Skip to content

Commit a7a376d

Browse files
committed
fix #13, Add a user ID filter
1 parent 56a30f6 commit a7a376d

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ PLAY_HT_SECRET_KEY=
2626
PLAY_HT_USER_ID=
2727
PLAY_HT_VOICE= # check docs for available voices https://playht.github.io/api-docs-generator/#utra-realistic-voices
2828
OPENAI_MODEL=gpt-3.5-turbo # only if you don't have access to GPT-4
29+
#SERVE_THIS_USER_ONLY=99999999 # uncomment this if you want to only serve this user id. The ID will be printed on stdout.
2930
```
3031

3132
4. `npm install`

src/index.ts

+9
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@ bot.help((ctx) => {
2828
});
2929

3030
bot.on("voice", async (ctx) => {
31+
32+
if(process.env.SERVE_THIS_USER_ONLY && parseInt(process.env.SERVE_THIS_USER_ONLY) !== ctx.message.chat.id){
33+
console.log(`User ${ctx.message.chat.id.toString()} is not allowed to be served.`);
34+
await ctx.reply(
35+
"Sorry, you're not allowed to be served by me."
36+
);
37+
return;
38+
}
39+
3140
const voice = ctx.message.voice;
3241
await ctx.sendChatAction("typing");
3342

0 commit comments

Comments
 (0)