#development

1 messages · Page 891 of 1

drowsy sentinel
#

Timeouts and Intervals are held in memory, once the process is terminated they will be erased. Therefore; you need to store the muted user, unmute date, and whatever other data needed in a more reliable place like a database. Then you can just initialize a setInterval function on the ready event to periodically scan the database and compare the unmute date to the current date.

limpid geode
#

Does anyone know if residential ISPs throttle Discord bot traffic?

ripe lantern
#

well uh anyone have any python discord bot guide thingy thongy

#

copy wopy pastey wastey

#

:)

cursive dagger
#

Not any good ones fully up to date ones atm afaik, although I know some are in the works

bitter meadow
#

@ripe lantern I know MenuDocs has a current discord.py series

ripe lantern
#

cool

limpid geode
#

But no documentation. XD

bitter meadow
#

I have written many as well :)

#

Favourite command has to be my speed test command I rekon

iron steeple
#

What’s that then

ripe lantern
#

well uh @limpid geode can ya teach me how to make la bot in dms

#

lol

limpid geode
#

Probably.

bitter meadow
#

@iron steeple it runs a speedtest (ookla) on the bots sever (self hosting)

iron steeple
#

Oh right I thought you meant like a discord server speed test which didn’t make sense

bitter meadow
#

nah like this

#

@iron steeple

iron steeple
#

Yeah I saw. Lots of bots have this kind of feature actually

#

System info

warm maple
#

whenever i do "npm install canvas" i get this error

quartz kindle
warm maple
#

i found this but i dont get it

knotty steeple
#

@earnest phoenix when you double click a js file to run it on windows

#

by default it does to some microsoft script thing

#

thats not node neither "browser js" mmLol

earnest phoenix
#

i did say it's the windows js thingy

knotty steeple
#

which isnt how u run an actual js file

quartz kindle
#

its not javascript, so it will never work

#

its not a windows problem, its a language mismatch

#

like trying to run a js file with python

#

or a jar file with C

knotty steeple
#

or the other way around for js and python

quartz kindle
#

or a mac app file on windows

knotty steeple
#

pm2

quartz kindle
#

or an exe on mac

knotty steeple
#

tim i think he got it now

quartz kindle
#

you never know, i can come up with more examples

#

:^)

earnest phoenix
#

hi

#

can aanyone help me make a timer code

nimble escarp
prime cliff
nimble escarp
earnest phoenix
#

hi
can aanyone help me make a timer code4

nimble escarp
#

The only .NET pro I can see.

earnest phoenix
#

tried altering a mute command but didnt work

#

plez hepl

quartz kindle
#

show relevant code, or an example code of what you have tried, and what you want it to accomplish

earnest phoenix
#

Here's code I tried to alter I couldn't find code I altered ```js
var person = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[1]));
if(!person) return message.reply("I CANT FIND THE USER " + person)

        let mainrole = message.guild.roles.find(role => role.name === "Newbie");
        let role = message.guild.roles.find(role => role.name === "mute");
       

        if(!role) return message.reply("Couldn't find the mute role.")


        let time = args[2];
        if(!time){
            return message.reply("You didnt specify a time!");
        }

        person.removeRole(mainrole.id)
        person.addRole(role.id);


        message.channel.send(`@${person.user.tag} has now been muted for ${ms(ms(time))}`)

        setTimeout(function(){
           
            person.addRole(mainrole.id)
            person.removeRole(role.id);
            console.log(role.id)
            message.channel.send(`@${person.user.tag} has been unmuted.`)
        }, ms(time));



    break;
}

});

robust arrow
#

Can you just members.get with the full "<!blahblah>" string?

#

I've pulled the numeric ID out, but maybe I didn't need to -.-

lucid pasture
#

hey does anyone know how to do one command to make all messages sent by the bot a embed

robust arrow
#

If you know the technique for any given message, apply it to the condition that the message came from the bot itself

#

And hasn't already had the operation performed~

lucid pasture
#

confused noises

#

nvm i got it

robust arrow
#

Do they not hear their own messages?

#

They may not, I may be way off

wicked pivot
#

anyone use quick.db here?

knotty steeple
#

can u just say what u want

wicked pivot
#

I just made a leaderboard "xp" but it lists me the XP to use them from all the server, and I would like it to list me as that of the server where I ordered

let TopMsg = db.all(`Msg_${message.guild.id}`)
      TopMsg.sort((a, b) => {
        return b.data - a.data
      })

      let bb = TopMsg.map((g, index) => `**${(index + 1)}**)  <@${g.ID.split("_")[2]}> / ${g.data}`).slice(0, 10).join("\n")

      let embed = new Discord.RichEmbed()
      .setTitle("Top 10 des membres sur le serveur")
      .setDescription(`${bb}`)

      return message.channel.send(embed)```
clever radish
#

Anyone been experiencing an increased amount of shard disconnects/reconnects over the last few days?

knotty steeple
#

blame discord

clever radish
#

That I was aware of, just seems like today was particularly bad (caused a token issue) which is why I was curios; haven't been able to track down / reproduce what caused a string of them earlier this morning

sudden geyser
#

I don't know if that announcement has to do with mine, because it freaks out and spam a ton of disconnects frequently (like 0.4 seconds) then calms down.

wicked pivot
#
//VoiceStateUpdate
let newUserChannel = newMember.voiceChannel
let oldUserChannel = oldMember.voiceChannel

//TypeError: Cannot read property 'voiceChannel' of undefined```
v11
quartz kindle
#

wdym combine them

#

@wicked pivot oldMember may be null

#

