#development

1 messages Β· Page 927 of 1

indigo cloud
#

whats the solution?

hasty sparrow
#

Check line 57

indigo cloud
#

i dont have 57 lines

#

only 55

hasty sparrow
#

Then show the last few lines

indigo cloud
#

wait oops

#

i forgot to save

#

but a new thing popped up

#

wait let me try to fix this one sec

rotund prism
#

is there something wrong with this code? it doesn't seem to be removing "Stranger" role when i enter this command on them but it does give the friend and ps2 division eu role

#
@client.command(pass_contxt=True)
@has_permissions(manage_roles=True)
async def ps2friendeu(ctx, member: discord.Member):
    roleFriend = discord.utils.get(ctx.guild.roles, name="Friend")
    roleps2EU = discord.utils.get(ctx.guild.roles, name="Planetside 2 Division EU")
    roleStranger = discord.utils.get(ctx.guild.roles, name="stranger")
    await member.add_roles(roleFriend, roleps2EU)
    await member.remove_roles(roleStranger)```
#

i have checked time and time again to see if it's because the name of the role is wrong, it's not

hasty sparrow
#

Is the role name Stranger or stranger?

rotund prism
#

Stranger

#

i even copied and pasted it

hasty sparrow
#

In your code you are using stranger

rotund prism
#

mfw, i kept looking at the left one not the right one

#

thank you for seeing through my stupidity

earnest phoenix
#
const express = require('express');
const http = require('http');

const app = express();
const server = http.createServer(app);
const dbl = new DBL(yourDBLTokenHere, { webhookAuth: 'password', webhookServer: server });

dbl.webhook.on('ready', hook => {
  console.log(`Webhook running with path ${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});

app.get('/', (req, res) => {
  // ...
});

server.listen(5000, () => {
  console.log('Listening');
});```
#

help

#

what password do you want

#

?

neat ingot
#

make one

earnest phoenix
#

I am trying to use dblapi but it just give me Error: 401 Unauthorized back

#
```what password do you want?
hasty sparrow
#

Are you providing a/the correct auth token?

rotund prism
#

@hasty sparrow actually the removal of role does not work but adding of role does work. i forgot to check if it was removing and it isn't

earnest phoenix
#

@earnest phoenix its your choice

#

Are you providing a/the correct auth token?
@hasty sparrow I regenerate but it not showing the new token

hasty sparrow
#

Check whether it can find the role

rotund prism
#

well if it can add the role, surely it should be able to remove the role

hasty sparrow
#

It can't remove roles it can't find

indigo cloud
#
internal/modules/cjs/loader.js:960
  throw err;
  ^

Error: Cannot find module 'minecraft-server-util'
Require stack:
- C:\Users\xAutentiqz\Desktop\Discord Bot\index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
    at Function.Module._load (internal/modules/cjs/loader.js:840:27)
    at Module.require (internal/modules/cjs/loader.js:1019:19)
    at Object.<anonymous> (C:\Users\xAutentiqz\Desktop\Discord Bot\index.js:4:14)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ 'C:\\Users\\xAutentiqz\\Desktop\\Discord Bot\\index.js' ]
} ```
#

i get this error now

hasty sparrow
#

Did you install the minecraft-server-util module?

indigo cloud
#

no

#

how do i do that

#

ok i did it

#

found the command

slender thistle
#

@rotund prism You could use get_role with role IDs

#

or use.find

slender wagon
#

how do i make a bot command work only on specified guilds

rotund prism
#

@slender thistle @hasty sparrow this may sound weird but i think i fixed it by adding a message at end of the command and now it's actually removing stranger role

hasty sparrow
#

That is weird indeed

rotund prism
#

legit just added a await ctx.send

#

and it's working now

#

anyway thanks guys for the help

#

i've been stuck on that for days

tight plinth
#

using erela.js, I tried to make my bot play music. The play command works, the "startTrack" event is triggered, ut the bot doesnt actually play anything.

earnest phoenix
#
const Discord = require("discord.js");
const fetch = require("node-fetch");

module.exports.run = async (bot, message, args) => {
  let target = message.mentions.users.first();
        if(!target) return message.reply(":no_entry_sign: **Specifica pe cine vrei sa plesnesti!**");
  const random_slap = [
'https://tenor.com/view/slap-handaseishuu-narukotoishi-barakamonanime-barakamon-gif-5509136',
    'https://tenor.com/view/no-angry-anime-slap-gif-7355956',
    'https://tenor.com/view/animepound-slam-gif-4880762',
    'https://tenor.com/view/anime-manga-japanese-anime-japanese-manga-toradora-gif-5373994',
    'https://tenor.com/view/hotd-slap-hit-anime-hitting-gif-5318916',
    'https://tenor.com/view/rosario-vampire-anime-slap-butt-gif-3412059'
]
  
  const file = random_slap[Math.floor(Math.random() * random_slap.lenght)]
  
  let pEmbed = new Discord.RichEmbed()
        .setColor("#0061ff")
        .setAuthor(`${message.author.username} ii da o palma lui ${target.username}`, message.guild.iconURL)
        .setImage(file)
        .setTimestamp()
        .setFooter(bot.user.username.toUpperCase(), bot.user.displayAvatarURL)
        .setURL(file);

        message.channel.send(pEmbed)
  
}

module.exports.help = {
    name: "slap"
}

Bot sends the embed but with no file, help ?

tight plinth
#

setImage(file)

#

smh

boreal latch
#

spelled "length" wrong

#

u spelled lenght

earnest phoenix
#

oh, right

#

@boreal latch the bot is sending the image too but the gif doesn't load, is that a bug or i have done something wrong ?

boreal latch
#

i think you need to do

#

.setImage(url = file)

#

pretty sure thats it

#

cmiiw

earnest phoenix
#

how should i define url ?

zenith terrace
#

how do i make a bot command work only on specified guilds
@slender wagon try

if (message.guild.id !== "ID") return;```
boreal latch
#

just type what i just typed xd

#

replace ur .setImage with what i just typed

#

.setImage(url = file)
^^

earnest phoenix
boreal latch
#

hm

#

wait a sec

earnest phoenix
#

ok

tight plinth
#

what r u guys trying to do

boreal latch
#

oh wait

#

u dont need to actually do that

#

.setImage(file) is actually already correct

#

but its not moving?

#

oh it doesnt load

indigo cloud
#
PS C:\Users\xAutentiqz\Desktop\Discord Bot> node .
The bot is active and ready to go!
(node:38204) UnhandledPromiseRejectionWarning: ReferenceError: MessageEmbed is not defined
    at C:\Users\xAutentiqz\Desktop\Discord Bot\index.js:41:31
    at C:\Users\xAutentiqz\Desktop\Discord Bot\node_modules\minecraft-server-util\src\index.js:125:23
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:38204) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:38204) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate 
the Node.js process with a non-zero exit code. ```
zenith terrace
#

@earnest phoenix u spelt length wrong

indigo cloud
#

whats the fix for this

zenith terrace
#

u spelt it as lenght

tight plinth
#

define it

boreal latch
#

he already fixed that

earnest phoenix
#

@zenith terrace i solved that already

zenith terrace
#

Oof ok

boreal latch
#

maybe try giphy

#

and copying the gif

indigo cloud
#

any idea?

boreal latch
#

i used giphy for my slap command

zenith terrace
#

@earnest phoenix send whole code again

boreal latch
#

or maybe try imgur

indigo cloud
#
PS C:\Users\xAutentiqz\Desktop\Discord Bot> node .
The bot is active and ready to go!
(node:38204) UnhandledPromiseRejectionWarning: ReferenceError: MessageEmbed is not defined
    at C:\Users\xAutentiqz\Desktop\Discord Bot\index.js:41:31
    at C:\Users\xAutentiqz\Desktop\Discord Bot\node_modules\minecraft-server-util\src\index.js:125:23
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:38204) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:38204) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate 
the Node.js process with a non-zero exit code. ```
earnest phoenix
#

you think i should change the tenor gifs with giphy? This does not make sense for me, gifs are gifs

boreal latch
#

i tried with tenor once

zenith terrace
#

send whole code Sabin

boreal latch
#

doesnt load either

#

so i tried with giphy and it worked perfectly fine

#

maybe its my bad, but i dont actually know

