mirror of
https://gitlab.com/qwerinope/qweribot.git
synced 2026-02-04 13:56:57 +01:00
change sendMessage wrapper, migrate from websocket connection to webhook for EventSub (reverse proxy)
This commit is contained in:
@@ -37,6 +37,6 @@ export { intents };
|
||||
import { singleUserMode, chatterApi, chatterId, streamerId } from "..";
|
||||
|
||||
/** Helper function to send a message to the stream */
|
||||
export const sendMessage = async (message: string, options?: HelixSendChatMessageParams) => {
|
||||
singleUserMode ? await chatterApi.chat.sendChatMessage(streamerId, message, options) : chatterApi.asUser(chatterId, async newapi => newapi.chat.sendChatMessage(streamerId, message, options));
|
||||
export const sendMessage = async (message: string, replyParentMessageId?: string) => {
|
||||
singleUserMode ? await chatterApi.chat.sendChatMessage(streamerId, message, { replyParentMessageId }) : chatterApi.asUser(chatterId, async newapi => newapi.chat.sendChatMessage(streamerId, message, { replyParentMessageId }));
|
||||
};
|
||||
|
||||
@@ -5,6 +5,6 @@ export default new Command('ping',
|
||||
['ping'],
|
||||
[],
|
||||
async msg => {
|
||||
await sendMessage('pong!', { replyParentMessageId: msg.messageId });
|
||||
await sendMessage('pong!', msg.messageId);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -6,12 +6,11 @@ export default new Command('yabai',
|
||||
['yabai', 'goon'],
|
||||
[],
|
||||
async msg => {
|
||||
const replyobj: HelixSendChatMessageParams = { replyParentMessageId: msg.messageId }
|
||||
const rand = Math.floor(Math.random() * 100) + 1;
|
||||
if (rand < 25) await sendMessage(`${rand}% yabai! chumpi4Bewwy`, replyobj);
|
||||
else if (rand < 50) await sendMessage(`${rand}% yabai chumpi4Hustle`, replyobj);
|
||||
else if (rand === 50) await sendMessage(`${rand}% yabai kiawaBlank`, replyobj);
|
||||
else if (rand < 80) await sendMessage(`${rand}% yabai chumpi4Shock`, replyobj);
|
||||
else await sendMessage(`${rand}% yabai chumpi4Jail`, replyobj);
|
||||
if (rand < 25) await sendMessage(`${rand}% yabai! chumpi4Bewwy`, msg.messageId);
|
||||
else if (rand < 50) await sendMessage(`${rand}% yabai chumpi4Hustle`, msg.messageId);
|
||||
else if (rand === 50) await sendMessage(`${rand}% yabai kiawaBlank`, msg.messageId);
|
||||
else if (rand < 80) await sendMessage(`${rand}% yabai chumpi4Shock`, msg.messageId);
|
||||
else await sendMessage(`${rand}% yabai chumpi4Jail`, msg.messageId);
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user