Compare commits

...

3 Commits

3 changed files with 9 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
# qweribot
A copy of twitch bot 'MandooBot' in [eddie's stream](twitch.tv/eddie).
A copy of twitch bot 'MandooBot' in [eddie's stream](https://twitch.tv/eddie).
## Usage
@@ -46,7 +46,7 @@ The `compose.yaml` file in the repository is for development.
services:
qweribot:
container_name: qweribot
image: ghcr.io/qwerinope/qweribot:latest
image: ghcr.io/qwerinope/qweribot-bot:latest
environment: # The README.md has more detail on these config options
# Use the supplied .example.env for setting environment variables
- BOT_NAME=$BOT_NAME
@@ -67,7 +67,7 @@ services:
pocketbase:
container_name: pocketbase
image: ghcr.io/qwerinope/pocketbase-qweribot:latest
image: ghcr.io/qwerinope/qweribot-pocketbase:latest
# If environment variables are left empty, the default user & password will be: test@example.com and 1234567890
# This will only impact the login on http://localhost:8090
#environment:
@@ -83,7 +83,7 @@ services:
### Native (not recommended)
If you wish to run the bot not using docker, you will need to set up a [pocketbase](pocketbase.io) instance, and point the `PBURL` environment variable to the correct address.
If you wish to run the bot not using docker, you will need to set up a [pocketbase](https://pocketbase.io) instance, and point the `PBURL` environment variable to the correct address.
Also make sure the migration from `pb/migrations` is passed into the pocketbase instance.
Install dependencies with `bun install`.

View File

@@ -35,10 +35,10 @@ async function firstAccess(main = true) {
if ((main && !OAUTH_CODE) || (!main && !BROADCASTER_OAUTH_CODE)) {
if (main) {
console.error("No 'OAUTH_CODE' provided. To get the code, please visit this URL, authorize the bot and copy the 'code' from the return URL.")
console.error(`https://id.twitch.tv/oauth2/authorize?client_id=${CLIENT_ID}&redirect_uri=${REDIRECT_URI}&response_type=code&scope=chat:read+chat:edit+moderator:manage:banned_users+moderation:read+channel:manage:polls`)
console.error(`https://id.twitch.tv/oauth2/authorize?client_id=${CLIENT_ID}&redirect_uri=${REDIRECT_URI}&response_type=code&scope=chat:read+chat:edit+moderator:manage:banned_users+moderation:read+channel:manage:polls+channel:read:polls`)
} else {
console.error("No 'BROADCASTER_OAUTH_CODE' provided. To get the code, please make the broadcaster visit the following URL, and get them to return the 'code' from the return URL.")
console.error(`https://id.twitch.tv/oauth2/authorize?client_id=${CLIENT_ID}&redirect_uri=${REDIRECT_URI}&response_type=code&scope=moderator:manage:banned_users+moderation:read+channel:manage:moderators+channel:manage:polls`)
console.error(`https://id.twitch.tv/oauth2/authorize?client_id=${CLIENT_ID}&redirect_uri=${REDIRECT_URI}&response_type=code&scope=moderator:manage:banned_users+moderation:read+channel:manage:moderators+channel:manage:polls+channel:read:polls`)
}
process.exit(1)
}
@@ -69,7 +69,7 @@ await authProvider.addUserForToken({
refreshToken: auth.REFRESH_TOKEN,
expiresIn: auth.EXPIRESIN,
obtainmentTimestamp: auth.OBTAINMENTTIMESTAMP
}, ['chat', 'moderator:manage:banned_users', 'channel:manage:polls', 'channel:manage:moderators'])
}, ['chat', 'moderator:manage:banned_users', 'channel:manage:polls', 'channel:read:polls', 'channel:manage:moderators'])
authProvider.onRefresh(async (_id, newTokenData) => {
auth.ACCESS_TOKEN = newTokenData.accessToken
@@ -95,7 +95,7 @@ const broadcasterAuthProvider = broadcasterAuthData === undefined ? undefined :
refreshToken: broadcasterAuthData.REFRESH_TOKEN,
expiresIn: broadcasterAuthData.EXPIRESIN,
obtainmentTimestamp: broadcasterAuthData.OBTAINMENTTIMESTAMP
}, ['moderator:manage:banned_users', 'moderation:read', 'channel:manage:moderators', 'channel:manage:polls'])
}, ['moderator:manage:banned_users', 'moderation:read', 'channel:manage:moderators', 'channel:manage:polls', 'channel:read:polls'])
broadcasterAuthProvider.onRefresh(async (_id, newTokenData) => {
broadcasterAuthData.ACCESS_TOKEN = newTokenData.accessToken

View File

@@ -16,7 +16,7 @@ export async function lootboxReady(user: HelixUser | null): Promise<lootboxReady
return { result: true, lastlootbox: 0, DBuser }
}
export async function resetLootboxTimer(user: any) {
export async function resetLootboxTimer(user: User) {
const data = { lastlootbox: new Date(Date.now()).toISOString() }
await pb.collection('users').update(user.id, data)
}