earnest phoenix
#
const Discord = require("discord.js");
const fetch = require("node-fetch");

module.exports.run = async (bot, message, args) => {
  let target = message.mentions.users.first();
        if(!target) return message.reply(":no_entry_sign: **Specifica pe cine vrei sa plesnesti!**");
  const random_slap = [
'https://tenor.com/view/slap-handaseishuu-narukotoishi-barakamonanime-barakamon-gif-5509136',
    'https://tenor.com/view/no-angry-anime-slap-gif-7355956',
    'https://tenor.com/view/animepound-slam-gif-4880762',
    'https://tenor.com/view/anime-manga-japanese-anime-japanese-manga-toradora-gif-5373994',
    'https://tenor.com/view/hotd-slap-hit-anime-hitting-gif-5318916',
    'https://tenor.com/view/rosario-vampire-anime-slap-butt-gif-3412059'
]
  
  const file = random_slap[Math.floor(Math.random() * random_slap.length)]
  
  let pEmbed = new Discord.RichEmbed()
        .setColor("#0061ff")
        .setAuthor(`${message.author.username} ii da o palma lui ${target.username}`, message.guild.iconURL)
        .setImage(file)
        .setTimestamp()
        .setFooter(bot.user.username.toUpperCase(), bot.user.displayAvatarURL)
        .setURL(file);

        message.channel.send(pEmbed)
  
}

module.exports.help = {
    name: "slap"
}
tight plinth
#

does someone have ever used erela.js here?

#

I need help

zenith terrace
#

the way I did it would be

let file = Math.floor((Math.random() * slap.length));```
boreal latch
#

that doesnt change anything though

#

i think

indigo cloud
#

@tight plinth can u help me i am getting ignored

earnest phoenix
#

this isn't even right

boreal latch
#

but you should try and see anyways, @earnest phoenix

indigo cloud
#
PS C:\Users\xAutentiqz\Desktop\Discord Bot> node .
The bot is active and ready to go!
(node:38204) UnhandledPromiseRejectionWarning: ReferenceError: MessageEmbed is not defined
    at C:\Users\xAutentiqz\Desktop\Discord Bot\index.js:41:31
    at C:\Users\xAutentiqz\Desktop\Discord Bot\node_modules\minecraft-server-util\src\index.js:125:23
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:38204) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:38204) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate 
the Node.js process with a non-zero exit code. ```
tight plinth
#

DEFINE IT

zenith terrace
#

then in .setImage

.setImage(random_slap[file])

unique nimbus
#

ReferenceError: MessageEmbed is not defined

#

mm

#

You didn't define it in line 31 in index.js

#

or 41

indigo cloud
#

ok

unique nimbus
#

it shows in error

#

smh

#

read it

tight plinth
#

const {MessageEmbed} = require('discord.js')

boreal latch
#

@earnest phoenix try giphy, click a gif, click url logo thing, and click "copy the gif itself"

tight plinth
#

this is how to define smth in ks

boreal latch
#

works for me

indigo cloud
#

ok thanks

sullen copper
#

hi

tight plinth
#

I spoonfeed u coz apparently u cant read docs/u dont know js

boreal latch
#

i have no idea why tenor doesnt work though

earnest phoenix
#

@zenith terrace no work

#

@boreal latch i'll try

boreal latch
#

good luck

earnest phoenix
#

ty

boreal latch
slender wagon
#

@zenith terrace thank you for the help dude

neat ingot
#

it seems like this netdata is wildly inaccurate. Says my cpu usage is 3% when its actuall between 13-16%, and says my memory is 31% when its 63% :/

earnest phoenix
#

@boreal latch it worked, tyvm

hushed wagon
#

hi

#

add dank memer bot

summer torrent
#

Dank Memer already is in this server

boreal latch
#

@earnest phoenix no problem, glad i could help!

hushed wagon
#

lets test

#

pls say hi to @summer torrent

#

hes not in this server

#

his

summer torrent
indigo cloud
#
    name: 'ban',
    description: "ban players",
    execute(message, args){
        message.channel.send('(user) has been banned from the server');
    }
}
    client.on("message", (message) => {
        if (message.content.startsWith("$ban")) {
    
            if (!message.member.roles.find("Owner", "Admin", "Mod"))
                return;
    
            // Easy way to get member object though mentions.
            var member = message.mentions.members.first();
            // ban
            member.ban().then((member) => {
                // Successmessage
                message.channel.send(":wave: " + member.displayName + " has been successfully banned https://gfycat.com/playfulfittingcaribou :point_right: ");
            }).catch(() => {
                // Failmessage
                message.channel.send("Access Denied");
            });
        }
    });```
#

will this work

earnest phoenix
indigo cloud
#

idk

quartz kindle
#

@indigo cloud no

indigo cloud
#

ok what do i need to fix it

quartz kindle
#

show your main file

earnest phoenix
#

its mine main file

heady lichen
#
const giphy = GphApiClient(process.env.giphy_api);

client.on('message', message => {
	if (message.content === '^gif') {

giph .search("gifs", { q: args })
.then(response => {
var totalResponse = response.data.length;
var responseIndex = Math.floor(Math.random() * 10 + 1) % totalResponse;
var responseFinal = response.data[responseIndex];
message.channel.send(
${message.author}Heres Your Gif! πŸ™‚,
{
files: [responseFinal.images.fixed_height.url]
}
);
})```

can you pls correct it i am new to it i just copied it from somewhere now facing problem
#

discord.js πŸ‘†

indigo cloud
#

k let me show u

#

can i go to a call and share screens

quartz kindle
#

no

indigo cloud
#

rip

severe gyro
#

can you pls correct it i am new to it i just copied it from somewhere now facing problem
interesting What kind of problems are you facing tho?

heady lichen
#

i dont know

#

i want it to work but not know how

quartz kindle
#

it would help if you explained what happens when you run it, if it shows any error, what error, etc...

tight plinth
#

with erela.js, my bot doesnt play any sound if I do the play commands. Here is my code: ```js
let args = message.content.split(' ').slice(1)
const { channel } = message.member.voice;
if (!channel) return message.channel.send("Woops, You're not connected to a voice channel!")
const player = client.music.players.spawn({
guild: message.guild,
voiceChannel: channel,
textChannel: message.channel,
});

    const res = await client.music.search(args.join(' '), message.author);
    if (!res || !res.tracks || !res.tracks[0]) return message.channel.send('No result found!')
    player.queue.add(res.tracks[0]);
    message.channel.send(`Enqueuing track ${res.tracks[0].title}.`)
    if (!player.playing) player.play();
#

everything works fine

heady lichen
#

i haven't made the response right

tight plinth
#

the lavalink node too

#

first; I got it to work
second: I improve it

heady lichen
#
const giphy = GphApiClient(process.env.GIPHYTOKEN);```



And now create a command for this and put in this:

```giph .search("gifs", { q: args }) 

.then(response => {
var totalResponse = response.data.length;
var responseIndex = Math.floor(Math.random() * 10 + 1) % totalResponse;
var responseFinal = response.data[responseIndex];
message.channel.send(
${message.author} Heres Your Gif! πŸ™‚,
{
files: [responseFinal.images.fixed_height.url]
}
);
})```
#

i was following this can you pls make it right for me @quartz kindle

quartz kindle
#

πŸ€¦β€β™‚οΈ

heady lichen
#

how to create cmd and put response in that

quartz kindle
heady lichen
#

ohh

#

what about create cmd i dont know how to make it correctly

#

@quartz kindle are you there

indigo cloud
#

if (message.content.startsWith("$ban")){
// do other thing
if (!message.member.roles.find("Owner", "Admin"))
return;

      // Easy way to get member object though mentions.
      var member = message.mentions.members.first();
      // ban
      member.ban().then((member) => {
          // Successmessage
          message.channel.send("πŸ‘‹ " + member.displayName + " has been successfully banned https://gfycat.com/playfulfittingcaribou πŸ‘‰ ");
      }).catch(() => {
          // Failmessage
          message.channel.send("Access Denied");
      });
    }
#

will this ban command work?

quartz kindle
#

no

#

thats not how you use .find()

indigo cloud
#

how

quartz kindle
#

but that will only work for role names

#

not for admin permissions or guild owner

indigo cloud
#

oh

#

the thing is i want to make it only for admin and owner

#

