#development

1 messages · Page 979 of 1

quartz kindle
#

@earnest phoenix delete muteTime or muteTime = undefined or muteTime = null will all probably work depending on what you want to do

earnest phoenix
#

ok thx

#

@quartz kindle can you help me?

#
    if(parseInt(muteTime) == null) delete muteTime;

So the Code will look like this ?

quartz kindle
#

welp, delete seems to only work for objects, not for primitives

#

just set it to undefined

earnest phoenix
#

oh

#

ok

ocean atlas
#

how do I replace bulkDelete methods

#

in discordjs v12

quartz kindle
#

wdym replace? they were never removed?

earnest phoenix
#

Anyone!?

#

if i set muteTime to undefiend so this will be true ?

if(!muteTime){
  //code
}
quartz kindle
#

it will be true with any of 0, null, undefined, "", NaN

earnest phoenix
#

:/

stable grail
#

yeah im waiting for help too xd

quartz kindle
#

@earnest phoenix try looping through all channels and filtering voice channels

earnest phoenix
#

I tried

quartz kindle
#

client.channels.cache.filter(c => c.type === "voice").reduce((a,b) => a + b.members.size,0)

#

something like that

earnest phoenix
#

thx

#

oh ok but im v11

tepid canyon
#

then the same thing without the .cache for v11

earnest phoenix
#

i know

tepid canyon
#

👍

ocean atlas
#

@quartz kindle i cant bulkdelete messages in channels in discord js v12

quartz kindle
#

show code

ocean atlas
#

tim

#

look at documentation

#

its gone

quartz kindle
#

its not gone

#

i sent you a link

gritty marten
#

.bulkDelete()

ocean atlas
#

tf

#

so then why doesnt this work ... ? client.channels.fetch("723199082486562857").bulkDelete(50)

quartz kindle
#

because fetch returns a promise

restive furnace
#

get

ocean atlas
#

it said get didnt work F

#

hold on

stable grail
#

how do i check the message from the author. He wrote !test but the bot should say that he should use !test [text] for example.

ocean atlas
#

do I have to use the cache here too now

gritty marten
#

Await at the start

restive furnace
#

check for args

quartz kindle
#

for get yes you need cache

#

for fetch no

#

get returns the channel from the cache, or undefined if not found
fetch returns a promise that resolves into a channel, from the cache, or from the api if not found in cache, or error if not found in the api

ocean atlas
#

ok

#

ty for help

#

i havent developed in a long time with discordjs and this new update is confusing me a lot

stable grail
#

how do i make an error for a command where it says it should use something after !test

#

pls in python

solemn latch
#

i dont know python, but if args is null, then nothing is after test

#

if your not doing args, then if nothing is after the first word, then error

stable grail
#

i only need 1 line 🤣

#

i only dont know what comes after if

solemn latch
#

its super basic, if your unsure how to do it, i would checkout a beginners guide on python

earnest phoenix
#

how i can add a emoji?

quartz kindle
#

you mean create an emoji? as in adding a new emoji to a guild?

slender thistle
#

@stable grail are you using the commands extension

stable grail
#

sry for asking that dumb but what are extensions xd

slender thistle
#

Do you use discord.Client

#

or commands.Bot

stable grail
#

commands.bot

slender thistle
#

you can use on_command_error as a global error handler OR give the command argument a default value like None and then checking if arg is None:

stable grail
#

i removed the global error because its not allowed on this server .d

earnest phoenix
#

How can i learn free space(s) from cpu(s)?

slender thistle
#

You can still ignore this server in your error handlers

stable grail
#

oh

earnest phoenix
#

guys?

stable grail
#

arg is red underlined do i have to install something?

slender thistle
#

Not too literally

#

Use the name of your argument

earnest phoenix
#

Math.floor(require('os').cpus()[0].times.idle/1024/1024) this is true?

#

my vps has "8GB RAM" so I think it wrong.

stable grail
#

if eightball is None: like this?

#

@slender thistle

slender thistle
#

What's your command function like rn

stable grail
#

it should send 3 random messages

#

which works

#

but they author should send a text after the n?eightball

#

the*

slender thistle
#

Misunderstanding. Show me the command function with the decorator

stable grail
#

whats that?

slender thistle
#

async def

stable grail
#

async def eightball(ctx):

slender thistle
#

Add , *, text = None after ctx

#

Then in the command use if text is None

stable grail
#

it works but its reversed xd

#

ty shivaco

radiant estuary
#

when i use cookies on my page, i have to warn the user, right? But is it okay, when the warning is only on the homepage?

sand thicket
#

Depends where they're viewing from. In the UK atleast you must notify about cookie usage

radiant estuary
#

thx

solemn latch
#

Whats the proper way to handle "permission denied" errors in discordjs?
I am currently just catching the error.
I was told that catching the error isnt correct and i need to check if the bot has permission.
But checking if the bot has permission every time seems like doubling the number of queries, and wasting resources.

the other suggestion i got was to cache the send message permission per channel, but i was thinking maybe discordjs already does that, but i wasnt sure how to find out.

Ive google around for a bit, and most suggestions for dealing with the error is just to catch it.

restive furnace
#

try/catch :)

#

or way better, check for permissions.

pale vessel
#

and no, checking for permissions does not waste resources

solemn latch
#

i have to send the permission request, wait for it to get back, then send the message then tho

#

right?

restive furnace
#

you dont have to, unless the member is uncached.

#

the member object has "permissions" property

solemn latch
#

permissions doesnt account for overwrites tho does it?
its just the role permissions

wet iron
#

Um Im using a json "database" and Heroku cant handle those and glitch disabled uptime robot pings so does anyone know where can I make my bot run 24/7 online?

modest maple
#

yes

#

a vps

#

that you pay for

#

:P

wet iron
#

fric

#

I need a free hosting

restive furnace
#

permissions doesnt account for overwrites tho does it?
its just the role permissions
member.permissions#has("ADMINISTRATOR") for example should work

#

also im a bit sleepy so yeah..

solemn latch
#

thanks that answers my question.

slender thistle
#

Some per-channel permissions are checked differently I believe

solemn latch
#

overwrites are seperate.
so if someone manually removes my bots talk permission in a room, it wont work.
but thats a rare condition that i can just catch

#

hopefully

#

if it becomes an issue later, i can just disable commands for a few minutes in channels where permission errors happen

#

which, the only case i think it will, is if the error happens enough time that my so many bad requests happen the bot gets temporary blocked

slender thistle
#

Is there some sort of equivalent of d.py's channel.permissions_for available?

earnest phoenix
#

man i just realised how long the primary script text files can be for bots

#

mine has 225 lines

#

thats a lot

#

:awhat:

#

and im still not even done with everything

#

rip nitro

#

sad

#

its been a while since ive had nitro

#

like a long time

#

uhh no

#

i always got confused with the Math.floor function

#

before i figured out it could be used to make random numbers if you do for example Math.floor(Math.random() * 10)

#

so then you'd make a command for it

