#development

1 messages Β· Page 748 of 1

prime cliff
opal halo
#

its a fake link

#

I made it up

prime cliff
#

Mkay

opal halo
#

but if that link does exist then uh...oops?

west raptor
#

then

#

check

prime cliff
#

No it does not but if people see FREE ROBUX in your bot status then they might just not use your bot

valid frigate
#

im gonna flip my shit if discord keeps the <@! thing since i need to check for two different prefixes

#

especially if it's silent since discord doesn't document this shit

#

anyone know if this is going to be in the next stable update or not

west raptor
#

it's discord what do you think

valid frigate
#

ah

#

well makes sense

west raptor
#

iirc on mobile pings are <@!

valid frigate
#

honestly why though

west raptor
#

never knew it was on desktop

valid frigate
#

it's not on stable channels at the moment

west raptor
#

it might just be a forever canary thing?idk

#

discord is weird

valid frigate
#

i hopw

#

hope

west raptor
#

but still a lot of people use canary

valid frigate
#

yeah that's why it's frustrating to have to adapt to canary

#

discord should honestly just leave mentions alone

west raptor
#

mhm

#

yet they do this dumb shit all the time for no reason

opal halo
#

my server count still doesn't show and it has been way over 15 minutes...

#

what do?

earnest phoenix
#
const Discord = require("discord.js");
const sql = require("sqlite");
const config = require("../assets/config.json");
sql.open(`./assets/${config.dbsqlite}`);
module.exports = async (client, guild, member) => {
if (member.user.bot) return;
        sql.get (`SELECT * FROM guildes WHERE guildId ="${guild.id}"`).then(row => {
          let modlog = member.guild.channels.find("name", row.logschannel);
          if (!modlog) return;
          if (row.logsenabled === "disabled") return;
          
          const embed = new Discord.RichEmbed()
              .setColor("#36393f")
              .setThumbnail(member.user.avatarURL)
              .addField("Utilisateur ", `${member.user.tag} (ID: ${member.user.id})`)
              .addField("Rejoint: ", `${member.user.tag} a rejoint le serveur!`)
              .setTimestamp()
              return client.channels.get(modlog.id).send(embed);
            
    })
}
(node:11471) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'guild' of undefined

This is this line
let modlog = member.guild.channels.find("name", row.logschannel);

How can I resolve this?

vital lark
#

guild doesn't exist

earnest phoenix
#

"Cannot read property 'guild' of undefined"

#

....

lament meteor
#

member is not defined or member is something empty

earnest phoenix
#

But this happens when the member joins

lament meteor
#

hmm

#

maybe try console logging the member

earnest phoenix
#

I think it's weird.

#

Mmmh okay

lament meteor
#

also async and u use .then()?

#

just do member

earnest phoenix
#

Okay

lament meteor
#

maybe it says undefined cause its in a function

earnest phoenix
#

Oh

#

Okay wait

#

undefined

#

In the console