hmm

quartz kindle
#

then you need to check for permissions, not for roles

indigo cloud
#

ok

quartz kindle
#

and instead of copying code, try to actually learn it, so you can do it yourself the way you want to

earnest phoenix
#

I made my bot load command modules but since they use functions from the main script, they error

#

what should I do

#

my first idea was put all the functions in a module and require that module in the command modules

lofty lagoon
#

I have node.js

honest perch
#

ahhh, just make a screenshot

quartz kindle
#

@earnest phoenix link them or pass them as variables

#

@lofty lagoon you didnt install it properly, download it from the node.js website, install it (make sure the Environment variables box is checked), then restart your computer

earnest phoenix
#

the modules are dependent on each other

#

so im just putting the functions in a module

quartz kindle
#

idk what language you're using, but most languages are very flexible in the ways you can import/export/link/pass modules and functions around

#

so theres probably many different ways of accomplishing what you're trying to do

#

so whatever works for you

earnest phoenix
#

the main script requires this module

#

so how would I get this function from the main script in this module

#

how can i install discord.py for my project i searched and i dont found anything

hardy vector
earnest phoenix
#

oh thanks

#

i try

#

what library i need to import

lofty lagoon
#

@lofty lagoon you didnt install it properly, download it from the node.js website, install it (make sure the Environment variables box is checked), then restart your computer
@quartz kindle I try with cmd and it's work

#

I think I need to restart my VSC

knotty steeple
#

@earnest phoenix how much python do u know

earnest phoenix
#

i can use libs but i cant import libs with library

indigo cloud
#
Require stack:
- C:\Users\xAutentiqz\Desktop\Discord Bot\index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
    at Function.Module._load (internal/modules/cjs/loader.js:840:27)
    at Module.require (internal/modules/cjs/loader.js:1019:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (C:\Users\xAutentiqz\Desktop\Discord Bot\index.js:7:12)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ 'C:\\Users\\xAutentiqz\\Desktop\\Discord Bot\\index.js' ]
}```
#

any fix for this?

knotty steeple
#

go learn more python

#

whos code did u copy

indigo cloud
#

i was following codelyon tutorial

knotty steeple
#

install the module

slender thistle
#

You can't import libraries with libraries?

indigo cloud
#

k

earnest phoenix
#

yes

knotty steeple
#

import discord

earnest phoenix
#

its not working

slender thistle
#

Any errors?

earnest phoenix
#

"resource": "/C:/Users/asus/Documents/bot projem/bot.py",
"owner": "python",
"code": "import-error",
"severity": 8,
"message": "Unable to import 'discord

#

this is error message

unique nimbus
#

Have you learnt Python before this

indigo cloud
#
The bot is active and ready to go!
C:\Users\xAutentiqz\Desktop\Discord Bot\index.js:58
            let mainrole = message.guild.roles.find(role => role.name === "Member");```
                                               ^
#

any fixes?

unique nimbus
#

Because I will say this, Discord Bots should not be your first project

#

@indigo cloud Have you read the docs

earnest phoenix
#

its very basic projects i dont need to save

unique nimbus
#

Discord Bots are not basic

#

Its advanced

indigo cloud
#

message.guild.roles.find is not a function

unique nimbus
#

Have you read the docs 260

knotty steeple
#

both of u go learn ur languages more

indigo cloud
#

well no

unique nimbus
#

Well read the docs

#

We won't spoonfeed you

#

when you haven't even tried

#

to learn

knotty steeple
#

and i told u dont use a yt tutorial

quartz kindle
#

in v12 its roles.cache.find()

knotty steeple
#

smh

unique nimbus
#

@quartz kindle Can you link the docs

#

I don't believe they are actually learning properly

quartz kindle
#

@indigo cloud ^

unique nimbus
#

I will say this and I don't know if you will agree Tim but Discord Bots should not be your first project

#

You first need to know the basics

#

as in, error management, basic projects

tight plinth
#

I cant get LL to work properly aaaaaaaaaaaaaaaaaaaaaaaaaaaa

unique nimbus
#

Copying and pasting will get you nowhere

copper cradle
#

anything that isn't making a calculator that adds 1 + 1 and ends up being 11 shouldn't be your first proyect

quartz kindle
#

lmao

unique nimbus
#

1 + 1 = Window

#

wdym

tight plinth
#

lmao

earnest phoenix
quartz kindle
#

wtf is that

earnest phoenix
#

glitch icon

tight plinth
#

why

#

dafuk

#

its broken

#

gonna restart my node

quartz kindle
tight plinth
#

it solves itself by restarting the LL server

#

hmmm

neat ingot
#

so yea, i think im gonna use this netdata thing. seems i can configure and customize the charts/graphs/gauges etc as i please. and it uses bootstrap and fontawesome (which i have used for years) so quite happy to have something else that uses those πŸ™‚

#

@chinesesymbolnameguy (@modest maple)

hardy vector
#

Well read the docs
@unique nimbus peter i agree but sometimes people need a person to explain to them im not defending them or telling u to spoonfeed but maybe try and explain

#

or do they not know their languages

unique nimbus
#

Correct

#

I am better with someone

hardy vector
#

cos thats another story

unique nimbus
#

however asking for people to give you the code to fix the error

#

is not the way to go

hardy vector
#

oh they did that

#

nvm

unique nimbus
#

If they want to learn they should ask "How can I do X in Y"

hardy vector
#

yea guys dont ask for spoonfeed

#

yea

#

tru

unique nimbus
#

Then someone can help them

hardy vector
#

doggo

#

πŸ™‚

unique nimbus
#

People needs to realise in #development nobody should spoonfeed code

#

to fix someones mistakes

neat ingot
#

i wish my dog ate from a spoon wth πŸ˜„

unique nimbus
#

They can guide the person

hardy vector
#

yea

#

i agree

unique nimbus
#

as in, you didn't define this

#

However not tell them how to do it

neat ingot
#

tbh, i find it easier sometimes to just write out the code; however, i then expect the people i give the code to, to actually read the code, and try understand why mines works when theirs didnt.

#

that part is critical imo

unique nimbus
#

A lot of people watched YouTube videos

#

and take the code

#

and thats it

neat ingot
#

^

unique nimbus
#

They don't understand what it is

#

and how it works

hardy vector
#

its annoying when they ask for spoonfeed

#

yea

#

i dont like watching vids

unique nimbus
#

like I totally understand if you are using YouTube to see how someone does something

hardy vector
#

they can be misleading

unique nimbus
#

however to use the code

hardy vector
#

and you dont learn anything by watching them

unique nimbus
#

and not understand it

hardy vector
#

i mean you do

#

but if you copy code

#

no learning

neat ingot
#

i legit watch nothing on tv, but am on youtube all day listening to tech news podcasts and tutorial videos on things im wanting to learn about πŸ˜„

unique nimbus
#

You should not copy code

hardy vector
#

so id rather read docs

unique nimbus
#

Docs are fine until they are shitty

hardy vector
#

yea

neat ingot
#

i wrote a little app (emo) that is basically a semi transparent overlay window that stays above all other windows, so i can watch videos in my code editor πŸ˜„

hardy vector
#

lmao

#

smat

neat ingot
#

sorry for the large logo thing

earnest phoenix
#
if (command === "help"){
let comandos = require("./help.json")
.addField("Infomativos", comandos.test)
.setColor(amarillo)
.setImage('https://media1.tenor.com/images/b19dc42af98ef98658e28b53eec2fbfd/tenor.gif?itemid=12880591')
}
(node:1086) UnhandledPromiseRejectionWarning: ReferenceError: comandos is not defined
hardy vector
#

its ok

neat ingot
#

only image i have of it over a thing lol

hardy vector
#

thats easy lil

#

you ddint define comandos

earnest phoenix
#

idk why dont work

hardy vector
#

oh wait you did

earnest phoenix
#

let comandos = require("./help.json")

hardy vector
#

yea i saw

#

i dont think amarillo is a color

earnest phoenix
#
{
  "test": "test"
}```
neat ingot
#

why are you adding a field into a required file?

#

your required file returns an embed?

hardy vector
#

i was gonna ask that

#

lmao

neat ingot
#

i swear, one of these days, someone in here is gonna hit the dumbest genius idea ever and become infamous πŸ˜„

#

'omg you can do x and it does y and z too? win'

hardy vector
#

lmao ok

earnest phoenix
#

so?, how i get comandos.test ?

neat ingot
#

your problem is this line:

let comandos = require("./help.json")
.addField("Infomativos", comandos.test)```
#

