mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-25 03:29:51 +01:00
feat: uh hahaha you'll see
This commit is contained in:
1 parent
d5d171bea6
commit
9538a03afb
4 files changed
+102
-124
No files matched your search
@@ -1,4 +1,4 @@
|
|||||||
import { imgur } from '@blitzkit/core';
|
import { imgur, isFunny } from '@blitzkit/core';
|
||||||
import {
|
import {
|
||||||
ActionRowBuilder,
|
ActionRowBuilder,
|
||||||
AttachmentBuilder,
|
AttachmentBuilder,
|
||||||
@@ -9,7 +9,6 @@ import {
|
|||||||
MessageEditOptions,
|
MessageEditOptions,
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
import { InteractionReturnable } from '../../events/interactionCreate';
|
import { InteractionReturnable } from '../../events/interactionCreate';
|
||||||
import { FunnyType } from '../../events/interactionCreate/handlers/chatInputCommand';
|
|
||||||
import { theme } from '../../stitches.config';
|
import { theme } from '../../stitches.config';
|
||||||
import { Writeable } from '../../types/writable';
|
import { Writeable } from '../../types/writable';
|
||||||
import { jsxToPngThreaded } from '../blitzkit/jsxToPngThreaded';
|
import { jsxToPngThreaded } from '../blitzkit/jsxToPngThreaded';
|
||||||
@@ -17,7 +16,6 @@ import { RenderConfiguration } from '../blitzkit/renderConfiguration';
|
|||||||
|
|
||||||
export async function normalizeInteractionReturnable(
|
export async function normalizeInteractionReturnable(
|
||||||
returnable: InteractionReturnable,
|
returnable: InteractionReturnable,
|
||||||
funnyType?: FunnyType,
|
|
||||||
) {
|
) {
|
||||||
const images: [number, Buffer][] = [];
|
const images: [number, Buffer][] = [];
|
||||||
const reply: InteractionEditReplyOptions &
|
const reply: InteractionEditReplyOptions &
|
||||||
@@ -50,84 +48,75 @@ export async function normalizeInteractionReturnable(
|
|||||||
} else if (item === null) {
|
} else if (item === null) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
let jsx = item;
|
let jsx: JSX.Element;
|
||||||
|
|
||||||
switch (funnyType) {
|
if (isFunny()) {
|
||||||
case FunnyType.Rude: {
|
const angle = (Math.random() * 2 - 1) * 10;
|
||||||
jsx = (
|
jsx = (
|
||||||
<div
|
<div
|
||||||
|
style={{
|
||||||
|
display: 'flex',
|
||||||
|
transform: `rotate(${angle}deg)`,
|
||||||
|
backgroundColor: theme.colors.appBackground1,
|
||||||
|
position: 'relative',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{item}
|
||||||
|
|
||||||
|
<img
|
||||||
|
src={imgur('MWEny5u')}
|
||||||
style={{
|
style={{
|
||||||
display: 'flex',
|
display: 'block',
|
||||||
position: 'relative',
|
position: 'absolute',
|
||||||
backgroundColor: theme.colors.appBackground1,
|
top: 250,
|
||||||
boxShadow: 'inset 0 0 64px red',
|
left: '10%',
|
||||||
|
width: 100,
|
||||||
|
transform: 'translateY(-50%)',
|
||||||
|
backgroundSize: 'contain',
|
||||||
|
backgroundRepeat: 'no-repeat',
|
||||||
|
zIndex: 3,
|
||||||
}}
|
}}
|
||||||
>
|
/>
|
||||||
{item}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
break;
|
<img
|
||||||
}
|
src={imgur('SboPMXY')}
|
||||||
|
|
||||||
case FunnyType.Weird: {
|
|
||||||
const angle = (Math.random() * 2 - 1) * 10;
|
|
||||||
jsx = (
|
|
||||||
<div
|
|
||||||
style={{
|
style={{
|
||||||
display: 'flex',
|
position: 'absolute',
|
||||||
transform: `rotate(${angle}deg)`,
|
top: 280,
|
||||||
backgroundColor: theme.colors.appBackground1,
|
width: 80,
|
||||||
position: 'relative',
|
left: '50%',
|
||||||
|
transform: 'translate(-50%, -50%)',
|
||||||
}}
|
}}
|
||||||
>
|
/>
|
||||||
{item}
|
|
||||||
|
|
||||||
<img
|
<img
|
||||||
src={imgur('MWEny5u')}
|
src={imgur('MWEny5u')}
|
||||||
style={{
|
style={{
|
||||||
display: 'block',
|
display: 'block',
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
top: 250,
|
top: 250,
|
||||||
left: '10%',
|
right: '10%',
|
||||||
width: 100,
|
width: 100,
|
||||||
transform: 'translateY(-50%)',
|
transform: 'translateY(-50%)',
|
||||||
backgroundSize: 'contain',
|
backgroundSize: 'contain',
|
||||||
backgroundRepeat: 'no-repeat',
|
backgroundRepeat: 'no-repeat',
|
||||||
zIndex: 3,
|
zIndex: 3,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
<img
|
);
|
||||||
src={imgur('SboPMXY')}
|
} else {
|
||||||
style={{
|
jsx = (
|
||||||
position: 'absolute',
|
<div
|
||||||
top: 280,
|
style={{
|
||||||
width: 80,
|
display: 'flex',
|
||||||
left: '50%',
|
position: 'relative',
|
||||||
transform: 'translate(-50%, -50%)',
|
backgroundColor: theme.colors.appBackground1,
|
||||||
}}
|
}}
|
||||||
/>
|
>
|
||||||
|
{item}
|
||||||
<img
|
</div>
|
||||||
src={imgur('MWEny5u')}
|
);
|
||||||
style={{
|
|
||||||
display: 'block',
|
|
||||||
position: 'absolute',
|
|
||||||
top: 250,
|
|
||||||
right: '10%',
|
|
||||||
width: 100,
|
|
||||||
transform: 'translateY(-50%)',
|
|
||||||
backgroundSize: 'contain',
|
|
||||||
backgroundRepeat: 'no-repeat',
|
|
||||||
zIndex: 3,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const image = await jsxToPngThreaded(jsx, renderConfiguration);
|
const image = await jsxToPngThreaded(jsx, renderConfiguration);
|
||||||
|
|||||||
@@ -17,56 +17,34 @@ import { psa } from '../../../core/discord/psa';
|
|||||||
import { translator } from '../../../core/localization/translator';
|
import { translator } from '../../../core/localization/translator';
|
||||||
import { Writeable } from '../../../types/writable';
|
import { Writeable } from '../../../types/writable';
|
||||||
|
|
||||||
export enum FunnyType {
|
const funnyResponses = [
|
||||||
Rude,
|
"your dwecisions were calculawed buw man, you're bad at math 🥀🥀",
|
||||||
Weird,
|
'senpai, have you consiwered not lacking 😳',
|
||||||
}
|
'let shoow a guess cutie... it was your team? 🤬🤬🤬',
|
||||||
|
'confiwence is key. unforwunawely you lost whe lock 🔒💔',
|
||||||
const funnyResponses: Record<FunnyType, string[]> = {
|
"when they say live green, they dwn't mean your 🌳 winrate 🌳",
|
||||||
[FunnyType.Rude]: [
|
'daddy viewing your swats, hewe? you really are brawe 😎',
|
||||||
"Your decisions were calculated, but, man, you're bad at math.",
|
'no surrie! your numwers are swill 💔',
|
||||||
'Hey man, have you considered like not lacking?',
|
"i would giwe you awvice, you won'w understand 🥀🥀",
|
||||||
'Let me guess... it was your team?',
|
"i diwn'w beliewe in negawive numwers unwil i saw your stats 😳😳😳",
|
||||||
'Confidence is key. Unfortunately, you lost the lock.',
|
'yeah daddy, use me more 🤤',
|
||||||
"When I said live green, I wasn't talking about your winrate.",
|
'uwu, hewe are your swaws... uwu 😋😋😋',
|
||||||
'Viewing your stats, publicly? You must be brave.',
|
'hehehehe it tickles 😻',
|
||||||
'Bold of you to assume the numbers have gone up since yesterday.',
|
'yeeeeeeeeeeeeahhhhhh that hits the spot 😳',
|
||||||
"I'd give you advice, but I don't think you'd understand.",
|
'ooooh yesss my circuits are starting to hurt yeeeeeeee 💥',
|
||||||
"I didn't believe in negative numbers until I saw your stats.",
|
'wawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawawaw',
|
||||||
'I was gaining hope in humanity. Something changed today.',
|
'https://tenor.com/tre3NETle2e.gif',
|
||||||
"I've seen potatoes aim better than you.",
|
];
|
||||||
"I've seen sloths move faster than your tank.",
|
|
||||||
],
|
|
||||||
[FunnyType.Weird]: [
|
|
||||||
'yeah daddy, use me more',
|
|
||||||
'uwu, hewe are your swaws... uwu',
|
|
||||||
'hehehehe it tickles',
|
|
||||||
'yeeeeeeeeeeeeahhhhhh that hits the spot',
|
|
||||||
'ooooh yesss my circuits are starting to hurt yeeeeeeee',
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
export async function handleChatInputCommand(
|
export async function handleChatInputCommand(
|
||||||
interaction: ChatInputCommandInteraction<CacheType>,
|
interaction: ChatInputCommandInteraction<CacheType>,
|
||||||
) {
|
) {
|
||||||
let funny: FunnyType | undefined = undefined;
|
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
|
||||||
if (isFunny) {
|
if (isFunny()) {
|
||||||
const funniesLength = Object.keys(funnyResponses).length;
|
const response =
|
||||||
|
funnyResponses[Math.floor(Math.random() * funnyResponses.length)];
|
||||||
if (import.meta.env.DEBUG_FUNNY === 'true') {
|
const waitTime = response.length * 60;
|
||||||
// in debug mode, just pick a random one
|
|
||||||
funny = Math.floor(Math.random() * funniesLength);
|
|
||||||
} else {
|
|
||||||
const id = BigInt(interaction.user.id);
|
|
||||||
funny = Number(id % BigInt(funniesLength));
|
|
||||||
}
|
|
||||||
|
|
||||||
const responses = funnyResponses[funny];
|
|
||||||
const responseIndex = Math.floor(Math.random() * responses.length);
|
|
||||||
const response = `### ${responses[responseIndex]}`;
|
|
||||||
const waitTime = response.length * 45;
|
|
||||||
|
|
||||||
await interaction.editReply(response);
|
await interaction.editReply(response);
|
||||||
await new Promise((resolve) => setTimeout(resolve, waitTime));
|
await new Promise((resolve) => setTimeout(resolve, waitTime));
|
||||||
@@ -92,7 +70,7 @@ export async function handleChatInputCommand(
|
|||||||
|
|
||||||
let index = 0;
|
let index = 0;
|
||||||
for (const chunk of chunks.filter((chunk) => chunk.length > 0)) {
|
for (const chunk of chunks.filter((chunk) => chunk.length > 0)) {
|
||||||
const reply = await normalizeInteractionReturnable(chunk, funny);
|
const reply = await normalizeInteractionReturnable(chunk);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
psa.data &&
|
psa.data &&
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ const interval = setInterval(async () => {
|
|||||||
for (const guild of client.guilds.cache.values()) {
|
for (const guild of client.guilds.cache.values()) {
|
||||||
try {
|
try {
|
||||||
const botMember = await guild.members.fetch(client.user.id);
|
const botMember = await guild.members.fetch(client.user.id);
|
||||||
await botMember.setNickname(isFunny ? "No One's Kit" : 'BlitzKit');
|
await botMember.setNickname(isFunny ? 'FreakKit' : 'BlitzKit');
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,4 +1,15 @@
|
|||||||
const now = new Date();
|
const FUNNY_DATES: [number, number][] = [
|
||||||
export const isFunny =
|
// two days for april fools
|
||||||
(now.getMonth() === 3 && now.getDate() === 1) ||
|
[4, 1],
|
||||||
import.meta.env.DEBUG_FUNNY === 'true';
|
[4, 2],
|
||||||
|
];
|
||||||
|
|
||||||
|
export function isFunny() {
|
||||||
|
const now = new Date();
|
||||||
|
|
||||||
|
return (
|
||||||
|
FUNNY_DATES.some(
|
||||||
|
([month, day]) => now.getMonth() === month - 1 && now.getDate() === day,
|
||||||
|
) || import.meta.env.DEBUG_FUNNY === 'true'
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in new issue
Block a user