restructure
move to bun workspaces bump zod begin adding fluxer
This commit is contained in:
22
core/src/lib/client.ts
Normal file
22
core/src/lib/client.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import config from "config";
|
||||
import { Client, GatewayIntentBits, Partials, ChannelType, Events, IntentsBitField } from "discord.js";
|
||||
|
||||
const client = new Client({
|
||||
intents: [IntentsBitField.Flags.Guilds,
|
||||
IntentsBitField.Flags.GuildMembers,
|
||||
IntentsBitField.Flags.GuildModeration,
|
||||
IntentsBitField.Flags.GuildMessages,
|
||||
IntentsBitField.Flags.GuildMessageReactions,
|
||||
IntentsBitField.Flags.GuildMessagePolls,
|
||||
IntentsBitField.Flags.GuildVoiceStates,
|
||||
IntentsBitField.Flags.MessageContent,
|
||||
IntentsBitField.Flags.DirectMessages,
|
||||
IntentsBitField.Flags.DirectMessageReactions,
|
||||
IntentsBitField.Flags.DirectMessageTyping,
|
||||
IntentsBitField.Flags.DirectMessagePolls,],
|
||||
partials: [Partials.Channel, Partials.Message, Partials.Reaction]
|
||||
});
|
||||
|
||||
await client.login(config.discord.token);
|
||||
|
||||
export default client;
|
||||
13
core/src/lib/utils.test.ts
Normal file
13
core/src/lib/utils.test.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { getRandomInt } from "./utils.ts";
|
||||
|
||||
describe("utils", () => {
|
||||
it("gets a random int", () => {
|
||||
const randomInt = getRandomInt(0, 10);
|
||||
|
||||
expect(randomInt).toBeDefined();
|
||||
expect(randomInt).toBeNumber();
|
||||
expect(randomInt).toBeLessThanOrEqual(10);
|
||||
expect(randomInt).toBeGreaterThanOrEqual(0);
|
||||
});
|
||||
});
|
||||
5
core/src/lib/utils.ts
Normal file
5
core/src/lib/utils.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export function getRandomInt(min: number, max: number) {
|
||||
const nextMin = Math.ceil(min);
|
||||
const nextMax = Math.floor(max);
|
||||
return Math.floor(Math.random() * (nextMax - nextMin + 1)) + nextMin;
|
||||
}
|
||||
Reference in New Issue
Block a user