@peak fractal you mean this? [http://myurl](http://myurl)

prime cliff
quartz kindle
#

yeah

#

but wdym combine them?

#

its label and url

#

test isnt an url tho?

#

oh you mean put it inside ` ?

#

hmm let me check

sudden geyser
#

You need to put the backticks in the label, not around the entire url thingy

#

You sure? Can you show the string in your code

quartz kindle
#

this works for me

#
[`mytext`](http://google.com)
prime cliff
#

You broke it because of [ ]`( )

#

` ` would have worked too i think

quartz kindle
#

nope

#

second one is with backticks around everything

wicked pivot
#
unction write(){
  fs.writeFile("./data.json", JSON.stringify(data), (err) => {
      if (err) console.log(err)
  })
}```is it good? because my bot doesn't write in json
sudden geyser
#

what's data

wicked pivot
#

it's for temporary stock

quartz kindle
#

you can also bold and italic and even code block it

#

and the link in code blocks actually works

sudden geyser
#

nasty

quartz kindle
#

[```google.com```](url here)

prime cliff
#

[```google.com```](url here)
This is weird but never tried it before lol

sudden geyser
#

oh god that actually works

#

wait that could actually look good

prime cliff
quartz kindle
#

spicy

prime cliff
#

I might actually use that trick for something

split hazel
#

Keep in mind this isn't the same for mobile @prime cliff

prime cliff
#

True i wonder how it looks on mobile hmm

split hazel
prime cliff
#

LUL

quartz kindle
prime cliff
#

Thanks mobile for markdown support lul

quartz kindle
#

lmao

split hazel
#

Discord dev team isn't very on sync with each other 😔

#

Years off sync

sudden geyser
#

mobile users can suffer

#

the future is now

split hazel
#

👀

regal saddle
#

Phone embeds = sick but weird

wicked pivot
#
const DataVoice = new Map()

bot.on("voiceStateUpdate", async(oldMember, newMember) => {
  if(oldMember.user.bot) return;
  guild = oldMember.guild
  let newUserChannel = newMember.user.voiceChannel
  let oldUserChannel = oldMember.user.voiceChannel
  if(oldUserChannel === undefined && newUserChannel !== undefined) {
    let bal = db.fetch(`Voice_${oldMember.guild.id}_${oldMember.user.id}`)

    if(bal === null) bal = 0

    DataVoice.set(oldMember.user.id, Date.now())
  }else if(oldUserChannel !== undefined && newUserChannel === undefined) {
    let total = (DataVoice.get(oldMember.user.id) - Date.now())

    db.add(`Voice_${oldMember.guild.id}_${oldMember.user.id}`, total)

  }
})```
I was barely a second and it gave me this:
regal saddle
#

I dont really get it, whats your problem here?

wicked pivot
#

i think the problem comes from here

let total = (DataVoice.get(oldMember.user.id) - Date.now())```
this is supposed to give me the time i'm staying on vocals in ms
regal saddle
#

mh, i cant help you here. Never used Voicechat stuff dev_blob_shrug
Sorry.

lyric mountain
#

Wait

#

So we can use emotes as buttons?

#

Now I need to try that

proper mist
#

how do you host discord.js github bot on heroku, every time I try, it changes my token

lyric mountain
#

It changes because a token is composed of a timestamp and the actual code

#

Just put the token there, it'll work

prime cliff
#

discord.js github bot ThonkangEyes

#

Clones are not allowed on this list btw

lyric mountain
#

My bot is a java github bot

#

Github is a repo lol

cerulean pebble
#

is nsfw accepted ?

#

i will set nsfw level in my command

cerulean pebble
#

🙂 why data get error 🙂

sudden geyser
#

nsfw must be in nsfw channels only. nsfw cannot be primary purpose of bot.

#

why does your data get an error

cerulean pebble
#

oke

#

@sudden geyser idk =))

sudden geyser
#

well

#

what is the error

#

what is your code about

#

etc.?

#

I can't read your mind (or can I)

astral yoke
#

test

#

okay it works

#

i had to reset my wifi lol

#

anyways

#

can someone help me fix this error npm ERR! integer@3.0.1 install: `prebuild-install || npm run build-release

#

cause if i do either of the ones in the both dont work

summer delta
grizzled raven
#

how do you send a message attachent back?

sudden geyser
#

yeah course I can

pine aspen
#

Hey, how can i do to check when a 'user/member' joins the guild if it's a bot user DJS v12

#
bot.on('guildMemberAdd', async (member) {
  if(member.bot) {
    // Add bot role
  } else {
    // Add member role
  }
})

(I got the role giving working).

warm marsh
#

member.user.bot?

pine aspen
#

I'll try..

#

Ah, yeah thanks.

earnest phoenix
#

help me guilds icon url save it SQL erro code ```js

Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'https://cdn.discordapp.com/icons/665282871505977363/fc6b015f823898ce6e66fd1c037f' at line 1

code: 'ER_PARSE_ERROR',
errno: 1064,
sqlMessage: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'https://cdn.discordapp.com/icons/665282871505977363/fc6b015f823898ce6e66fd1c037f' at line 1",
sqlState: '42000',
index: 0,
sql: "INSERT INTO prefix (sid, prefix, servername, serverimage) VALUES ('665282871505977363', '-', 'asd, 'https://cdn.discordapp.com/icons/665282871505977363/fc6b015f823898ce6e66fd1c037fa8cb.png')"
}```

#

js code js con.query(`INSERT INTO prefix (sid, prefix, servername, serverimage) VALUES ('${message.guild.id}', '-', '${message.guild.name}, '${message.guild.iconURL({ format: 'png' })}')`);

west spoke
crude phoenix
west spoke
#

what the hell

#

i can hardly even read that

#

oh

crude phoenix
#

I'm sorry

west spoke
#

the bot needs to be in this server to have its status show

crude phoenix
#

I don't speak English

#

Translate

#

😦

#

unknown status

#

wrıte

west spoke
#

botum needum to be in serverum (help me)

crude phoenix
#

Ok. Thank you 🙏🏻

west spoke
#

PFFFT

#

no way that worked

crude phoenix
#

Did you say it to me

west spoke
#

idk

earnest phoenix
#

help meeee pls ```js
code: 'ER_PARSE_ERROR',
errno: 1064,
sqlMessage: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's OOF Shop', 'https://cdn.discordapp.com/icons/500394164484309002/07ca209813a4a3' at line 1",
sqlState: '42000',
index: 0,
sql: "INSERT INTO prefix (sid, prefix, servername, serverimage) VALUES ('500394164484309002', '-', 'Tomo's OOF Shop', 'https://cdn.discordapp.com/icons/500394164484309002/07ca209813a4a3066c074b3bb62767dc.webp')"

#

why are you storing the name and the icon

#

Leaderboard system

#

yes and storing the name and icon is not the solution

#

why?

#

store the id and then pull the data from your bot

#

because the name and icon can change anytime

#

if it changes it will be updated in the system

#

and if you store any data that are not ids, you're legally required to encrypt that data

#

it isn't granted to be updated

#

they are also encrypted

#

x doubt

#

that's not what your sql script says

#

anyways

#

md5 encoding

#

your bot won't have a 100% uptime and you cannot just hope it doesn't go down and updates changes realtime

#

why?

#

plus imagine the waste of resources tracking all of the guild changes

#

what do you mean why

#

nothing has a 100% uptime

#

latest server processor i don't think

#

plus 32 gb ddr4 ram

#

and 3 TB storage

#

that doesn't grant it's not going to have downtime lol

#

plus bot downtime varies from a variety of factors like the bandwidth, the api etc.

#

so at the moment there was no problem with it so far it has worked that way

#

just because it works™️ now it doesn't mean it's going to work™️ later

#

bandwidth = 500+ mb download nad 500+ mb upload

#

i didnt ask

#

you're bound to run into an issue sooner or later because this kind of infrastructure is trash

#

if there are any problems later I will fix it

#

it will be too late to fix it once you accumulate so much data lol

#

i dont get why you won't just store the id

#

store the id and then just let the bot pull actual real time data

#

and how can i do that?

#

PHP website and NODEJS bot they run separately SQL goes from one place

#

oh god

#

i thought this couldn't get any worse

#

i thought wrong

#

😄

#

why don't you use node as your backend

#

there are a ton of node web frameworks, most common one being express

#

because i can't cause js oauth2 error, so i solved it differently

#

or PHP brings better understanding than node js for website writing

#

excuses excuses

#

no excuse just i can't do the login and error please download something i don't get

earnest phoenix
#

help node js sql update Special charachter ??

hasty sparrow
#

@earnest phoenix Escape your input/Use prepared or correctly parameterized statements

delicate garnet
#

can you help me to make a clear/purge order please?

iron steeple
#

What language?

delicate garnet
#

Javascript

iron steeple
delicate garnet
#

thx

#

I can't understand the site can you help me with the clear order please?

pale vessel
#

if you don't understand a simple documentation, you won't even be able to understand us

broken ruin
finite bough
#

official docs r more recommended here

#

but do as u please

broken ruin
#

I mean about learning JS

finite bough
#

that is not js that is d.js

broken ruin
#

d.js require ("javascript")

true ravine
#

Do the privileged intents toggles in the developer portal actually change anything yet or will they come into effect in october?

earnest phoenix
#

they're already in effect i think

#

e.g. you won't receive presence data unless you enable the intent

astral yoke
#

wassup

#

i need help

#

so like

#

i have in my message handler

#
        let pre = bot.db.fetch(`prefix_${message.guild.id}`)
        if(pre) {
        message.channel.send(`Howdy there. The prefix here is \`${pre}\`. Have fun!`)
        }
        if(!pre) {
            message.channel.send(`Howdy there. The prefix here is \`db!\`. Have fun!`)
        }
    }```
#

but the problem

#

is that its not like only for pinging it

#

if you do like

#

aieufhwiaeufbhiby @..bot it still responds to it

#

and its not supposed to

#

only respond to

#

@..bot

#

not like a full sentence then ping

earnest phoenix
#

then just check if the message content starts with the mention
..?

astral yoke
#

hm

#

how would you make it only respond to its own bot mention?

#

like if its a ping then anywhere else a letter it dosen't yk send it unless its just a alone ping?

earnest phoenix
#

by checking for the bots mention lol

quartz kindle
#

isMentioned means if the bot is mentioned in the message, it can be anywhere in the message

astral yoke
#

mhm

quartz kindle
#

not necessarily the beginning

astral yoke
#

mhm

earnest phoenix
#

mentions are in a <@id> or <@!id> format

#

simply check if the content starts with either of those two

astral yoke
#

the thing is

#

i dont want it still responding like

#

@..bot h

#

and it still responds

#

i want it only to respond to

#

@..bot

#

if any other letter is there it denies doing it

earnest phoenix
#

then check if the content exactly matches the mention lol

quartz kindle
#

^

wintry spire
#

Can i be a bot developer

#

?

earnest phoenix
#

no sorry

astral yoke
quartz kindle
#

and you'll get the role

wintry spire
#

Ok

astral yoke
#

that dont even work

#

I did <@!theid> and I pinged with something after and it still responded

#

I put both as well

#

<@theid> and <@!theid>

earnest phoenix
#

what's your code

astral yoke
#
        let pre = bot.db.fetch(`prefix_${message.guild.id}`)
        if(pre) {
        message.channel.send(`Howdy there. The prefix here is \`${pre}\`. Have fun!`)
        }
        if(!pre) {
            message.channel.send(`Howdy there. The prefix here is \`db!\`. Have fun!`)
        }
    }```
#
        let pre = bot.db.fetch(`prefix_${message.guild.id}`)
        if(pre) {
        message.channel.send(`Howdy there. The prefix here is \`${pre}\`. Have fun!`)
        }
        if(!pre) {
            message.channel.send(`Howdy there. The prefix here is \`db!\`. Have fun!`)
        }
    }```
earnest phoenix
#

that's not what i said to do

astral yoke
#

by checking for the bots mention lol **mentions are in a **

earnest phoenix
#

and then you said you wanted it to not respond if there was anything after the mention

#

and then i said what i linked

astral yoke
#

omfg

#

im retarded

earnest phoenix
#

guys i need help

astral yoke
#

thanks for dealing with the special ed zoomeyes

earnest phoenix
#

my bot's token is correct but it says "An invalid token was provided"

#

i regenerate token 3 times but error is same

#

then it isn't correct

#

no

#

computers don't lie

quartz kindle
#

show your client.login()

cinder patio
#

are you sure you are saving the code / restarting the process

earnest phoenix
#

client.login(client.settings.token)

#

yes

#

i'm sure

cinder patio
#

This looks like glitch, so can you truly be sure?

#

console.log client.settings.token

earnest phoenix
#

ok

#

i'll try

cinder patio
#

It's the same as the token on the discord developers page?

earnest phoenix
#

yes

cinder patio
#

I dunno then, are you sure the error isn't from before? I am not sure if the glitch console gets cleaned every time it restarts the process

#

is your bot online?

earnest phoenix
#

i asked this on discord api server and somebody is said me "maybe your bot account got tempbanned"

#

is your bot online?
@cinder patio yes

cinder patio
#

so everything is fine?

earnest phoenix
#

oh sorry

#

not online

cinder patio
#

Maybe it really was banned then

#

maybe cause it's hosted on glitch

earnest phoenix
#

too much bot is hosted on glitch

#

are you sure that the token isn't getting invalidated by discord because it keeps getting leaked

#

check your email to confirm that

modest maple
#

Discord also Dms you when it gets reset by them now, i would still say regen it, blocking a little bit of the token is still not good

earnest phoenix
#

check your email to confirm that
@earnest phoenix i didn't any mail from discord

#

try to manually hit an endpoint with the token

#

how?

quartz kindle
#

if you want, you can dm me your token and i'll test it for you

knotty steeple
#

zoomeyes

copper fog
#

Isn't tokens are super secret

#

owo

split hazel
#

👀

#

I'm sure Tim is trustworthy

slender thistle
#

That's up to you to trust your bot token to someone

quartz kindle
#

i've tested tokens for many people

copper fog
earnest phoenix
#

you can just regenerate the bot token

quartz kindle
#

but of course, dont do it if you dont trust me

digital ibex
#

hi

steep flame
#

I'm going to drop my question here right away 😂

#

I have a problem and we do not find the problem, when I launch my bot (with the token "test" it works very well, but when I launch it on the main token, I get no response.

note: the token is correct since it is the same one that works for my colleague, and it works perfectly .. do you have a suggestion? because we dry on our side

thx 😅

digital ibex
#

i'm trying to create custom commands for my bot but does anyoen kno why commands are not updating in the db?

#

code:

#
await guild.updateOne({ $addToSet: { name: args[0] } });
await guild.updateOne({ $addToSet: { response: args.slice(1).join(' ') } })
``` with mongoose
quartz kindle
#

