Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update dependencies, configs, and examples #5

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Leftovers
sdanialraza committed Jun 21, 2024
commit e0ed0005af7fb6af1f62e847f89edae62d5ee4d7
6 changes: 3 additions & 3 deletions _base/README.md
Original file line number Diff line number Diff line change
@@ -14,9 +14,9 @@ The template to use when creating a new example for voice. Steps to follow:
$ npm install
$ npm run build

# Set a bot token (see config.example.json)
$ cp config.example.json config.json
$ nano config.json
# Set a bot token (see .env.example)
$ cp .env.example .env
$ nano .env

# Start the bot!
$ npm start
2 changes: 1 addition & 1 deletion _base/package.json
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
"name": "@discordjs/voice-examples-base",
"version": "0.0.1",
"description": "An example receiver bot written using @discordjs/voice",
"main": "dist/index.js.js",
"main": "dist/index.js",
"type": "module",
"scripts": {
"build": "rimraf dist && tsc",
5 changes: 4 additions & 1 deletion _base/tsconfig.json
Original file line number Diff line number Diff line change
@@ -44,7 +44,10 @@
"experimentalDecorators": true,
"lib": ["ESNext", "esnext.disposable"],
"target": "ESNext",
"useDefineForClassFields": true
"useDefineForClassFields": true,

// Completeness
"skipLibCheck": true
},
"include": ["src/*.ts"],
"exclude": ["node_modules"]
3 changes: 1 addition & 2 deletions basic/src/index.ts
Original file line number Diff line number Diff line change
@@ -38,8 +38,6 @@ client.once(Events.ClientReady, async () => {
client.on(Events.MessageCreate, async (message) => {
if (message.author.bot || !message.inGuild() || !message.mentions.has(message.client.user.id)) return;

console.log(message.mentions, message.content);

if (message.content.includes('join')) {
if (!message.member?.voice.channel) {
await message.reply('Join a voice channel then try again!');
@@ -59,6 +57,7 @@ client.on(Events.MessageCreate, async (message) => {
* voice channel.
*/
connection.subscribe(player);

await message.reply('Playing now!');
} catch (error) {
/**
1 change: 1 addition & 0 deletions basic/src/util/helpers.ts
Original file line number Diff line number Diff line change
@@ -45,6 +45,7 @@ export async function connectToChannel(channel: VoiceBasedChannel) {
* is aware that we failed to connect to the channel.
*/
connection.destroy();

throw error;
}
}
5 changes: 4 additions & 1 deletion basic/tsconfig.json
Original file line number Diff line number Diff line change
@@ -44,7 +44,10 @@
"experimentalDecorators": true,
"lib": ["ESNext", "esnext.disposable"],
"target": "ESNext",
"useDefineForClassFields": true
"useDefineForClassFields": true,

// Completeness
"skipLibCheck": true
},
"include": ["src/*.ts"],
"exclude": ["node_modules"]