#development

1 messages · Page 1725 of 1

wheat mesa
#

I had a line of code above that returning whenever it received a message that did not start with its prefix

prime glacier
#

ok

earnest phoenix
#

@lyric mountain its working now thanks for your help 🙂
but i get now this error in the console if the member get kicked

(node:3316) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions```
prime glacier
earnest phoenix
#

the bot sending no messages if the member get kicked or its younger as 30 days

lyric mountain
#

don't u have the line which that happened?

earnest phoenix
#

and me bot have all perms

#

by this line

 await member.kick();```
lyric mountain
#

then you're trying to kick someone with higher or same role

earnest phoenix
#

me bot have permission to kick

#

me bot role stay higher then the user role

lyric mountain
#

is that production bot?

#

or you have a test bot?

earnest phoenix
#

production bot

lyric mountain
#

then it's indeed missing permissions

#

remember your bot isn't only in your server

earnest phoenix
#

i check if the guild have the protection on?

const status = new db.table(`protect_guild_${member.guild.id}`);
if (status.fetch(`status_${member.guild.id}`) === 'on' ) {```
#

so if it not on he return

lyric mountain
#

that's not a permission check

#

that's just a database check

earnest phoenix
#

and how to make a permission check?

lyric mountain
#

also

#

maybe there're other guilds with that protection activated

lyric mountain
sacred juniper
#

Hello

#

I have a question

#

Can I find out when I applied?

tardy lion
#

guys

#

how do i run 2 clients at once

prime glacier
#
client.on("presenceUpdate", (oldMember, newMember) => {
    if(oldMember.presence.status !== newMember.presence.status){
        const channel = member.guild.channels.cache.find(ch => ch.id === '836250294480142366')
        channel.send(`${newMember.user.username} is now ${newMember.presence.status}`);
    }
});```

error
```js
if(oldMember.presence.status !== newMember.presence.status){
                          ^

TypeError: Cannot read property 'status' of undefined```
earnest phoenix
tardy lion
cinder patio
shadow frigate
#

I’m thinking of different ways I could implement a voice channel XP system but only when a user is actually speaking in the VC. (discord.js)
Is this method plausible?

On a setInterval, every second, it checks if the speaking voice state is true, if so, it will +1 to a count value for the user. Once count reaches 10, it will award the user with XP and will then be reset to 0

Or any other ideas?

cinder patio
#

You can save the time when the user joined and when they left and then do some math

shadow frigate
#

I didn’t pass math :((

#

lmao

cinder patio
#

using a setInterval would be pretty slow, especially if you do it for every user in a vc

#

The math isn't complex though

topaz silo
#

Hi! I just made my first discord bot and added it for approval to top.gg, is there anything I should know about here?

quartz kindle
#

as long as your bot works you'll be fine

topaz silo
#

OK

#

I made a test server and it seems to be working fine

cinder patio
#

Store the time_joined in a Map with the user id as the key, and then get it when the user leaves a VC

shadow frigate
#

@cinder patio I want it to only count if the user is actually speaking though

shadow compass
#

is this the right code to dm someone when they change their avatar

shadow frigate
#

yes

shadow compass
#

it doesnt work though

shadow frigate
#

any errors?

cinder patio
#

aah... then you'd want to do the same thing, except instead join/leave vc you use the state change

shadow frigate
#

@cinder patio hence why I wanted to use the speaking voice state bool every second

signal estuary
#

Can someone help me. I want to get a user by ID, but sth weird happened:
If I want to warn a person for the first time with his ID, it says user = undefined.
If I warn a user by tagging him it works and after i did it, I can warn him with the User ID:

let user = msg.mentions.users.first() ||msg.guild.members.cache.get(args[0])
cinder patio
#

and instead of immediately adding XP you would just add the time_stayed to an accumulator, and when the user leaves the channel, then you do accumulator / 10

shadow compass
shadow frigate
shadow compass
#

do you know how to dm someone when they change their avatar

#

it works when they change their nickname

#

but not their avatar

shadow frigate
#

Show the full code

zenith terrace
#

delete that, you are exposing your token

shadow frigate
#

try changing avatarURL to just user.avatar

#

on both let lines

#

oldMember.user.avatar
newMember.user.avatar

shadow compass
signal estuary
# zenith terrace whats your code
        let user = msg.mentions.users.first() ||msg.guild.members.cache.get(args[0])
        if (!user) return msg.channel.send("``❌ You havent mention anyone``")
#

my whole code is too long to send it in here

zenith terrace
#

thats not showing for when the bot warns the user, put it into a pastebin

shadow frigate
#

College.work() = false

shadow compass
zenith terrace
shadow frigate
#

ey

shadow compass
shadow frigate
#

gg

shadow compass
#

full code

shadow frigate
shadow compass
#

Hi

shadow frigate
#

check the replied message

shadow compass
#

is that better

shadow frigate
#

yes, try that

signal estuary
shadow frigate
# shadow compass is that better

also please add .catch(console.error) where it can fail
not required, but might help with future errors and stops your bot from crashing

zenith terrace
shadow compass
#

at the top

#

or something

signal estuary
shadow frigate
#

no, it should go on the end of your newMember.send line

#

after the line, but connect it with the .

#

u know what i mean

shadow frigate
#

copy and paste your code in here
```js
Here
```

zenith terrace
shadow frigate
#

copy this

#

```js
```

shadow compass
zenith terrace
#

I have the same kinda code

let target = message.mentions.members.first() || message.guild.members.cache.get(args[0])```
and `target.user.username` works fine
shadow frigate
#

And put it in discord, then put your code in the middle of it

#

also change avatar back to avatarURL()

#

wait

#

before changing them, send me the code

shadow compass
#

i dont understand what you are saying

long crow
shadow frigate
#

type this in discord

#

```js

```

#

And put your code in between them

shadow compass
shadow frigate
#

```js

Your code goes here

```

#

No, just the important parts

#

It will change it to this.

if(yeet === true) return true;
#

a code block

zenith terrace
#
if(yes) return false;```
shadow frigate
#

or more like

if(College.work() === false) return console.log("No grades for me!")
zenith terrace
#
if(doingCollegeWork === false) doTheFuckingWork```
shadow frigate
#

pretty much

shadow frigate
shadow compass
shadow frigate
#

what u got?

shadow compass
#

nothing works

shadow frigate
#

show me the code

#

just take a screenshot...

#

can't be bothered explaining code blocks again

shadow compass
shadow frigate
#

why haven't you done
if(oldMember.user.avatarURL() !== newMember.user.avatarURL())

lol

#

anyways

#

uh

#

anything in console?

shadow compass
#

wait

zenith terrace
#

have you tried oldAvatar < newAvatar as thats what most of the events use to check if somethings changed

shadow frigate
#

I don't understand lmao, I don't see any issues with your code

sonic basin
#

guys, can somebody help me? I want to make my bot open-source, how can I do it?

shadow frigate
#

github

lyric mountain
sonic basin
#

I want to upload it to github, but how to do it exactly? Also with the token...

shadow frigate
#

¯_(ツ)_/¯

lyric mountain
#

for one, learn how to use git (not github)

shadow frigate
#

I've never made any of my projects open-source lmao

sonic basin
#

which one do I need to select in .gitignore?

lyric mountain
#

you're doing it the other way around

#

you don't create a repo on github, you push a repo to github

sonic basin
#

well, but can you help me how to do it?

lyric mountain
#

no, google can

sonic basin
#

I have git installed

lyric mountain
#

do you know how to use it?

sonic basin
#

better if i do a google search for it

lyric mountain
#

yes

shadow frigate
#

try what stargirl said, try replacing !== with <

shadow compass
shadow frigate
#

what is it

shadow compass
shadow frigate
#

show me ur code

shadow compass
sonic basin
#

I can use git init in the folder which already contains my bot right?

shadow compass
shadow frigate
#

@shadow compass the first image isn't necessary

shadow compass
#

well now you have it

lyric mountain
#

but to sum it up:

  • git init on your project root
  • git add .
  • git commit -m "some message"
  • create a new repository on github, don't add anything
  • git remote add origin https://github.com/username/repository
  • git push -u origin master
lyric mountain
shadow frigate
shadow compass
#

is there anything wrong with the code

shadow frigate
#

what code is on line 47? @shadow compass

shadow frigate
#

change newMember.send to
newMember.send('Looks like your avatar has changed! Looking fresh.').catch(console.error);

and try switching !== to <

sonic basin
#

how do I hide the bot token?

lyric mountain
# shadow frigate such as?

free full jetbrains toolkit license, being forced to think about code security, open collab, hassle-free automation, etc etc

#

but mostly the first 2

shadow frigate
#

My bots are personal projects lmao

#

and I don't use jetbrains

lyric mountain
#

also plenty of services have special stuff for OS projects

lyric mountain
#

ngl, I'd take it again if I could choose again

shadow frigate
#

my projects are just discord bots

#

nothing major

lyric mountain
#

mine too

shadow frigate
#

anything in console?

shadow compass
#

it looks normal

#

just the dm isnt coming

sonic basin
#

so how can I hide the bot token in the git repo

#

?

lyric mountain
#

what language?

shadow frigate
#
let oldAvatar = oldMember.user.avatarURL();
let newAvatar = newMember.user.avatarURL();
console.log("1");
if(oldAvatar !== newAvatar) {
  console.log("2");
  newMember.send('Looks like your avatar has changed! Looking fresh.').catch(console.error);
}
#

Try this @shadow compass

#

then let me know the output in console

shadow compass
#

I need to wait to change avatar

sonic basin
shadow frigate
#

inv me, i'll test it lol

#

@shadow compass

#

through DM's

shadow compass
#

isnt that dm advertising

#

i think that is agaisnt rules

shadow frigate
#

not if I asked

shadow compass
#

ok

lyric mountain
shadow frigate
#

@shadow compass anything in console?

shadow compass
#

no

#

looks fine

shadow frigate
#

no numbers?

#

1 or 2

shadow compass
#

No

shadow frigate
#

did you use the code above?

shadow compass
#

yes

shadow frigate
#

no

#

this one

shadow compass
#

yes

#

i did that

shadow frigate
#

then there will be numbers in the console

shadow compass
#

but this is what you sent

shadow frigate
#

This

#

Not that one

shadow compass
#

i typed that

shadow frigate
#

With

shadow compass
#

inside my code

shadow frigate
#

The numbers

#

with console.log

shadow compass
#

also there is an error

shadow frigate
#

...

#

why

shadow compass
#

thats what you sent

shadow frigate
#

remove the whole piece of code, and replace it with the one I sent above

#

Wait

lyric mountain
#

no you didn't send that

shadow frigate
#

Remove from, let oldAvatar to the }}'s

shadow compass
#

im pasting that in

shadow frigate
#

show me code before running it lmao

#

just to be sure

shadow compass
#

let oldAvatar = oldMember.user.avatarURL();
let newAvatar = newMember.user.avatarURL();
console.log("1");
if(oldAvatar !== newAvatar) {
console.log("2");
newMember.send('Looks like your avatar has changed! Looking fresh.').catch(console.error);
}

shadow frigate
#

okay

shadow compass
#

thats what im pasting in

shadow frigate
#

Let me know when you've restarted your bot

shadow compass
#

now this is an error

shadow frigate
#

show all code

shadow compass
shadow frigate
#

add these below the code: })

#

then restart your bot

#

and lmk when you've done that

shadow compass
#

ok

#

change your avatar

shadow frigate
#

any numbers

#

should be

lyric mountain
#

you have 1 avatar change remaining

shadow frigate
#

lmao

#

im just void rn

#

im nothing

#

@shadow compass console?

shadow compass
#

there is a 1 in console

shadow frigate
#

Okay, change < back to !== and let me know when you're done and restarted your bot

shadow compass
#

its already !==

shadow frigate
#

change it to <

shadow compass
#

ok

#

done

lyric mountain
#

inb4 wont work

shadow frigate
#

restarted?

shadow compass
#

yes

lyric mountain
#

and your next avatar change is the last for today

shadow frigate
#

yup

#

hopefully i don't get banned for this

#

🤞

#

coz I acc can't change it lmao

lyric mountain
#

that code wont work

#

strings cannot be smaller than strings

lyric mountain
shadow frigate
#

Idk what the issue is then lmao

#

It should work

shadow compass
zenith terrace
lyric mountain
#

exactly

#

cooldown is long af

#

ads

cold meteor
#

Oh this is java script

#

YO WHO ADVETISED

zenith terrace
#

its actually proven to be around 10-15 minutes if you get the "changed your avatar too quickly" error

rotund warren
#

9780077477394-69861658

lyric mountain
#

boi

zenith terrace
#

oh no

rotund warren
#

can anyone open it chegg assignment

oak cliff
#

Bruh

lyric mountain
#

did you just atMods?

oak cliff
#

-atmods

gilded plankBOT
#

Please do not mention (ping) more than one or two moderators for help, unless there is an emergency.

Here are some examples of emergencies:

  • Raids / Multiple members mass spamming.
  • Severe disruption of Discord's ToS (NSFW content, etc)
  • Anything that requires more than 2 moderators to handle.
cold meteor
#

Oh sorry

modern sable
cold meteor
#

Apologies MildPanic

#

Whyd it get auto deleted

oak cliff
#

Because they have no role

modern sable
#

@gilded plank auto-deletes all invites by people with no roles

cold meteor
#

:/

#

I apologise :=:

zenith terrace
cold meteor
#

Wont do it again

#

For the ping

rustic nova
#

whoever did atmods here, AMgabbruh

lyric mountain
#

youre below him

sonic basin
#

how can I upload if i did everything else? the pull or an other command?

#

so does it works if i just type in git pull?

cold meteor
#

I did i apologise aurel

sonic basin
#

i did it good?

#

how can I update the files?

#

because "security jim" found my token on the internet

snow vector
#

what would be the code to change my status im using discord.js

shadow frigate
umbral zealot
#

you can't have custom status, but you can definitely have other statuses

shadow frigate
#

Your own status?

#

Not the bots

solemn latch
#

i think he means change a users

#

ye

umbral zealot
#

I mean... yeah ok sure, but I'd assume Toxicity is asking about the bot's own status, lol

shadow frigate
#

Just that he said change my status

umbral zealot
#

I often say "my" referring to the bot, tbh.

shadow frigate
#

so ur a bot?!?!?!?!

#

omg

#

lmao

solemn latch
#

people often dont have english as a first language here too. sometimes "my" just means generic "my stuff"

#

one of the things you kinda just get used to.

shadow frigate
#

no need to gang up on poor SK1LL lmao

#

jk

#

fair enough

solemn latch
#

sorry didnt mean for it to come off like that 😓

umbral zealot
#

Neither did I 😄

shadow frigate
#

aye all good lmaoo

worn sonnet
#

how do i use custom domain with apache webserver on windows 10?

earnest phoenix
#

does anybody know any good lavalink tutorials for py

boreal iron
worn sonnet
#

any in detail i'm kinda inexperienced in it

cinder patio
#

Wait, you have a windows vps or you're trying to host a website on your own pc?

worn sonnet
#

but since those can't take 127.0.0.1:5000

#

i need to host it on my PC

solemn latch
#

i mean anything remote cannot take 127.0.0.1

worn sonnet
#

yeah

solemn latch
#

127.0.0.1 means "myself"

worn sonnet
#

yep!!

cinder patio
#

look up port forwarding, I dunno what domains have to do with anything, you don't need a domain

worn sonnet
#

and there isn't any place like 127.0.0.1

solemn latch
#

your public ip?

worn sonnet
#

hehe

solemn latch
#

probably shouldnt share your ip

worn sonnet
#

try forwarding it

solemn latch
#

👀

worn sonnet
#

lmao i changed a digit

solemn latch
#

then quite simple to find it 👀

#

plenty of tools to find available ports on a range of ip's

worn sonnet
#

oke try entering my router

#

i'm ready to welcome ya

solemn latch
#

why would I? lol, im trying to help you.

vivid fulcrum
#

....that's not how that works

worn sonnet
earnest phoenix
#

Helo! I have a question, how do you make a word incorporate a link? For example:

vivid fulcrum
earnest phoenix
#

Thank you very much!

worn sonnet
#

oke great now from where do i change the port

#

443 is already in use

boreal iron
#

443 is SSL

worn sonnet
#

solved running on 4430 now

rose creek
#

i need help for bot stalker

cinder patio
rose creek
#

what

cinder patio
#

elaborate

#

bot stalker?

rustic nova
#

use something like 5000 oder 9000 or 12395 etc

worn sonnet
#

well it's solved now, using 4430

rustic nova
#

best practice is to use ports over 1000

worn sonnet
#

the server is running

worn sonnet
rose creek
cinder patio
#

don't

rose creek
#

yes

craggy pine
#

waitwhat actually no

solemn latch
rose creek
#

ugh ok

cinder patio
#

can't believe you have to tell people that

worn sonnet
#

umm.. so i'm stuck again

#

i need to run flask app on my PC with domain

#

it should show example.xyz instead of 127.0.0.1:5000

solemn latch
#

youve bought a domain right?

worn sonnet
#

yeah i've one

solemn latch
#

ok, have you setup the dns settings for the domain?

worn sonnet
#

yep i've got cpannel

solemn latch
#

👀 cpannel doesnt have anything for configuring a domain dns afaik.

worn sonnet
#

wait lemme login there

#

oke so it's hPannel

#

and i can see DNS settings in there

solemn latch
#

👀 who did you register your domain with

worn sonnet
#

hostinger

#

umm.. u there?

solemn latch
#

add an a host, pointing to your public ip

worn sonnet
#

u mean the router IP

solemn latch
#

the public ip google gave you

#

not the internal one.

worn sonnet
#

alr added

solemn latch
worn sonnet
#

oke so its added

solemn latch
#

and youve port forwarded?

worn sonnet
#

i doubt i can do port forwarding.......

solemn latch
#

then you cant host on your machine.

worn sonnet
#

i mean i'm using my phone's data

solemn latch
#

dont think you can realistically host off phone internet

worn sonnet
solemn latch
#

youd probably have to do some research yourself into it. there might be a way, but its so specific no one here will know how to.

worn sonnet
#

hey @solemn latch i've router but no internet on it

#

so can i do something like using phone's internet and doing port forwarding on my router

solemn latch
#

again, this is very unique as a setup for a webhook/webserver, I know nothing about it, and doubt anyone here will be able to help much.

#

youll want to do you own research.

worn sonnet
#

yeah, i'm grateful to ya for the help till here

rough current
#

Can u use CSS and HTML on the same page?

vivid fulcrum
#

yes

#

they go hand in hand

rough current
#

kk ty

worn sonnet
#

now again watching some indian guy

#

on YT

boreal iron
#

3G, 4G etc. isn’t made for that anyways

worn sonnet
#

Shouldn't have missed my networking classes

boreal iron
#

A server is the best way in your case to go on

worn sonnet
craggy pine
#

Likely still need an actual internet connection, not mobile.

boreal iron
#

Yeah it’s not more than a VPN tunnel of your mobile connection to a server redirecting the incoming connections back to you

#

Which means the service can see and sniff you whole traffic

worn sonnet
boreal iron
#

To do what you wanna do you need NAT control or a dedicated/virtual server with access to configure your network

#

Even without a server hosting at home isn’t an issue as long as you can configure your router.
Non-static IP addresses can be handled using DDNS services for example.
Anything else, tunnels, VPNs, mobile connections etc. are just a mess.

worn sonnet
#

oke alr

#

and thanks for help till now

tardy lion
#

i am having le issues

#
if (msg.content === 'bot.runner') {
    msg.reply('Making Bot...');
    await require('./bot.js')
  }

await is only in async function

#

wait

#

how do i make it so if i say bot.runner it will require bot.js instead of running bot.js when node index is started

tardy hornet
#
case 'tutorial':
          const questions = [
            'test 1',
            'test 2',
            'test 3',
            'test 4',
            'test 5',
            'test 6',
            'test 7',
         ]
         let counter = 0
         const filter = m => m.author.id === message.author.id
         
         const collector = new Discord.MessageCollector(message.channel, filter, {
           max: questions.length,
           time: 1000 * 15
         })
         
         message.channel.send(questions[counter++])
         
         collector.on('collect', m => {
           if (counter < questions.length) {
             m.channel.send(questions[counter++])
           }
         })
             collector.on('end', collected => {
               let counter = 0
               collected.forEach((value) => {
                 console.log('worked')
               })
             }) 
             break;

i have made this, how can i make that if like for the first question, if they dont send a specific message that i want it will ask again

tardy lion
#

instead of sharing your code

#

which floods the channel

tardy hornet
#

sorry

#

cool pfp btw

tardy lion
#

tanks

tardy hornet
#

anyways

#

you know how?

vivid fulcrum
#

don't increment the counter until you've got your message

#

a simple logical issue

#

if there aren't any collected messages at the end, simply re-run the block of code

tardy hornet
#

yeah but like, for the first question, i want that they will send, like, "okay" and for the second one "sure"

#

and if it wont be that it will reask the question

tardy lion
#

hmmmmmmmmmmmm

vivid fulcrum
#

array of objects that contains both the question and the expected answer

#

or map the question to the answer

#

whatever you prefer more

tardy lion
#
if (msg.content === '1st thing') {
  msg.reply('okay')
  } else if (msg.content === '2st thing') {
  msg.reply('sure')
  }
#

this is kinda my way

#

so

#

if you ask a question it will say okay

#

then if you ask another question it would say sure

tardy hornet
#

i mean that the person will have to say okay

#

and if he wont say okay

tardy lion
#

oooooh

tardy hornet
#

it will reask it

tardy hornet
vivid fulcrum
#

🙄

tardy lion
#
if (msg.content === '1st thing') {
  msg.reply('okay')
then if (msg.content === '2st thing') {
  msg.reply('sure')
  }
  }
#

idk if this works

#

i just guessed

#

i know its something like that

#

i just forgot

vivid fulcrum
#
const whatever = [
{ q: "whatever?", a: "whatever." }
];

const questionObject = whatever[0];

//access your question with the q property and your answer with the a property
tardy hornet
#

wdym

tardy hornet
#

hello?

snow vector
#

anyway to make it where capitalization dosnt matter in triggers

clear sky
#

from what it can be

opal plank
#

@toxic jolt update your library, thats likely staging channels problem

toxic jolt
#

wrong channel maybe

opal plank
#

nah, it was right channel

toxic jolt
opal plank
#

which library u using?

toxic jolt
#

wait i looking now

#

"_id": "discord.js@12.5.3",

#

discord.js 12.5.3

opal plank
#

hmmmm

#

perhaps not what i assumed

#

channel type 13

#

let me see that rq

toxic jolt
#

Rate limit has been coming for days

opal plank
#

bingo

toxic jolt
#

I Couldn't fix this problem

opal plank
#

exactly what i said

toxic jolt
#

what

opal plank
#

it seems like your lib wasnt updated

#

channel 13 is staging channels

toxic jolt
#

how

#

i updated

tardy hornet
#

heyyyy erwinn

opal plank
#

update your code AND restart the bot

tardy hornet
#

long time no seen

opal plank
#

hello

toxic jolt
#

here

tardy hornet
toxic jolt
#

my bot

opal plank
#

@toxic jolt yeah , you told me u had it updated, but have you restarted it?

#

the version that your bot is RUNNING somehow isnt supporting staging channels

opal plank
#

try restarting now again

#

and make sure to update it to the lastest version(should already be)

opal plank
toxic jolt
#

I rebooted a thousand times

tardy hornet
toxic jolt
#

I rebooted windows too

opal plank
opal plank
toxic jolt
#

windows server 2012 R2

opal plank
toxic jolt
#

VDS

opal plank
#

oh i see

toxic jolt
#

here

opal plank
tardy hornet
# opal plank go ahead

so, i've tried to make a tutorial command, and i want that if someone do the command, it will ask a question, and like, i want the user to answer like "okay", and if the user wont say okay, it will reask the question

opal plank
#

let me get the branching version rq

tardy hornet
#

its not working tho

#

and i have this one as well:

opal plank
#

can you copy and paste this at the very top of your code?

opal plank
#
const pack =  require('./package.json');
console.log(pack.dependencies['discord-js'])
#

@toxic jolt

#

very very very top

#

before your client even is created

tardy lion
#

guys

#

me have such problem

#

me no fix

opal plank
#

@tardy hornet whats the error?

#

also PLEASE use a linter

#

seeing disorganized code like that is painful

plucky lily
#

good evening I should put the anonymous bot that when a person writes the message is deleted and automatically written in a chat anonymously, I want to know how to do it

opal plank
#

@tardy hornet

#

my compiler telling you this

lyric mountain
#

see the issue with "anonymously sent" messages?

tardy hornet
opal plank
#

so what you want is a bit complicated

#

i would personally just loop with a timeout

lyric mountain
#

yep

opal plank
#
let questions = [];
function Ask(q) {
  return new Promise(res, rej => {
  //collector stuff 
  if(!collected || collected?.first()?.content.trim().toLowerCase() !== 'okay') rej(false); else res(true)
});
}
for(let q of questions) try {
  await Ask(q);
} catch(e) {
  //retry?
}
#

theres likely a 100000% better way of doing this btw

#

collectors have a time option, so the timeout is unecessary

tardy hornet
#

and what if i want that the answer for the 2nd question will be something else?

opal plank
toxic jolt
#

here @opal plank

#
const client = new Discord.Client({ messageCacheMaxSize: 5, messageCacheLifetime: 60, messageSweepInterval: 60, messageEditHistoryMaxSize: 5, disableMentions: "everyone", cacheChannels: true });```
#

my client is here

#

maybe that's why she's giving an error

vivid fulcrum
#

you didn't spell dependencies properly

opal plank
#

oh my bad

#

i wrote it correctly

toxic jolt
#

here

#

12.5.3

opal plank
#

hmm so it seems to be either something else thats causing that or d.js big derp

#

the version in the code definitively running that version

blissful coral
#
if (i == 0) {
      ctx2.drawImage(canvas, 0, 0, canvas.width / 2, canvas.height / 2, 0, 0, canvas.width / 2, canvas.height / 2)
    } else if (i == 1) {
      ctx2.drawImage(canvas, canvas.width / 2, 0, canvas.width, canvas.height / 2, 0, 0, canvas.width, canvas.height / 2);
    } else if (i == 2) {
      ctx2.drawImage(canvas, 0, canvas.height / 2, canvas.width / 2, canvas.height, 0, 0, canvas.width / 2, canvas.height);
    } else if (i == 3) {
      ctx2.drawImage(canvas, image.width / 2, image.height / 2, image.width, image.height, 0, 0, image.width, image.height);
    }

The first 3 are working as intended, the final one though is not

#

The first 3 take the top left, top right, bottom left and seperate them into there individual sections

#

the fourth one is meant to do the same for the bottom right but is not working as intended

small tangle
#

in the last case your using image.width instead of canvas.width is the first thing that i register

blissful coral
#
const canvas = createCanvas(100, 100);
const canvas2 = createCanvas(50, 50);
const ctx2 = canvas2.getContext('2d');
const ctx = canvas.getContext('2d');
let image = new Image();
image.onload = function () {
  ctx.drawImage(image, 0, 0)
}
image.src = 'https://www.gravatar.com/avatar/7b67c827ee1671ba3b43f4aebf6794fb?s=128&d=identicon&r=PG'
``` top of file
modest bone
#

Hello, you're giving this error, can you help me?

#

const embed = new Discord.MessageEmbed()
    .setColor('bbe6f9')
    .setTitle(`**Acabaram de votar em mim!**`)
    .setDescription(`**Obrigado ${client.users.cache.get(req.vote.user).username} por votar, continue assim, e me ajude a crescer cada vez mais!\n**`);
    
    client.guilds.cache.get("812692760032968764").channels.cache.get('833758441553657907').send(embed)
    
  res.sendStatus(200)
    
})```
earnest phoenix
blissful coral
small tangle
#

ok let me have a closer look

modest bone
# earnest phoenix did you set anything to be *app*?

const webhook = new Topgg.Webhook('a') 
const api = new Topgg.Api("eyJhb")

setInterval(() => {
  api.postStats({
    serverCount: client.guilds.cache.size
  })
}, 300000)

Discord.Message.prototype.quote = async function(content, options) {
  const message_reference = {
    message_id:
      (!!content && !options
        ? typeof content === 'object' && content.messageID
        : options && options.messageID) || this.id,
    message_channel: this.channel.id
  };
  const { data: parsed, files } = await Discord.APIMessage.create(
    this,
    content,
    options
  )
    .resolveData()
    .resolveFiles();

  this.client.api.channels[this.channel.id].messages.post({
    data: {
      ...parsed,
      message_reference,
      allowed_mentions: { replied_user: false }
    },
    files
  });
};

app.post('/vote', webhook.middleware(), async (req, res) => {

const embed = new Discord.MessageEmbed()
    .setColor('bbe6f9')
    .setTitle(`**Acabaram de votar em mim!**`)
    .setDescription(`**Obrigado ${client.users.cache.get(req.vote.user).username} por votar, continue assim, e me ajude a crescer cada vez mais!\n**`);
    
    client.guilds.cache.get("812692760032968764").channels.cache.get('833758441553657907').send(embed)
    
  res.sendStatus(200)
    
})

app.get("/", (request, response) => {
  console.log("estou online")
  response.sendStatus(200)
})```
blissful coral
earnest phoenix
#

ok yeah I’m reading it

#

one second

vivid fulcrum
#

is there any part of that code

modest bone
#

ok

vivid fulcrum
#

that you didn't copypaste

blissful coral
#

who?

vivid fulcrum
#

alex

blissful coral
#

ah

modest bone
blissful coral
#

Looks copy pasted KEKW

small tangle
#

what lib is the canvas one?

blissful coral
#

just canvas

earnest phoenix
#

@modest bone your app is undefined. I would suggest doing this:
npm i express
and then add
const app = require(“express”)

blissful coral
#

npm i canvas

earnest phoenix
#

sorry for the lack of code blocks I’m on mobile

modest bone
blissful coral
small tangle
#

ok

modest bone
blissful coral
#

Your host doesn't accept XMLHTTPRequests?

#

thats odd

modest bone
blissful coral
#

express is just a wrapper for that

quaint wasp
#

how do I know where the error is from?

small tangle
#
else if (i == 3) {
      ctx2.drawImage(canvas, image.width / 2, image.height / 2, image.width / 2, image.height / 2, canvas.width / 2, canvas.height / 2, image.width, image.height);
}
blissful coral
#

The connection string you gave was invalid

small tangle
#

whats with that

small tangle
#

i mean does this work

blissful coral
#

one sec

quaint wasp
blissful coral
#

wherever you connect

vivid fulcrum
#

doesn't the stacktrace tell you where

#

lol

blissful coral
#

^

small tangle
#

so which part is actually wrong, bottom left?

blissful coral
#

The one you gave me displays the bottom left when it is supposed to show bottom right

small tangle
#

oh one sec

blissful coral
#

okay

earnest phoenix
#

what this problem for discord js

#

const Discord = require("discord.js")

const { version } = require("discord.js");
const moment = require("moment");
const m = require("moment-duration-format");
let os = require('os')
let cpuStat = require("cpu-stat")
const ms = require("ms")

module.exports.config = {
name: "botinfo",

}

const botinfo = new Discord.MessageEmbed()
.setAuthor(message.client.user.username)
.setTitle("Status:")
.setColor("RANDOM")
.addField("⏳ Ram usage", ${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)} / ${(os.totalmem() / 1024 / 1024).toFixed(2)} MB, true)

  .addField("📁 Users", `${message.client.users.cache.size}`, true)
  .addField("📁 Servers", `${message.client.guilds.cache.size}`, true)
  .addField("📁 Channels ", `${message.client.channels.cache.size}`, true)
  .addField("👾 Discord.js", `v${version}`, true)
  .addField("🤖 Node", `${process.version}`, true)
  .addField("🤖 CPU", `\`\`\`md\n${os.cpus().map(i => `${i.model}`)[0]}\`\`\``)
  .addField("🤖 CPU usage", `\`${percent.toFixed(2)}%\``, true)
  .addField("🤖 Architecture", `\`${os.arch()}\``, true)
  .addField("💻 Platform", `\`\`${os.platform()}\`\``, true)
  .addField("API Latency", `${(message.client.ws.ping)}ms`)  

message.channel.send(botinfo)
});
}
};