@steep flame how many guilds is the main bot in?

steep flame
#

33

quartz kindle
#

are you using discord.js?

steep flame
#

yep

quartz kindle
#

does the ready event work?

steep flame
#

yes it works with my colleague but with me it launches but does not answer at all ...
client.on('ready' . yes it works

#

i'm sorry xD

quartz kindle
#

if the ready event works, then the problem is in your code, maybe wrong prefix or something

formal solar
#

On my computer with exactly the same code it's run normaly

steep flame
#

thx drim haha

formal solar
#

^^

earnest phoenix
#

i'm trying to create custom commands for my bot but does anyoen kno why commands are not updating in the db?
@digital ibex do you fixed it?

#

I have,the same problem

lusty quest
#

can someone explain why 2+1 = 21 in node.js ( fetch a number from a mysql database and use it in a calculation)

slender thistle
#

string1 + string2 = string1string2

#

Make sure they both are numbers

modest maple
#

aka they need to be a integer datatype

lusty quest
#

thx

digital ibex
#

@earnest phoenix no

golden condor
#

@lusty quest you gotta do this

#

parseInt(string1) + parseInt(string2)

#

You gotta check if they can be converted

cinder patio
#

Or you can store the numbers as integers/floating points in your database

thorny meteor
#

How to find emoji id from a message that contain emoji?

lusty quest
#

got it already sorted out @golden condor changed my database column to interger

iron steeple
#

@thorny meteor what library

thorny meteor
#

discord.js

iron steeple
golden condor
#

Ok

iron steeple
#

@thorny meteor did it work?

thorny meteor
#

whats not what i meant @iron steeple

#

example : someone sent a emoji in a message
i need to find it's id from the message

iron steeple
#

Oh I see. I don’t actually use js so that was kind of my limit 😄

earnest phoenix
#

@blissful bridge

blissful bridge
#

?

hasty eagle
#

Someone know the ticket command ?

earnest phoenix
#

the ticket command

iron steeple
#

Do you mean how to code a ticket command?

idle mountain
#

@hasty eagle ticket command for which bot

inland cloud
#

Is the webhook for voting from top.gg broken or something? Did anything change since 07-04-2020 ?

knotty steeple
iron steeple
#

Should be working

hasty eagle
#

No like the code

#

@idle mountain

idle mountain
#

working fine for me

knotty steeple
#

make it urself

idle mountain
#

i only just realized this is the development channel and not off-topic dizzyPalm

#

sorry lol

iron steeple
#

It’s not a complicated command so maybe you should look over the basics of whatever language you are using

hasty eagle
#

Oh

#

I'm new there

nocturne grove
#

Why does this return null? It doesn't make sense.
console.log(message.guild.iconURL());

#

message object is valid, believe me 🙂
and it's sent in a guild

earnest phoenix
#

the guild doesn't have an icon?

nocturne grove
#

thanks 😂

gaunt blade
#

My bot got declined for this, so.. how do I filter the stuff? cause it uses the urban dictionary api.. and i didnt know that urban dictionary got that soo...

blazing portal
#

Lock it to NSFW channels

slender thistle
#

Locking the command to NSFW channels is enough S3KaedeShrug

gaunt blade
#

I wanna filter too :;/

#

if its not a nsfw channel

slender thistle
#

You're going to have a hard time filtering stuff

gaunt blade
#

ouf

#

imma lock it to nsfw then

summer torrent
gaunt blade
#

new Date().setTime?

#

idk

#

or use prettyMs or Moment.js?

slender thistle
#

There should be a method like "fromTimestamp"

surreal wagon
#

Reset is a date?

#

Or duration

gaunt blade
#

yep

slender thistle
#

Though it seems like how many seconds until something is reset, rather

sudden geyser
#

doesn't the Date object take the first arg as the time

summer torrent
#

that is "reset date" for ratelimit

knotty steeple
#

isnt that a timestamp

#

yea just do some math on it mmLol

surreal wagon
#

new Date(reset * 1000).toLocaleString()

summer torrent
#

lemme check

surreal wagon
#

I got this 06/24/2014 @ 9:33am (UTC)

#

It's normal ?

restive furnace
#

@summer torrent^

remote yacht
#
(node:14048) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'filter' of undefined```this error comes only if i use my invite command in this server
#
let memberInvites = invites.filter(i => i.inviter && i.inviter.id === member.user.id);
```this line
restive furnace
#

well show me how u did invites variablr bruh.

remote yacht
#
let invites = await message.guild.fetchInvites().catch((err) => {
            return;
        });```
sullen patrol
#

Doe anybody know how to make a webdashboard for your bot?

earnest phoenix
#

its basicially a pain in the webserver

#

you need a lot of endpoints and a bunch of html and interfaces

sacred mountain
#

Is there a way for me to log how many people are in the database for my bot? I was wanting to have it on the status saying something like helping 48 people or something but I’m not sure how to get the amount of ppl in the database.

earnest phoenix
#

What do you use for db?

summer torrent
#

@sullen patrol html/css + backend language

sacred mountain
#

@earnest phoenix idk it’s just a JSON file

sullen patrol
#

What do you use for db?
@earnest phoenix json

earnest phoenix
#

you can get the entries where all users are saved, if that is somewhere

#

and then use .length on it

#

so Object.entries(userObject).length

sacred mountain
#

Wait I’ll send a pic of what it looks like

remote yacht
#
(node:14048) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'filter' of undefined```this error comes only if i use my invite command in this server
sacred mountain
#

My database is like that

pale vessel
#

Object.keys(obj).length

#

so all the users

#

obj is your json file, require them

earnest phoenix
#

then you can just Object.keys(require("yourdb.json")).length to make it simple

sacred mountain
#

I hav no idea how to do that

pale vessel
#

t h i s

sacred mountain
#

I’m new to databases

pale vessel
#

he just told you how to do it

#

json is not even a db

earnest phoenix
#

what is the file name of your "database"

sacred mountain
#

userxp.json

#

Well it is sort of a database

earnest phoenix
#

is it in the same folder as your index?

sacred mountain
#

Yh

earnest phoenix
#

Object.keys(require("./userxp.json")).length

sacred mountain
#

Would I put that at the start?

#

I literally don’t know

earnest phoenix
#

that code returns the length of the users

pale vessel
#

servers*

earnest phoenix
#

oh wait

pale vessel
#

users are inside the keys

earnest phoenix
#

i forgot

#

he wants the users

sacred mountain
#

Oh

#

Yh

earnest phoenix
#

no wait

#

its userid: {serverid: {}}

#

so that's alright

pale vessel
#

no

sacred mountain
#

wait so where about do i put it

#

Object.keys(require("./userxp.json")).length

earnest phoenix
pale vessel
#

why would he do that?

earnest phoenix
#

i dont know

#

@sacred mountain lets say you want to set your status like this: Helping x users

sacred mountain
#

Yh

earnest phoenix
#

so you want to set your status and in the status you just add that little bit of code

sacred mountain
#

Oh

#

K

pale vessel
#

can you tell me which one is user id and server id? like in a clearer way

#

just want to make sure

sacred mountain
#

Idk

earnest phoenix
#

w h a t

sacred mountain
#

I watched a tutorial when I made it 🤣

pale vessel
#

well from the looks of it the code we gave you is for servers

earnest phoenix
#

you dont know how your db is structured

sacred mountain
#

I made it a while ago

pale vessel
#

again, "how your JSON is structured"

earnest phoenix
#

lemme just test something

#

@sacred mountain can you give me one id of your users

#

just one

sacred mountain
#

Why

earnest phoenix
#

because then i can check if that user exists

#

and if it doesnt, then that may be a server

sacred mountain
#

?

earnest phoenix
#

if it does we know the structure

sacred mountain
#

The server is within the user

#

I know that

earnest phoenix
#

so its user: {server: {data}}

sacred mountain
#

Yh

#

Exactly

earnest phoenix
#

alright

sacred mountain
#

Ok I hav another question

#

How do I update the status whenever the JSON file changes

pale vessel
#

so why are there so many servers for one user?

sacred mountain
#

That’s me

#

All my testing servers

#
  • some public ones
pale vessel
#

okay

sacred mountain
#

How do I update the status whenever the JSON file changes

#

But not the do

#

Do

#

*xp

earnest phoenix
#

@sacred mountain i dont think there is a way for node.js to detect file changes other than checking it every x ms and checking if the content changed, so i'd just make a 2 minute interval updating the status

pale vessel
#

yes there is

earnest phoenix
#

and that is?

sacred mountain
#

I mean it would work updating every 5 mins or so

earnest phoenix
#

who can help me

#

@pale vessel how can i see my client voters ?

sacred mountain
#

But I don’t rlly want that to change every time the file changes at all

#

I only want it to change when a user is added to it

pale vessel
#

well figure something out

earnest phoenix
#
require("fs").watch("userxp.json",function(event,filename) {
// update status here
})

@sacred mountain

#

if i read the docs correctly

#

@earnest phoenix help

pale vessel
#

that's for filename nm, it's correct

sacred mountain
#

oh i did bot.user.setActivity(Object.keys(require("./userxp.json")).length + ' people spam on ' + bot.guilds.cache.size + ' servers', {type: 'WATCHING'}).catch(console.error)

earnest phoenix
#

that works

sacred mountain
#

oh

#

ok

earnest phoenix
#

so just replace "// update status here" with your code

#

@earnest phoenix you need to make a call to the top.gg api

#

to check your votes

#

dblapi.js

sacred mountain
#

but the thing is with ur code u sent that will update whenever anything changed

#

i only want when a user is added

earnest phoenix
#

hM

sacred mountain
#

but its fine

earnest phoenix
#

thanks

sacred mountain
#

i will just do timer

earnest phoenix
#

wait there is a way but it includes pain

pale vessel
#

which is by not using json

sacred mountain
#

how will i do a timer function

#

im searching it now but cant rlly find what i need

pale vessel
#

setInterval() is for intervals

#

setTimeout()

sacred mountain
#

?

earnest phoenix
#

syntax: setInterval(function() {
// what to do when the interval fires
}, delayInMs)

pale vessel
#

he wants a "timer"

earnest phoenix
#

setTimeout() yea

#

ig with timer he means interval

pale vessel
#

idk, very vague for me

earnest phoenix
#

@sacred mountain do you want your event to fire once in x ms or fire every x ms

sacred mountain
#

every

earnest phoenix
#

alright, setInterval

sacred mountain
#

like maybe every 5-10 seconds

earnest phoenix
#

setTimeout() === setInterval()?

#

syntax: setInterval(function() {
// what to do when the interval fires
}, delayInMs)

#

@earnest phoenix no

#

K

sacred mountain
#

where would i put it in my code

#

does it need to be in a specific place

earnest phoenix
#

onReady is good

sacred mountain
#

K

#

Wait will it use a lot of CPU on my VPS having the timer

#

Every 20 seconds updating status

split hazel
#

does clicking a mouse use a lot of cpu

cinder dove
#

Anyone here using lavalink able to help me? ^^ (DJS)

static nexus
#

DPY

earnest phoenix
#

you didnt install cogs appearently

static nexus
#

uh
cogs is a part of the discord

earnest phoenix
static nexus
#

what do you use

earnest phoenix
#

discord.js because i dont code in python

static nexus
#

theres the prob

nocturne grove
#

Hi. I sometimes get this error with my MySQL database:
Error: read ECONNRESET
I guess I can't avoid this error, but how can I solve this. Will this work:

con.on('error', (error) => {
    console.log(error.stack);
    mysql.createConnection({
        host: database.host,
        user: database.user,
        password: database.password,
        database: database.name,
        charset: 'utf8mb4',
        collation: 'utf8mb4_unicode_ci',
    });
});```
sullen patrol
#

Is there a event that fires everytime that a event is fired? Discord.js

earnest phoenix
#

dont think so

sullen patrol
#

Ok

nocturne grove
#

I thought that was called a raw event, but can't find it in the docs

restive furnace
nocturne grove
#

I can't reproduce an error, or can I?

earnest phoenix
#

^

nocturne grove
#

otherwise I should wait and wait

earnest phoenix
#

ERRCONRESET is basicially a error fired when a connection resets

restive furnace
#

yes, so you just need to wait and see if it works

nocturne grove
#

yes but that's a waste of time if anyone here knows it

#

I mean: low chance it's working after the first try

earnest phoenix
#

are you by any chance using a single connection for all of your queries

hoary elm
#

Any chance someone can help me with this UnhandledPromiseRejectionWarning: TypeError: fields.flat is not a function

earnest phoenix
#

update node

hoary elm
#

Me?

earnest phoenix
#

yeah

hoary elm
#

Ok

#

V12 I'm guessing?

earnest phoenix
#

d.js v12 requires node v12+

#

yeah

hoary elm
#

Yeah thought so

#

I forgot to define the version so it used default thanks cry

nocturne grove
#

are you by any chance using a single connection for all of your queries
@earnest phoenix What do you mean? I just create a connection and export that one to all my command files

earnest phoenix
#

yeah don't do that

#

the general rule of thumb is to open a connection, execute a query, close the connection

nocturne grove
#

can't I re-export them after I reconnected the connection?

earnest phoenix
#

for every query you do, you open a new connection

pale vessel
#

cry i've heard of pools, what about them?

nocturne grove
#

but... that's a lot of work

earnest phoenix
#

it's not

#

connection pools are a good implementation however if you want true concurrency, do the above

#

pooling in node doesn't do much since node isn't multithreaded

nocturne grove
#

hm okay. Just for everything, selecting things from tables too?

earnest phoenix
#

yes

#

every query

#

Hi. I stopped bot for maintenance. And the bot was declined. If ı open the bot, do you add again?

#

you need to resubmit it

nocturne grove
#

okay so a kind of global function is the best way to go

earnest phoenix
#

pretty much, a service class or some sorts containing your functions

nocturne grove
#

okay

#

but before I will do that, why would I? Is it better or something

pale vessel
#

it is

earnest phoenix
#

if you notice a performance drop then do look into connection pooling too

#

i've never used it on node personally so i can't say much

pale vessel
#

that's what i currently use

#

plus some caching

nocturne grove
#

hm okay

#

so just every time do const con = mysql.createconnection ... and then do con.connect()?
I never did the last one because that caused errors

pale vessel
#

connect and disconnect after you're done i'm assuming

molten yarrow
#
mysql.createPool({
})

fixed ECONNRESET for me

nocturne grove
#

okay thanks

#

fixed ECONNRESET for me
@molten yarrow omg but that's a lot easier

#

:/

molten yarrow
#

hm?

nocturne grove
#

a lot easier than making a connection each time you're doing a query

static nexus
#
import discord
import asyncio
import random
import time
import logging
import typing
from discord import Client
from discord.ext import commands
bot = commands.Bot(command_prefix=commands.when_mentioned_or('drip!'))
initial_extensions = ['cogs.fun',
                      'cogs.help',
                      'cogs.mod)']
if __name__ == '__main__':
    for extension in initial_extensions:`
        bot.load_extension(extension)```

????
slender thistle
#

What's the class called in cogs.fun

static nexus
#

its called fun

slender thistle
#

Screenshot nekothinking

static nexus
#

seperate file

slender thistle
#

Full code please

static nexus
#

dont worry i got it

earnest phoenix
#

why i am get this?

pale vessel
#

are you embedding the bot page inside the bot description

earnest phoenix
#

@pale vessel that's an Outstanding move

knotty steeple
#

shiv already said stop with the markdown didnt they

earnest phoenix
#

@pale vessel yep in the detailed description

pale vessel
#

but why

knotty steeple
#

but why

earnest phoenix
#

what do you mean by why?

topaz fjord
knotty steeple
#

^

topaz fjord
#

there's no point

earnest phoenix
topaz fjord
#

anyways if you're trying to embed your own bot page it must be https

restive furnace
#

no, embed in ur bot page ur bot page, in ur bot page, in ur bot page, in ur bot page.

#

so basically it would create a cool illusion

earnest phoenix
#

why would you embed top.gg in top.gg
@topaz fjord i want to make my bot page more interactive by html

pale vessel
#

that's not how you do it

#

and how is that interactive

copper cradle
#

lma o

low bolt
#
      console.log(sentembed.id)
      sentembed.react("🎉")
    });```

Hello guys, I'm trying to fetch message id, but says "Cannot send an empty message". Why saying like that? Message is sending to channel, but i can't fetch message id.
topaz fjord
#

you can use HTML and CSS inntbe long desc to do that 👀

copper cradle
#

what are you even trying to do

earnest phoenix
#

yes

low bolt
#

Reaacting too.

topaz fjord
pale vessel
#

channel.send?

copper cradle
#

@low bolt show what embed is

pale vessel
#

oh you defined the channel

low bolt
#

const server = client.guilds.get(serverid); const channel = server.channels.get(channelid)

copper cradle
#

The error said

low bolt
#

 const embed = new Discord.RichEmbed() .setTitle(prize) .setDescription(`**Time Left:** ${client.time(endat - startat)}\nReact :tada: to join giveaway.`) .setFooter(`${winner} winners | End At`) .setTimestamp(new Date(endat).toISOString());

pale vessel
#

sentembed is a message so that's fine

#

cannot send means it didn't send the embed

low bolt
#

It sends message

pale vessel
#

did it send the embed?

low bolt
#

To channel

#

yes.

cinder dove
#

Anyone here used/using lavalink and erelajs?

#

Need some help

pale vessel
#

shoukaku gang

low bolt
#

Maybe waiting a little bit

#

Will solve?

pale vessel
#

nope

#

you added .then

low bolt
#

true.

pale vessel
#

try console.log(sentembed)

low bolt
#

It shows normally

#

and it works now wtf

#

703615436402589736

static nexus
#

?

#
import discord
import asyncio
import random
import time
import logging
import typing
from discord import Client
from discord.ext import commands
initial_extensions = ['cogs.fun',
                      'cogs.help',
                      'cogs.mod)']
bot = commands.Bot(command_prefix=commands.when_mentioned_or('drip!'))
if __name__ == '__main__':
    for extension in initial_extensions:
        bot.load_extension(extension)
@bot.event
async def on_ready():

    print(f'\n\nLogged in as: {bot.user.name} - {bot.user.id}\nVersion: {discord.__version__}\n')
    # Changes our bots Playing Status. type=1(streaming) for a standard game you could remove type and url.
    activity = discord.Game(name="I hate lockdown. | drip!help", type=3)
    await bot.change_presence(status=discord.Status.idle, activity=activity)
    print(f'Successfully logged in and booted...!')```
earnest phoenix
#

Does anybody know what mfaLevel is on a guild?
(What does it mean)

knotty steeple
earnest phoenix
#

yep

#

@knotty steeple
Are you talking about guild.verificationLevel or guild.mfaLevel?

knotty steeple
#

ok thats a thing

#

nevermind then

#

idk what it is

earnest phoenix
#

Hmm strange

slender thistle
#

Indicates the guild’s two factor authorization level.

#

It's for moderation

earnest phoenix
#

Oh i see...

cinder dove
#

Anyone using ytdl-core / lavalink & erelajs who can tell me where I did wrong?

#

I have no errors - so I don't know where I'm wrong ^^

static nexus
#

hrm

pale vessel
#

you didn't send anything

#

or we missed it

cinder dove
#

I was waiting for someone who uses ytdl-core

#

If you don't use ytdl-core most probably you won't have any idea of what the problem may be ^^ but it's okay, someone is already helping me.

pale vessel
#

i used ytdl-core and lavalink (shoukaku)

#

but okay then

static nexus
#

how do we use bot.event with cogs

#

dpy

slender thistle
#

What exactly do you want to do

static nexus
#
    if isinstance(error, commands.MissingPermissions):
           await ctx.send("There's no right for you to be using this command!(Missing Permissions)")```
#

check permissions

ionic compass
#

Will I need privileged intent to list guild members, or view bans? Im trying to understand what the whole "Privileged intent" thing means

slender thistle
#

Do you really need an event for that

rare mist
#

Shivaco can my bot awnser if its pinged just to give the prefix information about the guild

static nexus
#

yes

slender thistle
#

Yes

rare mist
#

Thx

ionic compass
#

wait who was that directed towards

rare mist
#

me

ionic compass
#

i mean the question

Do you really need an event for that

static nexus
#

wait no i dont

slender thistle
#

You just apply a decorator to the on_command_error function, that's all you need to make it an event

#

Most of the time you won't need bot.events

empty owl
#

How would I make a message builder that loops through a series of questions which are in an array

#

For example,

#
let array = [
"What's your name",
"What's your age?"
]
#

and it would do a prompt

#

When i try to do a forEach

#

it just sends all the messaegts at once

knotty steeple
#

make a loop

#

u can put awaitMessages in a loop

#

u can maybe do a function that calls itself

#

i did that

restive furnace
#

or use stringbuilder

toxic jolt
earnest phoenix
#

@toxic jolt 2-3 weeks just like the dbl approval

toxic jolt
#

hmm

empty owl
#

u can maybe do a function that calls itself
@knotty steeple wot

#

I have this prompt

knotty steeple
#

approval is 1-2 weeks but ok

empty owl
#

as a function

#
module.exports = async (message, prompt) => {
    const filter = (response) => response.author.id === message.author.id;
    const instance = await message.reply(prompt);
    return message.channel.awaitMessages(filter, { maxMatches: 1, time: 60000, errors: ['time'] })
        .then(collected => {
            const content = collected.first().content;
    
            collected.first().delete();
            instance.delete();
            return content;
        })
        .catch(_ => {
            instance.delete();
            return undefined;
        });
};
#

but

#

when I put it in a foreach loop

toxic jolt
#

I was waiting 2 weeks if I don't guess wrong

empty owl
#

it just sends them all at once

restive furnace
#

use for in loop instead of forEach, that might help.

maiden mauve
#

Mmmmm that feeling when your about to turn a two-page switch case into 1 line

#

💪

restive furnace
#

oo thats actually a big brain

empty owl
#

use for in loop instead of forEach, that might help.
@restive furnace How would i do a for in loop if its an array

pale vessel
#

for (let element of elements)

#

elements = array

empty owl
#

okay

pale vessel
#

if you want the keys only, you can do for in loop instead

empty owl
#

okay ty

low bolt
#

Why I'm getting undefined when trying this function?

    db.get("Giveaways").forEach(giveaway => {
        const server = client.guilds.get(giveaway.ServerID)
        const channel = server.channels.get(giveaway.ChannelID)

        const message = channel.fetchMessage(giveaway.MessageID).then(msg => {
          const embed = new Discord.RichEmbed()
            .setTitle(giveaway.Prize)
            .setDescription(`**Time Left:** ${client.time(giveaway.EndAt - Date.now())}\nReact :tada: to join giveaway.`)
            .setFooter(`${giveaway.WinnerCount} winners | End At`)
            .setTimestamp(new Date(giveaway.EndAt).toISOString());
          msg.edit(embed)
          return true;
        })
        return true;
    })
  }```
real bison
#

@spare goblet so I saw you declined my bot (sorry if this isn't the right place) for allowing anybody to kick (and something else which I just fixed), and I'd like more details about that as I can't replicate it in testing and looking at the code, it should work as intended?

wheat jolt
#

If I listen on port 80 without using https.createServer it works as expected

static nexus
#

DPY how do you do a timed mute?

restive furnace
#

@wheat jolt prob better ask some server what is focused in these, cause here you probably aint getting help. (i dont know neither)

wheat jolt
#

oki

static nexus
#

DPY how do you do a timed mute?

spare goblet
#

@real bison pls dm me

balmy knoll
#
client.user.setActivity(`${client.users.cache.size} utenti`);

Why this code doesn't set any activity?

low bolt
#

@balmy knoll v11 or v12?

balmy knoll
#

@low bolt v12

low bolt
#

clientUser.setActivity(`${client.users.cache.size} utenti`);

#

try it

amber fractal
#

uh

#

that wont be defined

#

and a ClientUser is returned from client.user

earnest phoenix
#

@balmy knoll the one you used is correct

pale vessel
#

his code is already correct

#

it probably discord being discord

earnest phoenix
#

@balmy knoll discord is drunk try later

#

Embed images and all are broken

low bolt
#

True :p

balmy knoll
#

Ok i wait

static nexus
#
@commands.command()
 @commands.has_permissions(kick_members=True)
 async def tempmute(ctx, member : discord.Member, time : int):
    guild = ctx.guild
    for role in guild.roles:
       if role.name == "Muted":
        await member.add_roles(role)
        await ctx.send(f"{member.name} was muted")
    if member is None:
        await ctx.send("please pass in a valid user")
        return
        await asyncio.sleep(time)
        await ctx.send(f"{member.name} was unmuted")
        await member.remove_roles(role)```
