mirror of
https://github.com/qwerinope/qweribot.git
synced 2025-12-19 00:51:37 +01:00
add randomchatter command, change silverbullet roulette timing
This commit is contained in:
@@ -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());
|
||||
};
|
||||
|
||||
22
src/commands/randomchatter.ts
Normal file
22
src/commands/randomchatter.ts
Normal file
@@ -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);
|
||||
}
|
||||
});
|
||||
@@ -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[] = [
|
||||
{
|
||||
|
||||
@@ -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());
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user