blissful coral
#

?

#

code block plz

earnest phoenix
#

that's how it is xd

vivid fulcrum
#

give more context with your question

small tangle
#

@blissful coral one sec im actually making a project rn, because its to hard just to imagine it lol

blissful coral
#

👍 this is the only problem I ham having

earnest phoenix
#

Can somebody help me??

blissful coral
#

You say "whats the problem"

#

We aren't wizards

#

What is the error

small tangle
#

@blissful coral can u just sent me the whole code (per DM if you want) to quickly test it?

sudden geyser
# earnest phoenix that's how it is xd

You can wrap code in a code block to give it syntax highlighting as so:
```javascript
your code here
```

As for your problem, like others have said, you'll need to provide more context for us to help you

timid radish
#

help me

#

CB bot is broken

solemn latch
gilded plankBOT
#

@timid radish

Hey! We think you have our server mistaken. We do not provide support, help, or advice for any bot. You need to click on the "Get Support" button on the bot's page of the bot you need support for, not the "Join Discord" button at the top of our website. If there isn't a button that says Support Server or you were banned from the bot's support server, then we can't help you. Sorry :(

earnest phoenix
#

discord js error unexpected token

``"const Discord = require("discord.js")

const { version } = require("discord.js");
const moment = require("moment");
const m = require("moment-duration-format");
let os = require('os')
let cpuStat = require("cpu-stat")
const ms = require("ms")

module.exports.config = {
name: "botinfo",

}

const botinfo = new Discord.MessageEmbed()
.setAuthor(message.client.user.username)
.setTitle("Status:")
.setColor("RANDOM")
.addField("hourglass_flowing_sand Ram usage", ${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)} / ${(os.totalmem() / 1024 / 1024).toFixed(2)} MB, true)

  .addField("file_folder Users", ${message.client.users.cache.size}, true)
  .addField("file_folder Servers", ${message.client.guilds.cache.size}, true)
  .addField("file_folder Channels ", ${message.client.channels.cache.size}, true)
  .addField("space_invader Discord.js", v${version}, true)
  .addField("robot Node", ${process.version}, true)
  .addField("robot CPU", \``md\n${os.cpus().map(i => ${i.model})[0]}```)
  .addField("🤖 CPU usage", `${percent.toFixed(2)}%`, true)
  .addField("🤖 Architecture", `${os.arch()}`, true)
  .addField("💻 Platform", ``${os.platform()}``, true)
  .addField("API Latency", ${(message.client.ws.ping)}ms`)  