whats happening here is:

hardy vector
#

did you define an embed?

neat ingot
#

you are requiring a file, and immediately trying to add a field onto the required file/module/json w.e

hardy vector
#

i dont see new Discord.MessageEmbed anywhere

earnest phoenix
#

shit xd

neat ingot
#

so when your calling addField with comandos.test, comandos is never fully defined, cause your still adding onto it

#

hence:(node:1086) UnhandledPromiseRejectionWarning: ReferenceError: comandos is not defined

earnest phoenix
#

@hardy vector is not the problem

neat ingot
#
let comandos = require("./help.json");
let embed = new Discord.RichEmbed();
embed.addField("Infomativos", comandos.test);```
hardy vector
#

he never did rich embed

neat ingot
#

is more likely what you want to be doing..

  • requiring the tile, creating an embed, and then using the file data to add a field into an embed
hardy vector
#

and rich embed is for v11

neat ingot
#

yea buts hes trying to add fields πŸ˜„

hardy vector
#

oh

#

lmoa

#

ok

neat ingot
#

ok, well MessageEmbed for v12

hardy vector
#

yea

#

i found some bot that was made just for searching the djs docs and its such a joke

#

the entire bot runs on 10 lines of code

#

i made my own one with node fetch

#

so stupid

honest perch
#

i doubt its 10 lines

hardy vector
#

ok more like 20

#

but

#

my version was 20 lines

#

so

#

and the bot literally does the same thing tho

#

so have you guys heard of deno

#

the new JS, and TS runtime built my nodejs fouder

#

*founde

#

*founder

#

i cant type

mossy vine
#

yes, we have heard about it

honest perch
hardy vector
#

but this is development

#

😠

#

jk

mossy vine
hardy vector
#

ok

mossy vine
#

ur right tho

#

i personally hate denos module system
a domain dies and uwu oops all ur code is dead

hardy vector
#

technically deno is still bot related since its also a js runtime maybe someday we make bots with deno and not nodejs

#

lmao

mossy vine
#

i guess thats the only negative thing i can say about it

#

having the module ecosystem centralized may be bad because privacy and capitalism and idk what the complaints are but at least its reliable

hardy vector
#

yea

mossy vine
#

and also that existing modules gotta do extra shit to work with deno

earnest phoenix
#

idk why but this work

if (command === "help"){
let embed = new Discord.RichEmbed()
.addField('InformaciΓ³n', comandos.informacion)
.setColor(amarillo)
.setImage('https://media1.tenor.com/images/b19dc42af98ef98658e28b53eec2fbfd/tenor.gif?itemid=12880591')
message.channel.send(embed)
}
tight plinth
#

(my song is never gonna give you up of course)

#

this=client

sterile nest
#

On top.gg it saya that my bot is oflfine

#

But it is online

hasty sparrow
#

@tight plinth Have you tried logging ...songs[0].info?

tight plinth
#

@sterile nest is your bot kivked from here

#

yes I tried

#

wait lemme redo

sterile nest
#

I dont know

#

Its called Noodles

#

But i cant ping it

hasty sparrow
#

Then it's not in this guild

tight plinth
#

well

sterile nest
#

I was never able to ping it , but other people were able

tight plinth
#

gan u giv us bot id?

sterile nest
#

How can i get it

tight plinth
#

u made a bot and u dont know how to get a id?

#

seriously?

sterile nest
#

706865701373345813

#

This is the id

tight plinth
#

try doing <@id>

#

it should ping your bot

sterile nest
#

@verbal cargo

#

oh

tight plinth
#

see

zenith terrace
#

Common prefix

tight plinth
#

it has common prefix role tho

#

but its not the problem

sterile nest
#

ik , im okay with not using it here , but i dont know why it says that its offline

#

when i search it , it says online , when i click on it , it says it offline

#

weird

zenith terrace
sterile nest
#

if you click on the bot , it says itsoffline

zenith terrace
#

im on ur page

#

ur bot page

sterile nest
#

oh

#

for me it says that its offline

#

i tried reloading the page too

#

oh , now its back

tight plinth
#

how to get playlist info with shoukaku

steep arrow
#

why does it look like this?

tight plinth
#

website sucks I guess?

hasty sparrow
#

Probably a caching issue

tight plinth
#

and for a issue like that you can go to #general

#

read channel topic

#

(@twilit rapids heres a bot with ur pfp)

nocturne grove
#

@steep arrow yeah those numbers are not right. But I found out the numbers on your profile are always up to date

sudden geyser
#

Timo Music

steep arrow
#

number of users still 54k

#

@nocturne grove

#

bot added to site and approved

nocturne grove
#

yes if you don't update it it won't change

steep arrow
#

why still 54k

#

I updated but still showing the same

spice kettle
#

Refresh status

restive furnace
#

caching things

nocturne grove
#

maybe I don't get you but if you set a status as js ${client.users.cache.size} users it won't update automatically

steep arrow
#

isn't rebooting enough?

nocturne grove
#

probably it is

restive furnace
#

no it isnt

#

it simply wont cache every users

nocturne grove
#

but idk what the problem is, I don't know much about those whole caching thing

#

if that's the problem, then yea

restive furnace
#

you need to smh js let users = 0; bot.guilds.forEach(g => { users += g.memberCount; }) that would work

#

and then use users

#

variable

#

@steep arrow

tight plinth
#

^

nocturne grove
#

but that will 99,9% sure not give the right amount

#

for example, popular bots will be in more than 1 guild so they will be counted more than one time

#

idk another proper way tho, as I don't have a large bot and am not using users size

restive furnace
#

users += g.memberCount

nocturne grove
#

I know

restive furnace
#

that appends into the value, so example js let cash = 182; cash += 18; console.log(cash) // returns 200, int

nocturne grove
#

yes but if Mee6 is in guild 1, than users = guild1.memberCount
then, it will add the membercount of guild 2, and Mee6 could be a part of that memberCount too

stable halo
#

then you can map to only look for users

restive furnace
#

well in <client>.users#size has the bot itself too

earnest phoenix
#

I'm currently implementing music commands into my bot and I have made 3 commands so far (play, skip, and stop). But when I try to use ?play (song link), my bot tells me I must be in a voice channel (which I am)

play.js:

function plya(connection, message) {
    var server = servers[message.guild.id];

    server.dispatcher = connection.playStream(YTDL(server.queue[0], {filter: 'audioonly'}))

    server.queue.shift()

    server.dispatcher.on('end', function() {
        if (server.queue[0]) play(connection, message);
        else connection.disconnect();
    })
}

exports.run = (client, message, args) => {
    if (args[1]) {
        message.channel.send('Please provide a link');
        return;
    }
    if (!message.member.voiceChannel) {
        message.channel.send('You must be in a voice channel')
        return;
    }
    if (!servers[message.guild.id]) sevrers[message.guild.id] = {
        queue: []
    } 
    var server = servers[message.guild.id];

    server.queue.push(args[1]);

    if (!message.guild.voiceConnection) message.member.voiceChannel.join().then(function(connection) {
        AnimationPlaybackEvent(connection, message);
    })
}
nocturne grove
#

yes but human users an also be in more than one server with the bot. That doesn't solve it

steep arrow
nocturne grove
#

@earnest phoenix I don't see guildMember.voiceChannel in the docs https://discord.js.org/#/docs/main/stable/class/GuildMember

#

so it's always false

restive furnace
#

well theres another way then just do loop in guilds and loop in bot.guilds of users

earnest phoenix
#

ok

#

thanks ill check it out

neat ingot
#

[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]([!+[]+!+[]]+(+(+!+[]+(!+[]+[])[!+[]+!+[]+!+[]]+[+!+[]]+[+[]]+[+[]])+[])[!+[]+!+[]]+[!+[]+!+[]]+(+((+(+!+[]+[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+[!+[]+!+[]]+[+[]])+[])[+!+[]]+[+[]+[+[]]+[+[]]+[+[]]+[+[]]+[+[]]+[+[]]+[+[]]+[+[]]+[+!+[]]])+[])[!+[]+!+[]]+[+!+[]])()
this equals 3! that is all.

nocturne grove
#

no you don't get me. Anyone could be in more servers with the bot. If the Mee6 owner counts his users by adding memberCount to it every time, I will count as 4 or something

restive furnace
#

i mean

nocturne grove
#

and of course, you can ignore that fact as a bot owner but it won't be very precise

restive furnace
#

like loop bot.guilds { loop guild.users { if user is already added } }

#

wobt spoonfeend

amber fractal
#

Users are only cached users tho

sudden geyser
#

Can you show some code.

amber fractal
#

The only way to get true numbers is memberCount, which you cant filter

nocturne grove
#

yes that's a nice solution (are guild.members always cached?)

amber fractal
#

Also looping every member is highly inefficient

#

And no

#

Not every member is cached

neat ingot
nocturne grove
#

guild.users doesn't exist btw iirc

earnest phoenix
#

this shard down servers reducing the number WTF anormaly

neat ingot
#

thats how i get my counts

earnest phoenix
#

help t

sudden geyser
#

<Guild>.memberCount returns the total amount of members in a guild according to the API which is going to be your best shot if you want the exact amount.

neat ingot
#

idc if it isnt a full counter πŸ˜„

copper cradle
#

why are you guys even doing this?

nocturne grove
#

yes but the problem is @sudden geyser, that it isn't very precise if you want a a total user amount

copper cradle
#

nobody cares how many users your bot has

neat ingot
#

you could also do:

copper cradle
#

like literally no one cares about that shit

neat ingot
#

^

sudden geyser
#

How is it not precise?

nocturne grove
#

nobody cares how many users your bot has
@copper cradle yes idc about my own bot but can still help others with it

sudden geyser
#

zSnails it's just fun to have for stats.

neat ingot
#

my bot has like 140k users, but thats totally irrelevant as only like 8 people use it πŸ˜„

copper cradle
#

well then why do you care about precise numbers then?

nocturne grove
#

if Mee6 wants to count its users using that code, it will count me as 4

copper cradle
#

no one checks for that

nocturne grove
#

lol I'm just helping others

copper cradle
#

still

lyric mountain
#

and of course, you can ignore that fact as a bot owner but it won't be very precise
@nocturne grove client.users

nocturne grove
#

but it's not my intention to just tell them half working code

lyric mountain
#

it'll give u a precise list of all the users the bot knows

#

without repeating

nocturne grove
#

@lyric mountain yes but it has to do with caching

amber fractal
#

Cached though

#

Which is still inaccurate

lyric mountain
#

well, that's a drawback of djs

amber fractal
#

Thats any lib

#

No lib caches all users

#

It's dumb to do so

neat ingot
#

tbf, any large scale app that doesnt cache things is wasting resources

sudden geyser
#

Like I said you can just loop over the guild and add up the memberCount number prop to get a more accurate number.

neat ingot
#

heck, i cache things in my shitty little mongo database for my bot

lyric mountain
#

@sudden geyser except if a user is in 2+ guilds

neat ingot
#

it makes sense to have a cache for things. no point arguing about it πŸ˜„

nocturne grove
#

depends on the situation what is more accurate tho, memberCount loop or client.users

sudden geyser
#

Correct!

lyric mountain
#

the new guild member gateway intent is there to deal with caching

nocturne grove
#

and if guild.members isn't complete too, there is no exact way I think

tight plinth
neat ingot
#

dude, just get a database, and check yourdatabase for how many actual useers you have if you want 'accurate'

#

all other means of getting counters from discord are always gonna be inaccurate

#

as not all guild members give a shit about your bot

#

chances are, 1-5 per guild care

#

if that

nocturne grove
#

I don't want anything in my bot about this. And why should someone with a random bot want to have a db with all users?

lyric mountain
#

xp module

nocturne grove
#

yes, but as I said, not everyone

neat ingot
#

not all users, but the ones who actually use your bot. that is the most important counter after all

#

your bot could be in every server discord has, but if no one uses it, its a waste of every slice of time spent, and every possible method of calculating user counters

nocturne grove
#

totally depends on what you want. My vision is that people only want to flaunt with their users size so the number should be as high as possible

neat ingot
#

yea, people love inflated numbers.. a dude in here admitted the other week to inflating server count to try get bot approvval πŸ˜„

nocturne grove
#

in my opinion, counting your bot's tickets/counters/leaderboards/giveways etc. is much more interesting

neat ingot
#

discord denied him, cause it was obvious af what he did lol

nocturne grove
#

πŸ˜‚

neat ingot
#

yea, get a leaderboard, thats a good means of keeping track

#

daily message/activity counters

nocturne grove
#

and if you want to flaunt with something, guild size is okay I think

neat ingot
#

log who votes for your bot

hardy vector
#

rn my inventory command sends it like this
sword
sword
fishing rod
sword
how can i make it so that it sees if there is multiple of an object
and says (3x) Sword

nocturne grove
#

oh that's not what I meant but could be :p

hardy vector
#

i use quick.db btw

neat ingot
#

add (x3) before the word Sword? πŸ˜„

lyric mountain
#

rn my inventory command sends it like this
sword
sword
fishing rod
sword
how can i make it so that it sees if there is multiple of an object
and says (3x) Sword
@hardy vector use an object instead of array

hardy vector
#

no lol i want it to check

nocturne grove
#

yes but he can't count everything himself @neat ingot

lyric mountain
#

read above

hardy vector
#

but i use quick.db

#

does quick.db doesnt have objects

#

im pretty sure

lyric mountain
#

still

#

oh my

neat ingot
#

idk quick db sry 😦

lyric mountain
#

dude

nocturne grove
#

idk too

neat ingot
#

but the logic is gona be something like:
get data from database
show data from database

nocturne grove
#

does it look like mysql?

neat ingot
#

your already getting data i guess to show the inventory

hardy vector
#

umm no

nocturne grove
#

okay srry then

lyric mountain
#

just get the items into an array, then use itemarray.map(item => counter)

hardy vector
neat ingot
#

so surely there is a property that donates how many of an item a person has?

hardy vector
#

its beginners version of SQL

#

they say that on the npm package pacge

#

*page

neat ingot
#

oooohhh wait

#

i think i get it

knotty steeple
#

no it just uses sqlite

nocturne grove
#

oh it's not that hard I see

neat ingot
#

hes storing the items individually, and just has to iterate over them and count

hardy vector
#

yea its sqlite wrapper

nocturne grove
#

but I still gtg, cya

knotty steeple
#

u learn no sql

hardy vector
#

i like it bc its easy

knotty steeple
#

learn sql its not hard anyway

hardy vector
#

can you use SQL with discord.js?

lyric mountain
#

SELECT i.name, (SELECT COUNT(i2.id) FROM items i2 WHERE i2.id = i.id) AS amount FROM items i

nocturne grove
#

yes

knotty steeple
#

obviously

hardy vector
#

holy shit SQL be looking like english

neat ingot
#
const items = ['sword','sword','rod','sword']
const item_object = Object.create(Object);
items.forEach(item => {
    if (!item_object[item]){
        item_object  = 1;
    } else {
        item_object++;
    }
})
lyric mountain
#

SQL IS ENGLISH

neat ingot
#

dunno if that helps any. but if you have an array of objects, that demonstrates how to count the number of duplicate elements

hardy vector
#

but this is my items variable js let items = db.get(message.author.id)

lyric mountain
#
const items = ['sword','sword','rod','sword']
const item_object = Object.create(Object);
items.forEach(item => {
    if (!item_object[item]){
        item_object  = 1;
    } else {
        item_object++;
    }
})

@neat ingot why not simply use map?

hardy vector
#

idk how to use map is it hard?

neat ingot
#

because for each is easier for nubies to comprehendo πŸ˜›

lyric mountain
#

ah

neat ingot
#

see

#

lol

#

nerd, when you do console.log(items) what does the console log?

hardy vector
#

oh lemme copy code you wrote

#

lmo

#

lmao

#

can you use the object thing inside an embed .addField(ietms, item_object)

knotty steeple
#

jesus

lyric mountain
#

in java it'd be Collections.frequency(array, "name of the item")

#

lol

neat ingot
#

yea, as long as you reference it properly. for example:

embed.addField("Sword", item_object.sword)```
hardy vector
#

