mirror of
https://gitlab.com/qwerinope/qweribot.git
synced 2026-02-04 09:26:58 +01:00
Compare commits
3 Commits
564ead12c6
...
5b5886e3a1
| Author | SHA1 | Date | |
|---|---|---|---|
| 5b5886e3a1 | |||
| 39b31e848c | |||
| d565945428 |
@@ -1,6 +1,6 @@
|
|||||||
# qweribot
|
# 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
|
## Usage
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ The `compose.yaml` file in the repository is for development.
|
|||||||
services:
|
services:
|
||||||
qweribot:
|
qweribot:
|
||||||
container_name: 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
|
environment: # The README.md has more detail on these config options
|
||||||
# Use the supplied .example.env for setting environment variables
|
# Use the supplied .example.env for setting environment variables
|
||||||
- BOT_NAME=$BOT_NAME
|
- BOT_NAME=$BOT_NAME
|
||||||
@@ -67,7 +67,7 @@ services:
|
|||||||
|
|
||||||
pocketbase:
|
pocketbase:
|
||||||
container_name: 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
|
# 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
|
# This will only impact the login on http://localhost:8090
|
||||||
#environment:
|
#environment:
|
||||||
@@ -83,7 +83,7 @@ services:
|
|||||||
|
|
||||||
### Native (not recommended)
|
### 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.
|
Also make sure the migration from `pb/migrations` is passed into the pocketbase instance.
|
||||||
|
|
||||||
Install dependencies with `bun install`.
|
Install dependencies with `bun install`.
|
||||||
|
|||||||
@@ -35,10 +35,10 @@ async function firstAccess(main = true) {
|
|||||||
if ((main && !OAUTH_CODE) || (!main && !BROADCASTER_OAUTH_CODE)) {
|
if ((main && !OAUTH_CODE) || (!main && !BROADCASTER_OAUTH_CODE)) {
|
||||||
if (main) {
|
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("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 {
|
} 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("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)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,7 @@ await authProvider.addUserForToken({
|
|||||||
refreshToken: auth.REFRESH_TOKEN,
|
refreshToken: auth.REFRESH_TOKEN,
|
||||||
expiresIn: auth.EXPIRESIN,
|
expiresIn: auth.EXPIRESIN,
|
||||||
obtainmentTimestamp: auth.OBTAINMENTTIMESTAMP
|
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) => {
|
authProvider.onRefresh(async (_id, newTokenData) => {
|
||||||
auth.ACCESS_TOKEN = newTokenData.accessToken
|
auth.ACCESS_TOKEN = newTokenData.accessToken
|
||||||
@@ -95,7 +95,7 @@ const broadcasterAuthProvider = broadcasterAuthData === undefined ? undefined :
|
|||||||
refreshToken: broadcasterAuthData.REFRESH_TOKEN,
|
refreshToken: broadcasterAuthData.REFRESH_TOKEN,
|
||||||
expiresIn: broadcasterAuthData.EXPIRESIN,
|
expiresIn: broadcasterAuthData.EXPIRESIN,
|
||||||
obtainmentTimestamp: broadcasterAuthData.OBTAINMENTTIMESTAMP
|
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) => {
|
broadcasterAuthProvider.onRefresh(async (_id, newTokenData) => {
|
||||||
broadcasterAuthData.ACCESS_TOKEN = newTokenData.accessToken
|
broadcasterAuthData.ACCESS_TOKEN = newTokenData.accessToken
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export async function lootboxReady(user: HelixUser | null): Promise<lootboxReady
|
|||||||
return { result: true, lastlootbox: 0, DBuser }
|
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() }
|
const data = { lastlootbox: new Date(Date.now()).toISOString() }
|
||||||
await pb.collection('users').update(user.id, data)
|
await pb.collection('users').update(user.id, data)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user