Skip to content

Commit 4c1fa43

Browse files
fix: update biome schema version and adjust file includes
1 parent fd37dce commit 4c1fa43

File tree

4 files changed

+134
-139
lines changed

4 files changed

+134
-139
lines changed

biome.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/2.3.8/schema.json",
33
"formatter": {
44
"enabled": true,
55
"indentStyle": "space",
@@ -12,10 +12,7 @@
1212
"recommended": true
1313
}
1414
},
15-
"organizeImports": {
16-
"enabled": true
17-
},
1815
"files": {
19-
"ignore": ["node_modules", "build"]
16+
"includes": ["**", "!**/node_modules", "!**/dist", "!**/build"]
2017
}
2118
}

prisma.config.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { defineConfig, env } from 'prisma/config'
1+
import { defineConfig, env } from "prisma/config";
22
import "dotenv/config";
33

44
export default defineConfig({
5-
schema: 'prisma/schema.prisma',
5+
schema: "prisma/schema.prisma",
66
migrations: {
7-
path: 'prisma/migrations',
7+
path: "prisma/migrations",
88
},
99
datasource: {
10-
url: env('MONGO_URL'),
10+
url: env("MONGO_URL"),
1111
},
12-
})
12+
});

src/events/Voice/VoiceStateUpdate.ts

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,39 @@ import { Event } from "../../structures/Event";
33

44
const tempChannels = new Map<string, string>();
55

6-
export default new Event("voiceStateUpdate", async (oldState: VoiceState, newState: VoiceState) => {
7-
const member = newState.member;
8-
const guild = newState.guild;
9-
const joinChannel = newState.channel;
10-
const leaveChannel = oldState.channel;
6+
export default new Event(
7+
"voiceStateUpdate",
8+
async (oldState: VoiceState, newState: VoiceState) => {
9+
const member = newState.member;
10+
const guild = newState.guild;
11+
const joinChannel = newState.channel;
12+
const leaveChannel = oldState.channel;
1113

12-
const triggerChannelId = "1332058835803836447";
14+
const triggerChannelId = "1332058835803836447";
1315

14-
if (joinChannel?.id === triggerChannelId && member) {
16+
if (joinChannel?.id === triggerChannelId && member) {
17+
const channel = await guild.channels.create({
18+
name: `👥┃${member.displayName}`,
19+
type: ChannelType.GuildVoice,
20+
userLimit: 10,
21+
parent: joinChannel.parentId ?? undefined,
22+
permissionOverwrites: [
23+
{
24+
id: member.id,
25+
allow: ["ManageChannels"],
26+
type: OverwriteType.Member,
27+
},
28+
],
29+
});
1530

16-
const channel = await guild.channels.create({
17-
name: `👥┃${member.displayName}`,
18-
type: ChannelType.GuildVoice,
19-
userLimit: 10,
20-
parent: joinChannel.parentId ?? undefined,
21-
permissionOverwrites: [
22-
{
23-
id: member.id,
24-
allow: ["ManageChannels"],
25-
type: OverwriteType.Member,
26-
},
27-
]
28-
});
29-
30-
tempChannels.set(member.id, channel.id);
31-
await member.voice.setChannel(channel);
32-
}
33-
if (leaveChannel?.name.startsWith("👥┃") && leaveChannel.members.size === 0) {
34-
await leaveChannel.delete().catch(() => { });
35-
}
36-
37-
});
31+
tempChannels.set(member.id, channel.id);
32+
await member.voice.setChannel(channel);
33+
}
34+
if (
35+
leaveChannel?.name.startsWith("👥┃") &&
36+
leaveChannel.members.size === 0
37+
) {
38+
await leaveChannel.delete().catch(() => {});
39+
}
40+
},
41+
);

src/structures/Client.ts

Lines changed: 94 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
import {
2-
ActivityType,
3-
Client,
4-
GatewayIntentBits,
5-
Options,
6-
} from "discord.js";
1+
import { ActivityType, Client, GatewayIntentBits, Options } from "discord.js";
72
import prisma from "../../prisma.config";
83
import { promises as fs } from "node:fs";
94
import path from "node:path";
@@ -12,108 +7,107 @@ import i18nbackend from "i18next-fs-backend";
127
import { readdirSync } from "node:fs";
138