summer torrent
restive furnace
#

well try log new Date() and log it and new Date(urtimestampherr)

elder vine
#

Shouldn't be unormal?

static nexus
surreal wagon
#

moment(timestamp * 1000).fromNow()

#

But it is not very precise

#

Maybe moment.duration((new Date() - timestamp * 1000)).format('...')

summer torrent
#

thanks :+1:

static nexus
#

how do we check if a user is an admin

amber fractal
#

what library

static nexus
#

dpy

slender thistle
#

member -> guild_permissions -> administrator

modest maple
#

shiv

#

i need ur help

#

do u have vlc installed?

slender thistle
modest maple
#

sorta

#

if you do pip install python-vlc

#

and then import vlc

lusty quest
#
        // Send the question in the current channel
        message.channel.send(questions[i].question);
        // Await for the answer
        let answer = await message.channel.awaitMessages(m => m.author.id === message.author.id, {
            max: 1,
            time: 30000,
            errors: ['time']
        }).catch(() => {
            // If the user doesn't answer to the question, save "The user didn't respond" as the answer
            questions[i].answer = "The user didn't respond";
        });
        // If the user provides a answer, save it
        questions[i].answer = answer.first().content;
    }```
Uses an Array of Questions and broke over night without changing anything. its still on V11. Did someone got an idea why .content is undefined?.
modest maple
#

does it work or does it commit no C lib

slender thistle
#

It works good on my end

modest maple
#

okay

#

ty

earnest phoenix
languid heart
#

Hi i need help

#

@modest maple can u help me

modest maple
#

hi help im cf

languid heart
#

Thx

modest maple
#

dont ask to ask

languid heart
#

Ok

split hazel
#

-ask2ask

gilded plankBOT
#

Don't ask to ask.
Just ask your question, it wastes time if you say "i need help" or "can someone help me?" instead of just saying what the problem is. Save your time and other people's time and just ask the question.

Please read https://dontasktoask.com/ for an explanation on why this is an issue.

languid heart
#

I need help beacuse i have an app named node to create a bot but i am on Mobile

gloomy imp
#

Is there somewhere with like a javadocs-type thing for the Discord api?

languid heart
#

So idk how to create a bot there

modest maple
gloomy imp
#

aha thx

modest maple
#

@languid heart literally no idea what u mean

gloomy imp
#

wait what if I'm using C#

#

similar?

split hazel
#

I believe they mean they have a node.js app on phone, and they don't know how to make a discord bot

modest maple
#

wait wait wait

#

There are diffrent libs for diffrent langs

#

what lib are you using

gloomy imp
#

um

#

I think?

modest maple
sudden geyser
#

I need help beacuse i have an app named node to create a bot but i am on Mobile
Do you not have a PC?

gloomy imp
#

ahaa

#

thx

opaque kite
#

pro tip:* Simply open glitch.com and turn on desktop mode on chrome

sudden geyser
#

ehh

#

not everyone uses glitch

opaque kite
#

For mobile users

maiden mauve
#

the fruits of my labor

turbid bough
#

turnPage(int)

#

or use an enum

sudden geyser
#

you genuinely should not need to use eval

turbid bough
#

eval is just an another easy way to access your token

earnest phoenix
#

how can we retrieve information that if args [0] is not a mention of a channel then its return?

turbid bough
#

just do the same as you would check for mention, but with # instead

#

<@ botid> <# channelid>

nimble escarp
#

pepeUp you can also check for role mentions <@&role-id>

turbid bough
#

huh, so mods can add a way to check if they are pining the mods, then they can automatically send a warning when they do

maiden mauve
#

just wanted to circumvent a series of switch cases

#

I'm aware eval is evil

#

but that code theorhetically handles any length of menu i toss at it

sudden geyser
#

where is m defined and what is m

maiden mauve
#

m is just a library of data blocks

sudden geyser
#

I mean you could use bracket notation

maiden mauve
#

could probably avoid defining the domain with a line of code too

#

just wanted to see it work

cinder dove
#

Hello, i Have a question. Is there an API to check if someone voted for your bot?

#

Curious for future development.

humble egret
#

Does anyone know how I can make the server count on the website working?

sudden geyser
#

Hello, i Have a question. Is there an API to check if someone voted for your bot?
yeah https://top.gg/api/docs#bots (Individual User Id Voting Check for the past 12 hours.)

#

If you're using a library, there may be a built-in method for it.

cinder dove
#

thank you

sudden geyser
#

@humble egret post to DBL.

#

as in send a post request to top.gg with your stats

earnest phoenix
#
if(!captchaChannel) return message.channel.send("❎ | **Veuillez mentionner le salon de vérification et le rôle de verification souhaité.\nExemple: `c?setup #channel @role`**")
let captchaRole = message.mentions.roles.first()```
sudden geyser
#

either a library or manually, which is in the documentation

earnest phoenix
#

Is good for roles? I don’t sure

cinder dove
#

Oh so there's a library

humble egret
#

@sudden geyser ahh thank you :)

cinder dove
#

I'll check into it once my bot is accepted.

fallow quiver
#

I want to make my bot read if a member has a role, but rather than by ID, how do I check it by name

sudden geyser
#

Is good for roles? I don’t sure
@earnest phoenix did you try it?

cinder dove
#

with find function @fallow quiver

sudden geyser
#

like what are you trying though

cinder dove
earnest phoenix
#

args[0] = mentions.channels()
args[1] = mentions.roles()
@sudden geyser

cinder dove
#

Don't use first() for both vinx. I'm not sure it will work.

sudden geyser
#

confused, is that actually in your code?

cinder dove
#

Use args, get the id and it'll work properly. @earnest phoenix

earnest phoenix
#

no kinolite

#

i search solution x)

#

args. Ok

cinder dove
#

for channel use .first() and for second option you can just slice it up and use .get for the ID it resulted

sudden geyser
#

you can still use .roles.first() though

cinder dove
#

Doesn't .first get the mentions?

#

Or it's different between roles and channels.

sudden geyser
#

.first on the Collection instance gets the first item in the collection.

cinder dove
#

try your first method, if you have errors use the method I've said earlier @earnest phoenix

sudden geyser
#

So if I have Collection<Snowflake, Role> (collection of roles), using .first() on it will get me the first Role.

cinder dove
#

Yeah, mention is not the collection so it should work for both

#

my method is useful in case you have 2 of same collection ^^

copper cradle
#

a collection is a fancy name for a map tbh

mossy vine
#

well

#

d.js collections are literally maps

#

but with extra utility methods

copper cradle
#

yeah

cinder dove
#

Someone new reading the docs wouldn't understand what a map is ^^

sudden geyser
nimble escarp
#

and .mentions are literally collections.

cinder dove
#

they're not.

sudden geyser
#

noop

ripe lantern
#

sorry im so dumb but how do i make a music command lol

cinder dove
#

@ripe lantern if you're new to djs it'll be hard. Search up some tutorials.

nimble escarp
#

Oh, my bad tho. Thought we meant mentions.users

cinder dove
#

You literally said .mentions are collections @nimble escarp

ripe lantern
#

im using python 3.6

nimble escarp
#

I know, it was a mistake in my brain pepeshrug

cinder dove
#

.users is a collection

pearl zodiac
#

hello

#

i have a question i run my bot on server
for playing music i have a problem :
PyNaCl library needed in order to use voice
anyone can help me for fix problem?

earnest phoenix
#
const figlet = require("figlet");
console.log(figlet.textSync('test').red)```
Anyone know why this is undefined...?
pearl zodiac
earnest phoenix
#

