Skip to content

Commit 207d269

Browse files
authored
Merge pull request #69 from Chiissu/dev
0.3.2
2 parents ef5fe1a + 93ffe65 commit 207d269

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+242
-406
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ A few guides onto how code contributed to Sokora should look like.
4848
- Use early returns to avoid nesting.
4949
- Avoid curly braces in one-line `if` statements.
5050
- Non-nullish assertions are valid when needed.
51-
- Use the cache instead of a new `fetch()` call where possible, to avoid unnecessary usage (e.g., if possible, prefer `guild.members.cache` over `await guild.members.fetch()`).
51+
- Use the functions `safeChannel` and `safeMember` from `safeThings` instead of using the cache or fetching.
5252
- Prefer `Promise.all` over having several `await` statements.
5353

5454
---

bun.lock

Lines changed: 20 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"The Sokora team",
66
"The GitHub contributors"
77
],
8-
"version": "0.3.1",
8+
"version": "0.3.2",
99
"main": "./src/index.ts",
1010
"type": "module",
1111
"scripts": {
@@ -26,13 +26,13 @@
2626
"sharp": "^0.34.3"
2727
},
2828
"devDependencies": {
29-
"@eslint/js": "^9.33.0",
30-
"@typescript-eslint/eslint-plugin": "^8.40.0",
31-
"@typescript-eslint/parser": "^8.40.0",
32-
"bun-types": "^1.2.20",
33-
"eslint": "^9.33.0",
29+
"@eslint/js": "^9.34.0",
30+
"@typescript-eslint/eslint-plugin": "^8.41.0",
31+
"@typescript-eslint/parser": "^8.41.0",
32+
"bun-types": "^1.2.21",
33+
"eslint": "^9.34.0",
3434
"prettier": "^3.6.2",
3535
"typescript": "^5.9.2",
36-
"typescript-eslint": "^8.40.0"
36+
"typescript-eslint": "^8.41.0"
3737
}
3838
}

src/bot.ts

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { ActivityType, Client, Partials } from "discord.js";
55
import { errorEmbed } from "embeds/errorEmbed";
66
import ms from "enhanced-ms";
77
import { registerGuildCommands } from "handlers/commands";
8-
import { loadAuditEvents, loadEasterEggs, loadEvents } from "handlers/events";
8+
import { loadEasterEggs, loadEvents } from "handlers/events";
99
import { rescheduleUnbans } from "utils/unbanScheduler";
1010

1111
export const client = new Client({
@@ -31,25 +31,20 @@ client.once("clientReady", async () => {
3131
setInterval(async () => {
3232
const topgg = new Api(process.env.TOPGG_TOKEN!);
3333
try {
34-
await topgg.postStats({
35-
serverCount: (await client.guilds.fetch()).size,
36-
});
34+
await topgg.postStats({ serverCount: (await client.guilds.fetch()).size });
3735
console.log("Posted statistics to top.gg!");
3836
} catch (error) {
3937
console.error(`Failed to start top.gg autoposter: ${error}`);
4038
}
4139

42-
const users = client.users;
43-
const subscribedUsers = new Set(
40+
for (const user of new Set(
4441
(await getUserSettingsTable("topgg", "remind"))
4542
?.filter(i => i.value == "1")
46-
.map(i => i.userID),
47-
);
48-
49-
for (const user of subscribedUsers) {
43+
.map(i => i.userID.replaceAll('"', "")),
44+
)) {
5045
try {
51-
if (await topgg.hasVoted(user)) continue;
52-
const dmChannel = await (await users.fetch(JSON.parse(user))).createDM();
46+
if ((await topgg.hasVoted(user)) == true) continue;
47+
const dmChannel = await (await client.users.fetch(user)).createDM();
5348
if (!dmChannel || !dmChannel.isSendable()) continue;
5449

5550
await dmChannel.send(
@@ -72,7 +67,6 @@ client.once("clientReady", async () => {
7267
await Promise.all([
7368
loadEvents(client),
7469
loadEasterEggs(),
75-
loadAuditEvents(client),
7670
registerGuildCommands(client),
7771
rescheduleUnbans(client),
7872
]).then(() =>

src/commands/about.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ import { replace } from "utils/replace";
1414

1515
export const data = new SlashCommandBuilder()
1616
.setName("about")
17-
.setDescription("Shows information about Sokora.");
17+
.setDescription("Shows information about Sokora.")
18+
.setContexts(0);
1819

1920
export async function run(interaction: ChatInputCommandInteraction) {
2021
const client = interaction.client;
@@ -23,7 +24,6 @@ export async function run(interaction: ChatInputCommandInteraction) {
2324
const members = guilds.map(guild => guild.memberCount).reduce((a, b) => a + b);
2425
const shards = client.shard?.count;
2526
const avatar = user.displayAvatarURL();
26-
2727
const embed = new EmbedBuilder()
2828
.setAuthor({
2929
name: `${dotCheck({ string: avatar, doubleSpace: true })}About Sokora`,

src/commands/changelog.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import { replace } from "utils/replace";
66

77
export const data = new SlashCommandBuilder()
88
.setName("changelog")
9-
.setDescription(`Sends a link to Sokora's latest version (${version}) changelog.`);
9+
.setDescription(`Sends a link to Sokora's latest version (${version}) changelog.`)
10+
.setContexts(0);
1011

1112
export async function run(interaction: ChatInputCommandInteraction) {
1213
const user = interaction.client.user;

0 commit comments

Comments
 (0)