Skip to content

Commit

Permalink
feat: cocoa 3
Browse files Browse the repository at this point in the history
  • Loading branch information
leomotors committed Sep 25, 2023
1 parent 5573eb2 commit f7c957f
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .prettierrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module.exports = require("@leomotors/config/prettier").withSortImports({
importOrder: [
"^dotenv",
"^cocoa-discord-utils",
"^cocoa-discord",
"^discord.js",
"^@discordjs",
"^[a-zA-Z]",
Expand Down
Binary file modified bun.lockb
Binary file not shown.
21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
{
"name": "bots-gulag",
"version": "2.0.0",
"version": "2.1.0",
"description": "Bots",
"repository": "https://github.com/CarelessDev/bots-gulag",
"type": "module",
"private": true,
"scripts": {
"start": "bun run src/bot.ts",
"format": "eslint . --fix",
"lint": "eslint . --max-warnings=0"
"lint": "eslint . --max-warnings=0",
"check": "tsc --noEmit"
},
"dependencies": {
"chalk": "5.3.0",
"cocoa-discord-utils": "2.3.0",
"cocoa-discord": "3.1.0",
"discord.js": "14.13.0",
"zod": "3.22.2"
},
"devDependencies": {
"@leomotors/config": "0.11.0",
"@trivago/prettier-plugin-sort-imports": "4.2.0",
"@typescript-eslint/eslint-plugin": "6.6.0",
"@typescript-eslint/parser": "6.6.0",
"eslint": "8.49.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-sort-destructure-keys": "^1.5.0",
"@typescript-eslint/eslint-plugin": "6.7.2",
"@typescript-eslint/parser": "6.7.2",
"eslint": "8.50.0",
"eslint-config-prettier": "9.0.0",
"eslint-plugin-import": "2.28.1",
"eslint-plugin-prettier": "5.0.0",
"eslint-plugin-sort-destructure-keys": "1.5.0",
"prettier": "3.0.3",
"typescript": "5.2.2"
}
Expand Down
10 changes: 5 additions & 5 deletions src/bot.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { setConsoleEvent } from "cocoa-discord-utils";
import { SlashCenter } from "cocoa-discord-utils/slash";
import { CocoaIntent } from "cocoa-discord-utils/template";
import { setConsoleEvent } from "cocoa-discord";
import { SlashCenter } from "cocoa-discord/slash";
import { CocoaIntent } from "cocoa-discord/template";

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

Expand All @@ -10,10 +10,10 @@ import { MaoCommander } from "./commands/index.js";
import { environment } from "./environment.js";
import { clients } from "./slave.js";

const MaoClient = new Client(new CocoaIntent().useGuildSlash());
const MaoClient = new Client(new CocoaIntent().useGuild());

const center = new SlashCenter(MaoClient, "Global");
center.addCogs(new MaoCommander(MaoClient));
center.addModules(new MaoCommander(MaoClient));
center.validateCommands();

MaoClient.on("ready", (cli) => {
Expand Down
12 changes: 6 additions & 6 deletions src/commands/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { EmbedStyle } from "cocoa-discord-utils";
import { EmbedStyle } from "cocoa-discord";
import {
CogSlashClass,
Param,
SlashCommand,
} from "cocoa-discord-utils/slash/class";
import { getStatusFields } from "cocoa-discord-utils/template";
SlashModuleClass,
} from "cocoa-discord/slash/class";
import { getStatusFields } from "cocoa-discord/template";

import { Client } from "discord.js";

Expand All @@ -16,7 +16,7 @@ const style = new EmbedStyle({
footer: { text: "天上太阳红呀红彤彤哎 ❤️❤️❤️" },
});

export class MaoCommander extends CogSlashClass {
export class MaoCommander extends SlashModuleClass {
private readonly client: Client;

constructor(client: Client) {
Expand All @@ -32,7 +32,7 @@ export class MaoCommander extends CogSlashClass {
const emb = style
.use(ctx)
.setTitle("Gulag's Status")
.addField({
.addFields({
name: "Bots Running",
value: `${slaves.length + 1}`,
inline: false,
Expand Down
4 changes: 2 additions & 2 deletions src/slave.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CocoaIntent } from "cocoa-discord-utils/template";
import { CocoaIntent } from "cocoa-discord/template";

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

Expand Down Expand Up @@ -63,7 +63,7 @@ export function buildSlave(
}

const client = new Client(
new CocoaIntent().useGuildSlash().useGuildMessage().useReadMessage(),
new CocoaIntent().useGuild().useGuildMessage().useReadMessage(),
);
client.on("ready", (cli) => {
console.log(chalk.green(`Slave ${name} is ready as ${cli.user.tag}!`));
Expand Down

0 comments on commit f7c957f

Please sign in to comment.