#
msg.channel.send(Math.Floor(Math.Random() * 10)
break;```
#

yeah i have the =>{ set to msg=>{

#

i use discord.js

rigid maple
#

pls help

sudden geyser
#

Help about what specifically? The deprecations are just warnings, but you should use something up-to-date.

#

Also I wouldn't recommend using Glitch in its current state.

honest perch
#

why do you have a .htaccess file

digital ibex
#

@earnest phoenix no, make ur own

wet iron
#

I forgot how to find a channel by its id can someone help me?

rigid maple
#

What would you suggest @sudden geyser ?

sudden geyser
#

Suggest what specifically

rigid maple
#

proposal

#

ı'm use translate

#

sory

sudden geyser
#

Yes but propose what. What dependencies to use instead?

rigid maple
#

I do not understand

wet iron
#

I forgot how to find a channel by its id can someone help me?

sudden geyser
#

What library are you using.

wet iron
#

me?

sudden geyser
#

yes

wet iron
#

Discord.js

#

V12

sudden geyser
#

guild.channels.cache.get is what you're looking for

wet iron
#

Um Im askng for help again

#

I want my bot

#

to send that he joined another server

#

to my support channel

#

and my code looks a little bit like this

#

not a little bit

#
  const newEmbed = new Discord.MessageEmbed()
  .setColor('#03a9fc')
  .setTitle(':tada: New User! :tada:')
  .setAuthor('Mari0', 'https://resizeimage.net/mypic/IGol2TBPzfzPANt1/XRQLX/mario-0.png')
  .setDescription(`I joined another server! Servers: ${client.guilds.cache.size}`)
})```
#

now

#

I need to find the channel

#

on my server

#

and send a message

#

can someone help me?

sudden geyser
#

You could get the collection of guild channels on <Client>.channels, or get the guild first in the <Client>.guilds collection, then do what I showed above.

wet iron
#

you mean like

#

client.guilds to get the guild and then do what you showed above

long hare
#

Which is the function who show all the members , even if they are offline, in a server with 1000+ members? Please? actually i'm noob

earnest phoenix
#

hello, i have problem i have bot on my vps and when i run bot and type -play bot need to play live stream code: ```css
connection.playStream(streamlink/stream)

bot join but dont play anything, any solution ?
#

my attempt at trying to make a command that requires a role failed and it did nothing

#

any help?

#

wait

#

hold on i think i know what i did wrong

#

i didnt add a cache

#

dang

ancient lichen
#

any help on deafing the bot while connected to any channel

earnest phoenix
#

i was wrong twice

#

welp thats great

north hollow
#

i need help How to make a Music Bot

tepid canyon
#

In which language tho

north hollow
#

Discord.js

earnest phoenix
#

@earnest phoenix define it

north hollow
#

@tepid canyon discord.js

earnest phoenix
#

Lmao

#

Sorry, idk its very hard

#

:c

wicked pivot
#

hello, has anyone mastered puppeteer

pale vessel
#

perhaps

#

please ask your question because i might sleep

#

@wicked pivot

wicked pivot
#

I give up for tonight maybe tomorrow ^^

pale vessel
#

but do you have something to ask?

#

just real quick

wicked pivot
#

I try to create an Instagram bot, problem here is the bot does not like and when it changes position sends me back ```(node:3284) UnhandledPromiseRejectionWarning: Error: Node is detached from document

#
likeTagProcess : async(tags = []) => {
        for(let tag of tags) {
            await instagram.page.goto(TAG_URL(tag), { waitUntil: 'networkidle2'});
            await instagram.page.waitFor(1000)

            let posts = await instagram.page.$$('article > div:nth-child(3) img[decoding="auto"]')

            for(let i = 0; i = 3; i++){
                let post = posts[i];

                await post.click();

                await instagram.page.waitFor(1000) 

                let isLikable = await instagram.page.$('#react-root > section > main > div > div > article > div > section > span:first-child > button');

                if(isLikable) {
                    await instagram.page.click('#react-root > section > main > div > div > article > div > section > span:first-child > button');
                }

                await instagram.page.waitFor(3000);

                await instagram.page.click('#react-root > section > nav > div > header > div > div > a > span > svg');

                await instagram.page.waitFor(1000);
            }

            await instagram.page.waitFor(60000);
        }
    }```
pine coral
#

Ptdr

wicked pivot
#

@pine coral ??

pine coral
#

Yes

#

??

#

on server cmb you asked for its

wicked pivot
#

two xD

pine coral
#

yes I know

wicked pivot
#

not here ShrugAnimated

meager burrow
#

qui voilà @pine coral

tepid canyon
#

@north hollow have you even started anything for the bot yet?

pine coral
#

Personne @meager burrow

wicked pivot
#
  1. Speak english. This way everyone can understand you. It is our lingua franca after all. Detente_ref
pine coral
#

Yes

sick cloud
#

trying to make a level system of sorts, how do you work out when a user actually levels up

#

like is it some sort of math or do people just type them out

quartz kindle
#

probably some formula

#

ie: if currentXP > baseXP * 1.5

#

can probably throw in some Math.log() or Math.sqrt() for something more fancy

sick cloud
#

i have zero ideas tbh, never had a reason to make levels. but okay

#

base xp though, like

quartz kindle
#

you can even make something as simple as

#

if xp > Math.exp(level)

#

although the curve for that is kinda steep, you might wanna lower it a bit

#

if user is level 3, it needs 20exp to level up, if user is level 4, it needs 54exp to level up, etc

#

if xp doesnt reset on each level, its a quite reasonable curve

sick cloud
#

might work, i think the guy i'm making it for wants to give up to 10xp per message lol

quartz kindle
#

sure, you can always add a multiplier to it

sick cloud
#

lmao

#

exp sounds a bit too unfair when its higher and too fair when its low

quartz kindle
#

yeah thats the problem with exponentials, they easily get out of hand

#

but they are damn good at preventing stupidly high level people from getting too far ahead

slender thistle
#

exp / 2 :^)

quartz kindle
#

maplestory used to have a xp system where every 10 levels the xp requirement would be multiplied by 10

sick cloud
#

that makes early levels easy to gain shiv

#

ouch

#

maybe there's a way to use the exp, but try and bring it up a bit for the earlier roles

#

also the logic i'd need would prob be user.xp > Math.exp(user.currentLevel + 1) right

#

to get the next level

quartz kindle
#

Math.sqrt can be good if you want a more linear progression, with resetting xp on every level

sick cloud
#

looks like it'd work better

#

also logic wise, this would theoretically check if the current time is past when the user last spoke + the interval (say 5 min) right

#

so the user can only get xp every 5min

quartz kindle
#

yeah

#

if the lastSeen property is only updated when the user gains xp

north hollow
#

@tepid canyon ya

sick cloud
#

yeah it is

#

thanks

#

i can't logic today tbh

empty owl
#

how do you return a function

i have code like

something.parse(stuff, (err, smt) => {
return smt  
})```


how do you return smt
#

js'

pale vessel
#

you returned smt

empty owl
#

uh

#

uh yes and

#

it doesnt work

quartz kindle
#

you're returning inside a callback

empty owl
#

so should I uh

#

idk what to do

quartz kindle
#

where is that code from?

#

is it a function you made?

empty owl
#

nah just example

#

would you like to see actual code?

quartz kindle
#

if you made that function yourself, then you'd need to change how the function works

empty owl
#

i didnt

quartz kindle
#

otherwise, functions that return callbacks are taken out of context and cannot return

#

unless you put it inside a promise and await it

empty owl
#

okay

quartz kindle
#

this is what happens:

#
someCode(); // this executes immediately
someFunction(callback => {
  // this is taken out of context, basically this doesnt exist for the outside code
  // this is executed asynchrunously, it might take some time execute
  // when you finally receive the callback, the outside code is already long gone, you cannot return anything to the outside anymore
})
someMoreCode(); // this executes immediately and does not wait for the above callback
empty owl
#

oh okay

#

so should I put it in an async function

#

or await return

#

or somethign

quartz kindle
#

the only way to force a callback to return to the same context is to wrap it inside a promise

#

like this

#
result = await new Promise(resolve => {
  someFunction(callback => {
    // do something with callback
    return resolve(data)
  })
}):
console.log(result); // result now contains the content of data
empty owl
#

oh okay thanks

#

this code creates a promise and uhh

#

what does the resolve => { return resolve(data)}

#

do

quartz kindle
#

when you create a promise, you get two values, resolve and reject

#

resolve is a function that makes the promise return a value

#

reject is a function that makes the promise return an error

empty owl
#

ah thanks

quartz kindle
#

if neither resolve nor reject are ever executed inside the promise, the promise will basically never return

#

and the code would await forever

empty owl
#

ohhhh

#

yea that makes sense

quartz kindle
#

so basically a promise can wait as much time as it needs to

#

until it finished whatever it needs to be done inside it

empty owl
#

yea

digital ibex
#

im trying to test my api and um, how can i test it if its on localhost?

quartz kindle
#

if its on localhost, you can only test it from localhost lul

digital ibex
#

wym?

quartz kindle
#

localhost = this computer

digital ibex
#

yeah

quartz kindle
#

it can only be accessed from the same computer

digital ibex
quartz kindle
#

is that a website or what?

digital ibex
#
quartz kindle
#

you cannot access localhost from it lol

digital ibex
#

o

quartz kindle
#

localhost can only be accessed from the same computer it runs on

digital ibex
#

what would i use instead then?

quartz kindle
#

nobody from outside can access it

digital ibex
#

so i can't test my api?

quartz kindle
#

not from outside

digital ibex
#

fuck me

#

im confused, what else can i do to uhh

#

do the equivalent of testing my api?

quartz kindle
#

is the api supposed to be public and accessible from outside?

digital ibex
#

its private, but im still making it

quartz kindle
#

but do you want to use it from other computers eventually?

digital ibex
#

i think so

#

if i have to yeah, otherwise i'd prefer to keep it private

quartz kindle
#

are you running it from a node.js app?

digital ibex
#

ye

quartz kindle
#

simply using whatever.listen(3000)?

digital ibex
#

yup

quartz kindle
#

then, if there isnt any firewall blocking it, it should already be accessible from outside

#

via your ip address

digital ibex
#

oh oki

quartz kindle
#

so try ipaddress:3000

#

instead of localhost

digital ibex
#

kk

quartz kindle
#

if you give localhost to a testing website, thats basically asking the website to test itself lul

digital ibex
#

my public ip or the 123.123.123 one?

quartz kindle
#

public

digital ibex
#

kk

sick cloud
#

ok so

#

@quartz kindle how would i check if a user's last seen date was over a month ago

#

if 1 month is 2592000000

#

i tried x.lastSeen < (Date.now() + 2592000000)

#

but it's firing true when my last msg was a few sec ago

quartz kindle
#

should be - not +

digital ibex
#

this is a dumb question but, ur public ip anyone can see and they can't do nothing w/ it?

sick cloud
#

ahhh

#

makes sense

quartz kindle
#

they can see your public ip if they connect to you for some reason

#

otherwise nobody automatically knows your ip if you dont give them, unless they wanna guess it

#

and no, they cant do anything with it besides scanning ports looking for vulnerabilities (which pretty much dont exist anymore) to try to ddos lol

digital ibex
#

i mean, giving people ur public ip isnt gonna do anything? like it would giving them ur 123.123.123 ip

sick cloud
#
const users = msg.client.userLevels.filter((x) => x.guildID === msg.guild.id).array().filter((a, b) => b.level - a.level).splice(0, 10);

so for some reason this line is returning nothing and i have no idea why

digital ibex
#

oh right

quartz kindle
#

giving people a public ip should probably be avoided, but in some circumstances it can be unavoidable

digital ibex
#

am i doing something wrong or

quartz kindle
#

you dont have an ipv4 address?

digital ibex
#

idk, lemme chck

sick cloud
#

wait ok nvm, how do you get the first n items in an arr

#

splice(0, 10) seems wrong

quartz kindle
#

slice would be better in this case i guess

#

you can also truncate the array length

#

array.length = 10

digital ibex
#

should i use the ipv4 one?

quartz kindle
#

probably

digital ibex
#

kk

sick cloud
#

wait you can just manually set the arr length? damn

#

though with slice, should it be the same?

#

slice(0, 10)

digital ibex
quartz kindle
#

ye, slice and splice are the same, its just that splice also removes the result from the original array, while slice doesnt

sick cloud
#

ah

digital ibex
#

took 60 seconds tho

quartz kindle
#

then you migth have a firewall blocking it

digital ibex
#

oh

quartz kindle
#

also check your node logs just in case

#

do you have console.logs on your "/" endpoint?

digital ibex
#

in some, not all

#

oh

#

i don't think so, lemme check

sick cloud
#

can i somehow await a map

#
await sorted.map(async (x) => {
  const u = await msg.client.users.fetch(x.userID);
  let emoji = '⭐';
  return `${emoji} **${u.tag}**: Level ${x.level}, ${x.xp} XP`;
}).join('\n')

tried this but it just outputs an [object Promise]

quartz kindle
#

nope, array.map cannot be async

sick cloud
#

crap

#

any other way to do this

digital ibex
#

oh, i don't. what should i log?

quartz kindle
#

what you can do is map it then use Promise.all() on it

#

map(async) will give you an array of promises

#

then you can feed the array to Promise.all(array)

sick cloud
#

so finalMap = await Promise.all(arrayOfMaps)

#

right

quartz kindle
#

await Promise.all(array.map(async x => {}))

#

yup

digital ibex
#

tim, what should i log to my console? like how would i get the error

quartz kindle
#

you're not looking for an error in this case

digital ibex
#

oh

quartz kindle
#

you're just looking for confirmation

sick cloud
quartz kindle
#

for example, just put a console log at the very beginning of your "/" endpoint

sick cloud
#

nevermind sorted that

quartz kindle
#

so if your api is ever reached, you should immediately see an indicator in your logs that something has successfully reached your api, even if the return data might not have worked

#

nice top 10 users xD

digital ibex
#

prob won't work :/

quartz kindle
#

anyway, your node app is in a linux vps?

digital ibex
#

its all on my pc, windows

quartz kindle
#

ah well that explains it

digital ibex
#

o

quartz kindle
#

besides the windows firewall, you also have your router/modem's firewall

#

you need to open ports in all of them

digital ibex
#

fuck me

#

oh right

#

how 2 open all ports?

quartz kindle
#

if you open a browser page and go to localhost:3000

#

does it work?

digital ibex
#

yeah, that works

#

it logs no too

quartz kindle
#

ok so your app is working

#

its just your firewall thats blocking external access, so the testing website will not be able to access it

#

but you can access it yourself since you're on the same machine

digital ibex
#

is there a way to not block external access? or is there no way?

quartz kindle
#

open ports

digital ibex
#

how would i do that?

quartz kindle
#

you need to find your router's gatewayy address, access its control panel

#

and look for port forwarding or virtual servers

digital ibex
#

im confused

#

how would i do that?

quartz kindle
#

you can also google "how to port forward <your router make and model here>"

night tartan
#

Hi, I keep getting this error in code. Could someone explain to me what the error means. I have never seen it before.
The error: TypeError [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type function. Received undefined

digital ibex
#

idk what my router make and model is uhm

quartz kindle
#

do you have a small piece of equipment that should be somewhere between your pc and your phone line or tv cable?

digital ibex
#

i don't think so

quartz kindle
#

where does your internet come from?

#

cable or wifi?

digital ibex
#

sky box lol

#

wifi

quartz kindle
#

where does the wifi come from?

#

sky box?

digital ibex
#

sky

#

yeah

quartz kindle
#

then that box should be your router

digital ibex
#

oh ok

#

now i have to get out of bed :(

#

brb

quartz kindle
digital ibex
#

oh

earnest phoenix
#

hey can someone help me program something?

tepid canyon
#

depends what language and what it is?

earnest phoenix
#

gimme a sec it's a bit hard to explain

halcyon ember
#

i get this error

#
18.06 19:19:08 [Bot] throw new ERR_INVALID_CALLBACK(callback);
18.06 19:19:08 [Bot] ^
18.06 19:19:08 [Bot] TypeError [ERR_INVALID_CALLBACK]: Callback must be a function. Received Promise { undefined }
18.06 19:19:08 [Bot] at setInterval (timers.js:169:11)
18.06 19:19:08 [Bot] at Object.<anonymous> (/cryptoverse.js:105:1)
18.06 19:19:08 [Bot] at Module._compile (internal/modules/cjs/loader.js:1133:30)
18.06 19:19:08 [Bot] at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
18.06 19:19:08 [Bot] at Module.load (internal/modules/cjs/loader.js:977:32)
18.06 19:19:08 [Bot] at Function.Module._load (internal/modules/cjs/loader.js:877:14)
18.06 19:19:08 [Bot] at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
18.06 19:19:08 [Bot] at internal/main/run_main_module.js:18:47 {
18.06 19:19:08 [Bot] code: 'ERR_INVALID_CALLBACK'
18.06 19:19:08 [Bot] }```
quartz kindle
#

you tried to pass an invalid callback

#

how big is the file?

#

where is the bot hosted?

#

how do you access you rpi? ssh?

#

then navigate to your bot's folder and check the size of the json file

halcyon ember
#

@quartz kindle is the callback just the stuff in the return thing inside the function or what

quartz kindle
#

for example foo("whatever", bar => {}) bar would be the callback

halcyon ember
#

i dont have anything of that

#

i don't want it to have a callback

elfin cosmos
#

!hel

#

!help

halcyon ember
elfin cosmos
#

?

quartz kindle
#

what is timers.js? is it a file you made?

halcyon ember
#

@quartz kindle how do i make it like ignore requiring a callback and just execute the function

#

i dont have timers.js

quartz kindle
#

what about cryptoverse.js

halcyon ember
#

i used setInterval(block.block(), 15000)

#

yea thats the file thats being ran

quartz kindle
#

then thats the problem

#

setInterval expects a callback function as the first parameter

#

setInterval(function here, 12000)

#

you're giving it function(), ie executing the function before giving it

#

instead of giving it for him to execute

halcyon ember
#

wait whats it supposed to be then

quartz kindle
#

idk what your block is

#

but probably block.block

#

without the ()

halcyon ember
#

ah

quartz kindle
#
function bla() { return 10 } // bla is a function
a = bla // pass the function to a
a = bla() // execute the function and give the result to a (10)
setInterval(bla) // pass the function to the interval
// the interval will try to do bla()
setInterval(bla()) // execute the function and give the result to the interval (10)
// the interval will try to do 10() // error
halcyon ember
#

kk

earnest phoenix
#

How do I put a Emoji?

solemn latch
#

press :
and type the name of the emoji

earnest phoenix
#

can somenone help me, i was making a music bot, than i got this error

/rbd/pnpm-volume/9216dccb-314f-4120-9b9d-2105eb722f88/node_modules/.registry.npmjs.org/simple-youtube-api/5.2.1/node_modules/simple-youtube-api/src/index.js:26
if (typeof key !== 'string') throw new Error('The YouTube API key you provided was not a string.');

#

even tho i got the right api

#

have you tried reading the error

#

like i said

solemn latch
#

put the token in ""

earnest phoenix
#

stop using json as a database

#

still didn't go

#

npm i quick.db
stupid easy to use db

#

@earnest phoenix

#

better use that instead of a fucking json db

#

docs exist for that very reason

autumn summit
#

help with d.py, Extension 'cogs.rpg' raised an error: AttributeError: 'Command' object has no attribute 'casefold'
My code:

@commands.command()
    async def leaderboard(self,ctx):
        count = 0
        leaderboard = discord.Embed(title="Leaderboard", description="top 25 users, based on points", color=0x00FF00)
        for usere in credits.find().sort('credits', pymongo.DESCENDING):   
            username = await self.bot.fetch_user("_id")
            if count == 0:
                leaderboard.add_field(name=f"**TOP 1: __{username}__**", value=f"Points: **__{(usere['credits'])}__** \n \n ", inline=False)
                count += 1
            elif count == 1:
                leaderboard.add_field(name=f"**TOP 2: __{username}__**", 
                value=f"Points: **__{str(usere['points'])}__** \n \n ", inline=False)
                count += 1
            elif count == 2:
                leaderboard.add_field(name=f"**TOP 3: __{username}__**", value=f"Points: **__{(usere['credits'])}__** \n \n ", inline=False)
                count += 1
            elif count <= 25:
                leaderboard.add_field(name=f"**{username}**", value=f"Points: {(usere['credits'])} \n \n ", inline=False)
                count += 1
            if count == 25:
                await ctx.send(embed=leaderboard)
                return
              
        await ctx.send(embed=leaderboard)```
earnest phoenix
#

you install it, you require it and read the docs

solemn latch
#

the basics of a real database can be learned in an hour

earnest phoenix
#

i put it between "" and it still didn't work

#

less than* an hour but for just storing basic user info in a discord bot quick.db is more than enough

autumn summit
#

can anyone help

earnest phoenix
#

on what

autumn summit
#

help with d.py, Extension 'cogs.rpg' raised an error: AttributeError: 'Command' object has no attribute 'casefold'
My code:

@commands.command()
    async def leaderboard(self,ctx):
        count = 0
        leaderboard = discord.Embed(title="Leaderboard", description="top 25 users, based on points", color=0x00FF00)
        for usere in credits.find().sort('credits', pymongo.DESCENDING):   
            username = await self.bot.fetch_user("_id")
            if count == 0:
                leaderboard.add_field(name=f"**TOP 1: __{username}__**", value=f"Points: **__{(usere['credits'])}__** \n \n ", inline=False)
                count += 1
            elif count == 1:
                leaderboard.add_field(name=f"**TOP 2: __{username}__**", 
                value=f"Points: **__{str(usere['points'])}__** \n \n ", inline=False)
                count += 1
            elif count == 2:
                leaderboard.add_field(name=f"**TOP 3: __{username}__**", value=f"Points: **__{(usere['credits'])}__** \n \n ", inline=False)
                count += 1
            elif count <= 25:
                leaderboard.add_field(name=f"**{username}**", value=f"Points: {(usere['credits'])} \n \n ", inline=False)
                count += 1
            if count == 25:
                await ctx.send(embed=leaderboard)
                return
              
        await ctx.send(embed=leaderboard)```

@autumn summit

earnest phoenix
#

oh the python problem

autumn summit
#

this

#

yeah

digital ibex
#

@autumn summit which line?

#

ok im going bed lol

#

sorry

earnest phoenix
#

How can i Make a number counter?

#

so whenever someone reacts to a message it sends message following the queue from 1 to 2 to 3

#

sorry If I didn't explain well 😦

#

how do i make my discord.py bot show the server under activity playing

#

I need gif category ideas to add to my bot

sudden geyser
#

Do you?

earnest phoenix
#

Yeah lol

#

My bot is a gif and mod bot

#

So I just need some more gif ideas to add to it

queen galleon
#

in the docs, it says bot.id, is this the same id as the user id of the bot from the Discord API? I'm guessing yes but I'm just making sure

clever wing
#

I need help when i try it then it doesn't sending to channel in in terminal i don't getting error

earnest phoenix
#

learn js

clever wing
#

smh

earnest phoenix
#

you're not enclosing your url as a string

clever wing
#

it's snetchfetch

#

bruh

earnest phoenix
#

yes and?

clever wing
#

nothing is wrong

earnest phoenix
#

yes it is

clever wing
#

nah

earnest phoenix
#

snekfetch won't magically fix syntax errors for you

#

and it's outdated

clever wing
earnest phoenix
#

stop acting dumb

clever wing
#

then tell me what is wrong

clever wing
#

answer me dumbass

earnest phoenix
#

low iq moment

clever wing
#

welp now i wasting my time by retard

#

if u not gonna help then don't reply

earnest phoenix
#

i don't know who's retarded here, the guy who's been doing software deving and IT work for 6 years or someone who doesn't know what a string is

#

🤷‍♂️

clever wing
#

tf noting is wrong on it

earnest phoenix
#

this is the third time im telling you

#

enclose your url as a string

clever wing
#

stop wasting my time

earnest phoenix
#

stop being dumb

clever wing
#

no

#

ur dumb

#

the api are lasted

earnest phoenix
#

🤡

clever wing
#

idc

#

wasting time not my style and when i wanna help u toxic saying learn js

earnest phoenix
#

i genuinely can't tell if you're trolling or not

#

enclose 👏 your 👏 url 👏 as 👏 a 👏 string 👏

#

fourth time

clever wing
#

I did string

earnest phoenix
#

no you didn't

clever wing
#

I did alr

earnest phoenix
#

no, you did not

clever wing
#

I did

earnest phoenix
#

you do not know what a string is

clever wing
#

bruh

#

I tell u u this

#

it's for another source

earnest phoenix
#

what

clever wing
#

yeah

earnest phoenix
#

no, i genuinely can't understand what you're trying to say

clever wing
#

I don't using basic source like y'all

earnest phoenix
#

stop being a clown

clever wing
#

ur clown

earnest phoenix
#

do what i told you to do and your error is going to magically go away

#

fifth time now

#

enclose your url as a string

clever wing
#

smh

earnest phoenix
#

js does not know that the url is a string

#

it thinks it's a part of the syntax

#

you have to enclose it as a string

#

to tell it

#

"hey use this url"

#

and you clearly did not read the mdn link i sent you

#

and you clearly do not know what a string is

#

stop being a help vampire

clever wing
#

if u mean then k but string is for another module

earnest phoenix
#

@green kestrel either trolling or a severe help vampire

clever wing
#

imagine

hardy vector
#

uh i think hes trolling lol

clever wing
#

I don't trolling probably

sudden geyser
#

Do you know what is and how to make a string.

vale garden
#

hello

earnest phoenix
#

Using discord.py how can I have my bot join and speak on multiple servers?

self.voice_chat = None
 async def play_joke_audio(self, joke, voice):
        filename, player = await YTDLSource.from_url(joke.audio)
        if self.voice_chat is None:
            self.voice_chat = await voice.channel.connect()
        self.voice_chat.play(player, after=lambda e: os.remove(filename))

Voice chat seems to only work with one server at a time
I tried doing this
    async def play_joke_audio(self, joke, voice):
        await self.connect(voice.channel)
        client = await self.get_client(voice.channel)
        filename, player = await YTDLSource.from_url(joke.audio)
        client.channel.play(player, after=lambda e: os.remove(filename))

    async def get_client(self, channel):
        for client in self.bot.voice_clients:
            return client if client.channel is channel else None
#

im getting AttributeError: 'VoiceChannel' object has no attribute 'play'

#

have a list of clients & players instead of a single reference

#

oh

#

nvm

#

wait

#

yeah

#

i'm not fluent in python so you'll have to wait on someone else if you want better tips

vale garden
#

henlo

#
const filter = m => m.author.id === message.author.id && m.content === "hit"

        const filter2 = n => n.author.id === message.author.id && n.content === "stand"

    message.channel.send("**`" + message.author.username + " has a(n) " + aaa[a] +  " of " + cards[card1] + "`**\n**`Bot has a(n) " + bbb[b] + " of " + cards[card2] + "`**");

    const collector = message.channel.createMessageCollector(filter, { time: 5000})
      
      collector.on("collect", m => {

        message.channel.send("**`" + message.author.username + " has a(n) " + aaa[a] +  " of " + cards[card1] + " and a " + ccc[c] + " of " + cards[card3] + "`**\n**`Bot has a(n) " + bbb[b] + " of " + cards[card2] + " and a " + ddd[d] + " of " + cards[card4] + "`**")

      })

      const collector2 = message.channel.createMessageCollector(filter2, {
        time: 5000})

        collector2.on("collect", n => {

          message.channel.send("**`" + message.author.username + " has a(n) " + aaa[a] +  " of " + cards[card1] + "`**\n**`Bot has a(n) " + bbb[b] + " of " + cards[card2] + " and a " + ddd[d] + " of " + cards[card4] + "`**")


        })

      

      collector.on("end", collected => { if(!collected.size) 
      {message.channel.send("You need to provide a valid response bruh")}
       }) 
       ||
      collector2.on("end", collected => { if(!collected.size)
      {message.channel.send("You need to provide a valid response bruh")}
       }) 
#

so this is my full code

#

at least the collector part of it

#

soz for bad indentation

#

but

#

when i type hit after the command

#

it goes properly

#

but if i type stand

#

it still sends: "You need to provide a valid response bruh" even after i send stand

#

what do i do

tepid canyon
#

Why not just 1 filter, and depending on what is collected you run a different function?

#

And maybe use less +'s in your message part, and just use ${}

earnest phoenix
#

Does a discord bot leave a voice channel on its own? or how would I have a bot leave after a certian amount of time of inactivity

tepid canyon
#

It won't leave unless you make it or someone disconnects it. You can use channel.leave() to make it leave after whatever you choose as a "certain time of inactivity".

vale garden
#

how do i do only one filter

#

the msg part is fine idc about it

#

lol

#

should i do a if else

#

if so how

#

@tepid canyon

tepid canyon
#

Personally, I use awaitMessages, but either method works it would seem. You would use something along the lines of collected.first().content and go through that. Just have your filter filter messages from the message author, and do something like if (collected.first().content.toLowerCase() === "hit") { code here }

vale garden
#

ok

#

i think i tried that

#

but it didnt work

#

wait one sec

#

yea

#
if (const filter = m => m.author.id === message.author.id && m.conten
t === "hit")
            ^^^^^

SyntaxError: Unexpected token 'const
#

this error

#

@tepid canyon

tepid canyon
#

You can't put const in if ()

vale garden
#

so what do i put in

#

do i do

#

const filter;
if (filter = ....

#

do i do that

tepid canyon
#

you can put the const in a line above the if

vale garden
#

oh

#

kk

#

so

tepid canyon
#

It has to go before the awaitMessages or messagecollector

vale garden
#

wait

copper cradle
#

dude

vale garden
#

how do i do it

#

yeah?

tepid canyon
#

You dont need to change your whole code

copper cradle
#

lmfao

#

put the declaration of filter one line above

vale garden
#

ok how

#

i cant just const filter;

#

or

#

ok im confused and dumb

#

lol

#

plz just help

tepid canyon
#

const filter = m => m . . .

#

Just like you had before, but without the content part.

vale garden
#

oh kk

copper cradle
#

dude it isn't that hard

vale garden
#

but how do i do the content part

#

see

#

the thing is

#

im really dumb

#

lmao

#

so its

#
const filter = m => m.author.id === message.author.id
if (filter === m.content === "hit)
#

like that?

copper cradle
#

what

tepid canyon
#

no

copper cradle
#

what are you even trying to do

vale garden
#

then how

#

even idk

#

lol

#

im sorry can you just tell me how i'd do it

#

im really confused

#

for some reason

copper cradle
#

if I don't even know what you're trying to do

vale garden
#

im tryna

copper cradle
#

how am I supposed to tell you what to do

vale garden
#

do a if else statement

#

for collecting a message

copper cradle
#

what are you trying to check

vale garden
#

if its "hit" it doesnt something, "stand" it does something else

#

so im tryna collect certain words

#

and send an error messages if those words arent collected

tepid canyon
#

Just like you had before in your code message.channel.createMessageCollector() like you had before you can use that, then just add .then(collected => {}) and work through your if statements with the collected.first() like i said before

vale garden
#

no im asking about the filter

tepid canyon
#

like i said, const filter = m => . . . like you had before, but remove the m.content part from it. and pass that into the collector function.

vale garden
#

ohh

#

k

#

thx

sick cloud
#

is there some sort of npm package around that offers half decent terminal formatting options

#

ie right/bottom/centre aligning text

earnest phoenix
#

hello, i have problem i have bot on my vps and when i run bot and type -play bot need to play live stream code: ```css
connection.playStream(streamlink/stream)

bot join but dont play anything, any solution ?
tight plinth
#

Use a set interval loop

copper cradle
#

@earnest phoenix that's not how it works

#

playStream plays a stream of data

#

not a youtube/twitch stream

#

lmfao

earnest phoenix
#

isnt twitch or youtube stream

copper cradle
#

well you literally said "streamlink"

earnest phoenix
#

i will send you link in dm

copper cradle
#

no

#

just tell me

#

what are you trying to play

#

well if ffmpeg was missing they would've gotten an error

earnest phoenix
#

radio live stream

#

i have ffmpeg installed

copper cradle
#

still that's not how it works

#

playStream doesn't play that kind of stream

#

you gotta pass in a stream of bytes

#

say

#

you download a song, turn it into a stream of bytes

#

and then pass it into the function

#

you can play the radio

#

but you need to get a stream of data from it

#

and then pass that stream to it

earnest phoenix
#

ahh okay, thanks 🙂

copper cradle
#

np

spark breach
#

So my boy has a command called "server-info"
But when I run it it crashes (in DBL), but if I run the command in a smaller server it does work,
what do I need to do to fix it?

Code:

    if(message.content.startsWith("Beaver server-info")) {

        const embedServerInfo = new MessageEmbed()
        .setAuthor(message.guild.name, message.guild.iconURL())
        .setThumbnail(message.guild.iconURL())
        .addField('Name', message.guild.name, true)
        .addField('ID', message.guild.id, true)
        .addField('Owner', message.guild.owner.user.tag, true)
        .addField('Member count', message.guild.memberCount, true)
        .addField('Members online', message.guild.members.cache.filter(members => members.presence.status != "offline").size, true)
        .addField('Bots', message.guild.members.cache.filter(members => members.user.bot === true).size, true)
        .addField('Roles', message.guild.roles.cache.size, true)
        .addField('Created', message.guild.createdAt, true)
        .addField('Verified', message.guild.verified, true)
        .addField('Role list', message.guild.roles.cache.map(r => r).join(" ").replace("@everyone", " "))
        .setColor(15105570)

        return message.channel.send(embedServerInfo);
    }
})

error:

twin pendant
#

same happens with my bot specifically on this server, idk why

spark breach
#

oof, maybe they blocked it?

amber fractal
#

owner is not cached

twin pendant
#

not sure, but i just checked if the owner==null and if it does itll just not add it to the embed, or you could check if the owner==null and if so then replace it with 'Unknown' or something so at least it returns something without errors

amber fractal
#

If you read the docs, it says owner is nullable

#

ownerID is always there though

twin pendant
#

ohhhhh

amber fractal
#

so just fetch the member by the id

spark breach
#

ohhh that makes sense

#

ty

amber fractal
#

which will return the member if in cache or fetch them if not.

#

it's a promise, so you'll need to await it

twin pendant
#

oh ive been having a problem with fetching users by id's since im upgrading from v11 to v12

#

in v11 i can just do client.users.get('321191321437995009').createdAt, but in v12 if i do client.users.fetch('321191321437995009').createdAt it returns undefined

#

would i need to await it?

amber fractal
#

yes

#

you can one line it though

#

(await client.users.fetch('321191321437995009')).createdAt

twin pendant
#

ok ill try that out thanks

pale vessel
#

or {createdAt} = await

amber fractal
#

I assume they're doing it in an embed

pale vessel
#

ig

amber fractal
#

so addField("owner created at", (await ...).createdAt) is probably the best way to one line it, as I don't think you can destructure it and use it in one line

#

Though, I've never tried :P

twin pendant
#

i usually just do everything in the description, so rn i got

var user = await client.users.fetch('321191321437995009').createdAt
console.log(user)

and its giving me undefined
sorry ive never used await before haha

#

oop nvm i forgot the brackets idk i thought that they wouldnt do anything but i got the response

#

thanks hahahaah

pale vessel
#

well you have to fetch the user first before getting its properties

twin pendant
#

yup makes sense now, thanks to u as well

coral trellis
#

What's a good lib to use for making requests in python

restive furnace
#

requests

slender thistle
#

Async? aiohttp
Sync? requests

pure lion
#

So uh

#

H e y

#

thinking of a good way to ask my question<

#

Basically I want to do a phtext command where it sends the image but uh

It sends the file

#

(discord.js, using the Alexflipnote API)

restive furnace
#

new Discord.Attacment

pure lion
#

Thanks

delicate horizon
#

...

#

@spark breach

spark breach
#

huh

#

why am i pinged?

delicate horizon
#

you helped me...

#

he wants us to chat here

spark breach
#

ohhhh

delicate horizon
#

wdym what os?

spark breach
#

Operating system..?

#

but I am confused

#

because you wanted to remove a user?

delicate horizon
#

yes

spark breach
#

Wdym with that like what kind of 'user'

delicate horizon
#

when you want to host your bot

#

you need to create a user

spark breach
#

ohhh

#

discord dev portal?

delicate horizon
#

so i want to delete a user

#

no

#

in contabo

spark breach
#

I have no clue what that is... sorry

#

brb-

pure lion
#

new Discord.Attacment
@restive furnace it's sending the file but I want it to show the image :////

restive furnace
#

@pure lion

    new Eris.MessageAttachment("thing.png")```
#

(its discord.js, iam just lazy to rename it on my own bot code)

modest maple
#

Copy paste cough cough

pure lion
#

No actually

#

cough cough

#

Okay imma send my code because I have no brain cells

restive furnace
#

No cough cough.. Im just messy coder cough cough I make things work first and dont rly care abt weird things, unless it stops working. cough cough

#

to CF8 ^

pure lion
#

here is my code cough cough

#
    case 'phtext':
      let loading = await msg.channel.send('Loading...')
      let ph = new Discord.MessageAttachment(
        `https://api.alexflipnote.dev/pornhub?text=${args[1]}&text2=${args[2]}`, name = "pornhub.png"
      )
      loading.edit(ph)
    break;
