mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-12-29 01:25:38 -05:00
Optimizations and update packages
This commit is contained in:
parent
21ea97d3c6
commit
85a40cfb06
39
.pnp.cjs
generated
39
.pnp.cjs
generated
@ -33,17 +33,17 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
|||||||
["@octokit/auth-token", "npm:4.0.0"],\
|
["@octokit/auth-token", "npm:4.0.0"],\
|
||||||
["@octokit/rest", "npm:20.0.1"],\
|
["@octokit/rest", "npm:20.0.1"],\
|
||||||
["@types/ms", "npm:0.7.31"],\
|
["@types/ms", "npm:0.7.31"],\
|
||||||
["@types/node", "npm:20.4.8"],\
|
["@types/node", "npm:20.4.10"],\
|
||||||
["axios", "npm:1.4.0"],\
|
["axios", "npm:1.4.0"],\
|
||||||
["canvas", "npm:2.11.2"],\
|
["canvas", "npm:2.11.2"],\
|
||||||
["discord-player", "virtual:20c353e2d6536e37339997f03975c6a660f4d296e664d291bd43620c6162cca8eb5ef90b0998dc9db75ff6862e5da587d0530bae26805f5fadc8f17aaa4ff794#npm:6.6.2"],\
|
["discord-player", "virtual:20c353e2d6536e37339997f03975c6a660f4d296e664d291bd43620c6162cca8eb5ef90b0998dc9db75ff6862e5da587d0530bae26805f5fadc8f17aaa4ff794#npm:6.6.2"],\
|
||||||
["discord.js", "npm:14.12.1"],\
|
["discord.js", "npm:14.12.1"],\
|
||||||
["libsodium-wrappers", "npm:0.7.11"],\
|
["libsodium-wrappers", "npm:0.7.11"],\
|
||||||
["moment", "npm:2.29.4"],\
|
["moment", "npm:2.29.4"],\
|
||||||
["mongoose", "npm:7.4.2"],\
|
["mongoose", "npm:7.4.3"],\
|
||||||
["ms", "npm:2.1.3"],\
|
["ms", "npm:2.1.3"],\
|
||||||
["prism-media", "virtual:20c353e2d6536e37339997f03975c6a660f4d296e664d291bd43620c6162cca8eb5ef90b0998dc9db75ff6862e5da587d0530bae26805f5fadc8f17aaa4ff794#npm:1.3.5"],\
|
["prism-media", "virtual:20c353e2d6536e37339997f03975c6a660f4d296e664d291bd43620c6162cca8eb5ef90b0998dc9db75ff6862e5da587d0530bae26805f5fadc8f17aaa4ff794#npm:1.3.5"],\
|
||||||
["systeminformation", "npm:5.18.12"],\
|
["systeminformation", "npm:5.18.15"],\
|
||||||
["typescript", "patch:typescript@npm%3A5.1.6#~builtin<compat/typescript>::version=5.1.6&hash=5da071"],\
|
["typescript", "patch:typescript@npm%3A5.1.6#~builtin<compat/typescript>::version=5.1.6&hash=5da071"],\
|
||||||
["xml-js", "npm:1.6.11"],\
|
["xml-js", "npm:1.6.11"],\
|
||||||
["youtube-sr", "npm:4.3.4"],\
|
["youtube-sr", "npm:4.3.4"],\
|
||||||
@ -513,6 +513,13 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
|||||||
}]\
|
}]\
|
||||||
]],\
|
]],\
|
||||||
["@types/node", [\
|
["@types/node", [\
|
||||||
|
["npm:20.4.10", {\
|
||||||
|
"packageLocation": "./.yarn/cache/@types-node-npm-20.4.10-a66bd58ee3-02a1ca415d.zip/node_modules/@types/node/",\
|
||||||
|
"packageDependencies": [\
|
||||||
|
["@types/node", "npm:20.4.10"]\
|
||||||
|
],\
|
||||||
|
"linkType": "HARD"\
|
||||||
|
}],\
|
||||||
["npm:20.4.8", {\
|
["npm:20.4.8", {\
|
||||||
"packageLocation": "./.yarn/cache/@types-node-npm-20.4.8-f8f2d8d349-86a3963c0c.zip/node_modules/@types/node/",\
|
"packageLocation": "./.yarn/cache/@types-node-npm-20.4.8-f8f2d8d349-86a3963c0c.zip/node_modules/@types/node/",\
|
||||||
"packageDependencies": [\
|
"packageDependencies": [\
|
||||||
@ -934,17 +941,17 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
|||||||
["@octokit/auth-token", "npm:4.0.0"],\
|
["@octokit/auth-token", "npm:4.0.0"],\
|
||||||
["@octokit/rest", "npm:20.0.1"],\
|
["@octokit/rest", "npm:20.0.1"],\
|
||||||
["@types/ms", "npm:0.7.31"],\
|
["@types/ms", "npm:0.7.31"],\
|
||||||
["@types/node", "npm:20.4.8"],\
|
["@types/node", "npm:20.4.10"],\
|
||||||
["axios", "npm:1.4.0"],\
|
["axios", "npm:1.4.0"],\
|
||||||
["canvas", "npm:2.11.2"],\
|
["canvas", "npm:2.11.2"],\
|
||||||
["discord-player", "virtual:20c353e2d6536e37339997f03975c6a660f4d296e664d291bd43620c6162cca8eb5ef90b0998dc9db75ff6862e5da587d0530bae26805f5fadc8f17aaa4ff794#npm:6.6.2"],\
|
["discord-player", "virtual:20c353e2d6536e37339997f03975c6a660f4d296e664d291bd43620c6162cca8eb5ef90b0998dc9db75ff6862e5da587d0530bae26805f5fadc8f17aaa4ff794#npm:6.6.2"],\
|
||||||
["discord.js", "npm:14.12.1"],\
|
["discord.js", "npm:14.12.1"],\
|
||||||
["libsodium-wrappers", "npm:0.7.11"],\
|
["libsodium-wrappers", "npm:0.7.11"],\
|
||||||
["moment", "npm:2.29.4"],\
|
["moment", "npm:2.29.4"],\
|
||||||
["mongoose", "npm:7.4.2"],\
|
["mongoose", "npm:7.4.3"],\
|
||||||
["ms", "npm:2.1.3"],\
|
["ms", "npm:2.1.3"],\
|
||||||
["prism-media", "virtual:20c353e2d6536e37339997f03975c6a660f4d296e664d291bd43620c6162cca8eb5ef90b0998dc9db75ff6862e5da587d0530bae26805f5fadc8f17aaa4ff794#npm:1.3.5"],\
|
["prism-media", "virtual:20c353e2d6536e37339997f03975c6a660f4d296e664d291bd43620c6162cca8eb5ef90b0998dc9db75ff6862e5da587d0530bae26805f5fadc8f17aaa4ff794#npm:1.3.5"],\
|
||||||
["systeminformation", "npm:5.18.12"],\
|
["systeminformation", "npm:5.18.15"],\
|
||||||
["typescript", "patch:typescript@npm%3A5.1.6#~builtin<compat/typescript>::version=5.1.6&hash=5da071"],\
|
["typescript", "patch:typescript@npm%3A5.1.6#~builtin<compat/typescript>::version=5.1.6&hash=5da071"],\
|
||||||
["xml-js", "npm:1.6.11"],\
|
["xml-js", "npm:1.6.11"],\
|
||||||
["youtube-sr", "npm:4.3.4"],\
|
["youtube-sr", "npm:4.3.4"],\
|
||||||
@ -1923,10 +1930,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
|||||||
],\
|
],\
|
||||||
"linkType": "SOFT"\
|
"linkType": "SOFT"\
|
||||||
}],\
|
}],\
|
||||||
["virtual:d0cf582de895e62953c81ce7ab1a408175da60784650b2939a6701a3e2b010f4c727d233f3f39d449e394e9ee90a709f72fd9dc5e400cff7ac78e132b6b47f51#npm:5.7.0", {\
|
["virtual:de9b2a4bee48b47472569f051556d00472ad2cae24f303eab2885fcb163b9304e49630ec473487f25346e199b727589de8b538c4c4621c9a5e46486fe0dda3c9#npm:5.7.0", {\
|
||||||
"packageLocation": "./.yarn/__virtual__/mongodb-virtual-7d609f886f/0/cache/mongodb-npm-5.7.0-c5e415a2e7-16357b6229.zip/node_modules/mongodb/",\
|
"packageLocation": "./.yarn/__virtual__/mongodb-virtual-3d9fb5213a/0/cache/mongodb-npm-5.7.0-c5e415a2e7-16357b6229.zip/node_modules/mongodb/",\
|
||||||
"packageDependencies": [\
|
"packageDependencies": [\
|
||||||
["mongodb", "virtual:d0cf582de895e62953c81ce7ab1a408175da60784650b2939a6701a3e2b010f4c727d233f3f39d449e394e9ee90a709f72fd9dc5e400cff7ac78e132b6b47f51#npm:5.7.0"],\
|
["mongodb", "virtual:de9b2a4bee48b47472569f051556d00472ad2cae24f303eab2885fcb163b9304e49630ec473487f25346e199b727589de8b538c4c4621c9a5e46486fe0dda3c9#npm:5.7.0"],\
|
||||||
["@aws-sdk/credential-providers", null],\
|
["@aws-sdk/credential-providers", null],\
|
||||||
["@mongodb-js/zstd", null],\
|
["@mongodb-js/zstd", null],\
|
||||||
["@types/aws-sdk__credential-providers", null],\
|
["@types/aws-sdk__credential-providers", null],\
|
||||||
@ -1969,13 +1976,13 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
|||||||
}]\
|
}]\
|
||||||
]],\
|
]],\
|
||||||
["mongoose", [\
|
["mongoose", [\
|
||||||
["npm:7.4.2", {\
|
["npm:7.4.3", {\
|
||||||
"packageLocation": "./.yarn/cache/mongoose-npm-7.4.2-d0cf582de8-2bf73cea4b.zip/node_modules/mongoose/",\
|
"packageLocation": "./.yarn/cache/mongoose-npm-7.4.3-de9b2a4bee-e92feec9e7.zip/node_modules/mongoose/",\
|
||||||
"packageDependencies": [\
|
"packageDependencies": [\
|
||||||
["mongoose", "npm:7.4.2"],\
|
["mongoose", "npm:7.4.3"],\
|
||||||
["bson", "npm:5.4.0"],\
|
["bson", "npm:5.4.0"],\
|
||||||
["kareem", "npm:2.5.1"],\
|
["kareem", "npm:2.5.1"],\
|
||||||
["mongodb", "virtual:d0cf582de895e62953c81ce7ab1a408175da60784650b2939a6701a3e2b010f4c727d233f3f39d449e394e9ee90a709f72fd9dc5e400cff7ac78e132b6b47f51#npm:5.7.0"],\
|
["mongodb", "virtual:de9b2a4bee48b47472569f051556d00472ad2cae24f303eab2885fcb163b9304e49630ec473487f25346e199b727589de8b538c4c4621c9a5e46486fe0dda3c9#npm:5.7.0"],\
|
||||||
["mpath", "npm:0.9.0"],\
|
["mpath", "npm:0.9.0"],\
|
||||||
["mquery", "npm:5.0.0"],\
|
["mquery", "npm:5.0.0"],\
|
||||||
["ms", "npm:2.1.3"],\
|
["ms", "npm:2.1.3"],\
|
||||||
@ -2681,10 +2688,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
|||||||
}]\
|
}]\
|
||||||
]],\
|
]],\
|
||||||
["systeminformation", [\
|
["systeminformation", [\
|
||||||
["npm:5.18.12", {\
|
["npm:5.18.15", {\
|
||||||
"packageLocation": "./.yarn/unplugged/systeminformation-npm-5.18.12-2a4b019257/node_modules/systeminformation/",\
|
"packageLocation": "./.yarn/unplugged/systeminformation-npm-5.18.15-6e7be558fc/node_modules/systeminformation/",\
|
||||||
"packageDependencies": [\
|
"packageDependencies": [\
|
||||||
["systeminformation", "npm:5.18.12"]\
|
["systeminformation", "npm:5.18.15"]\
|
||||||
],\
|
],\
|
||||||
"linkType": "HARD"\
|
"linkType": "HARD"\
|
||||||
}]\
|
}]\
|
||||||
|
@ -37,10 +37,10 @@
|
|||||||
"discord.js": "14.12.1",
|
"discord.js": "14.12.1",
|
||||||
"libsodium-wrappers": "0.7.11",
|
"libsodium-wrappers": "0.7.11",
|
||||||
"moment": "2.29.4",
|
"moment": "2.29.4",
|
||||||
"mongoose": "7.4.2",
|
"mongoose": "7.4.3",
|
||||||
"ms": "2.1.3",
|
"ms": "2.1.3",
|
||||||
"prism-media": "1.3.5",
|
"prism-media": "1.3.5",
|
||||||
"systeminformation": "5.18.12",
|
"systeminformation": "5.18.15",
|
||||||
"typescript": "5.1.6",
|
"typescript": "5.1.6",
|
||||||
"xml-js": "1.6.11",
|
"xml-js": "1.6.11",
|
||||||
"youtube-sr": "4.3.4",
|
"youtube-sr": "4.3.4",
|
||||||
@ -48,6 +48,6 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/ms": "0.7.31",
|
"@types/ms": "0.7.31",
|
||||||
"@types/node": "20.4.8"
|
"@types/node": "20.4.10"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,7 @@ export default {
|
|||||||
.addStringOption(x=>x
|
.addStringOption(x=>x
|
||||||
.setName('status')
|
.setName('status')
|
||||||
.setDescription('Set a status indicator for the bot')
|
.setDescription('Set a status indicator for the bot')
|
||||||
.setChoices(
|
.addChoices(
|
||||||
{name: 'Online', value: Discord.PresenceUpdateStatus.Online},
|
{name: 'Online', value: Discord.PresenceUpdateStatus.Online},
|
||||||
{name: 'Idle', value: Discord.PresenceUpdateStatus.Idle},
|
{name: 'Idle', value: Discord.PresenceUpdateStatus.Idle},
|
||||||
{name: 'Do Not Distrub', value: Discord.PresenceUpdateStatus.DoNotDisturb},
|
{name: 'Do Not Distrub', value: Discord.PresenceUpdateStatus.DoNotDisturb},
|
||||||
|
@ -5,12 +5,9 @@ import {SpotifyExtractor} from '@discord-player/extractor';
|
|||||||
export default {
|
export default {
|
||||||
async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){
|
async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){
|
||||||
if (!client.config.botSwitches.music && !client.config.whitelist.includes(interaction.user.id)) return interaction.reply({content:'Music module is currently disabled.',ephemeral:true});
|
if (!client.config.botSwitches.music && !client.config.whitelist.includes(interaction.user.id)) return interaction.reply({content:'Music module is currently disabled.',ephemeral:true});
|
||||||
if (!client.isStaff(interaction.member) && !client.config.whitelist.includes(interaction.member.id)) return interaction.reply('This command is in early stages of development, some parts may be missing or broken.\nIt has been restricted to staff for time-being.');
|
if (!client.isStaff(interaction.member) && !client.config.whitelist.includes(interaction.member.id)) return interaction.reply('Music module is close to being completed, some parts may be incomplete or broken, so it has been restricted to staff for time-being.');
|
||||||
const player = Player.singleton(client);
|
const player = Player.singleton(client);
|
||||||
await player.extractors.register(SpotifyExtractor, {
|
await player.extractors.register(SpotifyExtractor,{clientId: client.tokens.dontlookatme.client, clientSecret: client.tokens.dontlookatme.secret});
|
||||||
clientId: client.tokens.dontlookatme.client,
|
|
||||||
clientSecret: client.tokens.dontlookatme.secret
|
|
||||||
});
|
|
||||||
if (!interaction.member.voice.channel) return interaction.reply('Please join a voice channel first to use the command.');
|
if (!interaction.member.voice.channel) return interaction.reply('Please join a voice channel first to use the command.');
|
||||||
player.nodes.create(interaction.guildId, {
|
player.nodes.create(interaction.guildId, {
|
||||||
metadata: {
|
metadata: {
|
||||||
@ -27,53 +24,67 @@ export default {
|
|||||||
connectionTimeout: 25000,
|
connectionTimeout: 25000,
|
||||||
strategy: 'FIFO'
|
strategy: 'FIFO'
|
||||||
});
|
});
|
||||||
|
const queue = useQueue(interaction.guildId);
|
||||||
({
|
({
|
||||||
play: async()=>{
|
play: async()=>{
|
||||||
const url = interaction.options.getString('url');
|
const url = interaction.options.getString('url');
|
||||||
if (!url.includes('https://open.spotify.com/')) return interaction.reply('Sorry, I can\'t play that. I can only accept Spotify links that contains `https://open.spotify.com/`'); // Yes, I made it clear that it's intended typo.
|
if (!url.includes('https://open.spotify.com/')) return interaction.reply('Sorry, I can\'t play that. I can only accept Spotify links that contains `https://open.spotify.com/`'); // Yes, I made it clear that it's intended typo.
|
||||||
if (!(await player.search(url,{requestedBy:interaction.user})).hasTracks()) return interaction.reply(`No results found for \`${url}\`\nIt is either private, unavailable or you made a *tpyo* in your query.`)
|
if (!(await player.search(url,{requestedBy:interaction.user})).hasTracks()) return interaction.reply(`No results found for \`${url}\`\nIt is either private, unavailable or you made a *tpyo* in your query.`)
|
||||||
player.play(interaction.member.voice.channel, url);
|
player.play(interaction.member.voice.channel, url);
|
||||||
await interaction.reply(`Added the ${url.includes('playlist/') ? 'playlist' : 'song'} to the queue.`);
|
await interaction.reply(`Added the ${url.includes('playlist/') ? 'playlist' : url.includes('album/') ? 'album' : 'song'} to the queue.`);
|
||||||
},
|
},
|
||||||
stop: async()=>{
|
stop: async()=>{
|
||||||
player.destroy();
|
player.destroy();
|
||||||
await interaction.reply('Player destroyed.')
|
await interaction.reply('Player destroyed.')
|
||||||
},
|
},
|
||||||
pause: ()=>{
|
pause: ()=>{
|
||||||
const queue = useQueue(interaction.guildId);
|
|
||||||
queue.node.setPaused(!queue.node.isPaused());
|
queue.node.setPaused(!queue.node.isPaused());
|
||||||
if (!queue.node.isPaused) interaction.reply('Music has been paused.');
|
if (queue.node.isPaused()) interaction.reply('Music has been paused.');
|
||||||
else if (queue.node.isPaused) interaction.reply('Music has been unpaused.')
|
else interaction.reply('Music has been resumed.')
|
||||||
},
|
},
|
||||||
now_playing: ()=>{
|
now_playing: ()=>{
|
||||||
const {volume,timestamp,track} = useTimeline(interaction.guildId);
|
const {volume,timestamp,track} = useTimeline(interaction.guildId);
|
||||||
|
if (!track) return interaction.reply('There\'s nothing playing, why are you checking?');
|
||||||
|
else {
|
||||||
|
function convertNumberToText(input:number){
|
||||||
|
switch(input){
|
||||||
|
case 0: return 'Off';
|
||||||
|
case 1: return 'Track';
|
||||||
|
case 2: return 'Queue';
|
||||||
|
case 3: return 'Autoplay DJ';
|
||||||
|
}
|
||||||
|
}
|
||||||
interaction.reply({embeds:[
|
interaction.reply({embeds:[
|
||||||
new client.embed().setColor(client.config.embedColor).setTitle(`${track.title} - ${track.author}`).setThumbnail(track.thumbnail).addFields(
|
new client.embed().setColor(client.config.embedColor).setTitle(`${track.title} - ${track.author}`).setThumbnail(track.thumbnail).addFields(
|
||||||
{name: 'Timestamp', value: `**${timestamp.current.label}**/**${timestamp.total.label}**`, inline: true},
|
{name: 'Timestamp', value: `**${timestamp.current.label}**/**${timestamp.total.label}**`, inline: true},
|
||||||
{name: 'Volume', value: `${volume}%`, inline: true}
|
{name: 'Volume', value: `${volume}%`, inline: true},
|
||||||
|
{name: 'Loop mode', value: `${convertNumberToText(queue.repeatMode)}`, inline: true}
|
||||||
)
|
)
|
||||||
]})
|
]})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
queue: async()=>{
|
queue: async()=>interaction.reply({embeds:[new client.embed().setColor(client.config.embedColor).setTitle(`Songs currently in the queue: ${queue.tracks.size}`).setDescription(queue.tracks.size > 0 ? `\`\`\`${queue.tracks.map(i=>`${i.title} - ${i.author}\`\`\``).join('```\n')}`.slice(0,1017) : '*No songs currently queued.*')]}),
|
||||||
const queue = useQueue(interaction.guildId);
|
|
||||||
interaction.reply({embeds:[new client.embed().setColor(client.config.embedColor).setTitle(`Songs currently in the queue: ${queue.tracks.size}`).setDescription(queue.tracks.size > 0 ? `\`\`\`${queue.tracks.map(i=>`${i.title} - ${i.author}\`\`\``).join('```\n')}`.slice(0,1017) : '*No songs currently queued.*')]})
|
|
||||||
},
|
|
||||||
volume: ()=>{
|
volume: ()=>{
|
||||||
const vol = interaction.options.getNumber('percentage');
|
const vol = interaction.options.getNumber('percentage');
|
||||||
useQueue(interaction.guildId).node.setVolume(vol);
|
queue.node.setVolume(vol);
|
||||||
interaction.reply(`Successfully adjusted the player's volume to ${vol}%`)
|
interaction.reply(`Successfully adjusted the player's volume to ${vol}%`)
|
||||||
},
|
},
|
||||||
shuffle: ()=>{
|
shuffle: ()=>{
|
||||||
useQueue(interaction.guildId).tracks.shuffle();
|
queue.tracks.shuffle();
|
||||||
interaction.reply('Songs in the queue has been shuffled.')
|
interaction.reply('Songs in the queue has been shuffled.')
|
||||||
},
|
},
|
||||||
remove: ()=>{
|
remove: ()=>{
|
||||||
useQueue(interaction.guildId).removeTrack(interaction.options.getNumber('id',true));
|
queue.removeTrack(interaction.options.getNumber('id',true));
|
||||||
interaction.reply('Song has been removed from the queue.')
|
interaction.reply('Song has been removed from the queue.')
|
||||||
},
|
},
|
||||||
skip: ()=>{
|
skip: ()=>{
|
||||||
useQueue(interaction.guildId).node.skip();
|
queue.node.skip();
|
||||||
interaction.reply('Skipped the current song, now playing the next one in queue.')
|
interaction.reply('Skipped the current song, now playing the next one in queue.')
|
||||||
|
},
|
||||||
|
loop: ()=>{
|
||||||
|
const loopMode = interaction.options.getNumber('mode',true);
|
||||||
|
queue.setRepeatMode(loopMode);
|
||||||
|
interaction.reply(`Loop mode is now ${loopMode === 0 ? 'disabled.' : loopMode === 1 ? 'set to loop current track.': loopMode === 2 ? 'looping through current queue.' : 'activating Autoplay DJ.'}`)
|
||||||
}
|
}
|
||||||
} as any)[interaction.options.getSubcommand()]();
|
} as any)[interaction.options.getSubcommand()]();
|
||||||
},
|
},
|
||||||
@ -114,6 +125,19 @@ export default {
|
|||||||
.addSubcommand(x=>x
|
.addSubcommand(x=>x
|
||||||
.setName('shuffle')
|
.setName('shuffle')
|
||||||
.setDescription('Shuffle the songs in a queue'))
|
.setDescription('Shuffle the songs in a queue'))
|
||||||
|
.addSubcommand(x=>x
|
||||||
|
.setName('loop')
|
||||||
|
.setDescription('Loop through queue or current track or enable Autoplay DJ')
|
||||||
|
.addNumberOption(x=>x
|
||||||
|
.setName('mode')
|
||||||
|
.setDescription('Select the available modes to use')
|
||||||
|
.addChoices(
|
||||||
|
{name: 'Off', value: 0},
|
||||||
|
{name: 'Current track', value: 1},
|
||||||
|
{name: 'Queue', value: 2},
|
||||||
|
{name: 'Autoplay DJ (Play related songs based on queue)', value: 3}
|
||||||
|
)
|
||||||
|
.setRequired(true)))
|
||||||
.addSubcommand(x=>x
|
.addSubcommand(x=>x
|
||||||
.setName('remove')
|
.setName('remove')
|
||||||
.setDescription('Remove a specific song from the queue')
|
.setDescription('Remove a specific song from the queue')
|
||||||
|
11
src/index.ts
11
src/index.ts
@ -30,13 +30,18 @@ client.on('ready', async()=>{
|
|||||||
|
|
||||||
// Error handler
|
// Error handler
|
||||||
function DZ(error:Error, type:string){// Yes, I may have shiternet but I don't need to wake up to like a hundred messages or so.
|
function DZ(error:Error, type:string){// Yes, I may have shiternet but I don't need to wake up to like a hundred messages or so.
|
||||||
if (['getaddrinfo ENOTFOUND discord.com', 'getaddrinfo EAI_AGAIN discord.com', '[Error: 30130000:error:0A000410:SSL', '[Error: F8200000:error:0A000410:SSL'].includes(error.message)) return;
|
if ([
|
||||||
|
'getaddrinfo ENOTFOUND discord.com', 'getaddrinfo EAI_AGAIN discord.com',
|
||||||
|
'[Error: 30130000:error:0A000410:SSL', '[Error: F8200000:error:0A000410:SSL',
|
||||||
|
'HTTPError: Internal Server Error'
|
||||||
|
].includes(error.message)) return;
|
||||||
console.error(error);
|
console.error(error);
|
||||||
(client.channels.resolve(client.config.mainServer.channels.errors) as Discord.TextChannel | null)?.send({embeds: [new client.embed().setColor('#560000').setTitle('Error caught!').setFooter({text: 'Error type: ' + type}).setDescription(`**Error:**\n\`\`\`${error.message}\`\`\`**Stack:**\n\`\`\`${`${error.stack}`.slice(0, 2500)}\`\`\``)]})
|
(client.channels.resolve(client.config.mainServer.channels.errors) as Discord.TextChannel | null)?.send({embeds: [new client.embed().setColor('#560000').setTitle('Error caught!').setFooter({text: 'Error type: ' + type}).setDescription(`**Error:**\n\`\`\`${error.message}\`\`\`**Stack:**\n\`\`\`${`${error.stack}`.slice(0, 2500)}\`\`\``)]})
|
||||||
}
|
}
|
||||||
process.on('unhandledRejection', (error: Error)=>DZ(error, 'unhandledRejection'));
|
process.on('unhandledRejection', (error: Error)=>DZ(error, 'unhandledRejection'));
|
||||||
process.on('uncaughtException', (error: Error)=>DZ(error, 'uncaughtException'));
|
process.on('uncaughtException', (error: Error)=>DZ(error, 'uncaughtException'));
|
||||||
process.on('error', (error: Error)=>DZ(error, 'process-error'));
|
process.on('error', (error: Error)=>DZ(error, 'nodeError'));
|
||||||
|
process.on('warning', (warn: Error)=>DZ(warn, 'nodeWarning'));
|
||||||
client.on('error', (error: Error)=>DZ(error, 'client-error'));
|
client.on('error', (error: Error)=>DZ(error, 'client-error'));
|
||||||
|
|
||||||
// Audio Player event handling
|
// Audio Player event handling
|
||||||
@ -87,7 +92,9 @@ setInterval(async()=>{
|
|||||||
dailyMsgs.push([formattedDate, total]);
|
dailyMsgs.push([formattedDate, total]);
|
||||||
writeFileSync('./src/database/dailyMsgs.json', JSON.stringify(dailyMsgs))
|
writeFileSync('./src/database/dailyMsgs.json', JSON.stringify(dailyMsgs))
|
||||||
console.log(client.logTime(), `Pushed [${formattedDate}, ${total}] to dailyMsgs`);
|
console.log(client.logTime(), `Pushed [${formattedDate}, ${total}] to dailyMsgs`);
|
||||||
|
if (client.token != client.tokens.main){
|
||||||
client.guilds.cache.get(client.config.mainServer.id).commands.fetch().then(commands=>(client.channels.resolve(client.config.mainServer.channels.logs) as Discord.TextChannel).send(`:pencil: Pushed \`[${formattedDate}, ${total}]\` to </rank leaderboard:${commands.find(x=>x.name === 'rank').id}>`));
|
client.guilds.cache.get(client.config.mainServer.id).commands.fetch().then(commands=>(client.channels.resolve(client.config.mainServer.channels.logs) as Discord.TextChannel).send(`:pencil: Pushed \`[${formattedDate}, ${total}]\` to </rank leaderboard:${commands.find(x=>x.name === 'rank').id}>`));
|
||||||
(client.channels.resolve(client.config.mainServer.channels.thismeanswar) as Discord.TextChannel).send({files:['./src/database/dailyMsgs.json']}).catch(fileErr=>console.log(fileErr))
|
(client.channels.resolve(client.config.mainServer.channels.thismeanswar) as Discord.TextChannel).send({files:['./src/database/dailyMsgs.json']}).catch(fileErr=>console.log(fileErr))
|
||||||
|
} else console.log(client.logTime(), 'Development bot\'s token is in use, not uploading dailyMsgs.json to channel.')
|
||||||
}
|
}
|
||||||
}, 5000)
|
}, 5000)
|
||||||
|
31
yarn.lock
31
yarn.lock
@ -379,13 +379,20 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@types/node@npm:*, @types/node@npm:20.4.8":
|
"@types/node@npm:*":
|
||||||
version: 20.4.8
|
version: 20.4.8
|
||||||
resolution: "@types/node@npm:20.4.8"
|
resolution: "@types/node@npm:20.4.8"
|
||||||
checksum: 86a3963c0c7af3410553d1dfa4b018a20b3cb3ab4d8e8ffe27408b6338c5de0374b0bf379bc705da2205b466daa751ccfe062f453ba9bde34fdb0e5163ca6a68
|
checksum: 86a3963c0c7af3410553d1dfa4b018a20b3cb3ab4d8e8ffe27408b6338c5de0374b0bf379bc705da2205b466daa751ccfe062f453ba9bde34fdb0e5163ca6a68
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"@types/node@npm:20.4.10":
|
||||||
|
version: 20.4.10
|
||||||
|
resolution: "@types/node@npm:20.4.10"
|
||||||
|
checksum: 02a1ca415d9cc91144c4250383aa0ef1e48241bd36067ed7d1b239d8bacc2a11139dd90e223e11ac289345eeae624cc5dcf73359e684bd2e5a6c31bdfbab4811
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"@types/webidl-conversions@npm:*":
|
"@types/webidl-conversions@npm:*":
|
||||||
version: 7.0.0
|
version: 7.0.0
|
||||||
resolution: "@types/webidl-conversions@npm:7.0.0"
|
resolution: "@types/webidl-conversions@npm:7.0.0"
|
||||||
@ -750,17 +757,17 @@ __metadata:
|
|||||||
"@octokit/auth-token": 4.0.0
|
"@octokit/auth-token": 4.0.0
|
||||||
"@octokit/rest": 20.0.1
|
"@octokit/rest": 20.0.1
|
||||||
"@types/ms": 0.7.31
|
"@types/ms": 0.7.31
|
||||||
"@types/node": 20.4.8
|
"@types/node": 20.4.10
|
||||||
axios: 1.4.0
|
axios: 1.4.0
|
||||||
canvas: 2.11.2
|
canvas: 2.11.2
|
||||||
discord-player: 6.6.2
|
discord-player: 6.6.2
|
||||||
discord.js: 14.12.1
|
discord.js: 14.12.1
|
||||||
libsodium-wrappers: 0.7.11
|
libsodium-wrappers: 0.7.11
|
||||||
moment: 2.29.4
|
moment: 2.29.4
|
||||||
mongoose: 7.4.2
|
mongoose: 7.4.3
|
||||||
ms: 2.1.3
|
ms: 2.1.3
|
||||||
prism-media: 1.3.5
|
prism-media: 1.3.5
|
||||||
systeminformation: 5.18.12
|
systeminformation: 5.18.15
|
||||||
typescript: 5.1.6
|
typescript: 5.1.6
|
||||||
xml-js: 1.6.11
|
xml-js: 1.6.11
|
||||||
youtube-sr: 4.3.4
|
youtube-sr: 4.3.4
|
||||||
@ -1628,9 +1635,9 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"mongoose@npm:7.4.2":
|
"mongoose@npm:7.4.3":
|
||||||
version: 7.4.2
|
version: 7.4.3
|
||||||
resolution: "mongoose@npm:7.4.2"
|
resolution: "mongoose@npm:7.4.3"
|
||||||
dependencies:
|
dependencies:
|
||||||
bson: ^5.4.0
|
bson: ^5.4.0
|
||||||
kareem: 2.5.1
|
kareem: 2.5.1
|
||||||
@ -1639,7 +1646,7 @@ __metadata:
|
|||||||
mquery: 5.0.0
|
mquery: 5.0.0
|
||||||
ms: 2.1.3
|
ms: 2.1.3
|
||||||
sift: 16.0.1
|
sift: 16.0.1
|
||||||
checksum: 2bf73cea4bf72ffa553a7d024b827e50fcb4aba9a17111ece764e1644c97313d678e84e0fb63c101061e70966b19ba720524f46deedcfbc631f583da45533eb0
|
checksum: e92feec9e739fd429726b6b17ad0d5c05503d2786aa9605548e2b7e999f990a59bdf950e5cd44aa10e3936277410b4880e760e9e503627fae6c16b4901bf9c49
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
@ -2233,12 +2240,12 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"systeminformation@npm:5.18.12":
|
"systeminformation@npm:5.18.15":
|
||||||
version: 5.18.12
|
version: 5.18.15
|
||||||
resolution: "systeminformation@npm:5.18.12"
|
resolution: "systeminformation@npm:5.18.15"
|
||||||
bin:
|
bin:
|
||||||
systeminformation: lib/cli.js
|
systeminformation: lib/cli.js
|
||||||
checksum: 0893f61fecb0cae181c6cb37b544395263e8be1f7c53a06868c139e4fb9dfe605426850c339afe905d25427addf33e9f754c4c05ec71b0e73dbbf93c2da2247c
|
checksum: 15555c2c0fac29ca8146153c5b9ad146f5fe5ffe109f0cbc20d2d2b902f8b4d2cc57a1add233edc4914c13f984b96250a51ce351bd570a1ac6ba369ed3caa974
|
||||||
conditions: (os=darwin | os=linux | os=win32 | os=freebsd | os=openbsd | os=netbsd | os=sunos | os=android)
|
conditions: (os=darwin | os=linux | os=win32 | os=freebsd | os=openbsd | os=netbsd | os=sunos | os=android)
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
Loading…
Reference in New Issue
Block a user