ah

#

ok

restive furnace
#
for (let i = 0; i < bot.guilds.size; i++) {
     console.log(i + " only OGs remeber this");
}```
neat ingot
#

const removed_dups = [...new Set(array)];

#

i like using that for removing duplicate elements from arrays

#

but idk if there is a nice shorthand for counting dup elements

lyric mountain
#

that code you sent earlier is the shortest one can get

neat ingot
#

f

#
const counts = arr.reduce((acc, value) => ({
   ...acc, [value]: (acc[value] || 0) + 1
}), {});
``` found that on stackoverflow. which is just all kinda crazy complex πŸ˜„
#

or you could filter it too i guess

const counts = arr.filter(e => e === "sword").length;```
lyric mountain
#

ah, the reduce

tight plinth
#

so I made a really simple play command using shoukaku, but I have a problems with playlists: when I add then, they got added to the queue, but songs dont play at all (BUT songEnd events are triggered) wtf

#

here is code

#
const node = this.shoukaku.getNode();
            let data;
            if (urlcheck(args.join(' '))) {data = await node.rest.resolve(args.join(' '));} else {data = await node.rest.resolve(args.join(' '), "youtube");}
            if (!data) return console.log('no data');
            if (this.shoukaku.getPlayer(msg.guild.id)) {
                if (data.type === "PLAYLIST") {this.queue.get(msg.guild.id).songs=[this.queue.get(msg.guild.id).songs,...data.tracks]}
               else { this.queue.get(msg.guild.id).songs.push(data.tracks[0])}
            } else {
                if (data.type === "PLAYLIST") {
                    this.queue.set(msg.guild.id,{songs: data.tracks})
                } else {
                    this.queue.set(msg.guild.id,{songs: [data.tracks[0]]})
                }
            }
            const player = await node.joinVoiceChannel({
                guildID: msg.guild.id,
                voiceChannelID: msg.member.voice.channelID
            });
            const cleanFunction = (param) => {
                console.log(param);
                this.queue.delete(msg.guild.id)
                player.disconnect();
            }
            player.on('end', cleanFunction);
            player.on('closed', cleanFunction);
            player.on('error', cleanFunction);
            player.on('nodeDisconnect', cleanFunction);
            await player.playTrack(this.queue.get(msg.guild.id).songs[0].track); 
            await msg.channel.send("Now Playing: " + this.queue.get(msg.guild.id).songs[0].info.title);```