message.channel.send(botinfo)
});
}
};``"

#

How do I make that block?

solemn latch
#

```js
//code here
```

solemn latch
earnest phoenix
#

I have it in replit and there is no error online, if not, in the console it gives me one when they appear to me that the command has been used

#

@solemn latch

solemn latch
#

then how did you get this

discord js error unexpected token

earnest phoenix
#

why there I am emphasizing the error that gives me and the language you know

solemn latch
#

👀

#

so what line does the rest of the error message say the problem occurs?

lament rock
#

Discord releasing gateway and API v9. wow

#

Threads are pog

earnest phoenix
#

is my error of console @solemn latch It only gives me an error when it appears that they use the info bot

blissful coral
#

unexpected token }

#

You have a } that doesn't have a matching { above it

vagrant prairie
#

}

#

^

solemn latch
#

probably the one on the last line

vagrant prairie
#

Yesh

#

i hate when this happens

#

;-;

#

also

#

does anyone know how i can add commas?

#

in an output

blissful coral
#

commas?

vagrant prairie
#

like

#

,

blissful coral
#

console.log('pog' + ',')

#

?

vagrant prairie
#
const coins = await economy.getCoins(userid)

message.channel.send(`that user has ${coins} coins!`)```
#

like

#

the output can be

#

1000000

#

i want commmas in it

blissful coral
#

You have to do that yourself

vagrant prairie
#

like 1,000,000

#

message.split?

blissful coral
#

lemme send my util

near stratus
blissful coral
#
function formatNumber(number) {
    let str = String(number)

    return str.split('').reduce(
        (a, b, i) => a + (i && !((str.length - i) % 3) ? ',' : '') + b,
        ''
    )
}
vagrant prairie
#

o

#

so

blissful coral
#

or

#
var nf = new Intl.NumberFormat();
nf.format(number); // "1,234,567,890"
vagrant prairie
#

ya thats perfect

#

then message.channel.send(${nf})

#

thx

blissful coral
vagrant prairie
#

can it be

near stratus
vagrant prairie
#
var nf = new Intl.NumberFormat();
nf.format(coins); // "1,234,567,890"```
blissful coral
#