149
export class SoulKitten extends Client {
10+
public owner: string[];
11+
public db: typeof prisma;
1512

16-
public owner: string[];
17-
public db: typeof prisma;
13+
constructor() {
14+
super({
15+
makeCache: Options.cacheWithLimits({
16+
ApplicationCommandManager: 0,
17+
BaseGuildEmojiManager: 0,
18+
GuildMemberManager: Number.POSITIVE_INFINITY,
19+
GuildStickerManager: 0,
20+
GuildScheduledEventManager: 0,
21+
MessageManager: Number.POSITIVE_INFINITY,
22+
StageInstanceManager: 0,
23+
ThreadManager: 0,
24+
ThreadMemberManager: 0,
25+
UserManager: 0,
26+
}),
27+
intents: [
28+
GatewayIntentBits.Guilds,
29+
GatewayIntentBits.GuildMessages,
30+
GatewayIntentBits.MessageContent,
31+
GatewayIntentBits.GuildMembers,
32+
GatewayIntentBits.DirectMessages,
33+
GatewayIntentBits.GuildVoiceStates,
34+
],
35+
presence: {
36+
status: "idle",
37+
activities: [
38+
{
39+
name: "SoulKitten",
40+
type: ActivityType.Listening,
41+
},
42+
],
43+
},
44+
allowedMentions: {
45+
parse: ["users"],
46+
repliedUser: false,
47+
},
48+
});
49+
this.db = prisma;
50+
this.owner = ["932678185970192404"];
51+
}
1852

19-
constructor() {
20-
super({
21-
makeCache: Options.cacheWithLimits({
22-
ApplicationCommandManager: 0,
23-
BaseGuildEmojiManager: 0,
24-
GuildMemberManager: Number.POSITIVE_INFINITY,
25-
GuildStickerManager: 0,
26-
GuildScheduledEventManager: 0,
27-
MessageManager: Number.POSITIVE_INFINITY,
28-
StageInstanceManager: 0,
29-
ThreadManager: 0,
30-
ThreadMemberManager: 0,
31-
UserManager: 0,
32-
}),
33-
intents: [
34-
GatewayIntentBits.Guilds,
35-
GatewayIntentBits.GuildMessages,
36-
GatewayIntentBits.MessageContent,
37-
GatewayIntentBits.GuildMembers,
38-
GatewayIntentBits.DirectMessages,
39-
GatewayIntentBits.GuildVoiceStates,
40-
],
41-
presence: {
42-
status: "idle",
43-
activities: [
44-
{
45-
name: "SoulKitten",
46-
type: ActivityType.Listening,
47-
},
48-
],
49-
},
50-
allowedMentions: {
51-
parse: ["users"],
52-
repliedUser: false,
53-
},
54-
});
55-
this.db = prisma;
56-
this.owner = ["932678185970192404"];
57-
}
58-
59-
async init() {
60-
this.register();
61-
await this.login(process.env.DISCORD_TOKEN);
62-
}
53+
async init() {
54+
this.register();
55+
await this.login(process.env.DISCORD_TOKEN);
56+
}
6357

64-
async register() {
65-
this.loadLanguage();
66-
this.loadEvents();
67-
}
58+
async register() {
59+
this.loadLanguage();
60+
this.loadEvents();
61+
}
6862

69-
async loadEvents() {
70-
const readDirRecursively = async (dir) => {
71-
const files = await fs.readdir(dir, { withFileTypes: true });
72-
let eventFiles = [];
63+
async loadEvents() {
64+
const readDirRecursively = async (dir) => {
65+
const files = await fs.readdir(dir, { withFileTypes: true });
66+
let eventFiles = [];
7367

74-
for (const file of files) {
75-
const fullPath = path.join(dir, file.name);
76-
if (file.isDirectory()) {
77-
const subFiles = await readDirRecursively(fullPath);
78-
eventFiles = [...eventFiles, ...subFiles];
79-
} else if (file.name.endsWith(".ts") || file.name.endsWith(".js")) {
80-
eventFiles.push(fullPath);
81-
}
82-
}
83-
return eventFiles;
84-
};
68+
for (const file of files) {
69+
const fullPath = path.join(dir, file.name);
70+
if (file.isDirectory()) {
71+
const subFiles = await readDirRecursively(fullPath);
72+
eventFiles = [...eventFiles, ...subFiles];
73+
} else if (file.name.endsWith(".ts") || file.name.endsWith(".js")) {
74+
eventFiles.push(fullPath);
75+
}
76+
}
77+
return eventFiles;
78+
};
8579

86-
const eventFiles = await readDirRecursively(
87-
path.join(__dirname, "../events"),
88-
);
80+
const eventFiles = await readDirRecursively(
81+
path.join(__dirname, "../events"),
82+
);
8983

90-
for (const file of eventFiles) {
91-
const event = await this.importFile(file);
92-
this.on(event.name, event.exec);
93-
}
84+
for (const file of eventFiles) {
85+
const event = await this.importFile(file);
86+
this.on(event.name, event.exec);
9487
}
88+
}
9589

96-
async loadLanguage() {
97-
await i18next.use(i18nbackend).init({
98-
backend: {
99-
loadPath: "src/locales/{{lng}}/{{ns}}.json",
100-
},
101-
defaultNS: "language",
102-
fallbackLng: "en-US",
103-
interpolation: {
104-
escapeValue: false,
105-
useRawValueToEscape: true,
106-
},
107-
load: "all",
108-
ns: ["language"],
109-
preload: readdirSync("src/locales"),
110-
// debug: true,
111-
returnEmptyString: false,
112-
returnObjects: true,
113-
});
114-
}
90+
async loadLanguage() {
91+
await i18next.use(i18nbackend).init({
92+
backend: {
93+
loadPath: "src/locales/{{lng}}/{{ns}}.json",
94+
},
95+
defaultNS: "language",
96+
fallbackLng: "en-US",
97+
interpolation: {
98+
escapeValue: false,
99+
useRawValueToEscape: true,
100+
},
101+
load: "all",
102+
ns: ["language"],
103+
preload: readdirSync("src/locales"),
104+
// debug: true,
105+
returnEmptyString: false,
106+
returnObjects: true,
107+
});
108+
}
115109

116-
async importFile(file: string) {
117-
return (await import(file))?.default;
118-
}
110+
async importFile(file: string) {
111+
return (await import(file))?.default;
112+
}
119113
}

0 commit comments

Comments
 (0)