neat ingot
#

rip formatting

tight plinth
#

fuck formatting

hasty sparrow
#

@tight plinth Shouldn't it be ...this.queue.get(msg.guild.id).songs?

tight plinth
#

where

hasty sparrow
#

if (data.type === "PLAYLIST") {this.queue.get(msg.guild.id).songs=[this.queue.get(msg.guild.id).songs,...data.tracks]}

tight plinth
#

erm

#

it is

#

unless im blind

#

*oh wait

#

ik what you mean

#

no it shouldnt

hasty sparrow
#

Currently it's songs = [songs, ...tracks], which results in [[...], ...]

tight plinth
#

hm

#

am rly stoopid

#

fuc

#

wait a second, amma verify

neat ingot
#

from the looks of your code the duke is correct

tight plinth
#

wait a sec

#

shoulnt it be

#
[...this.queue[etc],...data.tracks]```
hasty sparrow
#

Yea

tight plinth
#

lemme try

queen needle
#

where can i get dbl web hook?

neat ingot
#

what do you mean where can you get one?

tight plinth
#

thx for noticing me of this

queen needle
#

nvm

tight plinth
#

but it doesnt solve my problem

rotund slate
#

Can someone plz help me

#
3|start  | 2020-05-13 12:43:05.377  WARN 25700 --- [     parallel-2] s.n.m.impl.connections.AudioWebSocket    : Connection closed due to [4006 SESSION_NO_LONGER_VALID] Session is no longer valid.. This could indicate an issue with the magma library or your usage of it. Please get in touch. https://github.com/napstr/Magma/issues
3|start  | 2020-05-13 12:43:05.377  INFO 25700 --- [     parallel-2] s.n.m.impl.connections.AudioWebSocket    : Closing```
#

In this error

neat ingot
#

on the dbl website, you can define which path and url to use for your webhook, but you still need to have a server somewhere waiting to recieve calls

rotund slate
#

They told that their is no issues with magma

neat ingot
#

that only leaves 'your usage of it' then πŸ˜›

rotund slate
#

Means

neat ingot
#

idk though dude, i've never used any audio processing libs 😦

#

could be a super common error around these parts πŸ˜„

tight plinth
restive furnace
#

shoukaku probably best in js

tight plinth
#

still doesnt play anything

neat ingot
#

shoukaku is an audio processing lib right?

rotund slate
#

Bt I am using lavalink

hasty sparrow
#

It only fails for playlists?

tight plinth
#

yes

#

oh wait

#

now it does too for regular songs

#

yay

#

depression time

#

I already solved this issue 2 times now

#

and its still broken

#

I checked, this.queue.get(msg.guild.id).songs[0].track exists

#

so...

#

(node was booting up)

#

(lemme retry once again)

neat ingot
#

Reason: No reason πŸ˜„

tight plinth
#

nope, still nothing

#

and nothing in logs too

#

ly lavalink.jar logs

#

hmmm

#

did someone have already encouter this error

#

java 14.0.1,ubuntu

hasty sparrow
tight plinth
#

how to install java 13 to ubuntu then

lyric mountain
#

java 14 is extremelly nightly atm

tight plinth
#

I git guides for java9,11&14, but not for 13

lyric mountain
#

most people still use 8, I'd recommend 11

earnest phoenix
lyric mountain
#

why please
@earnest phoenix show code

earnest phoenix
lyric mountain
#

you forgot a )

earnest phoenix
#

ok thanks

lyric mountain
#

see where the error marking is

hasty sparrow
#

Error console at the bottom literally telling you what the error is and how to fix it

lyric mountain
#

never EVER let a red underline stay unfixed

#

red means error

#

if you hover your mouse over it it'll tell u what's wrong

topaz fjord
#

you can sometimes

earnest phoenix
#

ok I begin sorry

topaz fjord
#

something the ide decides to be fucky but it works fine when you compile manually

nocturne grove
#

okay I have a little question and until now I haven't got a real clear answer, so I'm asking again:

const messageContent = await require('./file1.js').execute(message);
message.channel.send(messageContent);
// the file1
module.exports = {
  execute(message) {
    message.react('πŸ˜‰');
    return message.slice(2, 2);
  },
};```
Imagine I have something like this (this is total nonsense) and the bot can't react to the message with the emoji. Is there a way to stop the execution in the first file if file1 gives an error like 'cannot react to message'?
(This is just an example, I know I could've checked permissions first in this example)
lyric mountain
#

something the ide decides to be fucky but it works fine when you compile manually
@topaz fjord well, that's why I use intellij

topaz fjord
#

intellij is also fucky

#

new type inference algorithm apparently borked some people's projects when compiling using intellij

lyric mountain
#

okay I have a little question and until now I haven't got a real clear answer, so I'm asking again:

const messageContent = require('./file1.js').execute(message);
message.channel.send(messageContent);
// the file1
module.exports = {
  execute(message) {
    message.react('πŸ˜‰');
    return message.slice(2, 2);
  },
};```
Imagine I have something like this (this is total nonsense) and the bot can't react to the message with the emoji. Is there a way to stop the execution in the first file if file1 gives an error like 'cannot react to message'?
(This is just an example, I know I could've checked permissions first in this example)

@nocturne grove check the perm beforehand

topaz fjord
#

but command line build worked fine

lyric mountain
#

there's no other way, except by using try-catch

topaz fjord
#

tfw quotes can't handle code blocks

lyric mountain
#

new type inference algorithm apparently borked some people's projects when compiling using intellij
@topaz fjord what?

#

tfw quotes can't handle code blocks
they can

nocturne grove
#

@lyric mountain I just said this was just a stupid example :/

lyric mountain
#

well, my answer will be the same

nocturne grove
#

in my implementation it's not about discord perms either

lyric mountain
#

so why don't u show the real case?

nocturne grove
#

but that doesn't matter for my question

topaz fjord
#

not on mobile then

nocturne grove
#

because that doesn't make sense and I did sometimes again and that didn't get answered the way I meant

topaz fjord
#

yeah it can be fixed but it's still annoying that you have to do it manually

hasty sparrow
#

You could also throw an error inside your called method and handle it in the calling method or return something alongside/other than the message

lyric mountain
#

which is what I answered as second option

nocturne grove
#

oh sorry I didn't see your second answer

earnest phoenix
#

How can i learn an emoji creator ? (V11)

neat ingot
#

@nocturne grove when you call require('filename') this is a syncronous process. this means that nothing else will process until it has finished loading. no single line of code after that can cancel the loading of it.

#

oh, i think i was scrolled up? rip

nocturne grove
#

oh sorry I meant to use await for that one

neat ingot
#

sorry if you got answer already πŸ˜„

nocturne grove
#

no you're right but I just forgot to do that in the example

earnest phoenix
#

Any1!?

hasty sparrow
#

What is an "emoji creator"?

nocturne grove
#

You could also throw an error inside your called method and handle it in the calling method or return something alongside/other than the message
@hasty sparrow yes so just return 'thisIsANiceError' and use a line js if (messageContent == 'thisIsANiceError') { return message.channel.send('was an error'); }

Already thought about that but hoped for something without using an extra line.
Thanks tho, all

neat ingot
#

please reword your question @earnest phoenix

earnest phoenix
#

@hasty sparrow *author

hasty sparrow
#

Not how errors work

#

Ah, emoji author

neat ingot
#

isnt it just emoji.author or emoji.user or something?

neat ingot
#

ninjad πŸ˜„

nocturne grove
#

@hasty sparrow yes but I can handle the error in the 'function' file itself

#

when I catch an error there, I can do:

console.log(err);
return 'somethingThatMeansError';```
hasty sparrow
#

A callback-ish approach might be cleaner, where you return an object like { err: Error, message: string }

earnest phoenix
neat ingot
#

lua ooft

earnest phoenix
#

ye

neat ingot
#

sublime text ~ooftx2

earnest phoenix
#

nah I use visual studio

#

@hasty sparrow Thanks.

neat ingot
#

strange that your lua files are showing sublime icon πŸ˜›

earnest phoenix
#

I have each bot command separated into its own module and I require all of them in the main script, but they use functions in the main script and they return nil when used

restive furnace
#

he probably sat it himself

earnest phoenix
#

^

#

for all text files

nimble scarab
#

how can i set classification of a role in jda ?

guild.createRole().complete().getManager(). ?
earnest phoenix
#

isn't there a way to make it so a required module that loads after functions are declared, automatically uses the functions

neat ingot
#

guess that would depend on the scope of the functions

#

idk enough lua to be of any real help tho πŸ’”

earnest phoenix
#

-- main script
local function x()
  
end

require(module)
-- module
x()
#

requiring a module after a function has been declared does not recognize the function

neat ingot
#

in javascript it'd be as simple as passing the loaded functions to the newly loaded module

#

nah probably not in that case, as the required module has its own scope seperate from the local

#

again, idk much lua, but isnt it possible to just pass the function to the module? for example require(module)(x), where your required module returns a function that you call and provide the function arguments

earnest phoenix
#

problem is the functions needed vary lol

neat ingot
#

heck, you can probably pass the entire scope into the required module too, something simiimlar in javascript might be like:

require('modulename')(this);

// in module:
module.exports = function(scope) {
}
#

even if they vary, they all have to be defined within the main script, right? then used within modules?

#

just define them within some class or namespace and then pass reference to the object to your new required thing?

#
const MyNameSpace  = Object.create(Object);
MyNameSpace.x = function(){
    return 'I AM X !!';
}

require('modulename')(MyNameSpace);

// in module:
module.exports = function(namespace) {
    console.log(namespace.x());
}```
#

something like that perhaps?

#

again, no idea if that kinda thing is even valid in lua πŸ˜„

tight plinth
#
3|java  | WARNING: An illegal reflective access operation has occurred
3|java  | WARNING: Illegal reflective access by org.xnio.nio.NioXnio$2 (jar:file:/home/lumap/lavalink/Lavalink.jar!/BOOT-INF/lib/xnio-nio-3.3.8.Final.jar!/) to constructor sun.nio.ch.EPollSelectorProvider()
3|java  | WARNING: Please consider reporting this to the maintainers of org.xnio.nio.NioXnio$2
3|java  | WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
3|java  | WARNING: All illegal access operations will be denied in a future release```does anyone have ever got this issue with lavalink & java 11?
#

it doesnt stop my bot to run music or anything, its just here

neat ingot
#

what is an illegal reflective access?

tight plinth
#

I have no idea

#

its in my lavalink log

neat ingot
#

i'd try to google around and find out what that means

#

what if its like, you know how come youtube videos cant play in some countries? maybe its to do with that?

tight plinth
#

I have no idea

neat ingot
#

ngl: thats gibberish to me

#

lol

#

makes it sound pretty hacky lol

#

seems its a java thing though, so certainly not my thought about it being caused by videos not being able to play in certain countries πŸ˜„

lapis ocean
#

Hey guys, can I send a private 1 use invite to people that signup on a form?

queen needle
#
client.on('guildMemberAdd', (guildMember) => {
   guildMember.addRole(guildMember.guild.roles.find(role => role.name === "member"));
})```
#

no errors and it didnt add the role

hasty sparrow
#

Can't make private invites

torn nebula
#

parameter is member
member.user can able to add role

lapis ocean
#

@hasty sparrow why not?

hasty sparrow
#

Ask Discord Β―_(ツ)_/Β―

queen needle
#

@torn nebula what?

torn nebula
#

it's member not guildMember

queen needle
#
client.on('guildMemberAdd', (member) => {
   member.addRole(guildMember.guild.roles.find(role => role.name === "member"));
})```
#

so that

torn nebula
#

member.user.addRole

queen needle
#
client.on('guildMemberAdd', (member) => {
   member.user.addRole(guildMember.guild.roles.find(role => role.name === "member"));
})```
torn nebula
#

try

lapis ocean
#

@hasty sparrow what do you mean? You can

queen needle
#

iam im waitng fr someone to join to test

neat ingot
#

it doesnt matter what you call your variable, weather its member, guildMember, or lazypolicedog.

#

its still going to be the same object, with the same data

#

you just referenced it differently.

hasty sparrow
#

@lapis ocean Maybe I misunderstood what you meant with private

lapis ocean
#

@hasty sparrow I just mean a 1 time use invite that is delivered privately to an individual.

hasty sparrow
#

Ah yes, that is possible

lapis ocean
#

How would you suggest I achieve this?

#

I see 2 ways, not sure if both are possible.

#
  1. Pre Generate a list of 1 Time Use Invites. And when someone signups on our website we send them 1 of those.
hasty sparrow
#

You pretty much said it yourself, create the invite with limited uses and send it via DM

lapis ocean
#

@hasty sparrow can't send a DM if they are not on our Discord server already

#

Especially if they are not even on Discord to begin with

hasty sparrow
#

Derp, of course

#

Then you would have to pregenerate as you said

lapis ocean
#

Solution 2. Somehow make the form communicate with the bot, and somehow make the bot send an email to the user

queen needle
#

still doesnt work @torn nebula

lapis ocean
#

I am not the most genius, and I am not a developer. So I know there must be a better solution.

#

No way I came up with the best solutions in 5 minutes of thinking.

#

Actually I just busted my brain building a bot with a whole different solution to this.

#

And now just realized that there are 1 time use Invites.

#

So I kinda wasted my brain cells lol

hasty sparrow
#

You would have to update the list of available invites whenever a user receives one through the form

lapis ocean
#

That's with solution number 1.

#

Not elegant at all. It would be more elegant to generate the invite in real time. But maybe less stable, because then I am dependent on the bot (more moving parts). If the codes are pre generated indeed the bot could be offline as long as the form works everything is fine.

hasty sparrow
#

Solution 2 may be overengineered

lapis ocean
#

Bro, I just built a very overengineered bot for this

#

Busted my brian for 3 days

#

Look what I built. And I don't even know how to code basically.

#

So I made a bot that: 1. Sends a PM to the new user once he joins.

#
  1. Generates a link with his userid as a query string parameter.
#
  1. Made a form that catches this userid parameter.
hasty sparrow
#

If you already have a working solution, then what are we even discussing rn lmao

lapis ocean
#
  1. The form sends the iid as a Webhook to discord.
#
  1. The bot catches this and assigns the role.
#

A working solution for what?

#

It's a stupid solution.

#

I spent 3 days and built something really retarded.

hasty sparrow
#

Better a stupid one than none at all

lapis ocean
#

I had no idea invites could be limited by number of uses.

#

But it's not elegant because the user must join Discord first.

maiden mauve
#

sounds familiar

#

I spent days writing code to tear apart a tag as a string to pull out the integer and restring

lapis ocean
#

It's really hard for me because I don't code.

maiden mauve
#

without knowing i could pull the mention

lapis ocean
#

LOL, I am doing stuff like that all the time because I have no developer experience, and miss all the time simple solution to problems

#

And try to come up with some convoluted way to solve it.

maiden mauve
#

its just the normal learning curve though

#

that sthe fun of coding

#

you look back at something you wrote a month ago

#

and crunch it into 1 line

lapis ocean
#

Yeah well, it was fun, and painful as well.

maiden mauve
#

Generally anytime you see an indefinite repeating variable or condition

#

there is a smarter way to code it

#

and writing that line of code feels great

lapis ocean
#

So I guess I will generate a list of 1 time use Invites for my server, and deliver them to people that signup on the form

nocturne grove
near ether
#

are socket hang ups a client or server issue?

lyric mountain
#

are socket hang ups a client or server issue?
@near ether both

indigo cloud
#
internal/modules/cjs/loader.js:960
  throw err;
  ^

Error: Cannot find module 'discord.js-commando'
Require stack:
- C:\Users\xAutentiqz\Desktop\Discord Bot\index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
    at Function.Module._load (internal/modules/cjs/loader.js:840:27)
    at Module.require (internal/modules/cjs/loader.js:1019:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (C:\Users\xAutentiqz\Desktop\Discord Bot\index.js:1:28)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ 'C:\\Users\\xAutentiqz\\Desktop\\Discord Bot\\index.js' ]
}```
#

any fix for this?

hasty sparrow
#

Same issue as earlier today

nocturne grove
#

well seems clear, it can't find that module

hasty sparrow
#

Install your modules

indigo cloud
#

wait nvm

#

ya

#

ya

#

ik

#

sorry for bothering

nocturne grove
#

np

indigo cloud
#

extract:discord.js-commando: sill extract discord.js-commando@github:discordjs/Commando extracted to C:\Users\xAutentiqz\Desktop\Discoord-Bot

#

why is it stuck on that

#

when i download commando discord

lyric mountain
#

give it time

torn nebula
#

use npm to install packages

knotty steeple
#

wait

balmy knoll
#

[Node.js] With the canvas-constructor, how can i add a custom text font? Can you show me an example code?

torn nebula
#

looks like you download and extract to your bot folder

lyric mountain
#

[JavaScript] With the canvas-constructor, how can i add a custom text font? Can you show me an example code?
@balmy knoll javascript or node?

balmy knoll
#

@lyric mountain node.js sorry

lyric mountain
#

just require the font .ttf file

balmy knoll
#

Yes, i'm using glitch

#

I have the .ttf file in assets

lyric mountain
#

require it then

balmy knoll
#

Yes wait

#
let mage = new Canvas(500, 250)
      .registerFont('https://cdn.glitch.com/.ttf file link', 'Notosans Black')```