I changed it before uploading forgot to change arros tho @near stratus

vagrant prairie
#

using coins

#

not a number

blissful coral
#

what is coins defined as

#

do

#
nf.format(Number(coins))
#

If it isn't already a number instead of a string

vagrant prairie
#

oki lemme try

blissful coral
#

if its a number already leave it as just coins

near stratus
#
const coins = await economy.getCoins(userid)

message.channel.send(`that user has ${formatNumber(coins)} coins!`)
#

cleaner I guess

vagrant prairie
#

lol

#

so

vagrant prairie
#

only that line of code

solemn latch
#

with the function that was given earlier

near stratus
blissful coral
#

^

#

just do the nf one I sent

vagrant prairie
#

it kinda worked

#

so

fluid horizon
#

I can't get my bot to work

blissful coral
#

errors?

vagrant prairie
#
var nf = new Intl.NumberFormat();
nf.format(Number(coins)); // "1,234,567,890"
message.channel.send(`${nf}`)```
blissful coral
#

Thats what I told you to do

#

lmao

#

also why are you using string literals when you don't have anything else in the string

#

message.channel.send(nf)

near stratus
vagrant prairie
#

lol

#

i removed it for time inconvenience

#

@blissful coral urs didn't work

#

i tried function

#

and it worked

#

:>

blissful coral
#

huh

vagrant prairie
#
let desc = `Total Balance : ${total}\nCoins Owned : ${formatNumber(coins)}\nInventory Value : ${totPrice}`
        function formatNumber(number) {
    let str = String(number)

    return str.split('').reduce(
        (a, b, i) => a + (i && !((str.length - i) % 3) ? ',' : '') + b,
        ''
    )
}
    const bal = new Discord.MessageEmbed()
    .setTitle(`${member.user.username}'s balance`)
    .setDescription(desc)
    .setFooter(`RickRolled#3526 - Version 1.2.3`)
            .setColor(message.member.displayHexColor)
    
    message.channel.send(bal)```
#

this worked

solemn latch
#

might be a bit cleaner to move the function out of the middle of your code.

vagrant prairie
#

lol

lament rock
#

you can use regex to add commas into numbers. String(number).replace(/\B(?=(\d{3})+(?!\d))/g, ",")

vagrant prairie
#

is it possible

#

for me

#

to add a d!setprefix command

vagrant prairie
#

in a code

#

where guildid

#

is prevented?

lyric mountain
#

is it possible

#

for you

near stratus
lyric mountain
#

to write

#

in a single

#

line?

vagrant prairie
#

mongo

vagrant prairie
near stratus
vagrant prairie
#

oki

#
const data = await prefixModel.findOne({
        GuildID: message.guild.id
    });

    if (!args[0]) return message.channel.send('You must provide a **new prefix**!');

    if (args[0].length > 5) return message.channel.send('Your new prefix must be under \`5\` characters!')

    if (data) {
        await prefixModel.findOneAndRemove({
            GuildID: message.guild.id
        })
        
        message.channel.send(`The new prefix is now **\`${args[0]}\`**`);

        let newData = new prefixModel({
            Prefix: args[0],
            GuildID: message.guild.id
        })
        newData.save();
    } else if (!data) {
        message.channel.send(`The new prefix is now **\`${args[0]}\`**`);

        let newData = new prefixModel({
            Prefix: args[0],
            GuildID: message.guild.id
        })
        newData.save();
    }

}```
#

the code doesn't work

#

like

#

it replies

#

doesnt edit

ionic knoll
#

Way probot offline

#

I need to help !

earnest phoenix
#

go to the probot support server and ask there

half bear
#

guys how can i delete a file. i have setItem and getItem but i need to delete the item also

ionic knoll
umbral zealot
tardy lion
#
client.login(`${args[0]}`);
                    ^

TypeError: Cannot read property '0' of undefined
earnest phoenix
umbral zealot
#

uhhh why would args be defined when trying to login a bot?

#

that... makes little sense

strange moth
regal jacinth
#

guys quick question, can i update info in a website using it's API in python ? if so what should i look for ?

umbral zealot
#

"API"s don't care what language you use, they're based on a protocol, not a language

#

usually through HTTPS exchanges

quaint wasp
umbral zealot
#

Well, it's not defined

#

clearly

#

Since you like sharex, here's more arrows and stuff

sage bobcat
#

One message removed from a suspended account.

umbral zealot
#

uhh find a library that does HTTP requests, I guess?

tardy lion
umbral zealot
#

And that is.... what

#

login itself while it's logged in?

tardy lion
#

discord bot maker

#

inside discord

umbral zealot
#

Oh god please don't

pale vessel
#

Budget Pylon

umbral zealot
#

I mean seriously if you're blocked at "cannot read property 0 of undefined" and you need our help for that... forget it.

#

I'm sorry to say it ain't happenin'

tardy lion
#

why can't it happen

umbral zealot
#

I'm saying you aren't going to make this happen if this is where you're stuck

tardy lion
#

ok

#

i fixed it

#

but i have a differnet error now

#

(node:20080) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.

umbral zealot
#

the token wasn't valid.

tardy lion
umbral zealot
#

ok so you didn't provide it to the code correctly

tardy lion
#
const args = msg.content.slice(prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();

 let { token } = newFunction(args);

  function newFunction(args) {
    let token = args[0];
    return { token };
  }
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

const { args, command, token } = require('./index.js')
client.login(token);
umbral zealot
#

you're... importing index.js? Thonk

#

you shouldn't be... that doesn't... what in the actual fuck are you even doing

tardy lion
#

no

#

im importing index.js from bot.js

umbral zealot
#

ok and what are you writing inside index.js?

tardy lion
#
const Discord = require('discord.js');
const client = new Discord.Client();
var prefix = "bot."


client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);
});

client.on('message', msg => {
if (!msg.content.startsWith(prefix) || msg.author.bot) return;

const args = msg.content.slice(prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();

 let { token } = newFunction(args);

  function newFunction(args) {
    let token = args[0];
    return { token };
  }

  if (msg.content.startsWith(prefix + "runner")) {
    msg.reply('Making Bot...');
    require('./bot.js')
  }
});
umbral zealot
#

ok so first

#

you're not exporting anything

#

second, you're requiring bot.js from index.js and index.js from bot.js

#

require loops are bad, mmmkay

#

third, var ? jesus christ.

tardy lion
#

wait

#

so is it const

umbral zealot
#

Please, for the love of all that is wholy, stop what you're doing, drop this project, and roll on to a full javascript tutorial before attempting such a project.

#

Shoveling code might work on your usual crap bots but not with this idea. You just cannot stumble through something like this.

#

Do you even understand the least bit about modules? the security involved in this???

#

are you ready to learn docker and virtualization for this idea? because you'll need it

tardy lion
#

so no

umbral zealot
#

then that doesn't really make sense tbh

#

it's a horribly bad idea overall

tardy lion
#

which one?

umbral zealot
tardy lion
#

i closed the tab

umbral zealot
solemn latch
#

w3schools focuses mainly on web js kind of stuff.

tardy lion
#

my antivirus says the .info tld does something to my computer

umbral zealot
#

your antivirus is clearly defective

solemn latch
#

👀 honestly anything more than windows defender is kinda pointless unless you click on scam links frequently.

tardy lion
#

i got 18 cookies

#

i don't think dis safe

#

now i got 35

lyric mountain
solemn latch
#

if your anti virus doesnt trust .info it shouldnt trust any .com domain

tardy lion
#

how do i make a tld

solemn latch
#

a lot of money

tardy lion
#

where do i get a lot of money

lyric mountain
#

from tlds

tardy lion
#

im gonna make a tld

lyric mountain
#

but you need money

tardy lion
#

hole on

#

how to connect

#

i did it

#

i am a gof

#

gof

#

god

lyric mountain
solemn latch
#

👀 icann custom tld cost.

The process itself may be relatively straightforward. ICANN will make applications available (get the May 2011 draft of the Applicant Guidebook) from January 12, 2012 through April 12, 2012, giving companies time to develop a marketing plan and come up with justification to pay the $185,000 application fee and, if approved, the annual $25,000 fee.

#

ezpz

heady forum
#

I am attempting to save data in python using json. Just wanted to know if it was better to save all guild data in 1 json file or a new file for each guild?

odd stratus
#

A new file for each guild might be too many files

#

I wouldn't recommend using JSON files as a db though

heady forum
#

Do you have any recommendations?

odd stratus
#

SQLite is good, pretty easy to use

#

I mainly use MySQL and PostgreSQL right now but those are remote databases which takes a little more effort to set up

deep mantle
#

Or MongoDB it isnt too hard plus it uses JSON format

heady forum
#

Ok thanks i'll look into it

quaint wasp
hoary vale
#

a

ripe prairie
#

So, for storing data in Python, what'd be better (efficiency wise, and/or best practice)?
Let's say I have a mob with like, attack, defense and speed stats.
Would it be better to put all of that in a dictionary then store it in a DB, or make a class object with the stats and store that in the DB?

lyric mountain
pale vessel
#

LOL

#

imagine

#

google should utilize their .google TLD more

solemn latch
lyric mountain
#

I mean the price

solemn latch
#

oh no lol

lyric mountain
#

No decimals? 😫

crimson vapor
#

I like it

lyric mountain
#

main is dumb

tardy lion
#

guys i made my own tld

pure stream
#

how would i get my bot to do math for discord.pu?

#

.py*

livid compass
#

If I add a bot will it be accepted if it doesn't have any commands yet

pure stream
#

i can get simple respond commands but im not sure how to do math on it

pure stream
#

probably not though

livid compass
#

I dunno how to add commands

pure stream
#

python or java

livid compass
#

Not really

#

I can learn though

pure stream
#

ok well you need a coding software to start out and a bot

earnest phoenix
#

where can i get templates

pure stream
#

have you created a bot yet?

livid compass
#

Yes

pure stream
#

ok

livid compass
pure stream
#

ok

#

ur pc is win 10 right?

#

or just win

livid compass
#

Yeah

pure stream
#

ok

livid compass
#

What kinda coding software should I use

pure stream
livid compass
pure stream
compact echo
#

Vscode for sure

livid compass
pure stream
livid compass
#

Opening the store

pure stream
livid compass
#

I'm downloading it

compact echo
#

Python or Javascript

#

hmmmm

pure stream
compact echo
#

no

pure stream
#

what do you use?

compact echo
#

Javascript

livid compass
pure stream
livid compass
#

I'm very new to rhis

pure stream
livid compass
pure stream
#

ok

compact echo
#

hmm

livid compass
#

I need to free up some space on my computer after this

#

Ok it's almost done

livid compass
compact echo
#

I would probably just use the built-in eval() function in javascript after checking if the expression is valid

livid compass
#

I'm deleting mougus after this lol

compact echo
#

mhm

pure stream
#

how do you get it to like read what ur saying?

compact echo
#

specify "read what ur saying"

#

like the message?

livid compass
pure stream
#

for example carl-bot.... If you say -calc (x) + (z)

compact echo
#

i'll just put the evaled expression into a variable then send it to the channel

pure stream
#

itll come up with something specific based off the 2 numbers

compact echo
#

if it throws an error than i'll just say that's not a valid expression or smth

pure stream
livid compass
pure stream
#

k

livid compass
#

I dunno why it's taking so long

compact echo
#

probably cause your building it from the source

livid compass
#

Wdym

#

@pure stream it's done

pure stream
compact echo
#

basically it will most likely use something called "make/cmake" which is HELLA slow

pure stream
#

now you need to download a programing software

#

i use this one

#

but theres a lot

#

you can use others too

livid compass
#

Can I download it on opera or do I use the Microsoft store

compact echo
#

it's a website

#

just download it from the website