Skip to content

Commit 5b989bc

Browse files
chore: remove deprecated code and update deps (#572)
* chore: update depreciated methods/options * style: format files * fix: fixed type errors
1 parent e9cbd02 commit 5b989bc

File tree

33 files changed

+178
-523
lines changed

33 files changed

+178
-523
lines changed

.eslintrc.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

.prettierignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
CHANGELOG.md
33
prisma/
44
LICENSE.md
5-
dist/
5+
dist/
6+
bun.lock

README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212

1313
## Table of Contents
1414

15-
- [Invite](#invite-radon-to-your-server-click-here)
16-
- [Beta Testing](#beta-testing-for-radon)
17-
- [Developing on Radon](#developing-on-radon)
18-
- [Contributing](#contributing)
19-
- [Project Stats](#project-stats)
15+
- [Invite](#invite-radon-to-your-server-click-here)
16+
- [Beta Testing](#beta-testing-for-radon)
17+
- [Developing on Radon](#developing-on-radon)
18+
- [Contributing](#contributing)
19+
- [Project Stats](#project-stats)
2020

2121
## Invite Radon to your server [`Click here`][invite]
2222

@@ -36,10 +36,10 @@ At the moment I am not completely free but if you are interested in beta testing
3636

3737
**You should have a good understanding of the following:**
3838

39-
- [`Node.js`]: To run the project
40-
- [`MongoDB`]: To store the data
41-
- [`Discord.js`][discord.js]: To interact with the Discord API
42-
- [`Sapphire`]: Framework used in Radon
39+
- [`Bun`]: To run the project
40+
- [`MongoDB`]: To store the data
41+
- [`Discord.js`][discord.js]: To interact with the Discord API
42+
- [`Sapphire`]: Framework used in Radon
4343

4444
## Contributing
4545

@@ -65,17 +65,18 @@ To contribute to this repository, feel free to fork the repository and make your
6565
<!-- REFERENCES -->
6666

6767
[^env]: You will need to create a `.env` file in the root directory of the project.
68+
6869
[^lint]: We recommend using [`eslint`] and [`prettier`] to lint your code.
70+
6971
[^commit]: We strongly follow the [`Commit Message Conventions`]. This is important when commiting your code for a PR.
7072

7173
<!-- LINKS -->
7274

73-
[`node.js`]: https://nodejs.org/en/
7475
[`mongodb`]: https://www.mongodb.com/
7576
[`git`]: https://git-scm.com/
7677
[typescript]: https://www.typescriptlang.org/
7778
[discord.js]: https://discord.js.org/
78-
[node.js]: https://nodejs.org/en/
79+
[bun]: https://bun.sh/
7980
[pr]: https://github.com/EvolutionX-10/Radon/pulls
8081
[stars]: https://github.com/EvolutionX-10/Radon/stargazers
8182
[issues]: https://github.com/EvolutionX-10/Radon/issues

bun.lock

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

package.json

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,21 @@
66
"type": "module",
77
"private": true,
88
"imports": {
9-
"#constants": "./dist/lib/utility/constants.js",
10-
"#config": "./dist/lib/utility/config.js",
11-
"#lib/RadonClient": "./dist/lib/RadonClient.js",
12-
"#lib/*": "./dist/lib/*/index.js",
13-
"#root/*": "./dist/*.js"
9+
"#constants": "./src/lib/utility/constants.ts",
10+
"#config": "./src/lib/utility/config.ts",
11+
"#lib/RadonClient": "./src/lib/RadonClient.ts",
12+
"#lib/*": "./src/lib/*/index.ts",
13+
"#root/*": "./src/*.ts"
1414
},
1515
"scripts": {
1616
"test": "echo \"Error: no test specified\" && exit 1",
17-
"start": "yarn compile && NODE_ENV=production && node ./dist/index.js",
18-
"dev": "yarn compile && node ./dist/index.js",
19-
"deploy": "yarn heroku && yarn backup",
17+
"start": "bun .",
18+
"dev": "bun .",
2019
"release": "cj",
2120
"preview": "cj --dry-run",
22-
"compile": "tsup",
23-
"watch": "tsup --watch --onSuccess \"node ./dist/index.js\"",
24-
"postinstall": "husky install",
25-
"logs": "heroku logs --app=radon-dev -t --force-colors",
26-
"logs2": "heroku logs --app=radon-dev2 -t --force-colors",
27-
"format": "prettier --write './src/**/*.ts' './README.md'",
28-
"pretty": "prettier --check './src/**/*.ts' './README.md'",
29-
"typecheck": "tsc -b src",
30-
"lint": "eslint --fix --ext ts",
31-
"deps": "yarn upgrade-interactive"
21+
"format": "bunx prettier --write './src/**/*.ts' './README.md'",
22+
"pretty": "bunx prettier --check './src/**/*.ts' './README.md'",
23+
"typecheck": "tsc -b src"
3224
},
3325
"engines": {
3426
"node": "20.10.0"
@@ -56,20 +48,15 @@
5648
"@sapphire/ts-config": "5.0.1",
5749
"@swc/core": "1.10.12",
5850
"@swc/helpers": "0.5.15",
51+
"@types/bun": "1.2.1",
5952
"@types/colornames": "1.1.4",
6053
"@types/gradient-string": "1.1.6",
6154
"@types/node": "22.12.0",
6255
"@types/string-similarity": "4.0.2",
63-
"@typescript-eslint/eslint-plugin": "8.22.0",
64-
"@typescript-eslint/parser": "8.22.0",
65-
"eslint": "9.19.0",
66-
"eslint-config-prettier": "10.0.1",
67-
"eslint-plugin-prettier": "5.2.3",
6856
"husky": "9.1.7",
6957
"lint-staged": "15.4.3",
7058
"prettier": "3.4.2",
7159
"prisma": "6.3.0",
72-
"tsup": "8.3.6",
7360
"typescript": "5.7.3"
7461
},
7562
"dependencies": {

src/commands/Admin/setup.ts

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ import {
1717
Collection,
1818
type APIRole,
1919
ChannelSelectMenuBuilder,
20-
InteractionContextType
20+
InteractionContextType,
21+
MessageFlags
2122
} from 'discord.js';
2223

2324
@ApplyOptions<RadonCommand.Options>({
@@ -29,9 +30,9 @@ import {
2930
export class UserCommand extends RadonCommand {
3031
public override async chatInputRun(interaction: RadonCommand.ChatInputCommandInteraction) {
3132
let stage = 0;
32-
let msg = (await interaction.reply({
33+
let interactionResponse = await interaction.reply({
3334
embeds: [this.welcome()],
34-
fetchReply: true,
35+
withResponse: true,
3536
components: [
3637
new Row<Button>()._components([
3738
new Button() //
@@ -46,7 +47,12 @@ export class UserCommand extends RadonCommand {
4647
._emoji('<a:poggershype:879074649781174272>')
4748
])
4849
]
49-
})) as Message;
50+
});
51+
52+
const msg_id = interactionResponse.interaction.responseMessageId;
53+
if (!msg_id) return;
54+
let msg = (await interaction.channel?.messages.fetch(msg_id)) as Message<boolean>;
55+
if (!msg) return;
5056

5157
const collector = msg.createMessageComponentCollector({ time: mins(3) });
5258

@@ -60,7 +66,7 @@ export class UserCommand extends RadonCommand {
6066
if (i.user.id !== interaction.user.id) {
6167
await i.followUp({
6268
content: `This maze isn't for you mate!`,
63-
ephemeral: true
69+
flags: MessageFlags.Ephemeral
6470
});
6571
return;
6672
}
@@ -97,7 +103,7 @@ export class UserCommand extends RadonCommand {
97103
if (adminRoles.some((r) => modRoles.has(r.id))) {
98104
await i.reply({
99105
content: `Moderation roles and Administration roles cannot be the same!`,
100-
ephemeral: true
106+
flags: MessageFlags.Ephemeral
101107
});
102108
break;
103109
}
@@ -116,17 +122,18 @@ export class UserCommand extends RadonCommand {
116122
modLogChannel = i.channels.first() as TextChannel;
117123
case 'confirm_modlog':
118124
stage = 4;
119-
// eslint-disable-next-line no-case-declarations
120125
const edit = await modLogChannel!
121126
.edit({
122127
permissionOverwrites: permissions(
123128
!modLogChannel!.permissionsFor(interaction.guild.roles.everyone).has(PermissionFlagsBits.ViewChannel)
124129
)
125130
})
126131
.catch(async () => {
127-
await i.channel!.send(
128-
`I am unable to edit permissions of ${modLogChannel}. Please grant me admin permission or click on "Make a new modlog"`
129-
);
132+
i.channel &&
133+
i.channel.isSendable() &&
134+
(await i.channel.send(
135+
`I am unable to edit permissions of ${modLogChannel}. Please grant me admin permission or click on "Make a new modlog"`
136+
));
130137
return null;
131138
});
132139
if (edit) {
@@ -143,7 +150,7 @@ export class UserCommand extends RadonCommand {
143150
if (!interaction.guild.members.me?.permissions.has(PermissionFlagsBits.ManageChannels)) {
144151
await i.followUp({
145152
content: `I don't have the permissions to create channels!\nPlease give me the \`Manage Channels\` permission!`,
146-
ephemeral: true
153+
flags: MessageFlags.Ephemeral
147154
});
148155
return;
149156
}
@@ -163,7 +170,7 @@ export class UserCommand extends RadonCommand {
163170
`\`Manage Channels\` [Creation of Channel], \`Manage Roles\` [To configure channel permissions], \`Embed Links and Send Messages\` [To send modlogs] permissions to me!\n` +
164171
`**Note:** I need a role other than @everyone with the mentioned permissions!` +
165172
`If you are still having issues run </about me:970217477126643752> and join our support server!`,
166-
ephemeral: true
173+
flags: MessageFlags.Ephemeral
167174
});
168175
return undefined;
169176
});

src/commands/General/ping.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { RadonGuildId } from '#constants';
22
import { RadonCommand } from '#lib/structures';
33
import { ApplyOptions } from '@sapphire/decorators';
44
import { send } from '@sapphire/plugin-editable-commands';
5+
import { MessageFlags } from 'discord.js';
56

67
@ApplyOptions<RadonCommand.Options>({
78
description: `Check my latency!`
@@ -17,11 +18,12 @@ export class UserCommand extends RadonCommand {
1718
}
1819

1920
public override async chatInputRun(interaction: RadonCommand.ChatInputCommandInteraction) {
20-
const msg = (await interaction.reply({
21+
const interactionResponse = await interaction.reply({
2122
content: `Ping?`,
22-
ephemeral: true,
23-
fetchReply: true
24-
})) as RadonCommand.Message;
23+
flags: MessageFlags.Ephemeral,
24+
withResponse: true
25+
});
26+
const msg = interaction.channel?.messages.cache.get(interactionResponse.interaction.responseMessageId!) as RadonCommand.Message;
2527
const { diff, ping } = this.getPing(msg, interaction);
2628

2729
return interaction.editReply({

src/commands/General/stats.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { uptime } from 'node:os';
1010
description: 'Provides some stats about me'
1111
})
1212
export class UserCommand extends RadonCommand {
13-
public override messageRun(message: RadonCommand.Message) {
13+
public override messageRun(message: RadonCommand.Message<true>) {
1414
return message.channel.send({
1515
embeds: [this.statsEmbed()]
1616
});

src/commands/Moderation/ban.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { type BaseModActionData, PermissionLevels, RadonEvents } from '#lib/type
44
import { runAllChecks, sec } from '#lib/utility';
55
import { ApplyOptions } from '@sapphire/decorators';
66
import { type APIApplicationCommandOptionChoice, PermissionFlagsBits } from 'discord-api-types/v9';
7-
import { type User, InteractionContextType } from 'discord.js';
7+
import { type User, InteractionContextType, MessageFlags } from 'discord.js';
88

99
@ApplyOptions<RadonCommand.Options>({
1010
description: `Ban a user`,
@@ -31,7 +31,7 @@ export class UserCommand extends RadonCommand {
3131
const dm = interaction.options.getBoolean('dm') ?? false;
3232

3333
const { content: ctn, result } = runAllChecks(interaction.member, user, 'ban');
34-
if (!result) return interaction.reply({ content: ctn, ephemeral: true });
34+
if (!result) return interaction.reply({ content: ctn, flags: MessageFlags.Ephemeral });
3535

3636
const confirm = new Confirmation({
3737
content: `Are you sure you want to ban ${user}? ${reason ? `\nReason: ${reason}` : ''}`,

src/commands/Moderation/kick.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { type BaseModActionData, PermissionLevels, RadonEvents } from '#lib/type
44
import { runAllChecks, sec } from '#lib/utility';
55
import { ApplyOptions } from '@sapphire/decorators';
66
import { PermissionFlagsBits } from 'discord-api-types/v9';
7-
import { InteractionContextType } from 'discord.js';
7+
import { InteractionContextType, MessageFlags } from 'discord.js';
88

99
@ApplyOptions<RadonCommand.Options>({
1010
description: `Kick a member`,
@@ -22,12 +22,12 @@ export class UserCommand extends RadonCommand {
2222
if (!member) {
2323
return interaction.reply({
2424
content: `${Emojis.Cross} You must specify a valid member that is in this server!`,
25-
ephemeral: true
25+
flags: MessageFlags.Ephemeral
2626
});
2727
}
2828

2929
const { content: ctn, result } = runAllChecks(interaction.member, member, 'kick');
30-
if (!result) return interaction.reply({ content: ctn, ephemeral: true });
30+
if (!result) return interaction.reply({ content: ctn, flags: MessageFlags.Ephemeral });
3131

3232
let content = `${Emojis.Confirm} ${member.user.tag} has been kicked ${reason ? `for the following reason: ${reason}` : ''}`;
3333

@@ -43,7 +43,7 @@ export class UserCommand extends RadonCommand {
4343
if (!kicked) {
4444
return interaction.reply({
4545
content: `Kick failed due to missing permissions, please contact support server if this persists!`,
46-
ephemeral: true
46+
flags: MessageFlags.Ephemeral
4747
});
4848
}
4949

0 commit comments

Comments
 (0)