#development

1 messages · Page 801 of 1

earnest phoenix
#

debug your code

#

go through it step by step and see where's the issue

#

@earnest phoenix you cant ban a person that has a role above your highest

#

wym

tight plinth
#

What if I do open eval but without client

earnest phoenix
#

if they arent in the server they arent bannable..

#

different library.

#

LumapToday at 7:15 PM
What if I do open eval but without client
don't

#

idk

#

look it up

#

there's a 99% chance that your eval in fact wont be sandboxed and someone will find a way to break it

#

mee6 uses their own private thing iirc

pine aspen
#

Hey.

#
let crow = await con.prepare('SELECT * FROM codes');
        const { code } = await con.prepare('SELECT code FROM codes');
        if(code == args[0]) {
#

would this work?

cursive dagger
pine aspen
#

@cursive dagger I can’t

#

Lol

#

I’m not on computer

cursive dagger
#

¯\_(ツ)_/¯

earnest phoenix
#

then why are you asking if you aren't there lol

lilac wharf
#

planning future coding I guess...

quartz kindle
#

@pine aspen that will likely not work

#

idk which database and library you're using, but prepared statements are not promises and dont do anything by themselves, they must be executed after being prepared

honest perch
#

how would i make an embed that showed the users username and pfp in an embed, using discord.js

quartz kindle
#

using discord webhooks

#

if you mean changing the author's name and pfp

#

like pretending the bot is someone else

honest perch
#

no, just for it to say like requested by name#discrim

#

in the .setAuthor

quartz kindle
#

you mean in the embed footer?

crimson vapor
#

new Discord.RichEmbed().setAuthor(message.author.avatarURL, message.author.tag) I think

#

whoops backwards

quartz kindle
crimson vapor
#
                .setAuthor(message.author.tag, message.author.avatarURL)```
honest perch
#

ok thank you

summer torrent
#

serverinfo <server id> ?

#

<Client>.guilds.get()

earnest phoenix
#

var server = <Client>.guilds.get("id");
server.name
server.owner.tag
server.iconurl
Etc...

quartz kindle
#

isnt that privacy breach tho?

pine bear
#

I'm actually stuck on how the rolling system is going to work.

earnest phoenix
#

@quartz kindle i think this is allowed, before i have seen a bot who get any users from any serveurs the bot his

quartz kindle
#

it doesnt mean its allowed just because you seen someone doing it

blissful scaffold
#

I think it's allowed as long as it can only be used on the server itself

earnest phoenix
#

Hmmmm

#

Okay

blissful scaffold
#

You should never leak server data/info to other servers

earnest phoenix
#

@earnest phoenix shhhht

#

@blissful scaffold okay

true ravine
#

Do most people have loads of then and catch sections of their code because up until now a lot of my commands assume that everything goes smoothly and I'm just getting round to improving stability

earnest phoenix
#

make your code async

#

and you'll make it cleaner just by doing that

true ravine
#

But say I was doing x code but something went wrong, I'd surely need to use a catch?

slate oyster
true ravine
#

Could be worse

slate oyster
#

Also my editor mixes hard tabs and soft tabs

earnest phoenix
#

java itself is gross

slate oyster
#

No u

true ravine
#

Damn

#

If I had an async function and an error occured while running it, could I put a catch on the point I call the function to run some code if it goes wrong?

#
async function uhoh(){
  sadjajlasdk
}
uhoh()
.catch(() => {
  console.log("Upsie")
});

Like this

#

Is that allowed?

quartz kindle
#

that will work yes

true ravine
#

Thank you

pine bear
#

Like if I wanted to add an rp roll system in my bot, how would I make my bot see the number they wanted to roll?

lyric mountain
#

hmmm, arguments?

#

comma, whitespace, semicolon, you choose it

pine bear
#

Ok, that doesn't clarify much, I'll look into it.

lyric mountain
#

consider the following:

#

prefix!roll 20

#

if we split it by whitespace, we'll get two Strings: prefix!roll and 20

#

take the second argument and apply a rng on it

#

Integer.parseInt(20) * Math.random()

#

then send a message containing the result

pine bear
#

Ok.

violet obsidian
earnest phoenix
#

guyys

violet obsidian
#

I have loads more commands to put in

earnest phoenix
#

my server is locked in top.gg why??

violet obsidian
#

just not the time lol

#

Wait

#

What do you mean?

earnest phoenix
#

it says that it is locked

violet obsidian
#

Im not sure

earnest phoenix
#

'SERVER LOCKED'

violet obsidian
#

🤔

earnest phoenix
#

i just asked a mod

violet obsidian
#

Yeah lol idk

#

This is my premium version of the bot (better quality commands, embeds, DM tickets etc)

#

Currently unavailable since im using it as a test bot for now lol

hoary elm
#

@violet obsidian looks good for a pre-alpha you can always work on it and add more as time goes on.

earnest phoenix
#

how would you get a username in on_member_join?

#

langauge is .py

unique nimbus
#

?

hoary elm
#

@unique nimbus wouldnt it be member.username? Or does Python not use that

unique nimbus
#

It doesn't do it most likely

#

I always used .name

#

it might be an aliasis

#

¯_(ツ)_/¯

hoary elm
#

Ahh okay wasn't sure. Don't really use python

earnest phoenix
#

would a say command be NSFW?

summer torrent
#

no

tight plinth
#

No

earnest phoenix
#

ok

#

but if you let anyone execute that command your bot is probably going to get deleted by discord themselves - users can make it say straight up racist and fucked up stuff

#

then delete their message and report the bot

tight plinth
#

Snipe commands exist I guess

earnest phoenix
#

ok then im not going to do that

tight plinth
#

Every bot (almost) has a say command, and 99% of the servers have rules against that

earnest phoenix
#

im for sure not going to do that then

#

Every bot (almost) has a say command, and 99% of the servers have rules against that
every shitty* one

#

none of the mainstream bots have one for a reason

#

nadeko != shitty

#

nadeko is indeed shitty

#

kwoth is equivalent to yandev in programming skills

slate oyster
#

Mine had an echo command
But I deleted it because then when a user writes a message they can delete it

#

Ofc pings were disabled
but still, deletions didn't register in audit log

earnest phoenix
#

yeah for that very reason it's best to just not have one

#

it does more harm than good

slate oyster
#

Oh
I could add a user id in front
and indent newlines
like I do with chatlinks

#

Well, I don't yet indent newlines
but same point

earnest phoenix
#

nadeko is the core bot in my server so

amber fractal
#

doesn't mean its good or your choice was good

outer niche
#
@bot.has_role('BotAccess')
async def cadhelp(ctx):``` ```Traceback (most recent call last):
  File "C:\Users\culan\Desktop\beach hosting\beach hosting.py", line 240, in <module>
    @bot.has_role('BotAccess')
AttributeError: 'Bot' object has no attribute 'has_role'```
modest maple
#

my guy

#

youve been here some months

#

and you always get the same fucking error

#

would it be so hard to learn a little bit of OOP

copper cradle
#

what can you expect

earnest phoenix
#

but remember

#

people dont like using the oop

slate oyster
#

OOP is so much better than procedural
What do you mean?

earnest phoenix
#

you were around last night

#

i think

slate oyster
#

yea

earnest phoenix
#

this

#

thats why

#

idl

#

idk

slate oyster
#

I remember now

earnest phoenix
#

people just dont seem to want to learn the basics first and jump in WAY over their head

slate oyster
#

Ah ok

earnest phoenix
#

oof my bot has super basic stuff

#

i can't do anything advanced yet

#

So?

#

Just cuz your bot cant do complicated things doesn't make it bad

ionic anchor
#

Hey someone know how can we get memory and cpu usage of bot

knotty steeple
#

cpu usage dont know

#

memory some function in process

earnest phoenix
#

Cpu is also in process

#

But it requires more math

knotty steeple
#

well never used it

#

so idk about that

ionic anchor
#

How use it

knotty steeple
#

scan the node.js docs

knotty steeple
#

isnt memory just process.memoryUsage()

#

ok there

amber fractal
#

if you're using pm2 it can get both for you

ionic anchor
#

Thanks

mystic violet
#

any library better than lavalink? for example that can actually do playlists and livestreams?

#

(for music)

earnest phoenix
#

@earnest phoenix do you know if all of the elements are stylable?

#

#bot doesnt seem to work for the background, even tho browser says it should

#

you talking bout the page background

#

ye

#

just do body

#

facepalm

#

yup

#

i'm dumb

#

thx xD

#

also

#

i can give u a template if u want

#

sure :3

#

there's a few steps you'd have to take tho

#

iusfdgfub jfersgfb j

#

like?

#

there's an image u have to edit

#

it's the little up arrow

#

for the upvote count

#

o?

#

to what tho

#

you gotta edit the color

#

i'll show you how

#

oh to make it match?

#

give me a second

#

yeah

#

o

#

oki

#

i was gonna do black/blue

#

so it might fit

slate oyster
#

I think my computer's clock is off from Discord's
That would explain the numbers I got
As I am definitely subtracting correctly
String ping = String.valueOf(msg.getTimestamp().toEpochMilli()-send);
But then how do I write a ping command?

earnest phoenix
#

what lib?

slate oyster
#

Discord4J

earnest phoenix
#

cuz they'd probs already have a ping

slate oyster
#

I'm trying to use my computer's time and Discord's time to calculate ping and pong
But I think our clocks are off
I'll see if my lib has a ping thing I missed, but I don't think they do

crimson vapor
#

if you are running a bot on a computer, it would be normal to have a litle high ping, maybe 2000ms as a max, negatives would not make sense though

earnest phoenix
#

ok another web question

#

does css @import not work?

slate oyster
#

This is the more code
I'm not seeing any logic errors far as I can tell

#

The read underlines is just my IDE not working
it compiles (and runs) fine

crimson vapor
#

if you hover on the red line it should say whats wrong

slate oyster
#

It's missing the "Projects and External Dependencies"
Despite refreshing and building with the eclipse plugin applied

#

So the IDE is not correctly recognizing my argument types - "refers to the missing type"

#

Anyways though,
I really don't see any errors in my logic

#

So I dunno why I'm getting negative ping times
Except for clock inconsistencies between Discord and I

earnest phoenix
#

see if syncing your clock helps

#

you on win?

slate oyster
#

rn

earnest phoenix
#

?

slate oyster
#

This is my testing device, not production device, though

earnest phoenix
#

well if you want to see, windows settings, time and language, date and time

#

then click

slate oyster
earnest phoenix
#

oH

slate oyster
#

I pressed sync now

earnest phoenix
#

thats

#

yea

slate oyster
#

It still gives a negative ping

earnest phoenix
#

are you doing it backwards?

slate oyster
#

So should I repost the code snippet?
I would subtract the older time sample from the newer sample
right?

earnest phoenix
#

ye

slate oyster
#

I've checked it multiple times
I don't think it's backwards

earnest phoenix
#

do it like this

klsedhfgklj
#

hell of a lot easier to read

slate oyster
#
                cadapter.send(text, msg->{
                    String pong = String.valueOf(System.currentTimeMillis()-msg.getTimestamp().toEpochMilli());
                    String ping = String.valueOf(msg.getTimestamp().toEpochMilli()-send);```
#

No

#

Indentation is bad

earnest phoenix
#

so fix it..

#

but anyay

slate oyster
#

Though you can copy+paste

#

Anyways
If I'm subtracting the older, smaller time from the newer, larger time
It should be positive

#

Unless our clocks are still out of sync

earnest phoenix
#

where are the "older" and "newer" times coming from

#

wait

#

i see nvm

slate oyster
#

long send = System.currentTimeMillis();<-older
msg.getTimestamp().toEpochMilli()<-newer

earnest phoenix
#

ngl, im clueless

slate oyster
#

I think
it's just not syncing properly
Despite pressing "sync now"

blissful scaffold
#

You are comparing the system time with the discord time?

slate oyster
#

Yea
I think one of the two is off though

#

That's my only guess

blissful scaffold
#

dont compare the times of 2 different machines, they are never in sync

slate oyster
#

How do I check the ping then?
Unless I did them across messages, but than that's not really a ping

#

Or I guess I can just merge my ping and pong times maybe

#

Though that then shows less information to the user

blissful scaffold
#

record the start time > send a message > wait till the message is send > record the end time

#

or use the ping that is build into the api

slate oyster
#

Yea
That would be merging the ping and pong

#

There is no ping built into the api
or, if there is, it doesn't seem to be documented

blissful scaffold
#

what library are you using?

slate oyster
#

D4J

blissful scaffold
#

give me a minute

slate oyster
blissful scaffold
#

client.getResponseTime()

slate oyster
#

Ah ok

#

thx

blissful scaffold
#

2 of my bots also use D4J

slate oyster
#

How does it calculate that?

blissful scaffold
#

Discord and the bot sometimes send ping messages to each other to make sure the bot is still alive

#

And that message contains the ping time

slate oyster
#

Ah ok

#

And then how about my pong time?
I assume that is off too

#

It would be really nice
If my IDE would actually work

blissful scaffold
#

2nd time is client.getResponseTime()

#

3rd time is sending a message and checking the send time

slate oyster
#

Oh I see

#

I can subtract getResponseTime from time elapsed locally

#

Right?

#

To get the pong

quartz kindle
#

no

slate oyster
#

But if .getResponseTime is the ping

#

And x time elapses

blissful scaffold
#

No, client.getResponseTime() is a 2 way time as far as i know

quartz kindle
#

there are two latencies to discord: websocket and rest

slate oyster
#

then x-ping is pong

quartz kindle
#

websocket latency is the time taken for discord packets to reach your machine. they are recorded by the library, averaged, and saved into the getResponsetime getter

#

rest latency is the time taken for your machine to send a request to discord and receive a response

slate oyster
#

So can I just not divide my ping and pong times then?

quartz kindle
#

rest latency is not recorded by default, you can record it by sending a message and waiting for a response, and measuring time elapsed in between

slate oyster
#

I was just hoping that I could make ping the amount of time to send a message
And pong the amount of time to recieve
But I guess I can only check the WS ping then ):

blissful scaffold
#

As far as I know a ping is already a 2 way response time, and not 1 way
But I could be wrong

slate oyster
#

It would be really cool
If our clocks were in sync
Because then I could have gotten the 1-way time

quartz kindle
#

yes, but in case of websocket, whose main function is receiving packets from discord, it is safe to say its ping is the amount of time taken for discord to reach you

earnest phoenix
#

@earnest phoenix I sent you the theme template and instructions for how to edit it.

blissful scaffold
#

if you want the 1 way time then take half of the time, usually packets will take roughly the same route

slate oyster
#

Oh ok
Cool

#

Thanks

blissful scaffold
#

but if you take the 1 way time it's not a valid ping time

quartz kindle
#

one-way time is impossible to get, you can only estimate it like spirit said

slate oyster
#

It's just an estimate
but I can specify that

quartz kindle
#

since all requests require an acknowledgment to be returned

slate oyster
#

It would have been lovely if our clocks were in sync
I'm quite upset about that

blissful scaffold
#

all ping checks are A>B>A where A is one machine and B is another machine

#

You could sync your bot time to discord's time if you check the time of a received message and take the delay in account.
But that will be very unreliable (Messages might be received late, or the ping might fluctuate)

slate oyster
#

I'll look into it

#

Yea

#

It wouldn't be reliable

blissful scaffold
#

Why is it even important that the time is in sync?

slate oyster
#

To get the correct 1-way ping and pong

quartz kindle
#

i think he wants to compare bot timestamp to message timestamp

slate oyster
#

Yea

#

That was what I was trying

blissful scaffold
#

what you could do is record the time, then send a message to discord and check what timestamp discord gave to that message

slate oyster
#

Except
Our clocks are off

blissful scaffold
#

just remember that there WILL be some delay between you sending it and discord receiving it

slate oyster
#

Our clocks are off
I am recording the time
and checking what timestamp Discord gave
but our clocks are different
Because it is quite hard to sync clocks when syncing itself involves a) having the correct time and b) dealing with latency of the time syncing service

#

I'll just suffice for the 2-way ping
but I'm sad

#

So my actual 2-way ping is 74 ms

#

Not negative, not large

blissful scaffold
#

I think the Discord servers that communicate with bots are in New York

quartz kindle
#

a weird thing you could try:
on message event -> check message timestamp -> deduct client.getResponseTime() -> compare to system time -> get offset and save to a variable
all further time comparisons involving system time shall include this offset

#

offset could be updated on every new message event

#

basically an attempt at manually syncing the clock with discord lmao

slate oyster
#

Interesting
That sounds genius

#

I screenshotted for later reference

quartz kindle
#

xD

slate oyster
#

Will probably try that out sometime before I submit my bot
I love it

blissful scaffold
#

I will be going now, its 3am here ^^

#

good luck

quartz kindle
#

same, 2am here

slate oyster
#

Goodnight to ya'll then

lol only 9:03 here

blissful scaffold
#

Your ping already told me you are in the USA 😛

slate oyster
#

Wait

#

How

#

Oh

#

Today at x:0x

earnest phoenix
#

xD

slate oyster
#

The thing it shows

#

on the screenshot

blissful scaffold
#

70ms ping means there is no ocean between you and the discord servers

slate oyster
#

Discord lets you choose the server region, doesn't it?

blissful scaffold
#

Bots always connect with New York as far as I know

slate oyster
#

Oh
interesting
What's a ping look like where you live?

blissful scaffold
#

My bot is hosted in the Netherlands

slate oyster
#

Oh
it's only slightly longer
It could always be network delay

blissful scaffold
#

hopping the ocean is close to 100ms

pine bear
#

So I wanted my bot to send a welcome message in my server and came up with this but I wanted the bot to mention the new user.
Here is what I got

client.on('guildMemberAdd', member => {
    member.guild.channels.get('660593478807322634').send("Hey there"); 
});

So I feel like you have to place message.mentions.members in
member.guild.channels.get('660593478807322634').send("Hey there");
^^^^^^^^^^

slate oyster
#

Yea

#

I don't use d.js
But I'm quite sure that is how it works from code I've seen

pine bear
#

mmm

blissful scaffold
#

i think it's something like member.mention?

pine bear
#

So it would be like this?

member.guild.channels.get('660593478807322634').send("Hey there", message.mentions.members); 

or probably close to that, I might have missed something.

#

Not sure if it is that.

blissful scaffold
#

message How do you get the message?

pine bear
#

'member.mention'

blissful scaffold
#

There is no message when a user joins

pine bear
#

Oh so then.

member.guild.channels.get('660593478807322634').send("Hey there", member.mention); 
hoary elm
#

I literally just use member.user.tag, member.user.id ect

#

For my welcome messages

blissful scaffold
#

I have no experience with JS bots, so I can't help with any details

hoary elm
#

To get it to ping them you can do <@${member.user.id}>

pine bear
#

so if member.user.tag would mention the new user?

#

Oh ok

hoary elm
#

Or yeah ${member.user.tag} will work

earnest phoenix
#

<@${}> *?

#

@ before $?

hoary elm
#

Yeah I know I messed up

pine bear
#

So this will be the final product of the code because it looks to the point where it looks correct?

client.on('guildMemberAdd', member => {
    member.guild.channels.get('660593478807322634').send("Hey there", '${member.user.tag}' );
});
earnest phoenix
#

catra you could use member.guild.systemChannel too

hoary elm
#

Yeah to get the default welcome channel

earnest phoenix
#

^

pine bear
#

There is no default

earnest phoenix
#

there is

pine bear
#

welcome channel

hoary elm
#

Yeah

pine bear
#

I turned it off

earnest phoenix
hoary elm
#

By default when you make the server it's the general chat

#

Oh

earnest phoenix
#

there still is a system channel

#

it might not show welcome messages

#

but it still exists

pine bear
#

I'll keep it as is because I don't really want to change a whole lot of things in my server.

earnest phoenix
#

you wont tho?

hoary elm
#

It's just easier then defining the channel how you did but whatever works

pine bear
#

If the one above works, I'm fine with it

#

The codes already in.

earnest phoenix
#

well just know that if, for some reason you ever have to change the welcome channel, you'd have to change the bots code. and with the way you get the channel now, the bot can never send welcome messages in any other server

pine bear
#

That channel existed for I dunno 3 months

earnest phoenix
#

my 2nd half still stands

hoary elm
#

Yes but what he means is that because you called the channel by ID it will only run in that channel

#

No other server can use the welcome messages

earnest phoenix
#

if it ever gets in another server, you'll have to either 1) make it configurable or 2) use the system channel

#

so you might as well do it now

pine bear
#

My bot is private to only my server

earnest phoenix
#

its good practice anyway

sick cloud
#

so i have an array here, ['h', 't'], when i use .slice(0, 1) i only get ['h'], why's that? it should slice both

hoary elm
#

Okay well that's different private bots don't really need it to be for everyone

earnest phoenix
#

element 0, stops BEFORE 1

pine bear
#

nice reply!

sick cloud
#

well 0 is the first and 1 is the second

#

so what's up there

earnest phoenix
#

and it stops BEFORE the 2nd arg

#

slice(a,b) goes between a and b, INCLUDING a, but EXCLUDING b

#

so (forgive my python notation) "0123456789"[2::6] would be "2345"

sick cloud
#

so instead of 0,1 i should do 0,2?

earnest phoenix
#

yup

sick cloud
#

ah ok, ty

earnest phoenix
#

np

pine bear
earnest phoenix
#

line 12

#

column 90

#

like the error says

#

you didnt teminate (end) a string

#

you used " to start it and ' to end it

hoary elm
#

And ${} should also be ran in ``

pine bear
#

back ticks ``

earnest phoenix
#

yup

hoary elm
#

Yeah

#

Or it won't read it how it should

#

It will send it as a normal message instead of outputting the ping

pine bear
#

Lmao, that explains why

#

Past experiments doesn't exist anymore.

lavish seal
hoary elm
#

@lavish seal try message.guild

earnest phoenix
#

you aren't defining guild anywhere to begin with but yeah try that ^^

#

that would work

#

i think

hoary elm
#

He already has it

lavish seal
#

sheet, ill try that but how would i define it? tbh i thought it was enough to require discod.js

earnest phoenix
#

you define the parameters when you call the function but the function itself doesn't take any parameters peepoWeird

#

member.guild afaik

hoary elm
#

At the top async function play(message, guild, serverQueue) {

#

Otherwise message.guild should work or you could also do const guild = message.guild; but that's just the lazy way 🤷🏻‍♂️

earnest phoenix
#

const msg = message
const ch = message.ch
const guild = ch.guild

#

best

#

;3

hoary elm
#

That works to

#

Lol

#

@lavish seal ^

earnest phoenix
#

xD

lavish seal
#

will try all of the above

earnest phoenix
#

So I'm trying to use noblox.js in node.js, but I don't get how the cookies necessarily work,

so I have a command that logs someone in using an alt's cookie, and I have a command called "shout", which is supposed to create a group shout, however, I'm calling roblox.shout(groupid, message, cookie[HERES MY PROBLEM]). If I call it with a cookie then it says I'm not logged in, but if I call it without a cookie, it works just fine. I can confirm that the cookie variable is correct and is working.
Can someone tell me how I can use a robloxsecurity cookie as an argument in it so I can have multiple users?

pine bear
#

???

copper cradle
#

use fucking lua

pine bear
#

The welcome message won't work, I tested by getting help from someine in my server.

client.on('guildMemberAdd', member => {
    member.guild.channels.get('660593478807322634').send("Hey there", `${member.user.tag}`, "Welcome to She ra");
});

Sends nothing.

copper cradle
#

ofc

sudden geyser
#

You shouldn't be passing args that don't need to be passed.

copper cradle
#

client.guilds.channels.get

#

should do it

#

member is the object of the member that joined

#

use fucking common sense

sudden geyser
#

If the channel by the ID exists in that guild, it should work. If it doesn't, no work.

copper cradle
#

no

pine bear
copper cradle
#

that member object has nothing of that

sudden geyser
#

what do you mean?

pine bear
#

K, I get it.

lavish seal
steel heath
#

try msg insteas

#

oh no don't do that lol

#

can't use a variable outside of it's scope

sudden geyser
#

are you sure you defined it

steel heath
#

so you have to do that in the message event's scope

#

cuz I guess you put it to the 3rd line of the whole file

lavish seal
pine aspen
#

Hey,

let crow = await con.prepare('SELECT * FROM codes'); const { code } = await con.prepare('SELECT code FROM codes'); if(code == args[0]) {

sudden geyser
#

can you show your code

lavish seal
#

yep hang on

#

lemme make new paste

pine aspen
#

How can i check if a data is in a column?

steel heath
#

what pepowot

earnest phoenix
pine aspen
#

Does my code work up there?

#

I assume it does but the rest of the code does weird things.

pine aspen
#

I assume it does but It does weird things.

#

no

#

pastebin reeee

sudden geyser
#

Can you show the code in commands/fun/MusicBot.js

#

I don't believe that's the file.

lavish seal
#

the one i uploaded

#

oh i removed the consts that were causing the error

#

because bot wouldnt start and they werent helping the command

#

but they were right under the top 2 const like this

const discord = require("discord.js")
const ytdl = require("ytdl-core")
const msg = message
const ch = message.ch
const guild = ch.guild
#

then i removed

const msg = message
sudden geyser
#

yes, you can't use a variable before it's been declared. are you having anymore issues?

lavish seal
#

yes i originally added that as the recommendation to define guild because when i did s!play with my bot it joined the channel but did not play the yt link i provided

hoary elm
#

@lavish seal You have to define the consts under the async function since that is where message is originally defined

lavish seal
#

oooo i c

hoary elm
#

i also don't recommend using multiple different methods to call the same function or event or whatever

#

use one if it doesn't work try the other

#

Example: if you define Guild in the async function you shouldnt need to define it again anywhere else it should be able to be called and used as is

wide ridge
#

hey guys

#

I just got Contabo VPS (4 core 8GB tier), and the response time is pretty slow for some of my commands

#

does anyone have any suggestions on what I should do? I'm using Heroku right now and was thinking of migrating to Contabo, but I'm not sure now since it's kind of slow.

#

Maybe I should get a better tier for Contabo, like the 8 core 30GB RAM one?

#

Would appreciate any help!!!

pine bear
#

Still doesn't work

#
client.on('client.guilds.channels.get', member => {
    member.guild.channels.get('660593478807322634').send("Hey there", `${member.user.tag}`, "Welcome to She ra");
});
regal saddle
#

What you trying to do?

earnest phoenix
#

nope

#

take out those commas

#
client.on('client.guilds.channels.get', member => {
    member.guild.channels.get('660593478807322634').send(`Hey there, ${member.user.tag}, Welcome to She ra`);
});
#

@pine bear

regal saddle
#

I.

#

yep

pine bear
#

now ```js
("Hey there" ${member.user.tag} "Welcome to She ra");
^

there is suppose to be a comma here right?
regal saddle
#

Nah

#

It wont work becuz of „hey there“

pine bear
#

But then it just shows error

regal saddle
#

wtf

hoary elm
#

Wow

regal saddle
#

is it js or am i dumb?

hoary elm
#

It's supposed to be "" + `` + ""

#

You have to seperate them

regal saddle
#

that was what i was thinking

#

no cap

pine bear
#

Oh I needed to seperate them

regal saddle
#

Yep

hoary elm
#

("Hey There " + `${member.user.tag}` + " Welcome to She Ra")

pine bear
#

I was just following the quick fixes

#

I saw

hoary elm
#

Make sure you add spaces or it won't

regal saddle
#

can someone tell me how i can add custom prefixes? weirdsip

pine bear
#

I fixed it a moment ago

hoary elm
#

Okay

pine bear
#

I know how to code lmao

hoary elm
#

@regal saddle per server?

regal saddle
#

yep

hoary elm
#

Link a DB of some sort make it create a default prefix on GuildCreate and store the prefix in the DB via Guild.ID

#

Then create a command to allow them to replace db prefix

regal saddle
#

k thx m8

copper cradle
#

@pine bear separating those is just plain stupid

#

you can do

regal saddle
#

developer beeeef smell pogey pogey pogey

copper cradle
#
(`Hey There ${member.user.tag} Welcome to She Ra`)

There's something called template literals

hoary elm
#

Ahh yes all one message

#

🤦🏻‍♂️

earnest phoenix
#

thats what i said

#

forever ago

copper cradle
#

ppl don't read

#

like me

regal saddle
#

I already told him this @copper cradle but he says there will come a error

copper cradle
earnest phoenix
#

more complaining abt toxicdev xD

copper cradle
#

LMFAOOO

hoary elm
#

🤔 hey now!

earnest phoenix
#

no but what me and @copper cradle said is the way to go

hoary elm
#

He said that would error so I recommended a different way 🤷🏻‍♂️

earnest phoenix
#

it doesnt error tho?

copper cradle
#

yeah but why in thw world you you separate a string and put it inside another string

hoary elm
#

He also had it as "" `` "" without the + so I corrected

earnest phoenix
#

omg

#

no

copper cradle
#

("Hey There " + ${member.user.tag} + " Welcome to She Ra")

#

("Hey There " + member.user.tag + " Welcome to She Ra")

earnest phoenix
#

@pine bear you didnt copy exactly what i said

#

thats why it errored

copper cradle
#

you can do it the ES5 way

earnest phoenix
#
client.on('client.guilds.channels.get', member => {
    member.guild.channels.get('660593478807322634').send(`Hey there, ${member.user.tag}, Welcome to She ra`);
});
#

exactly that

copper cradle
#

^

regal saddle
earnest phoenix
#

NOT ```js
"Hey there, " ${member.user.tag} "Welcome to She ra"

hoary elm
#

Works either way 🤦🏻‍♂️

#

But 👌

earnest phoenix
#

no

hoary elm
#

It does actually

#

Have multiple commands that use it

earnest phoenix
#

clearly not in their env

#

wait

regal saddle
#

zSnails, how your day goin so far? @copper cradle

earnest phoenix
#

so you're telling me

hoary elm
#

@earnest phoenix I'm not talking about what you just sent

earnest phoenix
#

mk

hoary elm
#

I'm talking about what I suggested

earnest phoenix
#

ye

#

but the way me and snails sugessted is cleaner

hoary elm
#

It is I also forgot that you didn't have to put it in the ${} so that's my bad

#

Sorry

earnest phoenix
#

use template literals when possible

regal saddle
#

Using Discord.js Docs: ytho
Using templates without understanding it: smirk smirk

pine bear
#

My main problem with coding bots is that there would be so many variables to learn.

earnest phoenix
#

wha

pine bear
#

wha

regal saddle
#

ahW

earnest phoenix
#

wym so many variables

regal saddle
#

ill go sleep, its 6am lool pogey

earnest phoenix
#

xDDD

regal saddle
#

i didnt even noticed it xD

pine bear
#

eh, not like javascript variables but like what variables are going to affect the outcome of the javascript

regal saddle
#

i was like, ight im gonna sleep around 1am or 12pm and now its 6am haha

copper cradle
#

@regal saddle kinda good kinda bad

#

i'm talking to my ex

regal saddle
#

Abort mission am i right?

ionic compass
#

is there an API limit on what messages a bot can edit? for some reason if I restart my bot, then try to make it edit one of its message, nothing happens

regal saddle
#

its cuz the cache of your bot gets deleted

#

Your bot cant remember that he sends the message

ionic compass
#

ahh okay thanks

earnest phoenix
#

somehow i doubt

regal saddle
#

Y that?

earnest phoenix
#

i can edit a message from years ago if i want

#

as long as you have the id and channel you should be fine

regal saddle
#

Yeah

#

🙂

ionic compass
#

oh... well then there must be a deeper issue... I will have to do some more digging

regal saddle
#

you can make an message cache.

#

just get the message id and channel id and your should be fine

earnest phoenix
#

can be solved so that my robot can speak multiple languages?

#

google translate api?

pine aspen
#

Hey!

earnest phoenix
#

hi?

pine bear
#

I just joined this one server where the "bot" appears to be on mobile? How does that work?

ionic compass
#

more debugging reveals that lukas is right. The message id points to the right message, but the bot doesn't see it as SocketUserMessage anymore. Though Im not quite sure how to make the bot see it as such again...

floral bloom
#

How come I get an error (shown below) when trying to require a .json file?

let c = require("./configMsgs.json");
```Error:
```diff
- Cannot find module './configMsgs.json'
amber fractal
#

the path is wrong

#

you'll have to show us your file tree

earnest phoenix
#

make sure they are in the same directory

#

or change your path

floral bloom
#

I also tried without ./ but it still didn't work.

earnest phoenix
#

what file are you running that line from

floral bloom
#

A command from the commands folder.

amber fractal
#

../configMsgs.json ../ goes up one

earnest phoenix
#

^

floral bloom
#
- SyntaxError: Illegal return statement
amber fractal
#

that's a different error

floral bloom
#

Yes.

#

Ah.

#

I thought it had to do with the require function.

#

Thanks, it must have worked! 🙂

halcyon ember
#

Im making my bot check to make sure that the userID is me to run an admin command, but it doesnt seem to be working with message.author.id(). Does anyone know how to do it?

earnest phoenix
#

library?

#

@halcyon ember

halcyon ember
#

discord.js

earnest phoenix
#

cant help you there

halcyon ember
#

rip

earnest phoenix
#

does d.js have a similar command to discord's isOwner()

halcyon ember
#

not sure, dont think so tho

earnest phoenix
#

sadness

halcyon ember
#

rip

digital ibex
#

hi

#

how do i set up the ascii table to load commands?

#

in the console

stable horizon
#

lang? library?

digital ibex
#

oh, sorry. Discord.js

hoary elm
halcyon ember
#

thanks, it worked:D

hoary elm
#

Lol np

celest drum
#

i have a question, does anyone know how to implement music into a discord bot? I've tried to install the npm package discord-music-core but it keeps failing

golden condor
#

I do @celest drum

#

You could use lavalink

#

But I have one issue

#

I don't know how to install a lavalink voice node

celest drum
#

could it be found in npm?

golden condor
#

?

#

I'll link a GitHub guide

celest drum
#

thankyou

earnest phoenix
#

Anyone here have experience with the discord api?

#

Specifically redirect uris?

#

oauth you mean

#

yeah what with it

earnest phoenix
#

I cant on my bot

#

I need help about my bot

#

it's disconnect

earnest phoenix
#

i need some one help me

#

I need to make my bot on

#

you are aware we don't have superpowers and can't read your mind right? you need to provide your error, library, language etc for us to be able to help you, we need context

#

ok

#

what

#

yeah

#

????

#

And my bot just disconnect

#

which library are you using

#

library

#

...

neat ingot
#

which tools and programming language did you make your bot with?

earnest phoenix
#

command prompt

#

node

#

what

#

It's my first time

#

have you even tried reading the docs

#

yes

#

3 times

#

also it's not a good idea to faceplant into making a discord bot without any prior programming knowledge

neat ingot
#

if your bot is written in javascript language, using node js, your likely using eris or discord.js. you likely have a file called something like index.js, or bot.js, and a package.json file etc.
go to the directory your bot files are in, shift and right click to open command prompt (may be called windows power shell), then type node filename.js, with whatever your bot file is called. you may be able to instead run something like npm start depending on the package.json file's configuration.

#

thats it, im out ~

earnest phoenix
#

ok

#

tk

earnest phoenix
#

how to change the border color of the bot icon in the bot page

#

nvm

#

im dumb

neat ingot
#

😄

earnest phoenix
#

@neat ingot wait, do u know how?

quartz kindle
#

its a box-shadow in the css

earnest phoenix
#

ohhhh

#

i tried other things, coz i didnt see that in the source

neat ingot
#

how much are we allowed to do with the html we put into the page?

quartz kindle
#

anything except hiding ads and buttons/links

earnest phoenix
#

^

neat ingot
#

well, what about umm..

earnest phoenix
#

a test: ```css
html {
box-shadow: blue;
}

neat ingot
#
<iframe src="" onload="window.location.href='https://dekbot.com'"></iframe>```
#

couldnt help but notice thats what the medal bot does

quartz kindle
#

yes iframes are allowed

earnest phoenix
#

@neat ingot what happens

neat ingot
#

its a redirect

#

it sends person away from top.gg

#

to my site

quartz kindle
#

that is not allowed i think

neat ingot
#

why oin earth is that allowed? 😄

#

but medal bot does it

earnest phoenix
#

probably isnt

neat ingot
#

so clearly exemptions...

earnest phoenix
#

<iframe id="botiframe" src="https://test.com"><p>ehm, uwu? Your browser does not support iframes</p></iframe>

#

i just use that

#

but its still better than letting google harvest your data on top.gg lol

quartz kindle
#

medalbot doesnt do it

earnest phoenix
#

medalbot put that in the auction bot settings

#

idk how to say it

neat ingot
quartz kindle
#

oh

neat ingot
#

thats from view src on pokecord page

earnest phoenix
#

it's commented

neat ingot
#

yes i noticed that

quartz kindle
#

but yeah, its disabled

#

so its not allowed

neat ingot
#

but medal still redirects 😄

quartz kindle
#

it doesnt for me?

neat ingot
#

o0

#

it does for me

quartz kindle
earnest phoenix
#

box-shadow: blue;

#

box-shadow: blue;
this does not work

quartz kindle
#

the page is all broken and shit tho for me lmao

#

maybe because of my adblocks

neat ingot
#

noah you need to put it into a style block

earnest phoenix
#

i did

quartz kindle
#

@earnest phoenix you need to pay attention to css specificity

earnest phoenix
#
<style>
  
  html {
  
  background-color: #7289DA;
  box-shadow: blue;
  }
  
  .owners a {
    color: red;
}
  </style>```
#

lol

quartz kindle
#

more specific css rules will always override less specific rules

neat ingot
#

!important

#

😛

quartz kindle
#

smh

earnest phoenix
#

rip

quartz kindle
#

dont abuse important

neat ingot
#

lmao

quartz kindle
#

just make your css equally specific

earnest phoenix
#

sure

quartz kindle
#

use the same selectors they use when you inspect element

earnest phoenix
#

yeah

neat ingot
#

so im now curious why medal tv bot redirects me but not you

#

its always redirected me, thats what caused me to notice it

earnest phoenix
#

exactly

neat ingot
#

and then, are they allowed to be redirecting?

#

and then, are we?

#

cause i mean, its incredibly simple to do so, but i dont see why the site would allow for it tbh

quartz kindle
#

i doesnt redirect on incognito either for me

#

what browser are you using?

neat ingot
#

firefox

#

ill try in chrome

#

yea chrome redirects also

quartz kindle
#

no redirect in firefox either

neat ingot
#

could it be location specific maybe?

quartz kindle
#

lmao

neat ingot
#

im in uk: scotland

earnest phoenix
#

@neat ingot @quartz kindle its not that

#

Its a 'feature' of auction programm

quartz kindle
#

this is what their iframe looks like for me in the source code

#

<iframe id="botiframe" onload="setCampaignIframe('');" width="100%" src="https://medal.tv/?ref=dblbotpage" id="botiframe">

neat ingot
#

just so you know im not trolling 😄

hoary elm
neat ingot
#

aha, another person! where are you based toxic>?

hoary elm
#

🇨🇦 lol

neat ingot
#

ahh rip location theory 😄

hoary elm
#

Lol

earnest phoenix
#

@quartz kindle could it be your browser/isp cache

quartz kindle
#

i figured it out

neat ingot
#

also, is there any other thing in their source, like the script tag i found in pokecords thing?

earnest phoenix
#

Its a 'feature' of auction programm

#

..

neat ingot
#

lol

earnest phoenix
#

I saiddd

quartz kindle
#

its not an iframe redirect

neat ingot
#

no its a full page redirect as though we clicked a link

#

seems to be anyway

earnest phoenix
#

Bruh

quartz kindle
#

its a backend redirect, and it only works via top.gg/bot/medal and not via top.gg/bot/medalsBotID

neat ingot
#

oohhh

earnest phoenix
#

Send bot id

quartz kindle
#
https://top.gg/bot/medal
301 Moved Permanently
https://medal.tv?utm_source=dbl&utm_medium=dbl&utm_campaign=dblcard&ref=dblcard
200 OK```
#

its a 301 redirect

neat ingot
#

301 ooft

#

perm moved 😄

quartz kindle
#

it just shows their iframe

neat ingot
#

wait, are we allowed to set the css for a custom background image? 😄

#

wheres that rules thing

#

scrolls up

quartz kindle
#

yes you can use custom backgrounds

earnest phoenix
#

It looks cool their page

neat ingot
#

yea imo its nicer than their site 😄

#

like, it seems neater through top.gg

earnest phoenix
#

XD

#

does someone know how to put bot icon in circle?

#

i mean i knowh ot to but i need the style

quartz kindle
#

border-radius: 50%

earnest phoenix
#

yeah but i need like .bot-img

quartz kindle
#

yeah just give it the border-radius

earnest phoenix
#
 img {
    border-radius: 50%;
    height: auto;
    max-width: 100%;
}```
#

only this?

quartz kindle
#

css specificity

earnest phoenix
#

?

quartz kindle
#

img needs to be at least as specific as the original

earnest phoenix
#

okay

#

the img is now rounded

#

but the background nope

quartz kindle
#

give it to the background instead

earnest phoenix
#

the problem is the border color

#

border-color: trasparent; ?

quartz kindle
#

border:none

earnest phoenix
#

rip

#

1 se

quartz kindle
#

you know, you can just test it out directly in the element inspector

earnest phoenix
#

nope

#

okay

#

i will see tht there

#

coz it doesnt work

#

OHH I KNOW

quartz kindle
neat ingot
#

i just flat out copied some stuff to make my bot avatar float like medals does 😄

#

i wanted the round border anyway, but now he bouncy 😄

toxic jolt
#

Heroku

#
client.on("messageUpdate", async (oldMsg, newMsg) => {
  //let prefix = await db.fetch(`prefix_${newMsg.guild.id}`) || ayarlar.prefix
  if (newMsg.author.bot) return;
  if (!newMsg.content.startsWith(prefix)) return;
  let command = newMsg.content.split(" ")[0].slice(prefix.length);
  let params = newMsg.content.split(" ").slice(1);
  let perms = client.elevation(newMsg);
  let cmd;
  if (client.commands.has(command)) cmd = client.commands.get(command);
  else if (client.aliases.has(command))
    cmd = client.commands.get(client.aliases.get(command));
  if (cmd) {
    if (perms < cmd.conf.permLevel) return;
    cmd.run(client, newMsg, params, perms);
  }
});```
hoary elm
#

client.on("messageUpdate", async (oldMsg, newMsg)) = { @toxic jolt

#

You forgot a ) at the end

toxic jolt
#

thankss

#

❤️

#

fixed

hoary elm
#

😁

#

I literally just noticed I forgot the > for => 🤷🏻‍♂️ but it shouldn't matter tbh

toxic jolt
#

omgggg

hoary elm
#

Lol I said the issue

toxic jolt
#

whyy??

hoary elm
#

^^

#

I literally just noticed I forgot the > for =>
^^^^

toxic jolt
#

i how to fixx

#

😄

quartz kindle
#

wtf

toxic jolt
#

@hoary elm can you help mee

hoary elm
#

=>

toxic jolt
earnest phoenix
#

i tried adding a background image and still appear that

#

and changing background color and same..

hoary elm
#

@toxic jolt => not =

quartz kindle
#

the correct way is => WITHOUT the extra ) lol

hoary elm
#

@quartz kindle without it?

#

So leave an open bracket

dusky marsh
#

I was gonna say, it should be a callback

toxic jolt
#
client.on("messageUpdate", async (oldMsg, newMsg)) => {
  //let prefix = await db.fetch(`prefix_${newMsg.guild.id}`) || ayarlar.prefix
  if (newMsg.author.bot) return;
  if (!newMsg.content.startsWith(ayarlar.prefix)) return;
  let command = newMsg.content.split(" ")[0].slice(ayarlar.prefix.length);
  let params = newMsg.content.split(" ").slice(1);
  let perms = client.elevation(newMsg);
  let cmd;
  if (client.commands.has(command)) cmd = client.commands.get(command);
  else if (client.aliases.has(command))
    cmd = client.commands.get(client.aliases.get(command));
  if (cmd) {
    if (perms < cmd.conf.permLevel) return;
    cmd.run(client, newMsg, params, perms);
  }
});```
#

here

quartz kindle
#
client.on("something", (a,b) => {
  // where are the open brackets?
})```
hoary elm
#

That's what he used the first time

toxic jolt
#

okay

quartz kindle
#

and he was correct, just missing the >

hoary elm
#

Ahh I didn't notice that

#

My bad

#

🤦🏻‍♂️

quartz kindle
#

the closing bracket gets pushed to the end to make room for the callback function

#

client.on("something", (a,b) => {})

hoary elm
#

Yeah that makes sense

steel heath
#

how did that fix his issue tho

quartz kindle
#

it didnt

hoary elm
#

No it didn't

toxic jolt
earnest phoenix
hoary elm
#

@toxic jolt try turning the dyno off and on again or just wait a minute for it to catch up with the updates

quartz kindle
toxic jolt
quartz kindle
#

remove the extra )

toxic jolt
#

okay

earnest phoenix
#

what should i do

#

ok nvm

#

i understand

quartz kindle
#
.shapes-background {
  display: none
}```
earnest phoenix
#

i was doing it v:

#

okay xd

toxic jolt
#

i dont fixedd

#

@steel heath ohaa

steel heath
#

?

toxic jolt
#

@steel heath omg

steel heath
#

wow

toxic jolt
#

omgg

#

dm dm dm

dusky marsh
#

wrong channel fam

toxic jolt
hoary elm
#

how do you have client defined?

steel heath
#

maybe you forgot a ) or } before that

#

of another scope

hoary elm
#

Yeah I was just thinking the same thing

#

Ended something wrong prior or isn't defining client but then it would just say it's not defined

earnest phoenix
#
const DBL = require("dblapi.js");
const dbl = new DBL('API_TOKEN_DBL', client);



dbl.on('posted', () => {
  console.log('[DBL] Server count has been updated!');
})

client.on('ready', () => {
    setInterval(() => {
        dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
    }, 1800000);
});

dbl.on('error', e => {
 console.log(`Oops! ${e}`);
});```
#

this does not work ^

#

it posts the guilds count but not shards

quartz kindle
#

@toxic jolt show code before that

#

@earnest phoenix you dont need to use .postStats if you have client in DBL

#

it will use the autoposter instead

tight plinth
#

@earnest phoenix if server count is posted, token is correct. Are you sure that your shard system works like that? (client.shards.total for number of shards...)

earnest phoenix
#

wait

#

i do this

#
const dbl = new DBL('API_TOKEN_DBL', client, client.shards.total);
#

?

quartz kindle
#

no

earnest phoenix
#

then

quartz kindle
#

if you do this new DBL('API_TOKEN_DBL', client) you dont need to use postStats

#

you only need to use postStats if you do this new DBL('API_TOKEN_DBL')

earnest phoenix
#

oh

#

i delete ,client

quartz kindle
#

and btw, client.shards doesnt exist in v11

#

are you on v11 or v12?

earnest phoenix
#

of d.js?

quartz kindle
#

yes

earnest phoenix
#

huh let me check

#

how it was to check that

#

npm v discord.js

#

?

quartz kindle
#

in your package.json

earnest phoenix
#

OH SHIT

#

IM DUMB

tight plinth
#

require('discord.js').version

earnest phoenix
#

version: 11.5.1

quartz kindle
#

yes, client.shards doesnt exist

earnest phoenix
#

then how to

tight plinth
#

const dbl = new DBL('API_TOKEN_DBL', client);

quartz kindle
#

but if you use the automatic posting, it will do it for you

tight plinth
#

Just that

earnest phoenix
#

@tight plinth but i want to post shard count too

tight plinth
#

It's automatic

storm bluff
#

how can i transfer app from team to my self i am the owner of app and team

quartz kindle
#

the automatic posting will post shard count if your bot is sharded

earnest phoenix
#

oh

#
const DBL = require("dblapi.js");
const dbl = new DBL('API_TOKEN', client);


dbl.on('posted', () => {
  console.log('[DBL] Server count has been updated!');
})

dbl.on('error', e => {
 console.log(`Oops! ${e}`);
});
#

then this?

quartz kindle
#

yes

earnest phoenix
#

thanks

storm bluff
#

@quartz kindle

quartz kindle
#

i dont know

#

i dont use teams

lethal stratus
#

any ideas why when running nodejs under systemd it has no read/write perms?

quartz kindle
#

idk, did you create a service file for it?

earnest phoenix
#
.owners a {
    background-color: #23272A;
    color: #ffb53b;
}```
#

how to remove the white color

lethal stratus
#

idk, did you create a service file for it?
ye, its running as User=root

neat ingot
#

^past 30 days bandwidth for my bot

#

is it normal to be using so much since hes in this server?

#

its almost all inbound

true ravine
#

That's what my CPU utilisation graph looks like so I guess this server be thicc

#

If you think about it, every time a message is sent, your bot checks if it contains your prefix

true ravine
#

So that means a lot of incoming messages

earnest phoenix
#

help ^

neat ingot
#

^ my cpu and such for 3o days

true ravine
#

Mine has gone from idling at like 0.03 % to idling at 2%

#

So...

neat ingot
#

lmao

true ravine
#

But in proportion its a big jump

neat ingot
#

well yea i guess thats true 😄

#

wondering what kinda bandwidth these bots with like 100k servers+ use 😄

true ravine
#

Timo aardappel streams his usage stats fairly regularly so you can find out when he does

#

His bot is pretty big

#

ch-stats

#

Oh nvm

quartz kindle
#

90% of a bot's cpu and bandwidth usage is due to presence packets

#

if you dont need them, you can disable them through gateway intents