mirror of
https://github.com/qwerinope/qweribot.git
synced 2025-12-19 23:31:38 +01:00
fixed that @ sign breaks data from redis, minor rephrasing, tnt cheer now plays alert
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -17,6 +17,8 @@ report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
|
|||||||
|
|
||||||
# dotenv environment variable files
|
# dotenv environment variable files
|
||||||
.env
|
.env
|
||||||
|
.env.production
|
||||||
|
.env.development
|
||||||
.env.development.local
|
.env.development.local
|
||||||
.env.test.local
|
.env.test.local
|
||||||
.env.production.local
|
.env.production.local
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
## Concepts
|
## Concepts
|
||||||
|
|
||||||
|
#### Note: Cheering functionality is working but as I don't have affiliate you can't cheer. You can safely ignore all mentions of cheering.
|
||||||
|
|
||||||
### Admins
|
### Admins
|
||||||
|
|
||||||
Admins are defined by the streamer and can use special administrative commands on the bot.
|
Admins are defined by the streamer and can use special administrative commands on the bot.
|
||||||
|
|||||||
@@ -25,13 +25,13 @@ export default new Cheer('tnt', 1000, async (msg, user) => {
|
|||||||
sendMessage(`wybuh ${target?.displayName} got hit by ${user.displayName}'s TNT wybuh`),
|
sendMessage(`wybuh ${target?.displayName} got hit by ${user.displayName}'s TNT wybuh`),
|
||||||
createTimeoutRecord(user, target!, ITEMNAME),
|
createTimeoutRecord(user, target!, ITEMNAME),
|
||||||
createCheerEventRecord(user, ITEMNAME),
|
createCheerEventRecord(user, ITEMNAME),
|
||||||
playAlert({
|
|
||||||
name: 'tntExplosion',
|
|
||||||
user: user.displayName,
|
|
||||||
targets
|
|
||||||
})
|
|
||||||
]);
|
]);
|
||||||
}));
|
}));
|
||||||
|
await playAlert({
|
||||||
|
name: 'tntExplosion',
|
||||||
|
user: user.displayName,
|
||||||
|
targets
|
||||||
|
})
|
||||||
|
|
||||||
await sendMessage(`RIPBOZO ${user.displayName} exploded ${targets.length} chatter${targets.length === 1 ? '' : 's'} with their TNT RIPBOZO`);
|
await sendMessage(`RIPBOZO ${user.displayName} exploded ${targets.length} chatter${targets.length === 1 ? '' : 's'} with their TNT RIPBOZO`);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ async function parseChatMessage(msg: EventSubChannelChatMessageEvent) {
|
|||||||
if (!await isInvuln(user?.id!)) user?.setVulnerable(); // Make the user vulnerable to explosions if not marked as invuln
|
if (!await isInvuln(user?.id!)) user?.setVulnerable(); // Make the user vulnerable to explosions if not marked as invuln
|
||||||
|
|
||||||
if (!await redis.exists(`user:${user?.id}:haschatted`)) {
|
if (!await redis.exists(`user:${user?.id}:haschatted`)) {
|
||||||
await sendMessage(`Welcome ${user?.displayName}. Please note: This chat has PvP, if you get timed out that's part of the qwerinope experience. You have 10 minutes of invincibility. A full list of commands, cheer events and items can be found here: https://github.com/qwerinope/qweribot/#qweribot`);
|
await sendMessage(`Welcome ${user?.displayName}. Please note: This chat has PvP, if you get timed out that's part of the qwerinope experience. You have 10 minutes of invincibility. A full list of commands and items can be found here: https://github.com/qwerinope/qweribot/#qweribot`);
|
||||||
await redis.set(`user:${user?.id}:haschatted`, "1");
|
await redis.set(`user:${user?.id}:haschatted`, "1");
|
||||||
if (!streamerUsers.includes(msg.chatterId)) await setTemporaryInvuln(user?.id!); // This would set the invuln expiration lmao
|
if (!streamerUsers.includes(msg.chatterId)) await setTemporaryInvuln(user?.id!); // This would set the invuln expiration lmao
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -20,10 +20,11 @@ export default class User {
|
|||||||
public id!: string;
|
public id!: string;
|
||||||
public displayName!: string;
|
public displayName!: string;
|
||||||
|
|
||||||
static async initUsername(username: string): Promise<User | null> {
|
static async initUsername(dirtyUsername: string): Promise<User | null> {
|
||||||
try {
|
try {
|
||||||
const userObj = new User();
|
const userObj = new User();
|
||||||
userObj.username = username.replaceAll(/[@]/g, '');
|
const username = dirtyUsername.replaceAll(/@/gi, '');
|
||||||
|
userObj.username = username;
|
||||||
const userid = await redis.get(`userlookup:${username}`);
|
const userid = await redis.get(`userlookup:${username}`);
|
||||||
if (!userid) {
|
if (!userid) {
|
||||||
const userdata = await chatterApi.users.getUserByName(username);
|
const userdata = await chatterApi.users.getUserByName(username);
|
||||||
@@ -39,7 +40,7 @@ export default class User {
|
|||||||
};
|
};
|
||||||
return userObj;
|
return userObj;
|
||||||
} catch {
|
} catch {
|
||||||
logger.err(`Failed to initialize user with name: ${username}`);
|
logger.err(`Failed to initialize user with name: ${dirtyUsername}`);
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user