#
module.exports = async (client, guild, member) => {
  console.log(member)
lament meteor
#

Thonk how does ur cmd handler handle events

earnest phoenix
#
fs.readdir('./events/', (err, files) => {
  files = files.filter(f => f.endsWith('.js'));
  files.forEach(f => {
      const event = require(`./events/${f}`);
      client.on(f.split('.')[0], event.bind(null, client));
      delete require.cache[require.resolve(`./events/${f}`)];
  });
});
#

In the ready.js i have the commands

lament meteor
#

the member isnt pushed?

#

or whatever it is

earnest phoenix
#

No

#

member is only in the event

#

Event: guildMemberAdd

lament meteor
#

client.on(f.split('.')[0], event.bind(null, client)); does it bind the member?

earnest phoenix
#

No

sinful lotus
#

client.on('name', event)
should be fine
or
client.on('name', event.bind(client))
will make more sense and lets you access client as this on the event

#

parameters is automatically passed as well

earnest phoenix
#

:/

#

client.on('event1', event.bind(client))
client.on('event2', event.bind(client))
etc...?

#

This is weird...

sinful lotus
#

yeah, client will be this on the events

#

instead of client

lament meteor
#

brb

sinful lotus
#

since you bind it

earnest phoenix
#

Bruh

#

Okay

sinful lotus
#

then on events

#

the parameters on function

#

will be exactly what the event gives

earnest phoenix
#

Okay

#

Ty

#
    sql.get(`SELECT * FROM guildes WHERE guildId ="${guild.id}"`).then(row => {

TypeError: Cannot read property 'id' of undefined

#

πŸ‘€

sinful lotus
#

did you define guild

earnest phoenix
#

client.on('guildMemberAdd', event.bind(client, guild))?

#

Do I have to define everything one by one like that?

sinful lotus
#

the guild there is redundant

vital lark
#

shouldnt this be there too?

sinful lotus
#

event.bind(client) is all you need

earnest phoenix
#

Mmmh

sinful lotus
#

I doubt the this is defined on that scope

vital lark
sinful lotus
#

and he wants the client exactly to be this

earnest phoenix
#

Basically my problem is module.exports = async (client, guild, member) => {

sinful lotus
#

client is the member there

#

guild and member is undefined

#

while client will be this

earnest phoenix
#

Wait i log guild

sinful lotus
#

member has a property called guild

#

if you want access to client, then you can do so by using this on the event file

#

since that what .bind does

earnest phoenix
#

this.member?

sinful lotus
#

this "is your discord.js client"

#

do discord.js client have a property called member?

earnest phoenix
#

The member is only in module.exports = async (client, guild, member) => {

sinful lotus
#

its basically the same of what guildMemberAdd outputs

#

the reason why guild and member is undefined because the event doesnt even output those

#

and you mistook member thinking its your client

earnest phoenix
#

Mmmh

sinful lotus
#

console.log()
this and client there
you will see where you are wrong

#

if you have knowledge of js as I think you have ofc

earnest phoenix
#

When i console log guild

sinful lotus
#

thats undefined

earnest phoenix
#

No

#

Just member

#

guild is defined

sinful lotus
#

wait what how do you run your event.bind()?

#

in reality you only need module.exports = async (member) => {}

earnest phoenix
#
fs.readdir('./events/', (err, files) => {
  files = files.filter(f => f.endsWith('.js'));
  files.forEach(f => {
      const event = require(`./events/${f}`);
      client.on(f.split('.')[0], event.bind(null, client));
      //client.on('guildMemberAdd', event.bind(client))
      delete require.cache[require.resolve(`./events/${f}`)];
  });
});

module.exports = async (client, guild, member) => {
console.log(guild) => defined
console.log(member) => undefined

#

Mmmh

sinful lotus
#

well ofc guild will be member if you null the first

#

I think you dont even listen to what I explained to you

earnest phoenix
#

I have a very poor level of English

sinful lotus
#

event.bind(null, client) will

  1. set this as null on your event file
  2. member is your guild
  3. member is undefined
#

event.bind(client) will

  1. set this as client in your event file
  2. client as your member prop
  3. guild and member will be undefined
#

thats my last explanation

earnest phoenix
#

Oh

#

Okay

sinful lotus
#

if you dont understand wtf is this, its actually easy. every function have a variable this

#

its just not utilized, in simple terms

earnest phoenix
#

Okay nice

sinful lotus
#

.bind() lets us use the this if its non existent, specially on arrow functions

earnest phoenix
#

Mmmh

#
client.on(f.split('.')[0], event.bind(client));

client.user.username => TypeError: Cannot read property 'user' of undefined

sinful lotus
#

1. set this as client in your event file

earnest phoenix
#

How

sinful lotus
#

as simple as changing client to this

earnest phoenix
#

Okay

sinful lotus
#

this is a variable

earnest phoenix
#

Oh x)

#

Okay okay

sinful lotus
#

basically the owner of that function is the client

#

thanks to bind

earnest phoenix
#

Okay

#

Ty

#

This is perfect

#

Thank you

opal halo
#

my server count still doesn't show and it has been way over 15 minutes...
what do?
I put the code in and everything https://prnt.sc/qbboe5

Lightshot

Captured with Lightshot

earnest phoenix
#

how could i add mentions to a role or user in an embed text using magic bot?

magic heart
#

Just dm me I’ll walk you through it

opal halo
#

Who

wheat jolt
#

INSERT INTO warns (userID, reason, expiresAt, staffID) VALUES ('${member.user.id}', ${reason ? reason : null}, ${expiresAt}, '${msg.author.id}') what the heck is wrong in this sql

earnest phoenix
#
INSERT INTO warns (userID, reason, expiresAt, staffID) VALUES (?, ?, ?, ?), [member.user.id, `${reason ? reason : null}`, expiresAt, msg.author.id]
#

@wheat jolt

#

πŸ€”

#

I think this is good

wheat jolt
#

Wtf

earnest phoenix
#

?

restive furnace
#

@earnest phoenix its sql it wont take [] breh

#

not json

earnest phoenix
#

Sql is similary to sqlite no?

#

πŸ€”

#

My bot use sqlite and this is good

wheat jolt
#

Nope

late hill
#

You can't just randomly use ${} ?

#

or like

#

Did you put that in `` or not

earnest phoenix
#

does anyone knows what this error means:
Error: getaddrinfo ENOTFOUND name.glitch.me name.glitch.me:80 at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:67:26)

vital lark
#

can't connect to glitch

modest maple
#

@earnest phoenix isn't it () not []

earnest phoenix
#

cool

vital lark
#

try again later or check the status page for any maintenance?

prisma lion
#

can i have help

earnest phoenix
#

yes

modest maple
#

Ask2ask

prisma lion
#

ok

#

it doesn't work

#

i mean it need to only work for me

#

and other guy

#

but

#

it for everyone

#

when lunching the cmd

#

by //dev

quartz kindle
#

you cant do something === something2, something3

prisma lion
#

mm

#

so

#

what can i do

earnest phoenix
#

you could do id === id1 || id2

mossy vine
#

that wont work either iirc

earnest phoenix
#

lame

prisma lion
#

ooof

celest cradle
earnest phoenix
#

do you have a website

celest cradle
#

No

mossy vine
#

@celest cradle if you dont know what it is, dont put anything there

celest cradle
#

But it wouldn’t let me submit without it

mossy vine
#

it does

prisma lion
#

no

mossy vine
#

you have an error somewhere else

prisma lion
#

its dont habe the red star

celest cradle
#

Okay hold on let me try again

prisma lion
#

so u can

celest cradle
modest maple
#

Do Ur long description then

earnest phoenix
#

your long description is too short

celest cradle
#

Oh

compact raft
#

is this possible to send dm using bot to whole server member at one time

earnest phoenix
#

like to a whole server

#

yeah i'm pretty sure

#

i'm also pretty sure that could be api abuse

compact raft
#

i'm using this to send a saperate mensioned user

let mn = message.mentions.users.first();

i want to know that how to send to whole server member dm

earnest phoenix
#

.forEach works

compact raft
#

can i use

client.guilds.forEach
lament meteor
#

ratelimits

earnest phoenix
#

there's also that

earnest phoenix
#

don't mass dm

#

api abuse and you're putting your bot at risk of termination

#

repeat it multiple times and your account will be terminated

green kestrel
#

im just brainstorming a way to restart a bot without any loss of messages. because the old instance of the bot would still be running and would start the new instance, i wouldnt be able to use a RESUME, so im thinking:

  1. old bot instance creates a file at a known location called ".restart"
  2. new bot instance starts up and identifies to all shards, but doesnt respond to any messages yet. at this point, old bot instance can still respond to messages.
  3. once all shards are up on the new bot, the new bot removes the ".restart" file
  4. new bot can now respond to messages
  5. old bot is watching the ".restart" file, and when it sees its deleted, shuts down.

this way theres no loss of any messages, and no visible downtime at all when i issue a restart of the bot. thoughts?

#

also doing it this way means if something messes up in the sequence and a .restart file is still left around when one instance is started up outside of a restart, it will just go through normal operations, removing that .restart file once its up and running.

earnest phoenix
#

Can someone tell me which MongoDB atomic operators should I use if I want to replace an entire document?

mossy vine
#

@green kestrel holy shit thats a really smart idea, ill add that to my template

green kestrel
#

you think it'll work?

#

ive yet to try it out

mossy vine
#

in theory it should

#

but since im only working with child processes, i dont need watching a file

#

just pass stuff through an ipc socket

earnest phoenix
#

hi help me pls

mossy vine
#

whats the error

earnest phoenix
mossy vine
#

show code context

earnest phoenix
#
    queue[0].voiceChannel
      .join()
      .then(connection => {
        const dispatcher = connection
          .play(
            ytdl(queue[0].url, {
              quality: 'highestaudio',
              highWaterMark: 1024 * 1024 * 10
            })
          )
          .on('start', () => {
            message.guild.musicData.songDispatcher = dispatcher;
            const videoEmbed = new MessageEmbed()
              .setThumbnail(queue[0].thumbnail)
              .setColor('#e9f931')
              .addField('Now Playing:', queue[0].title)
              .addField('Duration:', queue[0].duration);
            if (queue[1]) videoEmbed.addField('Next Song:', queue[1].title);
            message.say(videoEmbed);
            message.guild.musicData.nowPlaying = queue[0];
            return queue.shift();
          })
          .on('finish', () => {
            if (queue.length >= 1) {
              return this.playSong(queue, message);
            } else {
              message.guild.musicData.isPlaying = false;
              message.guild.musicData.nowPlaying = null;
              return message.guild.me.voice.channel.leave();
            }
          })
          .on('error', e => {
            message.say('Cannot play song');
            console.error(e);
            return message.guild.me.voice.channel.leave();
          });
      })
      .catch(e => {
        console.error(e);
        return message.guild.me.voice.channel.leave();
      });
  }
module.exports.help = {
    name: "play"
}
#

full code ??

west raptor
#

what

mossy vine
#

function playSong

earnest phoenix
#

Thanks Bro

#

we love a good copypaste

modest maple
#

Indeed

olive kiln
#

Hwy i need help with my +work Command. Its code isnt working at all

placid iron
#

Ironic

earnest phoenix
slim heart
#

We need code and an error

olive kiln
#

Ill give it to you from hastebin. Its too lonf

slim heart
#

You can just post the part that’s broken

#

And the error

olive kiln
#

There

slim heart
#

Error

vital lark
#

we need an error

#

before we can help you

#

just giving us code won't do anything to fix the problem

earnest phoenix
#

refer to the link above

olive kiln
#

The code is 2000 max chars well the error is. The data.etc it has a red mark which my coder is glitch.com which sucks :(

#

Like data.memberData.workStreak

#

It doesnt work

#

Thats the error

vital lark
#

is there any specific error in the console

olive kiln
#

Yes

#

When I do +work it wont respond

earnest phoenix
#

again refer to the link above, learn to ask a proper question because no one has any idea what you're talking about or what you're using

olive kiln
#

πŸ˜… 😁

vital lark
prisma lion
#

how to make only ids cmd

amber fractal
restive furnace
green kestrel
#

thats assuming javascript

#

and assuming discord.js iirc

#

but as you didnt say which language, thats probably a valid assumption to make

slender thistle
#

... since most people here use d.js or d.py

prisma lion
#

i use node.js

#

ye d.js

#

@restive furnace can i use like alot of ids

#

not just one

earnest phoenix
#

put them in an array

#

then check if the message author's id is in the array

prisma lion
#

array?

#

eh srry what

earnest phoenix
#

oh god

prisma lion
#

u mean

modest maple
#

LEARN THE BASICS

amber fractal
prisma lion
#

chill

modest maple
#

It's an arrat

amber fractal
#

That's basic programming...

modest maple
#

Array*

#

It's like the second thing you learn

earnest phoenix
prisma lion
#

CHILL I JUST WOKE UP

earnest phoenix
#

it isn't even programming

#

an array is a concept in maths

prisma lion
#

omg

modest maple
#

Bruh

prisma lion
#

i jusst deleted the scripttttt.

earnest phoenix
#

ok

prisma lion
#

lemme undo

#

oof

drowsy wedge
#

nice

prisma lion
#

well i did it in "array" thing but it didnt work everyone can still acces the cmd

#

its my old problem

#

(yesterday i said the same)

earnest phoenix
#

then you didn't do it right

modest maple
#

Judging from that snippet of code

#

You didn't do an array

prisma lion
#

ok
.

modest maple
#

You did god know what to a string

#

But that's it

earnest phoenix
#

refer to the link above

#

codecademy is a great learning source for tech newbies

prisma lion
#

man

#

i did it in "array"

#

it didn't worrk

#

everyone still can acces it

earnest phoenix
#

what's your code

prisma lion
#

a sec

restive furnace
earnest phoenix
#

that's not an array

#

again

#

refer to the link above

restive furnace
#

[] this is empty array

earnest phoenix
#

@restive furnace don't spoonfeed code, or well don't spoonfeed incorrect code

prisma lion
#

oh wait a sec

restive furnace
#

kk

#

but all code what i already spoonfeeded are only line 1 line or like that "[]"

restive furnace
#
  • every of then should work on the package Mehdi using.
prisma lion
#

wait

earnest phoenix
#

that's still incorrect

prisma lion
#

ooof

#

ik

earnest phoenix
#

you're comparing the id to an array

#

your goal is to check if the id is inside of the array

prisma lion
#

ehm?

restive furnace
#

check it by "includes" key word, not spoonfeeding the code.

earnest phoenix
#

no

late latch
#

?

#

==

earnest phoenix
#

shut up

prisma lion
#

meh

earnest phoenix
#

@prisma lion why do you keep ignoring the link

#

it tells you what an array is

prisma lion
#

link?

#

what link

late latch
#
const dev = [456532271969730562, 469848488545484800]
if(message.author.id == dev) {
earnest phoenix
#

@late latch that's still incorrect, stop spoonfeeding code

prisma lion
#

....

earnest phoenix
#

that's very incorrect

late latch
#

omg

prisma lion
#

its same

#

like me

earnest phoenix
#

it very much isn't

prisma lion
#

but worst

restive furnace
#

my tip what i alr said earlier: check it by "includes" key word.

earnest phoenix
#

yes

#

worse indeed

restive furnace
#

On python if authorid == array works but i still like js more cuz python isnt so modular as node.js

#

xd

earnest phoenix
#

python is yuck for me

#

tbh

#

i dislike the syntax and it's interpreted

#

but everyone has their prefs

slender thistle
#

Python went well for me personally despite it being interpreted /shrug

earnest phoenix
#

i'm a maniac for performance

slender thistle
#

understandable

restive furnace
#

c langs gud for perfonmance

slender thistle
#

Also some_id == list() won't work

prisma lion
#

wut

slender thistle
#

Python == compares values. If you want to check if an object is in a list, use in

restive furnace
#

what about list in list in list in list?

prisma lion
#

omg

#

is that a philosophy lesson cuz i hate it

restive furnace
#

arr[0][0][0][0] possible xd

slender thistle
#

Possible but there's no point in doing that imo

restive furnace
#

yes

prisma lion
#

ye right

slender thistle
#

Unless you are doing some really fucky stuff

prisma lion
earnest phoenix
#

nest lists into oblivion to the point it crashes on init

restive furnace
#

list in list sometimes needed

prisma lion
slender thistle
#

Yes but not a recursive list_x in list_y

prisma lion
#

@earnest phoenix can u gimme a template

earnest phoenix
#

what

prisma lion
#

tem

#

pl

#

ate

earnest phoenix
#

you don't have to be annoying

#

i don't get what you want

#

template of what

prisma lion
#

the code

earnest phoenix
#

what

prisma lion
#

correct one

earnest phoenix
#

oh the id checking

#

no i can't

prisma lion
#

ok

earnest phoenix
#

i gave you a link to a resource which is very helpful

prisma lion
#

k.

earnest phoenix
marble juniper
#

is there a way I can check if a url is a valid audio file

modest maple
#

check the extension

earnest phoenix
#

does anyone know a good rpg bot?

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
#

oh

#

ok boomer

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

check the extension
it isn't reliable enough

#

you have to check the file header

#

if you only do extension checking someone can pass a png file as an mp3

compact oriole
#

or the mimetype

earnest phoenix
#

which will error out when you attempt to read it as an audio file

#

mimetype also depends on the extension of the file

#

or well whatever the host sets it to

#

which most set it to the extension

compact oriole
#

yea

#

hmm

#

true

prisma lion
#

how to add cooldown to cmd that shows you how much time it rest to use the cmd again

earnest phoenix
#

use a map

#

keyed by the user id

#

and the command as the value

#

when the command execution finishes add the user id to the map

#

and setTimeout for whatever your cooldown is to remove the user

sage bobcat
#

One message removed from a suspended account.

compact oriole
#

dont dotpost

fluid basin
#

PIL

prisma lion
#

well

#

ye sorry

#

pal

fluid basin
#

not like you can find it in JS

earnest phoenix
#

isn't nadeko .net

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

prisma lion
#

let me check some websites

earnest phoenix
prisma lion
#

ty btw

earnest phoenix
fluid basin
#

oh wait yeah true@earnest phoenix

#

should be the latter I think idk

#

for 1 sec I thought it was py

#

well I dont use nadeko so

compact oriole
#

Good alternative to pil is https://p5js.org/

fluid basin
#

either ways you can't find those exact libraries in JS

sage bobcat
#

One message removed from a suspended account.

fluid basin
#

so yuh got to find some alternatives and mess around with that

sage bobcat
#

One message removed from a suspended account.

compact oriole
#

p5js

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

magick.net is just a binder for imagemagick which is crossplatform

fluid basin
#

@compact oriole afaik thats for JS not node

earnest phoenix
#

so you can theoretically use imagemagick in js

fluid basin
#

yeah ofc you can always use wrapper libraries

#

but the syntax and usage wont exactly be the same

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

i just want to remake nadeko in javascript
i'd say that is pretty much a suicide mission, js is not as powerful and efficient as c# is

sage bobcat
#

One message removed from a suspended account.

compact oriole
#

Well actually

slender thistle
#

JS is interpreted, isn't it

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

fluid basin
#

JS is JIT

#

if you're using V8 node

#

(which should be the case )

sage bobcat
#

One message removed from a suspended account.

fluid basin
#

no not discord js version

compact oriole
fluid basin
#

its the engine behind node

compact oriole
#

Maybe you should search npm

fluid basin
#

true, there are many options available

#

though as a webdev I usually use jimp (but slow) or canvas

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

neat flower
#

jimp is gonna drain the hell out of whatever you're hosting your bot in

#

js itself is not a shining paragon of efficiency, add image processing to it and you meet impending doom

fluid basin
#

well its a good starter choice though

sage bobcat
#

One message removed from a suspended account.

neat flower
#

well it indeed is. but it would be a better investment to learn the canvas api

sage bobcat
#

One message removed from a suspended account.

neat flower
#

it is a native module so it runs on the underlying C++ binaries instead on the v8 itself

amber fractal
#

Yeah, canvas has more uses as well

#

Like html5 mmulu

neat flower
#

node canvas can be a bit painful to set up, and isn't as intuitive , but it sure is powerful

vital lark
#

I'm surprised no one suggested Jimp

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

amber fractal
#

But jimp is

#

Well

vital lark
#

oh fucc

neat flower
#

we did and immediately told why not to use it plxLUL

amber fractal
#

πŸ’©

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

neat flower
#

ram is not exactly your main concern

#

imagine that JS is single threaded and jimp will do image processing on that one thread every time

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

neat flower
#

well node doesn't care

amber fractal
#

6 what

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

neat flower
#

it will only use one

amber fractal
#

Single threaded

neat flower
#

regardless of how many cores you have

#

V8 is not hyperthread-ready

sage bobcat
#

One message removed from a suspended account.

neat flower
#

cpu-locking

#

it will wait every image processing task on a queue

#

as your bot grows that adds up

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

neat flower
#

if you don't have variable images you can go for it. but that just hides the problem. doesn't solve it

fluid basin
neat flower
#

if you're going for like. profile cards and such, then u gonna have a hard time

fluid basin
#

thonk which is why you use subprocesses

#

for this kind of things

neat flower
#

canvas being a native module does exactly that

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

neat flower
#

then caching is pretty useless

sage bobcat
#

One message removed from a suspended account.

amber fractal
#

Unless you want to kill your system

neat flower
#

the problem is not storing or grabbing images, but processing them

#

since they'll change Everytime, there's no much point in storing the result

earnest phoenix
#

How to get the news channel of a guild?

sage bobcat
#

One message removed from a suspended account.

amber fractal
#

Steam had a security flaw with just that problem actually lol

earnest phoenix
#

d.js @sage bobcat

#

v12-dev

fluid basin
#

time to actually write a bot in C++

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

@fluid basin lmao

fluid basin
#

not a pure C++ bot ofc

mossy vine
fluid basin
#

maybe with a JS connector

amber fractal
#

Thet cached someones personal page and gave anyone that accessed it their details

earnest phoenix
#

any1 help me?

fluid basin
#

@earnest phoenix channel.type

earnest phoenix
#

does that return a bolean?

fluid basin
#

read the docs please

earnest phoenix
#

i just saw it

#

i need it as bolean

#

type returns a string

mossy vine
#

what do you need again

mossy vine
#

wait what

#

cant a server have several news channels?

slender thistle
#

Yes

mossy vine
#

then just filter through the channels to get a list of news channels

earnest phoenix
#

i just need the bolean so i can check if it exists

#

i dont need the names/id's of it

amber fractal
#

Filter channels by type, if there is at least one result return true

#

Pseudo code is helpful, think of the problem and solution in words first

earnest phoenix
#

Why does discordapp.com refuse my connection if I do it through an iframe?

fluid basin
#

what? that depends on what you're trying to do

prime cliff
#

My guess would be that they are trying to block scammers from using iframes to create a fake discord website

earnest phoenix
#

I'm trying to add an invite to my discord server

prime cliff
#

?

#

Ah i see

#

Yea intresting looks like Discord does indeed block iframes from loading server invite pages

earnest phoenix
#

why though?

#

is it that hard to add a button that opens the invite in a new tab

#

yes

#

if you have popup blocker, yes

cold canyon
#

does anyone know how to program a musicbot in discord.py rewrite

#

cause im having issues

prime cliff
#

@earnest phoenix he wants to have a dynamic name/background and member count too also if it did work it would not open a new tab

#

That's why he wanted an iframe but discord block that

earnest phoenix
#

if you have popup blocker, yes
a popup blocker allows new tabs to opened if it's a voluntary action

#

which, clicking on a button, is

#

I have had times when it blocked it

#

but well, it's working now

prime cliff
#

Yea it just depends on what popup blocker settings you have enabled also js scripts can just fake click a button so how would it dected that from normal user input Thonkeng

earnest phoenix
#

it happens when sites use anything other than anchor or button tags as buttons

#

@prime cliff the position of the mouse maybe?

prime cliff
#

Yea that would be intresting

light drift
#

How i can do this but in json

#

because i want to now my bot wich user,channel,idserver

mossy vine
#

wha

wheat jolt
#

What language is that

light drift
#

C++ but isnΒ΄t my is a motor of nadeko

wheat jolt
#

Uhm

light drift
#

But i wonΒ΄t wich command canΒ΄t returns the info of the comands are using and channel id and id of the server

earnest phoenix
#

i had a stroke trying to read that

slender thistle
#

same

light drift
#

I want to create a log style to see which channels the commands are used as in the capture but in json code

dusky marsh
mossy vine
#

either edit the source code or capture the output and parse it

modest maple
#

'in json code'

earnest phoenix
#

do you want to store logs in json format?

#

English please

light drift
#

sorry

modest maple
#

why do people want to store things in json so much πŸ™ƒ whats wrong with A db

light drift
#

I already did it but the engine of that exe was badly created.

earnest phoenix
#

from what I've figured from here is that people are afraid of learning

light drift
#

Only i wonΒ΄t is like you send a comand of the bot in a channel when he user doing that comand me returns that: user(id), channel(id) mesage(comand)

modest maple
#

well that would just be like having a system that just adds that text to a DB every time

#

then when u need it just calling on the DB

#

why you would use a JSON for that is just weird

light drift
#

Yes i will take a look because the motor of my bot is from Nadeko Bot. Is in net and C++

earnest phoenix
#

c++ and net are not the same

modest maple
earnest phoenix
#

making a functional bot in c++ is granted to give you a trip to a psychologist

slender thistle
#

So I should reserve one

earnest phoenix
#

smh

light drift
#

@earnest phoenix If you saw what I decompressed from the engine of the bot, 70 .dll and 3 json and some .net

earnest phoenix
#

im aware that dotnet publish outputs a lot of dlls

#

and im aware that single file publish exists

#

so you didn't do it, the dotnet CLI did

modest maple
#

its just, a massive pain in the ass

light drift
#

@modest maple yes

modest maple
#

choose a better supported language πŸ‘ next time xD

light drift
#

I was talking with the owner and saying way you canΒ΄t do in 2 .dll because is very bad all the code

#

@modest maple Wich code you use?

earnest phoenix
#

you can actually pack everything into one executable

light drift
#

More times i use only Json and Node

modest maple
#

ive built a bot in both python and d.js

light drift
#

And net or c++

modest maple
#

and yh but you can do it in c# cant u to make it into a EXE

light drift
#

Python is more easy ?

modest maple
#

not rlly

#

easy is objective

light drift
#

I now now will do one in pascal

modest maple
#

easier for people to over estimate their abilities

light drift
#

Yeah now i create some explots for jailbreak

earnest phoenix
#

x doubt

modest maple
earnest phoenix
#

lol

modest maple
#

well thats one way to get banned both from discord and this server

#

if your taking tokens that arnt assigned to your account

light drift
#

now because i am not using and he can take a look in my account

earnest phoenix
#

i feel like im back in 2010 where kids are cocky talking about hackerman stuff without knowing what it means

#

because that's what is happening here

modest maple
#

yup

#

someone with no knowledge acting like they do

#

also

#

good try

#

xD

light drift
#

Only discord can take a look from my account

slender thistle
#

I jailbreak Android

mossy vine
#

@earnest phoenix shut up before i reverse proxy ddos your gpu speed

modest maple
#

idek what ur trying to say hoister

#

buttttttttt

#

dont steal / break tokens

earnest phoenix
#

oh yeah well my dad works for microsoft @mossy vine

modest maple
#
  1. dick move
  2. get beaned
mossy vine
#

mine is apple

light drift
#

JAJAJAJ nice try but in mi IP or discord history are nothing

earnest phoenix
#

ok

#

nobody cares

modest maple
#

ah yes

#

discord history

slender thistle
#

Remember to clear your Discord history

earnest phoenix
#

fun fact you actually can though

#

in compliance with eu's GDPR your data must get deleted once you terminate your account

modest maple
#

yh

#

you can request your data aswell

earnest phoenix
#

i dont even want to look at that

#

it has too much sinner in it

modest maple
#

XD

sage bobcat
#

One message removed from a suspended account.

twilit rapids
#

@loud salmon ily

sage bobcat
#

One message removed from a suspended account.

loud salmon
#

fucku2 @twilit rapids

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

twilit rapids
#

uh

#

you are local hosting LL?

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

twilit rapids
#

LL = lavalink

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

twilit rapids
#

Wait you don't have a LL server running yet?

sage bobcat
#

One message removed from a suspended account.

twilit rapids
#

Well there's your issue

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

twilit rapids
#

Alright

#

Did you download the lavalink.jar file from github?

sage bobcat
#

One message removed from a suspended account.

twilit rapids
#

Did you create an application.yml file in the same directory?

sage bobcat
#

One message removed from a suspended account.

twilit rapids
#

Then change it to your likings

#

port, address, password, sources, bufferduration, youtubeplaylistloadlimit, youtubesearchenabled and soundcloudsearchenabled

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

twilit rapids
#

then run java -jar Lavalink.jar in terminal in that directory

sage bobcat
#

One message removed from a suspended account.

twilit rapids
#

capital L

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

twilit rapids
#

are you sure it's in the right directory

sage bobcat
#

One message removed from a suspended account.

twilit rapids
#

and are you sure that there's a Lavalink.jar file in there

earnest phoenix
#

Yeah but the jar isn't in the root of that dir

#

I'm pretty sure you need to build it first

#

Or you can download the jar from their CI

twilit rapids
#

They said that they already downloaded the lavalink file

prime cliff
#

Yea you don't need to build it that jar file is the built package

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

twilit rapids
#

n o

prime cliff
#

Wait what are you downloading the repo

earnest phoenix
twilit rapids
#

Holy heck

#

that's a long

#

link

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

prime cliff
#

Imagine not reading

sage bobcat
#

One message removed from a suspended account.

sage bobcat
#

One message removed from a suspended account.

prime cliff
#

Download jar file from releases create an application.yml file along with the jar

#

And see that Example

sage bobcat
#

One message removed from a suspended account.

twilit rapids
#

Move the lavalink.jar file to the directory your application.yml is

#

Don't open it

#

Just

#

let it exist

sage bobcat
#

One message removed from a suspended account.

twilit rapids
#

and run java -jar Lavalink.jar again

sage bobcat
#

One message removed from a suspended account.

twilit rapids
#

That's good

#

Now it's running

sage bobcat
#

One message removed from a suspended account.

twilit rapids
#

I assume you have lavalink-server.json file in your bot's directory

sage bobcat
#

One message removed from a suspended account.

prime cliff
#

Did you change the default password in application.yml though monkaS

sage bobcat
#

One message removed from a suspended account.

twilit rapids
#

Configure that to whatever you changed the things to in the application.yml file

#

port, address, password

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

twilit rapids
#

now run your bot again

#

and see if it connects

sage bobcat
#

One message removed from a suspended account.

twilit rapids
#

So it connected?

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

twilit rapids
#

Epic

#

np

#

Though

sage bobcat
#

One message removed from a suspended account.

twilit rapids
#

Because YouTube is yeeting IPs, I would suggest to disable YouTube for now until you setup IPv6 on your VPS

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

unique nimbus
#

Soundcloud

twilit rapids
#

soundcloud

#

vimeo

#

mixer

#

bandcamp

#

twitch

prime cliff
#

Youtube does not yeet you if you are under a certain limit but disable any playlists from loading

twilit rapids
#

They yeet really often now

mossy vine
#

in js will having a class that extends a class that extends another class that extends yet another class etc. up to like 6-7 max affect the performance noticably?

modest maple
#

w-wha- who DF does that>?

twilit rapids
#

I honestly have no idea if it would

mossy vine
#

@modest maple me

earnest phoenix
#
const DBL = require('dblapi.js');
const dbl = new DBL(settings.dbltoken, { webhookPort: 5000, webhookAuth: 'password' });

dbl.webhook.on(`ready`, hook => {
 console.log(`Webhook is up and running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on(`vote`, vote => {
 var VotedUser = vote.user;
 console.log(`User with ID ${vote.user} just voted!`);
 try{
 client.users.get(VotedUser).send("Thanks for voting!");
 client.users.get(settings.owner).send(`${VotedUser} just voted for ${client.username}`);
 }
 catch(error){
 console.log('Uh oh! ' + error);
    }
});

When someone votes, the bot doesn't do that.

modest maple
#

what does it do

earnest phoenix
#

how to get users by username?

modest maple
#

what lib

wheat jolt
#

discord.js?

earnest phoenix
#

I want to get their IDs as soon as the voters give it over

#

But it doesn't work

const DBL = require('dblapi.js');
const dbl = new DBL(settings.dbltoken, { webhookPort: 5000, webhookAuth: 'password' });

dbl.webhook.on(`ready`, hook => {
 console.log(`Webhook is up and running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on(`vote`, vote => {
 var VotedUser = vote.user;
 console.log(`User with ID ${vote.user} just voted!`);
 try{
 client.users.get(VotedUser).send("Thanks for voting!");
 client.users.get(settings.owner).send(`${VotedUser} just voted for ${client.username}`);
 }
 catch(error){
 console.log('Uh oh! ' + error);
    }
});
wheat jolt
#

You don't need to give the code twice

earnest phoenix
#

ok

summer torrent
#

@earnest phoenix find()

lunar crystal
#
  if (message.content === prefix + 'count') {
    message.guild.createChannel(`${message.guild.member.count}`,{type: 'voice'}) 
    .then(console.log)
    .catch(console.error);
  }
})```
#

Why when I try the command the channel is named undefined ?

earnest phoenix
#

message.guild.members.find(m => m.user.username === args.join(' ')

#

? @summer torrent

summer torrent
#

yes

earnest phoenix
#

ok

summer torrent
#

@lunar crystal message.guild.member.count is wrong

earnest phoenix
#

@lunar crystal message.guild.createChannel({name:message.guild.memberCount}, type: "voice")

summer torrent
#

message.guild.memberCount

earnest phoenix
#

i belive

#

@summer torrent maybe hes on master

summer torrent
#

Β―_(ツ)_/Β―

lunar crystal
#

ok thank you both @summer torrent @earnest phoenix

earnest phoenix
#

np

summer torrent
#

πŸ‘Œ

earnest phoenix
#

i typed no instead of no xD

lunar crystal
#

x)

#
next_tick.js:68
code:50035
message:"Invalid Form Body\nname: Could not interpret "{'name': 13}" as string."
method:"POST"```
#
  if (message.content === prefix + 'count') {
    message.guild.createChannel({name:message.guild.memberCount},{type: "voice"})
    .then(console.log)
    .catch(console.error);
  }
})```
earnest phoenix
#

the error is english

#

the name has to be a string

#

you could use several things to make it one

#

such as template literals

#

toString

summer torrent
earnest phoenix
#

ok

#

and there it says name is a string

#

not a number

timid dawn
#

I can't but my bot in tip.gg they saying
Invalid server format what is meaning

earnest phoenix
#

the servers need to be guild IDs

#

which means that the servers need to have the @pliant gorge bot in it

timid dawn
#

i but this bot in my server

#

And my server in the top.gg but my bot is not

unique nimbus
#

Your bot needs to be accepted

#

for it to be in this server

timid dawn
#

How

unique nimbus
#

Did you put your bot to get tested?

timid dawn
#

How πŸ™‚

unique nimbus
#

Unless I got confused

#

with what you said

timid dawn
#

i Do all Thing in the end say's
Invalid server format

summer torrent
#

server area is optional

timid dawn
#

Ok, what will I do?

restive furnace
#

leave it empty

quartz kindle
#

server must be the ID of the server

split hazel
#

I'm using the HTTPS module paired with express to establish SSL with our certificates, GET requests work fine but POST never get through, the server does not connect, when just using standard app.listen(port) with http it gets through fine

quaint grotto
#

ok so my embed wont send but im not getting any errors

sudden geyser
#

What library and show code pls

quaint grotto
#

discord.js if(command === "Help") { let embed = new Discord.RichEmbed() .setColor('#1e5878') .setThumbnail('stuff') .addField('eee', 'field') message.channel.send(embed) };

sudden geyser
#

what is command?

grim aspen
#

i don't think you put 'stuff' as a thumbnail

quaint grotto
#

there were links

#

so i just put random stuff

#

const command = args.shift().toLowerCase();

modest maple
#

u do know

#

that um

#

thumnail

sudden geyser
#

Help should be help

modest maple
#

wants an image right?

grim aspen
#

wait

#

do you have a command handler?

quaint grotto
#

yeah i just realised oof

#

not right now, Creeper

timid dawn
#

How i will enter my bot in this server

mossy vine
quartz kindle
#

@timid dawn did you finish adding it in the website?

timid dawn
#

Yes

#

It is in the website now @quartz kindle

quartz kindle
#

ok, now you wait

#

it will be added to this server when its approved

quaint grotto
#

my embed is not working still

modest maple
#

send code

quaint grotto
#

i just made a new one if(command === 'embed') { let embed = new Discord.RichEmbed() .setDescription('Heyy') message.channel.send(embed) }

modest maple
#

πŸ‘ read πŸ‘ The πŸ‘ Docs πŸ‘

#

it literally gives you an example

green kestrel
#

is it generally acceptable to send a message unannounced to all servers if the bot is being shut down/restarted by the bot developer?

#

as opposed to the normal 'respond only when triggered' rule

earnest phoenix
#

I don't think that's exactly smart to be sending messages like that

#

mainly because 1. its unannounced and 2. its annoying

#

if anything I'd want an opt in

slender mountain
#

^

#

Also do opt in's with stuff like that

sudden geyser
#

Unannounced like there's no set announcement channel they can speak? Nah. Pretty much what Rico said

slender mountain
#

Generally bots should only send messages when they are triggered by a user

amber fractal
#

Most automated things that arent in response to a user are considered api abuse

green kestrel
#

true, but this isnt every 'X'

#

its to announce a shutdown, which unless things are really going down the shitter should be like, once every 6 months or less

#

but yes, there would probably need to be some configured announce channel

#

it would be abusive to send it to every channel of every guild

west raptor
#

just make sure you space out the message for each guild

#

so one guild might get it at 2:30pm while another gets it at 2:35pm

green kestrel
#

thats a defininte need. right now, i'd have to send 560 of them or so

earnest phoenix
#

chances are nobody cares for the announcement

#

if you want to announce stuff

#

create a central guild for it

green kestrel
#

@earnest phoenix in my experience when i restart the bot nobody even notices

#

its back within 2 minutes

#

and tbh i do have a status updates news channel that others could subscribe to if they want that info

#

probably best sticking with that

west raptor
#

I agree with cry honestly

earnest phoenix
#

it's general bad practice to send it to every guild instead of posting a note to a central//support guild

#

from my pov i'd personally get annoyed if a bot would constantly tell me it's shutting down

west raptor
#

I mean if it's configured I guess it fine but eh

#

you just make a channel for it and if people want they can get notifications for the channel or follow the channel and have the webhook send it to a channel in their server

#

which you dont run the risk of api abuse

green kestrel
#

come to think of it

#

even if its configured and opt in, it would become unmanageable to send them

west raptor
#

yeah so just let discord handle it really with a channel for it in your support guild or whatever

green kestrel
#

running the message sending at the proper rate limit, 500 guilds would take 10 minutes(?) to send the notices

#

and that 500 is only going to get bigger

west raptor
#

well that assuming all 500 opt-in

green kestrel
#

well, if the bot continues to grow at present rate, within 2 more months i'll be at 1000 servers

#

so that would only be half of servers opted in

#

etc etc

#

but right now growth is looking a little less linear

slender mountain
#

Heyo, I was wondering, I was in the bad habit of having all my code in one main file, so I recently am having all the commands in separate files and stuff.
My problem is that I don't know how to manipulate variables in the main file from the command files.

For examples, if I were to run a command that SHOULD toggle a Boolean variable (in the main file) so that any I can do something with any message sent after the command is run.

I know that you use modules.exports or something to make things available to other files, but it kinda looks like that just makes a new instance? I need the variable IN the main file to change, otherwise my command won't work.

Do you have any resources or links I could take a look at for this?

opaque eagle
#

Put them under client

#

Like: js // index.js const client = new Discord.Client() client.foo = "bar"``````js // commands/ping.js module.exports = (msg, client, args) => { console.log(client.foo) // bar }

slender mountain
#

so if I went

client.foo = "test";

it would change it?

#

(in the commands.js)

opaque eagle
#

well... idk what commands.js looks like so idk what ur talking about

slender mountain
#

I assume you read what I wrote above?

opaque eagle
#

no mention of a specific file called "commands.js"

slender mountain
#

There is no specific file called commands.js

#

I'm just wondering if that would work with what you've shown me

opaque eagle
#

If you add a property to client after initializing it, and you pass it into every command using your command handler, the property can be manipulated.

lapis merlin
#
if (command === "kick") {
        if (message.member.missing('KICK_MEMBERS', false)) {
            return message.channel.send('no perm error');
        }```
#

wait

#

(node:8660) UnhandledPromiseRejectionWarning: TypeError: message.member.missing is not a function

#

uat hellp

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

lapis merlin
#

oh

#

;-;'

sage bobcat
#

One message removed from a suspended account.

lapis merlin
#

hmmm wait

#

,-,

opaque eagle
#

message.member.hasPermission() @lapis merlin read the docs

lapis merlin
#

okay

opaque eagle
#

or you might have intended to put message.member.permissions.has()

#

idk

lapis merlin
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

west raptor
#

don't use deprecated methods

sudden geyser
#

are you on master or stable

west raptor
#

Permissions#has is the way to go

lapis merlin
#

I'm sorry guys, I'm a beginner and I can make some silly mistakes ;-;'

west raptor
#

we've been there

#

dw about it

lapis merlin
#

c:

#

aaaaaaaa

west raptor
#

use permissions.has

lapis merlin
#

a

#

okay

#

(The google translate tab is open because my english is not very good and I don't want to make any mistakes)

west raptor
#

it's fine

lapis merlin
#

@west raptor yayyy thankssss

#

:3

opaque eagle
#

why isn't it white

lapis merlin
#

lol

west raptor
#

uh

opaque eagle
#

I'm using the right selector

west raptor
#

link?

opaque eagle
#

no the selector is a#libclick

west raptor
#

can I have

#

a link

#

: )

opaque eagle
#

shit

#

im dumb

#

wait u mean like a#libclick:link right

west raptor
#

no can I have the link to your bot page

opaque eagle
#

oh it's pending approval

west raptor
#

I can still access it

#

nice

opaque eagle
#

lmao

west raptor
#

lemme hop onto pc

#

im honestly not sure how css works but doesn't like !important exist

#

or smth

#

idk what it does

sage bobcat
#

One message removed from a suspended account.

opaque eagle
#

yes it does

#

that works ty

west raptor
#

oh wow i actually helped

earnest phoenix
#

hello solver i have a discord bot i run from my own server but i just want to stop or started it on a web interface

#

if for some reason you stop the bot it can be solved to restart automatically

analog forge
#

I have a question regarding discord.py, I'm trying to get to differnt .wav files to play() sequentially with as little delay as possible, but I'm having a bit of trouble. Does anyone know a good way to go about it

#

?

restive furnace
#

@earnest phoenix if you are using some pm2 or other process manager, they will restart it if you do process.exit() or shutdown it someway. + i thought that youre on js so i said why its happening on js

earnest phoenix
#

@restive furnace Node js