Added version to stats and workaround for #1
This commit is contained in:
parent
f1fb72294d
commit
ba4ded7b72
2 changed files with 10 additions and 3 deletions
|
@ -1,4 +1,5 @@
|
||||||
const client = require("../utils/client.js");
|
const client = require("../utils/client.js");
|
||||||
|
const { version } = require("../package.json");
|
||||||
const moment = require("moment");
|
const moment = require("moment");
|
||||||
require("moment-duration-format");
|
require("moment-duration-format");
|
||||||
const os = require("os");
|
const os = require("os");
|
||||||
|
@ -14,6 +15,10 @@ exports.run = async (message) => {
|
||||||
"color": 16711680,
|
"color": 16711680,
|
||||||
"description": "**You are currently using esmBot Dev! Things may change at any time without warning and there will be bugs. Many bugs.**",
|
"description": "**You are currently using esmBot Dev! Things may change at any time without warning and there will be bugs. Many bugs.**",
|
||||||
"fields": [{
|
"fields": [{
|
||||||
|
"name": "Version",
|
||||||
|
"value": `v${version}-dev`
|
||||||
|
},
|
||||||
|
{
|
||||||
"name": "Memory Usage",
|
"name": "Memory Usage",
|
||||||
"value": `${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)} MB`
|
"value": `${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)} MB`
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
const client = require("./client.js");
|
const client = require("./client.js");
|
||||||
const fs = require("fs");
|
|
||||||
const logger = require("./logger.js");
|
const logger = require("./logger.js");
|
||||||
|
|
||||||
module.exports = async (sound, message) => {
|
module.exports = async (sound, message) => {
|
||||||
|
@ -7,12 +6,15 @@ module.exports = async (sound, message) => {
|
||||||
if (!message.channel.guild.members.get(client.user.id).permission.has("voiceConnect") || !message.channel.permissionsOf(client.user.id).has("voiceConnect")) return client.createMessage(message.channel.id, `${message.author.mention}, I can't join this voice channel!`);
|
if (!message.channel.guild.members.get(client.user.id).permission.has("voiceConnect") || !message.channel.permissionsOf(client.user.id).has("voiceConnect")) return client.createMessage(message.channel.id, `${message.author.mention}, I can't join this voice channel!`);
|
||||||
const voiceChannel = message.channel.guild.channels.get(message.member.voiceState.channelID);
|
const voiceChannel = message.channel.guild.channels.get(message.member.voiceState.channelID);
|
||||||
if (!voiceChannel.permissionsOf(client.user.id).has("voiceConnect")) return client.createMessage(message.channel.id, `${message.author.mention}, I don't have permission to join this voice channel!`);
|
if (!voiceChannel.permissionsOf(client.user.id).has("voiceConnect")) return client.createMessage(message.channel.id, `${message.author.mention}, I don't have permission to join this voice channel!`);
|
||||||
const connection = await voiceChannel.join();
|
const connection = await voiceChannel.join({
|
||||||
|
opusOnly: true
|
||||||
|
});
|
||||||
|
if (connection.playing) return client.createMessage(message.channel.id, `${message.author.mention}, I'm already playing a sound!`);
|
||||||
const playingMessage = await client.createMessage(message.channel.id, "🔊 Playing sound...");
|
const playingMessage = await client.createMessage(message.channel.id, "🔊 Playing sound...");
|
||||||
if (connection.playing) {
|
if (connection.playing) {
|
||||||
connection.stopPlaying();
|
connection.stopPlaying();
|
||||||
}
|
}
|
||||||
connection.play(fs.createReadStream(sound));
|
connection.play(sound);
|
||||||
connection.on("error", (error) => {
|
connection.on("error", (error) => {
|
||||||
voiceChannel.leave();
|
voiceChannel.leave();
|
||||||
playingMessage.delete();
|
playingMessage.delete();
|
||||||
|
|
Loading…
Reference in a new issue