restive furnace
#

loading.edit({files: [ph]})

#

may work

pure lion
#

ah

restive furnace
#

wait

pure lion
#

okay

restive furnace
#

hmm

#

you need to stream it someway

pure lion
#

hmmmm

restive furnace
#
message.channel.send("My Bot's message", {files: ["https://i.imgur.com/XxxXxXX.jpg"]}); 
``` change the imgur link to ph thing
#

found it

#

from stackoverflow ofc

#

@pure lion ^

pure lion
#

oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo

#

i think i tried that already

restive furnace
#

what error

earnest phoenix
#

Oof

restive furnace
#

well alternative is embeds

#

its way easier

pure lion
#

what error
it sent the file

restive furnace
#

where

pure lion
#

just the file, not image

#

nvm im stupid

daring quiver
#

i know i asked this before but can i get more information about embed

pure lion
#
var embed = new Discord.MessageEmbed()
  .setTitle(string)
  .addField(string, string)
msg.channel.send(embed)
#

assuming you use js, my all-seeing-specticles broke

frosty swan
#

my bot is verified 🎉

#

look at my profile

pure lion
#

so idk what lib

#

yooo gg

#

btw can i have some help?

#

:pog:

frosty swan
#

about what

#
var embed = new Discord.MessageEmbed()
  .setTitle(string)
  .addField(string, string)
msg.channel.send(embed)

@pure lion

pure lion
#

basically i wanna react with an emote thats not a standard emoji

daring quiver
#
var embed = new Discord.MessageEmbed()
  .setTitle(string)
  .addField(string, string)
msg.channel.send(embed)

@pure lion thanks

pure lion
#

emoji_id: Value "704009611207770192>" is not snowflake.

earnest phoenix
#

message.react('id')

daring quiver
#

my bot is verified 🎉
@frosty swan my bot allready not verified 😭

strong tundra
#

my bot allready not verified 😭

#

guys how do i make dicord bot

earnest phoenix
#

Not funny.

strong tundra
#

is codding dicord bot col and fun

frosty swan
#

are you serios?

#

u know which languages?

strong tundra
#

i do not know language

frosty swan
#

.

#

u must be learn a language

#

js or python

earnest phoenix
#

He has developer role :d?

frosty swan
#

yes i have :p

strong tundra
#

i only know haskel bro

earnest phoenix
#

Not u@frosty swan

strong tundra
#

i use "learn you a haskell for great good" book

frosty swan
#

Not u@frosty swan
do not ping me

earnest phoenix
#

dO NOt PiNg Me

strong tundra
#

but sir i do knot know if haskell is a god lamguage???

#

can u make dis cod bot with haskell

frosty swan
#

if you want help with any subject write dm do not ping me

strong tundra
#

ok sir

daring quiver
#
var embed = new Discord.MessageEmbed()
  .setTitle(string)
  .addField(string, string)
msg.channel.send(embed)

@pure lion

royal tree
#

someone can help me: The YouTube API key you provided was not a string.

frosty swan
#

where u from?

#

ogo

#

turkey?

daring quiver
#

yes

frosty swan
#

aferin

daring quiver
#

😄

frosty swan
#

: )

daring quiver
#

: )
@frosty swan where are you from

frosty swan
#

you don't need to know

#

: )

strong tundra
#

thank u for help sir

restive furnace
#

OGO glitch :)

daring quiver
#

you don't need to know
@frosty swan ok (Türksün gibi geldi)

#

OGO glitch :)
@restive furnace yes 😄

frosty swan
#

im using vds

#

is good

#

it does not cause any problems

daring quiver
#

im using vds
@frosty swan is it website

frosty swan
#

stop ping me

strong tundra
#

yes bro

daring quiver
#

ok

frosty swan
#

anybody want to make me a logo?

daring quiver
#

yes bro
@strong tundra thx

restive furnace
#

i still dont understand diffence between vds and vps

strong tundra
#

vds is physical hardware i think

restive furnace
#

ok

daring quiver
#

vds is physical hardware
@strong tundra can you send me VDS's link (DM)

royal tree
#

how can I fix "The YouTube API key you provided was not a string."

strong tundra
#

no

restive furnace
#

it needs to be string

#

"string"

daring quiver
#

no
@strong tundra ok

strong tundra
#

is the type of the var a string

#

this is why i hate javascript

royal tree
#

and how I do that

restive furnace
#

.toString

strong tundra
#

^

daring quiver
#

how can i find VDS

strong tundra
#

lowendbox

#

idk

royal tree
#

where I put .toString

restive furnace
#

I think VPS is cheaper thsn VDS, since VPS is literally Virtual Machine in Cloud, while VDS is physical hardware according to ruby's knowledge

frosty swan
#

how do i get the verified bot developer role here?

daring quiver
#

is VDS Visual Studio Coding

restive furnace
#

no

daring quiver
#

ok

strong tundra
#

well technically not. but it may as well be

#

i mean vds being physical

rigid maple
#

pls help

strong tundra
#

thanks for your help

daring quiver
#

okay I will continue with glitch 😄

restive furnace
#

update ur packages @rigid maple

rigid maple
#

how ?

royal tree
#

@restive furnace how to fix The YouTube API key you provided was not a string.

restive furnace
#

show up ur code

#

also you dont need to ping me since when im online im probably watching this channel

royal tree
restive furnace
#

GOOGLE_API_KEY.toString()

rigid maple
#

update ur packages @rigid maple
@restive furnace how ?

restive furnace
rigid maple
#

I am not using node.js

restive furnace
#

you are

royal tree
restive furnace
#

yes

royal tree
restive furnace
#

ok show ur config

#

edit the tokens

#

tho

#

i mean config.js file

royal tree
#

oh

restive furnace
#

module.exports = { GOOGLE_API_KEY: "key here " }

royal tree
#

I only have the token in config

royal spade
#

ive a discord.py bot on heroku and ive set the config vars how do i access it in my code

restive furnace
#

well youre importing PREFIX and GOOGLE_API_KEY there

royal spade
#

like client.login('thenwhat')?

restive furnace
#

import urfile

#

and then urfile.token

royal spade
#

ic

#

wait wdym your file?

warm marsh
#

I think he was talking to Edy

royal spade
#

oh lmao

warm marsh
#

use os

#

import os

#

then using .environ[key]

restive furnace
#

no

#

i was talking to care

royal spade
#

i set the token on heroku config vars

royal tree
#

when I type prefix is showing me an error

royal spade
#

oh

warm marsh
#

Heroku puts config vars into env

restive furnace
#

@royal tree bcs you have only token on ur config file.

royal spade
#

ah ic

royal tree
#

yes but when I try to type prefix in config

warm marsh
#

Missing a comma.

royal tree
#

where?

warm marsh
#

End of line 2

slender thistle
#

after the token value

royal tree
#

ok

royal spade
#

@warm marsh it says bot_token not defined

slender thistle
#

Show your code

royal spade
#

using os.environ

slender thistle
#

The key must be a string

warm marsh
#

import os

os.environ["bot_token"]

royal spade
#

ah

#

ic

warm marsh
#

or whatever you called it in config vars

royal spade
#

yes yes

royal tree
#

still not working

warm marsh
#

How are you requiring the file?

#

const { prefix, token } = require('./config.json');

royal tree
warm marsh
#

Your imported keys must be the same as the config file.

royal spade
#

and that worked thanks dillion shivaco

warm marsh
#

TOKEN must be "TOKEN" in config.json

royal tree
#

ok

#

is working

#

thanks

restive furnace
#

you probably using v12

#

RichEmbed is now MessageEmbed

royal tree
#

so I need to change to messageembed?

grand violet
#

sure

#

I'm making emoji to image bot like
if I send h!emoji [emoji], bot sends original emoji image.

but really hard to change this code
( if [emoji] to if h!emoji [emoji])

help! (sorry for my english skill)

// Emoji to image - beta
  client.on("message", async message => {
    if (message.author.bot) return;

  const args = message.content.trim().split(/ +/g);
  let emoji = args[0];
  emoji = emoji.substring(3, emoji.length - 1);

  const emojiarray = emoji.split(':');

  const botemoji = client.emojis.cache.get(emojiarray[1]);

  if(!botemoji) {
   await message.channel.send({files: [
    {
      attachment: botemoji.url,
      name: botemoji.name + '.png'
    }
  ]});
}
vale garden
#

yo

#

sup

#

people

royal tree
restive furnace
#

bcs voiceChannel doesnt exists

#

are you copypasting v11 code?

royal tree
#

yes

grand violet
#

uh..

royal tree
#

is a old bot

grand violet
royal tree
#

yes

grand violet
#

^ clone this code and try again

royal tree
#

ok

acoustic kiln
#
 const pokemon = require("../../dex.json")
 module.exports = {
 name: "Command name",
 category: "Category name",
  description: "Command description",
 run: (client, message, args) => {
     var pkmn = message.content.toString().toLowerCase();
        pkmn = pkmn.substring(9);
        for(var i=0;i<pokemon.length;i++){
            if(pkmn == pokemon[i]._engName.toLowerCase() || pkmn == pokemon[i]._frName.toLowerCase() || pkmn == pokemon[i]._nb){
                var text = "__You selected__\n";
                text += "**N° "+pokemon[i]._nb+"** \n";
                text += "English name: **"+pokemon[i]._engName+"** \n";
                 text += "French name: **"+pokemon[i]._frName+"** \n";
                text += "Type: **"+pokemon[i]._type+" "+pokemon[i]._type2+"**\n";
                text += "Catch Ratio: **"+pokemon[i]._catchRate+"**\n\n";
                text += "__Base Stats__\n";
                text += "HP: **"+pokemon[i]._baseStats._hp+"**\n";
                text += "Atk: **"+pokemon[i]._baseStats._atk+"**\n";
                text += "Def: **"+pokemon[i]._baseStats._def+"**\n";
                text += "S. Atk: **"+pokemon[i]._baseStats._sAtk+"**\n";
                text += "S. Def: **"+pokemon[i]._baseStats._sDef+"**\n";
                text += "Spd: **"+pokemon[i]._baseStats._spd+"**";
                message.reply("whats the text lmao??");
            }
        }
    }
};
 
weary ridge
#

hey so i did this right but i want the people to know who did it or make it into an embed

slender thistle
#

Why are you using .purge instead of just ctx.message.delete

acoustic kiln
#

whats the code for spawning any pokemon

#

at any time

#

all poke details stored in pokemon.js

#

but no pics