diff --git a/README.md b/README.md index 3605c6e..a0bc28d 100644 --- a/README.md +++ b/README.md @@ -149,6 +149,7 @@ COMMAND|FUNCTION|USER|ALIASES|DISABLEABLE `qbucksleaderboard`|Get the current qbucks leaderboard [(info)](#leaderboards)|anyone|`qbucksleaderboard` `moneyleaderboard` `baltop`|:white_check_mark: `anivtimeouts`|Get the amount of timeouts, dodges and dodge percentage from aniv timeouts [(info)](#aniv-timeouts)|anyone|`anivtimeouts` `anivtimeout`|:white_check_mark: `racetime`|Get the racetime.gg room the streamer is currently in. Needs to have twitch linked to racetime account|anyone|`racetime` `raceroom`|:white_check_mark: +`randomchatter`|Get a random chatter for whatever reason|moderators|`randomchatter`|:white_check_mark: ### Qweribucks/Item commands diff --git a/src/cheers/execute.ts b/src/cheers/execute.ts index eda6584..3a6e3c1 100644 --- a/src/cheers/execute.ts +++ b/src/cheers/execute.ts @@ -32,7 +32,7 @@ export default new Cheer('execute', 666, async (msg, user) => { targets: users.map(a => a.displayName), finaltarget: target.displayName }); - await new Promise((res, _) => setTimeout(res, 6000)); + await new Promise((res, _) => setTimeout(res, 4000)); } else { target = await User.initUsername(args[0].toLowerCase()); }; diff --git a/src/commands/randomchatter.ts b/src/commands/randomchatter.ts new file mode 100644 index 0000000..6e77ca0 --- /dev/null +++ b/src/commands/randomchatter.ts @@ -0,0 +1,22 @@ +import { api } from "index"; +import { Command, sendMessage } from "lib/commandUtils"; +import { streamerId } from "main"; +import { playAlert } from "web/alerts/serverFunctions"; + +export default new Command({ + name: 'randomchatter', + aliases: ['randomchatter'], + usertype: 'moderator', + execution: async (msg) => { + const data = await api.chat.getChatters(streamerId).then(a => a.data); + const target = data[Math.floor(Math.random() * data.length)]; + await playAlert({ + name: 'blastinRoulette', + user: msg.chatterName, + targets: data.map(a => a.userDisplayName), + finaltarget: target?.userDisplayName + }); + await new Promise((res, _) => setTimeout(res, 4000)); + await sendMessage(`${target?.userDisplayName}`, msg.messageId); + } +}); diff --git a/src/index.ts b/src/index.ts index 68ce93a..a43abad 100644 --- a/src/index.ts +++ b/src/index.ts @@ -35,7 +35,7 @@ const eventSubPath = process.env.EVENTSUB_PATH; await connectionCheck(); const CHATTERINTENTS = ["user:read:chat", "user:write:chat", "user:bot", "user:manage:whispers"]; -const STREAMERINTENTS = ["channel:bot", "user:read:chat", "moderation:read", "channel:manage:moderators", "moderator:manage:chat_messages", "moderator:manage:banned_users", "bits:read", "channel:moderate", "moderator:manage:shoutouts", "channel:read:subscriptions", "channel:manage:redemptions"]; +const STREAMERINTENTS = ["channel:bot", "user:read:chat", "moderation:read", "moderator:read:chatters", "channel:manage:moderators", "moderator:manage:chat_messages", "moderator:manage:banned_users", "bits:read", "channel:moderate", "moderator:manage:shoutouts", "channel:read:subscriptions", "channel:manage:redemptions"]; const users: authProviderInstructions[] = [ { diff --git a/src/items/silverbullet.ts b/src/items/silverbullet.ts index 4b15e51..7d87e63 100644 --- a/src/items/silverbullet.ts +++ b/src/items/silverbullet.ts @@ -8,6 +8,7 @@ import { timeout } from "lib/timeout"; import { playAlert } from "web/alerts/serverFunctions"; import User from "user"; import { redis } from "lib/redis"; +import { streamerId } from "main"; const ITEMNAME = 'silverbullet'; @@ -26,7 +27,7 @@ export default new Item({ await user.setLock(); const userObj = await getUserRecord(user); - if (userObj.inventory[ITEMNAME]! < 1) { await sendMessage(`You don't have any silver bullets!`, msg.messageId); await user.clearLock(); return; }; + if (userObj.inventory[ITEMNAME]! < 1 && user.id !== streamerId) { await sendMessage(`You don't have any silver bullets!`, msg.messageId); await user.clearLock(); return; }; let target: User | null; if (!messagequery[0]) { @@ -46,7 +47,7 @@ export default new Item({ targets: users.map(a => a.displayName), finaltarget: target.displayName }); - await new Promise((res, _) => setTimeout(res, 6000)); + await new Promise((res, _) => setTimeout(res, 4000)); } else { target = await User.initUsername(messagequery[0].toLowerCase()); };