mirror of
https://github.com/qwerinope/qweribot.git
synced 2025-12-20 05:51:39 +01:00
disabled items can no longer be used with !use, admingive is now disableable, removed command specific intents, simplified command permission system
This commit is contained in:
13
bot/index.ts
13
bot/index.ts
@@ -1,12 +1,10 @@
|
||||
import { createAuthProvider } from "./auth";
|
||||
import { ApiClient } from "@twurple/api";
|
||||
import { EventSubHttpListener, ReverseProxyAdapter } from "@twurple/eventsub-http";
|
||||
import { commandintents } from "./commands";
|
||||
import { itemintents } from "./items";
|
||||
import { addAdmin } from "./lib/admins";
|
||||
|
||||
const CHATTERBASEINTENTS = ["user:read:chat", "user:write:chat", "user:bot"];
|
||||
const STREAMERBASEINTENTS = ["user:read:chat", "moderation:read", "channel:manage:moderators"];
|
||||
const CHATTERINTENTS = ["user:read:chat", "user:write:chat", "user:bot"];
|
||||
const STREAMERINTENTS = ["user:read:chat", "moderation:read", "channel:manage:moderators", "moderator:manage:banned_users"];
|
||||
|
||||
export const singleUserMode = process.env.CHATTER_IS_STREAMER === 'true';
|
||||
export const chatterId = process.env.CHATTER_ID ?? "";
|
||||
@@ -19,11 +17,8 @@ if (hostName === "") { console.error('Please set a EVENTSUB_HOSTNAME in the .env
|
||||
const port = Number(process.env.EVENTSUB_PORT) ?? 0;
|
||||
if (port === 0) { console.error('Please set a EVENTSUB_PORT in the .env'); process.exit(1); };
|
||||
|
||||
const streamerIntents = STREAMERBASEINTENTS.concat(commandintents, itemintents);
|
||||
const chatterIntents = singleUserMode ? CHATTERBASEINTENTS.concat(streamerIntents) : CHATTERBASEINTENTS;
|
||||
|
||||
export const chatterAuthProvider = await createAuthProvider(chatterId, chatterIntents);
|
||||
export const streamerAuthProvider = singleUserMode ? undefined : await createAuthProvider(streamerId, streamerIntents, true);
|
||||
export const chatterAuthProvider = await createAuthProvider(chatterId, singleUserMode ? CHATTERINTENTS.concat(STREAMERINTENTS) : CHATTERINTENTS);
|
||||
export const streamerAuthProvider = singleUserMode ? undefined : await createAuthProvider(streamerId, STREAMERINTENTS, true);
|
||||
|
||||
/** chatterApi should be used for sending messages, retrieving user data, etc */
|
||||
export const chatterApi = new ApiClient({ authProvider: chatterAuthProvider });
|
||||
|
||||
Reference in New Issue
Block a user