Skip to content

Commit

Permalink
feat: wonderhoy
Browse files Browse the repository at this point in the history
  • Loading branch information
leomotors committed Nov 25, 2023
1 parent c656bcd commit 3b7c826
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 23 deletions.
1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Bots Gulag

Run ~~5~~ 6 Discord Bots in the same process to make server feels active and not dead.
(It actually dead :skull:)
Run ~~five~~ six Discord Bots in the same process to make server feels active and not dead.
(It actually dead 💀)

## Feature: Help you win argument by Emu Ootori

![](./images/emudemo.png)

(Address and IP Leak 😱)
Binary file modified bun.lockb
Binary file not shown.
Binary file added images/emudemo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bots-gulag",
"version": "3.1.0",
"version": "3.2.0",
"description": "Bots",
"repository": "https://github.com/CarelessDev/bots-gulag",
"type": "module",
Expand All @@ -14,20 +14,20 @@
"dependencies": {
"chalk": "5.3.0",
"cocoa-discord": "3.1.0",
"discord.js": "14.13.0",
"discord.js": "14.14.1",
"zod": "3.22.4"
},
"devDependencies": {
"@leomotors/config": "0.11.0",
"@trivago/prettier-plugin-sort-imports": "4.2.0",
"@typescript-eslint/eslint-plugin": "6.8.0",
"@typescript-eslint/parser": "6.8.0",
"eslint": "8.51.0",
"@trivago/prettier-plugin-sort-imports": "4.3.0",
"@typescript-eslint/eslint-plugin": "6.12.0",
"@typescript-eslint/parser": "6.12.0",
"eslint": "8.54.0",
"eslint-config-prettier": "9.0.0",
"eslint-plugin-import": "2.28.1",
"eslint-plugin-import": "2.29.0",
"eslint-plugin-prettier": "5.0.1",
"eslint-plugin-sort-destructure-keys": "1.5.0",
"prettier": "3.0.3",
"typescript": "5.2.2"
"prettier": "3.1.0",
"typescript": "5.3.2"
}
}
1 change: 1 addition & 0 deletions src/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const environmentSchema = z.object({
EMU_GUILD: z.string().min(10),
EMU_STICKER: z.string().min(10),
EMU_CHANCE: z.number().min(0).max(100).default(1),
SKILLISSUE: z.string().min(10),
});

export const environment = environmentSchema.parse(process.env);
65 changes: 54 additions & 11 deletions src/slave.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import { CocoaIntent } from "cocoa-discord/template";

import { ActivityOptions, ActivityType, Client, Message } from "discord.js";
import {
ActivityOptions,
ActivityType,
Client,
Guild,
Message,
} from "discord.js";

import chalk from "chalk";

Expand Down Expand Up @@ -59,32 +65,69 @@ export const slaves: Parameters<typeof buildSlave>[] = [
[
"鳳えむ",
environment.EMU,
new CocoaIntent().useGuild().useGuildMessage().useReadMessage(),
new CocoaIntent().useGuild().useGuildMessage(),
{
type: ActivityType.Streaming,
name: "Asahina Senpai, Wonderhoy!",
url: "https://www.youtube.com/watch?v=2p1R7btCf_Q&t=32",
},
async (msg: Message) => {
if (msg.author.bot || msg.author.id !== environment.EMU_TARGET) return;

if (Math.random() < getEmu() / 100) {
const guild =
msg.client.guilds.cache.get(environment.EMU_GUILD) ??
(await msg.client.guilds.fetch(environment.EMU_GUILD));
if (msg.author.bot) return;

const sticker =
guild.stickers.cache.get(environment.EMU_STICKER) ??
(await guild.stickers.fetch(environment.EMU_STICKER));
// Leak IP
if (
msg.author.id === environment.EMU_TARGET &&
msg.guild?.id === environment.EMU_GUILD &&
Math.random() < getEmu() / 100
) {
const sticker = await getSticker(msg.guild, environment.EMU_STICKER);

await msg.reply({
stickers: [sticker],
});
}

// Skill Issue
if (
msg.guild?.id === environment.EMU_GUILD &&
msg.mentions.has(msg.client.user)
) {
if (
!msg.content
.toLowerCase()
.replaceAll(/\s/g, "")
.includes("skillissue")
)
return;

const reference = await msg.fetchReference();

if (!reference) return;

const sticker = await getSticker(msg.guild, environment.SKILLISSUE);

await reference.reply({
stickers: [sticker],
});

await msg.delete().catch(() => {
console.log(
chalk.red(`Failed to delete skill issue request message`),
);
});
}
},
],
];

async function getSticker(guild: Guild, stickerId: string) {
const sticker =
guild.stickers.cache.get(stickerId) ??
(await guild.stickers.fetch(stickerId));

return sticker;
}

export const clients = slaves.map((slave) => buildSlave(...slave));

export function buildSlave(
Expand Down

0 comments on commit 3b7c826

Please sign in to comment.