Resolved

summer torrent
#

Yes, for you and web mods.

#

wait for approval

earnest phoenix
#

Ok

pearl zodiac
#

@summer torrent can you help me?

#

i have a question i run my bot on server
for playing music i have a problem :
PyNaCl library needed in order to use voice
anyone can help me for fix problem?

summer torrent
#

is that python

pearl zodiac
#

yeah

#

i install

summer torrent
#

I am using js. Sorry I can't help you

pearl zodiac
#

ah okay , anyway thanks 🙂

earnest phoenix
#

load pylancı library

pearl zodiac
#

how i should load?

earnest phoenix
#

umm i forget to load library in python

#

oh i remembered

summer torrent
#

pip install ?

earnest phoenix
#

it will work too

#

import will work too

pearl zodiac
#

now i should install pip?

#

it will work?

modest maple
#

pip should already be installed ...

pearl zodiac
#

wait pls i want check my codes

#

yeah

#

i installed

#

i use it for install
py -3 -m pip install -U discord.py[voice]

languid heart
#

Hi how i put mod commands to my bot

#

With a coding app

earnest phoenix
#

What

#

Mod commands such as..?

languid heart
#

Moderation commands

earnest phoenix
#

oh i understand you

languid heart
#

Can u help me?

earnest phoenix
#

yes

languid heart
#

Thx

#

What i should do

mossy vine
#

please

  • dont code on mobile
  • learn the language you want to use
  • LEARN THE BASICS OF HOW BOTS WORK
copper cradle
#

code 'em

languid heart
#

I code on mobile ._. and it works

earnest phoenix
languid heart
#

With the app termux