#

This is the code that i'm using

lyric mountain
#

ain't that working?

torn nebula
#

With the canvas-constructor
you can use example
.setTextFont('28px Impact')

balmy knoll
#

Yes but i want use a custom font @torn nebula

lyric mountain
#

.setTextFont('28px Notosans-Black')

#

you can't have whitespaces iirc

civic flower
#

@rotund prism you may have to over complexify who and how you are removing the role, like maybe having the roles be made into numbers, like 1 being starnger, because sometimes things just have to be brought up to the system in a new perspective.

lyric mountain
#

what?

civic flower
#

sorry i was talkign to someone that was a few hundred messages up

rotund prism
#

it's fine now, i've fixed it. it works perfectly fine. i was looking to try to make it into role id's

civic flower
#

ok cool

balmy knoll
#

@lyric mountain Ok, but i didn't get the right font, the bot use a font that it isn't Notosans Black

lyric mountain
#

just adapt to your needs

#

those were examples

#

not a ctrl + c ready code

balmy knoll
#

I know this. But if i have to use the Notosans Black font, i have load it somewhere?

lyric mountain
#

the registerFont method will register that font for that canvas object

indigo cloud
#
PS C:\Users\xAutentiqz\Desktop\Discord Bot> node index.js
internal/modules/cjs/loader.js:1170
    throw err;
    ^

SyntaxError: C:\Users\xAutentiqz\Desktop\Discord Bot\config.json: Unexpected end of JSON input
    at parse (<anonymous>)
    at Object.Module._extensions..json (internal/modules/cjs/loader.js:1167:22)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Module.require (internal/modules/cjs/loader.js:1019:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (C:\Users\xAutentiqz\Desktop\Discord Bot\index.js:4:27)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)```
#

any fixes?

lyric mountain
#

check your json

#

config.json

quartz kindle
#

your config.json file is wrong

indigo cloud
#

oh ya i see the problem

amber fractal
#

hey tim, do you know why node's readFile() would return a different buffer/string for a file that hasnt changed?

quartz kindle
#

wait what

copper cradle
#

what

amber fractal
quartz kindle
#

that makes no sense

#

whats your code?

amber fractal
#
fs.readFile(name, {encoding: "utf8"}, (err, data) => {
    if(err) return console.error(err)
    console.log(data.length)
})
copper cradle
#

hi I have no knowledge about programming whatsoever, I don't have any code why isn't botum on?

quartz kindle
#

honestly i have no idea why data.length would be different

copper cradle
#

lol

#

It shouldn't

amber fractal
#

I'm on windows if that makes a difference

copper cradle
#

well

#

windows always fucks things up

#

so may be the cause

#

but who knows

amber fractal
#

Ik filesystem is different on windows

quartz kindle
#

it seems like whatever data was missing in the first read was added on the second read

amber fractal
#

cuz their file api

#

has to be because the file is really large

sage wigeon
#

Anyone, how do I embed a video via video URL(using discord.js)?

amber fractal
#

is there a way to read past a certain point?

lyric mountain
#

use substring

#

Anyone, how do I embed a video via video URL(using discord.js)?
@sage wigeon you don't

sage wigeon
#

;_;

lyric mountain
#

you can't put videos on embeds

sage wigeon
#

Well that puts a hole in my plans but ty nonetheless.

copper cradle
#

lmfbao

quartz kindle
#

@amber fractal yes there is a way to read only a part of the file, but its complicated

amber fractal
#

I'd still need all the data too

#

which is the issue it seems

#

also it's a .log file as well

#

any way to read those differently?

quartz kindle
#

if you need all the data but not at once, use a readableStream

#

you can also use readline

amber fractal
#

I just need to get new lines from a file as they enter the file

#

this may work

quartz kindle
#

looks cool

amber fractal
#

hm

#

but line is an empty string

#

cool

copper cradle
#

lol

amber fractal
#

well it is 8 years old

quartz kindle
copper cradle
#

lol

amber fractal
#

it returns 8 lines

#

well

#

now 9

#

it's weird

tight plinth
#

how does shard works with shoukaku?

amber fractal
#

it seems to return everything in the file even with fromBeginning set to false

copper cradle
#

lo

#

l

cinder patio
#

Do you guys think it's better to upload images on an external service (example: imgur) instead of hosting them on your server?

copper cradle
#

yeah

#

way better

#

at some point you'll have to buy a better plan

#

unless you've got a 10PB storage plan

#

which I highly doubt

#

bc of the price

cinder patio
#

yeah I agree on that but what I meant was: let's say I am making a website and I want to have a few images, it's a possibility to upload the image to imgur nd then just reference the imgur link or I can host the image where the website is hosted

lyric mountain
#

anonymously uploads image to imgur

quartz kindle
#

if you want performance, upload them to your website

#

only reason to use an external service is if you're gonna have thousands of user-generated content

tight plinth
#

how can I easily convert"1m 52s" to miliseconds

lyric mountain
#

112 * 1000