#development
1 messages · Page 1394 of 1
by setting a interval that resets it in every X seconds
So it is normal to reset? It's not a code problem, right?
like in js you could do setInterval(() => ClientUser#setPresence(...), 6000 * 30);
yeah
like in js you could do
setInterval(() => ClientUser#setPresence(...), 6000 * 30);
this is every 30 mins
Ok, I had thought, instead of creating an interval, to set the status of the bot every time the presenceUpdate event is triggered (by entering a check on the user ID)? Can this be done?
I don't think it's supposed to reset, but then again I'm using discord py
LOL i was just looking around on the website in your status, this is hilarious
capitalism ™️
channel.send(shardReconnectings).catch((err) => {
^
TypeError: Cannot read property 'send' of undefined
guys I've done catch just becausse it kept giving me that error
and it still does give me the same error
LOL i was just looking around on the website in your status, this is hilarious
@hollow sedge This was for a friend of mine who wanted at all costs to use my bot to make fun of me and I decided so 😄
@ancient nova because the error isn't coming from the promise lol
the promise isn't even getting executed
channel is undefined
extort your friends for money using this one simple method
Exactly, but this was mainly for him 
@earnest phoenix well let me send you the entire command, I'm pretty sure it's because I'm trying to use discord.js before it even starts
i get it, im just making a joke
but see for yourself
it probably is
like i said, channel is undefined
interact with discord in/after the ready event
<client>.on("shardReady", id => {
console.log(`[SHARD] Shard ${id} booted up...`);
const shardReadys = new MessageEmbed()
.setTitle(`Shards`)
.setColor(COMMANDCOLOR)
.setDescription(`Shard **${id}** booted up...`)
.setTimestamp();
const channel = bot.channels.cache.get('770505348339466250');
channel.send(shardReadys);
});
the thing is
it sometimes works
sometimes doesn't
that what makes me mad about it
is the channel always in the cache
the guild that the channel is in probably isn't in that shard
oh I see
give me a sec
alright
shard_id = (guild_id >> 22) % num_shards
use this formula to get the id of the shard the channel is accessible in
oh i see you want to send a message for every shard that is ready
yeah
you can use fetch instead of get
that'll return it directly from discord if not in cache
it's a promise though, don't forget to await it
I'm so confused, so I'm uploading an attachment with my bot, and every time it goes to upload, it's a totally different size. I can't figure out why, but I would assume that the bot is just sending it before it's even finished the upload....
impossible
when you attach files you send a multipart request
it won't finish until the multipart is done
Take a look
Same file, it goes to reupload it to a different channel, and it's different every time
wow
what's your code
All it does it grab the file, save it, create a new channel, upload it, delete it
await ticketchannel.send({
embed: embed,
files: [{
attachment: `${process.cwd()}/downloadedzips/${name}`,
name: `${name}`
}]
});```
also have you tried downloading the file, unzipping it, seeing the contents are intact?
can you provide the code for downloading
Sure, I know it downloads right because I can check my file server, and it's there in tack
request.get(url)
.on('error', console.error)
.pipe(fs.createWriteStream(`downloadedzips/${name}`));```
url is the attachment url
How can I fetch a different guild then the one i’m talking in?
client.guilds.cache.get('ID')```
Ty
i have no clue if request's pipe is blocking
try using node-fetch
https://github.com/node-fetch/node-fetch#streams in particular
I can confirm the download is working, it's on the upload side, as I can just go to my server and manually download it
if you go to your server and manually download it and it's working fine
then it's the downloading code
..? I guess I'm confused
@earnest phoenix hey but what about if it boots up before discord .js and I get that unknown message error
@ancient nova ...unknown message, what?
@dense drift what are you confused about
if you download it manually and it works
it means that your code to download the file is incorrect because when you try to download it, it doesn't download properly
try using node-fetch and the sample they have
What I mean is, when I run the
fs.createWriteStream(`downloadedzips/${name}`)````
line of code, and navigate to my server with visual studio to manually download it, it's the correct file on the server
Only the file that is attached by the bot on Discord is incorrect
Same file, it goes to reupload it to a different channel, and it's different every time
@dense drift not development related, but that's a smart idea ngl
then you don't need to download it to your drive in the first place
djs allows buffers to be passed
That would make it easier hahaha
I was just saving > uploading > deleting
await ticketchannel.send({
embed: embed,
files: [{
attachment: `${process.cwd()}/downloadedzips/${name}`,
name: `${name}`
}]
});```
So with this code, I can just change what attachment has?
How can I make a role with the manage messages permission and create it using js?
Instead of pulling locally?
guild.createRole({ name: 'ROLENAME', permissions: ['MANAGE_MESSAGES'] });```
so if I have this , and while playing it randomly edits the embed
this.gameEmbed.edit(editEmbed).catch((err, msg) => {
//console.log(err)
});
but someone deletes the embed before it could edit it, it gives me unknown message error, I used catch on it, but it still sends me the damn error
One google search, and it was the first answer
it's basically flooding my entire console with these errors
@dense drift
you can directly just pass the url of the file and djs will take care of it
files: ["url"]
should work just fine
if you want to rename the file on upload
files: [{
attachment: "url",
name: "whatever.zip"
}]
Well.. that worked, thanks man
I should've just uploaded straight from discord to discord
I made more work for myself hahaha
So yesterday someone told me to use node-fetch to fetch a webpage and pass that to cheerio
i am not well-versed in node-fetch or js so this is what is looks like rn
``` fetch(https://brawldb.com/player/stats/${args});
const $ = cheerio.load(fetch.text());```
this is obviously very wrong lol, anyone know how to fix?
pretty much almost any method in node-fetch is a promise
first await the fetch method and store the result of it in a variable
i need to set this straight
then await the text() method on the said variable
is print() what makes the bot speak or no?
no
@earnest phoenix github has a ton of different uses of node-fetch so i just dk which to use lol
are you talking about this one?
params.append('a', 1);
(async () => {
const response = await fetch('https://httpbin.org/post', {method: 'POST', body: params});
const json = await response.json();
console.log(json);
})();```
yeah ofc lol
so basically, await the fetch, store in a variable
in that snippet the variable is response
in your case, instead of using json() you'd use text()
and that's it
shit man thanks a ton
I tried creating a role using a command.
guild.createRole is not a function
Anyone help?
I was told to do that by somebody.
@royal crescent👀
How to get shard count?
guys how to see how many voice channels my bot is in?
in which library?
@earnest phoenix discord.js ^12
How do I assign a role to user? Keeps saying “Cannot read property of ‘roles’ of undefined.
Code:
message.guild.members.cache.find(‘737918277866487928’).roles.add(‘778101197009190933’)
How do I assign a role to user? Keeps saying “Cannot read property of ‘roles’ of undefined.
Code:
message.guild.members.cache.find(‘737918277866487928’).roles.add(‘778101197009190933’)
@agile lance first fetch , then assain
Result for how fly:
When a person knows how to control their vehicle well in the air in the video game Rocket League. Especially when you personally can’t do the same.
and idea @earnest phoenix about shard count?
@agile lance first fetch , then assain
@tired panther Do I replace find with fetch?
sec
You can't assign a role to a user 
is there even a point giving them warnings
guys how to see how many voice channels my bot is in?
@tired panther do you use the sharding manager?
yap , the auto
I'd use guilds.reduce()
@ancient nova client.voice.connections
I did but it always returns 0
<client>.voice.connections.size
also tried to do .map
with it
it doesn't return anything
and you're sure your bot is connected to a at least one voice channel?
are you using intents?
do you have the GUILD_VOICE_STATES intent?
I don't think so
I have two clients running at the same time always, one for music streaming and one for the rest of the commands
@ancient nova what if you check message.guild.voiceStates.cache
let me see
%eval message.channel.send(client.shard.totalShards); does not work
@tired panther where did you get totalShards from?
@ancient nova so voice states are working, but client.voice.connections.size is still 0?
yeah
let me send you
length is for arrays, size is for maps
@ancient nova try message.guild.voiceStates.cache.map(x => x.member.user)
dafuq
Huhhh
bot
Weird
the same where the music is being run from?
yeah
ok then idk
well for now I have every server on the same shard due to a memory leak
but using the sharding manager?
^?
for now I don't use it
nope
so how do you know which is which? only one of them has an eval command?
ot.on('ready', () =>{
console.log("this bot is online!");
setInterval(() => {
bot.user.setActivity(`a!help | ${bot.guilds.cache.size} Servers.`, {type: "PLAYING"});
}, 60000);
setInterval(() => {
dbl.postStats(bot.guilds.size);
}, 1800000);
})
its not refreshing it in the page
and u sure the main one is the one thats playing the music?
@tardy hornet bot.guilds.size is not a thing anymore
then what is it?
also you dont need to use postStats
i want to ask if i want to make a incremental function to update everyone's money in the database every second whats the most efficient way? the way im planning to do it is every second pull out all the players data from the database and increment it and save it to the database before repeating it within a second and my bot will start to lag when theres multiple players
@tardy hornet bot.guilds.size is not a thing anymore
@quartz kindle then what is it?
look in your setActivity to see it
@tardy hornet you already have the answer in your setActivity
@river wing updating the entire db every second is indeed a bad idea
but is there other ways to workaround that
caching and eventual consistency
keep a copy of all user's money in memory, update that every second
only push it to the database once every 10 seconds or so
if your bot crashes, all users will be roled back about 10 seconds, but that shouldnt be much of an issue
or just calculate how much money based on the time
other than that ^
basically subtraction with no cost to it
hmm okay
it definitely doesnt make sense
I know I'm as confused as you
is there any tutorials for that like keeping the users money and updating it every second
as in the people have different increment values
ok, you can still do what lite said
when a user is created, give it a creation timestamp, a base money and an increment value
when you pull the user to check its money, compare its timestamp to the current time, and calculate how much money they have
if the incremented value changes, save a new timestamp and a new base money
does the ms npm module not support months?
from a functionality standpoint you are updating it into the database
@quartz kindle I wrote a code to directly access the client directly and it still says 0
which is a billion times better for performance
ok ill try that
is there a better module that converts args to ms?
@ancient nova wait... you're using a third party library to play music?
yeah but it all saves
so how else can I get it?
the library you're using should have a list of channels its connected to
let me see
it gives me a random error
I don't even know where it comes from
@quartz kindle
btw the manager there is the library
I'm just accessing cuz it's in another file in my bot
what library are you using
lavalink
Does anyone know about these intents?
My bot is verified, but the guildMemberAdd seems to not work?
Its the GUILD_MEMBERS intent right? for guildMemberAdd
It's kind of interesting to me though
cause my bot is over 100 servers, and verified
That would mean my bot has these things enabled by default isnt it?
so in the bot this can not be turned on?
you must request those intents in order to use them
as for my code; i'll have to look on the web on how to do that (javascript)
request them by the scopes?
contact discord support
oh
so i was doing py -3 -m pip install -U discord.py everything was going well untill i got a shit ton of errors...
...
XD
What are you trying to do?
Xd
Good evening I have a problem for 1 hour the photos are no longer displayed in the embed.
case 'kill':
const array5 = [
'https://media1.tenor.com/images/a0d13ec25f9774f155b6cd5ebf12a6c8/tenor.gif?itemid=18258403',
'https://media1.tenor.com/images/361a7354f193af1b1ace5843dcaeeb02/tenor.gif?itemid=18599860',
'https://media1.tenor.com/images/3cedee4f8118855c83ea05463498f326/tenor.gif?itemid=16400090',
]
const Random = Math.floor(Math.random() * array5.length)
if(!args[1]) return message.channel.send('who do you want to kill?')
const opponent2 = message.mentions.users.first();
if ( !opponent2 ) {
return message.reply( 'who do you want to kill?' );
}
if(message.author.id === opponent2.id) return message.channel.send("please mention a user that is isnt you.")
const killf = new Discord.MessageEmbed()
.setDescription(`${message.author} killed ${opponent2}:dorange:`, '\u200b')
.setImage(array5[Random])
.setColor("RED")
message.channel.send(killf)
break;
its just sending the embed with out the gif
One message removed from a suspended account.
One message removed from a suspended account.
did an error occur sending the message
Is Discord having issues deleting Voice Channles?
no i just randomly keep getting it in console
It's having some issues doing stuff.
and i cant find the issue
Like timing out bulk deleting messages I just got
Well, it comes from line 44 in commands/config.js, so I think it's safe to assume it has something to do with sending the message, because if an error occurs, you're ignoring it and setting the value equal to undefined instead (.catch(() => {return;}) => () => undefined).
Would someone be how to use the randomcolor package?
so how would i write an event handler where i set the events to a collection and then when an event occurs it triggers said event?
the message sending has a catch
so i was doing py -3 -m pip install -U discord.py everything was going well untill i got a shit ton of errors...
Oh
how do you get a database in discord.js lmao
Node.js I think
no
Working with databases is not really limited to Discord.js. You set up the database like you're supposed to.
case 'kill':
const array5 = [
'https://media.giphy.com/media/OHbDlU9nH13cbJPCWq/giphy.gif',
'https://media.giphy.com/media/Diy0XGkNkA14nPGfBE/giphy.gif',
'https://media.giphy.com/media/3bUxL3UQGTnbyF1tVe/giphy.gif',
]
const Random = Math.floor(Math.random() * array5.length)
if(!args[1]) return message.channel.send('who do you want to kill?')
const opponent2 = message.mentions.users.first();
if ( !opponent2 ) {
return message.reply( 'who do you want to kill?' );
}
if(message.author.id === opponent2.id) return message.channel.send("please mention a user that is isnt you.")
const killf = new Discord.MessageEmbed()
.setDescription(`${message.author} killed ${opponent2}:dorange:`, '\u200b')
.setImage((array5[Random]))
.setColor("RED")
message.channel.send(killf)
break;
its not sending the gif in there!
i personally use nosql but its up to you
yeah, how do i set it up
What database would you like to use?
depends on the database
sql
That's a language. A database using SQL would be SQLite, Postgres, etc.
case 'kill': const array5 = [ 'https://media.giphy.com/media/OHbDlU9nH13cbJPCWq/giphy.gif', 'https://media.giphy.com/media/Diy0XGkNkA14nPGfBE/giphy.gif', 'https://media.giphy.com/media/3bUxL3UQGTnbyF1tVe/giphy.gif', ] const Random = Math.floor(Math.random() * array5.length) if(!args[1]) return message.channel.send('who do you want to kill?') const opponent2 = message.mentions.users.first(); if ( !opponent2 ) { return message.reply( 'who do you want to kill?' ); } if(message.author.id === opponent2.id) return message.channel.send("please mention a user that is isnt you.") const killf = new Discord.MessageEmbed() .setDescription(`${message.author} killed ${opponent2}:dorange:`, '\u200b') .setImage((array5[Random])) .setColor("RED") message.channel.send(killf) break;its not sending the gif in there!
@tardy hornet doesnt look like you ever call the array
If you're new I'd recommend SQLite. It's very common/easy to setup.
sure
@tardy hornet doesnt look like you ever call the array
@pure lion .setImage((array5[Random]))
Okay, now see the npm package on how to set it up: https://www.npmjs.com/package/sqlite
also are there any errors
The database is essentially a local file.
the message sending has a catch
@obtuse jolt which, if called, evaluates toundefined, which is why it may throw the TypeError? Am I missing something?
hmm is mongodb easier?
What do you mean the counter code.
MongoDB is a NoSQL database.
You should search it's setup guide on the website if you want to use it.
There Is A code That Count The Votes
Do you want to use Top.gg's API to get the number of votes your bot has, or to know when a user has voted?
so? what should i do?
To get the number of votes
(node:4568) UnhandledPromiseRejectionWarning: FetchError: request to https://discord.com/api/v7/gateway/bot failed, reason: unable to verify the first certificate
what's this error

@sudden geyser after install the visual build tools from that link inside tbe error it should work when i input the command again right?
glassy I think Discord is having issues right now
thought so
holy cow, setting up a database looks hard as hell
@safe creek it should, just try it out and see.
It may seem hard at first, but it gets easier as you learn more.
Practice makes perfection.
Haha yeah my head really hurts
am guys, i found the problem
.setImage dose not work
anyone else got it?
i saw 5 people that dose
^^
can anyone help me with a discord.js event handler?
Lmao
ive set event files to a discord collection
how old are you?
@pure lion me?
you
ive set event files to a discord collection
And im not sure how to access the files when an event happens
im dead confused where i should put the database code
and what should be the file extension?
you
@pure lion why are you asking?
why are you defensiveing
Could someone help me use the "RandomColor" package
so how would i write an event handler where i set the events to a collection and then when an event occurs it triggers said event?
@pure lion similar to how you set up command handlers, but I think it's easier to just store the functions to call when the event has been emitted in the files, then, in the loader, do<EventEmitter>.on(theEventNameFromTheFile, theFunctionToCall).
Do you really need to store the commands in a collection? That would be like having a key of file names and the value being the function call (hence your map).
anyone got a good "whats the sauce of this image"-like api ?
when you say sauce, is your interest in finding anime by a scene
yup
@pure lion similar to how you set up command handlers, but I think it's easier to just store the functions to call when the event has been emitted in the files, then, in the loader, do
<EventEmitter>.on(theEventNameFromTheFile, theFunctionToCall).Do you really need to store the commands in a collection? That would be like having a key of file names and the value being the function call (hence your map).
@sudden geyser so then how would i d o
There's trace.moe (https://trace.moe/), but I've had issues with it due to server errors.
is there a way to listen for everything?
ok thanks Ill look into it ^^
I don't know about one event on the EventEmitter that gets triggered for all listeners.
There are certain ways to get that behavior.
ah?
Small question ...
How to create embed using eris
as in discord.js v12 its ```js
const Discord = require('discord.js');
const exampleEmbed = new Discord.MessageEmbed()
Well, take for example.
Let's say I have two events: guildMemberAdd and guildMemberRemove in two separate files (./events/*.js). I'd like to go the extra mile by using a switch for control.
If I were to put that into code, I could write: ```js
function loader() {
let files = readdir("./events/");
for (const file in files) {
let eventName = file.replace(".js", "");
let eventFunc = require(./events/${file});
bot.on(eventName, (...args) => whichListener(eventName, eventFunc, ...args))
}
}
function whichListener(name, func, ...args) {
switch (name) {
case "guildMemberAdd": ...
case "guildMemberRemove": ...
}
}```
Unless I'm misunderstanding something. I still don't understand why you'd want to store all the functions for later because I don't see much use out of it. The message from the loader function should make enough sense though. @pure lion
@heavy marsh you need to send it as an object.
message.channel.createMessage({
embed: {
// ...
}
});```
https://hatebin.com/nceboezkay TypeError: Cannot read property 'toLowerCase' of undefined. It is coming from line 52. I have logged it and it displays raid is undefined
They're the same Discord expects it to be. See https://discord.com/developers/docs/resources/channel#embed-object-embed-structure
please could anybody help me?
@sudden geyser so it is the same tags like creating a title , desc and etc
not exactly
It should be structured like Discord expects the library to send it as (JSON).
For example, title: "this is the title"
ooh I see
For a color, Discord wants an integer. Maybe 0xABCDEF
hey guys could anybody look at my question above? Thanks already 🙂
no sucess trying to use sqlite
so i have the following code:
if message.content == 'c!meme':
memes = ('https://cdn.discordapp.com/attachments/753695631167586499/778709549397442600/unknown.png', 'https://cdn.discordapp.com/attachments/735991790284439563/778317227144904755/animal-memes-9-11.png', 'https://cdn.discordapp.com/attachments/735991790284439563/774738067629146163/ecd39aa9ea89c2884de38a822f8480aa--so-funny-funny-stuff.png')
choice = random.choice(memes)
await message.channel.send('{}'.format(choice))
i would like it to convert the link directly into an image like normal, but for some reason it only shows the random link. can someone help?
Is this a good chat/channel to ask about markdown on the bots log desc?
sure
So basically rn, I’m trying to setup my bot using Slappey and after I install nodemon I attempt npm run dev but I get a whole bunch of errors
You're missing your package.json file for some reason.
so i have the following code:
if message.content == 'c!meme':
memes = ('https://cdn.discordapp.com/attachments/753695631167586499/778709549397442600/unknown.png', 'https://cdn.discordapp.com/attachments/735991790284439563/778317227144904755/animal-memes-9-11.png', 'https://cdn.discordapp.com/attachments/735991790284439563/774738067629146163/ecd39aa9ea89c2884de38a822f8480aa--so-funny-funny-stuff.png%27)
choice = random.choice(memes)
await message.channel.send('{}'.format(choice))
i would like it to convert the link directly into an image like normal, but for some reason it only shows the random link. can someone help?
@olive roost message.channel.send({embed:{image:{url: ${choice}}} })
k i'll try that
You won't need to download and save it. You'll just need a file object. https://discordpy.readthedocs.io/en/latest/api.html#discord.File
Bae they're using discord.py
Not Discord.js
k thx
oh I see, sorry about that
@sudden geyser so its class discord.File(fp, filename=None, *, spoiler=False)
?
I'd help you but I'm not good with py
could somebody help me please?
https://hatebin.com/nceboezkay TypeError: Cannot read property 'toLowerCase' of undefined. It is coming from line 52. I have logged it and it displays raid is undefined
@eternal osprey
@eternal osprey do you not see anything wrong with this?
What you showed me is the signature of the function. Not what you're supposed to pass. Each parameter is a positional argument.
So, discord.File(fp, filename, spoiler) where fp, filename and spoiler are their expected types. If the file is a spoiler I'll replace spoiler for true.
It's hard to explain, but it's a matter of reading documentation and understanding the signature of something.
@eternal osprey
console.log(raid.pokemon_id + options.name)
let raid = raids.shift();
let raids = data.raids.filter(raid => getName(raid.pokemon_id).toLowerCase() === options.name.toLowerCase() && raid.level >= (options.level ? options.level : 5))
Do you still need help
oowh it is defined outsside
well not outside but after
what errors
i still need help tho:
you mean it still doesnt work?
TypeError: Cannot read property 'toLowerCase' of undefined line 52
@earnest phoenix make ur function async
why do you have the error message before you get the member
?
args[0] would be an id
@eternal osprey because you didnt define raid before calling toLowerCase on it
you just type async
okay look
let res = await afetch("https://nycpokemap.com/raids.php?time=" + new Date().valueOf())
let data = await res.json();
const getName = id => nameList.filter(el => el.i === id)[0].n;
let raid = raids.shift();
let raids = data.raids.filter(raid => getName(raid.pokemon_id).toLowerCase() === options.name.toLowerCase() && raid.level >= (options.level ? options.level : 5))
console.log(raid.pokemon_id + options.name)```
Cannot access 'raids' before initialization
const Discord = require('discord.js')
module.exports ={
name: 'kick',
description: 'kick a user',
execute(client, message, args){
if (!message.member.hasPermission('KICK_MEMBERS')) {
return message.channel.send(`You are unable to kick members`)
}
const member = message.mentions.members.first() || message.guild.members.cache.get(args[0]);
if(!member) return message.reply('you didnt mention anyone');
try {
await member.kick();
await message.channel.send(`${member} has been kicked!`)
} catch (e) {
return message.channel.send(`User isn't in this server!`)
}
}
}
hH
why is everything greeN
very poggers
@sudden geyser another help how to do some thing like
Hello
and an embed below in eris
execute async ect
Yes, you are calling raids.shift before even defining raids@eternal osprey
yeah but how would i do it otherwise?
i'm not doing eeverything for you G)
wdym
i cannot first define the raids
You have to define raids before defining raid
and then the raid
Yes you can?
as i am getting the raid.pokemon_id
Oh
(raid.pokemon_id) then this would be undefined
@heavy marsh are you referring to the footer?
nope
You are going about it the wrong way then
async before execute
I'm not sure how the pokemon API works so I can't help you
const exampleEmbed = new Discord.MessageEmbed()
.setTitle('Some title')
.attachFiles(['../assets/discordjs.png'])
.setImage('attachment://discordjs.png');
channel.send(`Hello`, exampleEmbed);
``` - but in eris
@hollow sedge i am not using any form of api's
i am grabbing the info from a webite
The first argument should be the content. The second argument will be what the first argument is right now.
@earnest phoenix fucking put async execute
Yes you are?
Aka js createMessage("Hello", { embed: { // ... } })
what do you think nycpokemap is
hmm it told be wrong format
let me try it again
oh wait I'm stupid
👀
It should look like this: js createMessage({ content: "Hello", embed: { // ... } })
hi, recently (like less then a hour) i had an issue with my clear command. When i use the clear command i receive the mesage that the bot clear messages but the messages don't been deleted
anyone knows how i can define this shit i wrote
let res = await afetch("https://nycpokemap.com/raids.php?time=" + new Date().valueOf())
let data = await res.json();
const getName = id => nameList.filter(el => el.i === id)[0].n;
let raid = raids.shift();
let raids = data.raids.filter(raid => getName(raid.pokemon_id).toLowerCase() === options.name.toLowerCase() && raid.level >= (options.level ? options.level : 5))
console.log(raid.pokemon_id + options.name)```
why are u using new Date().valueOf()
what is undefined?
its the same as Date.now()
@young flame the raids
hmmm
and should it not be await fetch and not await afetch?
as i am defining raid = raids.shift before the raids defining
but i canot define raids before the raid as i am calling the raid variable in it.
yes
look at the lil snippet. Appreciate it!
why can't you
raid = raids.shift
why would you
the raids.shift will be undefined as i clearly have not named the raids yet
yeah i see
can u console.log(data)
if raids is undefined nothing will happpen if raids is defined before raid nothing will happen
yeah i know
can u console.log(data)
@molten yarrow it's not his data
the way he's coding it
is retarted
so how can i ever fix it and define both
does he even get anything?
you can't defined both
try changing the code in raid so it doesn't define raids yet
like ```js
let raid = []
then after raids is defined you can like call something to put in that [] what you have in raids now
so raid will work because it wont say undefined because what your defining after will be defined
okay i understand the first part
but the second part is kinda complicated
could you give an example?
raid = raids[0] is the same as raid = raids.shift()
i didn't say raids[0]
@molten yarrow still would give the raids error
i just said raid = []
you dont need to define raid atall??
he needs raid for raids
My friend is a weirdo
i do alina
just use raids[0] ....
ata.raids.filter(raid => getName(raid.pokemon_id).toLowerCase() === options.name.toLowerCase() && raid.level >= (options.level ? options.level : 5))
i am calling raid.pokemon id
he needs raid lmao
thanks
whats up with the pfp alina
kinda pog
someone developing with mongoose?
@earnest phoenix ask your question
@earnest phoenix that was his question lmao
yeah but he expects someone to say yes and then ask another question
so might as well get to the point
btw boys
LOL
i don't help in dms
it still did not work. Cannot read property 'toLowerCase' of undefined
@molten yarrow MY IMAGES IN EMBED TAKE LIKE 5 MINUTES TO WORK
i am losing my faith in my code.
eh
bruh this channel is cursed
send the code
@eternal osprey do you even get any data from api?
yeah i do
i'll eval it in my bot and see what happens @eternal osprey
Moon show me ur snipped
i would really appreciate it man!
np lol
you sure? console.log() it
god dayum
1000 character limit
what's wrong?
you defined it as fetch and call it as afetch...
yeah
kinda poggers G)
Devs help meh
@earnest phoenix dev senpai is here
whats da problem
lets see
ah but it still did nothing?
yeah you need add intents to your client :3
always end it in ;
you dont rly need to end with ;
anyways, if you could eval it i would appreciate it! Take your time and jut ping me when you are done with evalling it!
like ```js
const Discord = require('discord.js');
you always wanna end it in ; lol
stops it from tweaking
Is there a bot that you can open pokemon cards?
good
case 'giveaway':
if (!args[0]) return message.reply(`You didn't specify you time`);
if (
!args[1].endsWith("d") &&
!args[1].endsWith("h") &&
!args[1].endsWith("m") &&
!args[1].endsWith("s")
) return message.reply(`Please format you amount of time correct!`);
if (isNaN(!args[1][1])) return message.reply(`That is not a number!`);
let channel2 = message.guild.channels.cache.find(ch => ch.name === "giveaways");
if (!channel2) return message.reply(`Please create a channel named \`"giveaways"\``)
let prize = args.slice(2).join(" ");
if (!prize) return message.reply(`You need to specify a prize`);
message.reply(`You giveaway has been created on \`${channel2.name}\``)
let Embed = new Discord.MessageEmbed()
.setTitle(`🎉 **New Giveaway!** 🎉`)
.addFields(
{ name: "Host", value: `\`${message.author.tag}\``, inline: true },
{ name: "Prize", value: `\`${prize}\``, inline: true },
{ name: "Date (M/D/Y)", value: `\`${new Intl.DateTimeFormat("israel").format(Date.now())}\``, inline: true }
)
.setColor("EA0D0D")
let m = await channel2.send(Embed).then (m => m.react("🎉"))
setTimeout(() => {
if (m.reactions.cache.get("🎉").count <= 1) {
message.channel2.send(`Reactions: ${m.reactions.cache.get("🎉").count}`);
return channel2.send(`The giveaway has been ended and failed because not enough people reacted`)
}
let winner = m.reactions.cache.get("🎉").users.cache.filter((u) => !u.bot).random();
channel2.send(`The giveaway has been ended and the winner for \`${prize}\` is ${winner}`)
}, ms(args[1]))
break;
TypeError: Expected a number
is that the only thing it says?
----> }, ms(args[1]))
break;
this line
Does anyone know a good Wolfram Alpha library/API?
for converting time into ms
ms is for time conversion
@tardy hornet can you show what args[1] is
but regardless node devs are dumb and need a library for something that's two lines if code lol
yep
i fixed that
have you seen is-even
ty all
lol
best lib
wat
bruh
people also keep on installing the install package
by people i mean clueless newbies who dont understand how npm works
@young flame have you evalled it yet?
check out this amazing lib https://github.com/madrobby/vapor.js
boys can someone help me out please
undefined = require("undefined")
but regardless node devs are dumb and need a library for something that's two lines if code lol
@earnest phoenix I wouldn't say, themslibrary is quite useful as a utility for converting some time to milliseconds. It's not like a one-liner library likeis-odd. It's useful for preserving DRY as well.
@young flame have you evalled it yet?
@eternal osprey it's over the 1000 character limit
lmfao
THE SOURCE CODE LMAO
and of course dont forget the mighty https://github.com/jezen/is-thirteen
these are some remarkable devs
semicolon.js is “a more secure and reliable vapor.js.” Rather than containing zero lines of code, semicolon.js contains a semicolon.
vanilla.js is a JavaScript compiler that compiles JavaScript into JavaScript.
do you guys like my coding profile picture
if you coded it yes
yes def
epic 👍
@earnest phoenix run ls in that dir
you dont have a package.json
not in that directory
are you sure you are in the right place?
where is the bot src
like where is the code stored
on your computer
k then on your phone
there is ur problem
go to the place where your bot code is
go to that directory
ok run pwd
terminal command
Shows current directory
is the output of that command the correct place?
is the bot code in the downloads folder?
also have you ever ran it successfully
have you ran it before
if the code isnt in the downloads folder then you arent in the right place
and of course dont forget the mighty https://github.com/jezen/is-thirteen
@quartz kindle wow this lib is very useful, thanks
How do I donate to that
Thirteen is an unlucky number, I just cannot allow my users to input that anywhere
http://www.wtfpl.net/txt/copying/ LMAO THEIR LICENSE
someone knows what is happening? why i cant install packages?
Try deleting the node_modules folder
Also, use the npm cache clean command
Maybe that will help you
ok thanks
@ember lodge you dont have the command line tool make installed on your computer
Hello
Does anyone know where a Discord bot can be hosted other than repl.it?
a VPS
or computer
is it me or database are hard asf
no matter what I try or how much time I spend learning I can't grasp it
@stark abyss what kind of database?
i tried quick.db [easiest yet I failed], nedb, mongodb
Or just save coffee money and buy a vps
I get stuck somewhere and then I can't move on
Have you tried sql databases?
Does anyone know where a Discord bot can be hosted other than repl.it?
@Mr.Abyssus#0001 heroku, something.host, etc
Also, don't think sql as a programming lang
It's really just a "I want this data" query
Or "gimme that data, from that table and also sort it by date"
oh okay I will try postgress next it's probably gonna take time but worth it
I'd recommend a plug-n-play database to train before you hop into complex ones
Like sqlite

How to create a database?
Right click -> New file -> rename -> database.sqlite
Also it has very basic data types
So it's a really good database to start doing sql
Also it doubles as caching database
Because it's so lightweight that you'll barely notice it
Hey all!
so I want to add a music command to my discord.js bot
Can someone help?
Just @ me 🙂
@primal garden, this may interest you:
@sudden geyser Does this link talk about on how to make a YouTube Music Bot?
Sorry if i'm being dumb...
I don't mean to
I just really don't know how to do music side of things
It teaches you how to work with voice channels in Discord, not how to work with YouTube. As for how to get the YouTube data, I've never worked with music, but I've heard of ytdl-core: https://www.npmjs.com/package/ytdl-core
oh okay thhx
Is there a way to capture an airport’s METAR information and post it into Discord with Python? It’s a little project I want to work on
so im trying to send a embed through pages but it sends the embed written out in text instead of sending the actual embed any ideas?
Java: Are you building the embed object?
JS: Are you sending the correct object?
Java: Are you building the embed object?
JS: Are you sending the correct object?
@lyric mountain im using python and yes
Is it sending the string representation of the embed or is it sending the content as text?
Nonetheless, double check if you're passing the right object
Someone tag me when they respond to me
is it against ToS for bot to auto leave server if bot hasn't been used after lets say 1 week?
if you google metar api theres a buttload of them @hasty mulch
no, you can leave servers whenever
so bots can leave server whenever they like?
just double confirming here.
yeah, it may be ideal to mention it somewhere on your bots page that itll leave for no one using it.
Not as much as you think tho
if it helps, it helps 🤷♂️
well it kinda does since i have an online db with a read/write limit
any recommendations?
never used one
Ah that sucks
Why not use an embedded db?
Or are you heroku'ing?
yes
I see
heroku 
well, its only a hobby for making bots but people do use it
It always start like that
My bot was never meant to be global too
Shiro now kinda became my younger sis
both its quite strange
Maybe you're missing some smallish details somewhere
ive tried that
Try debugging the code
ive started from screatch no embeds just pages
any ideas where i should go from there
I mean, ig python has debuggers
yes i tried nothing came up
Run the code in debug mode
And put breakpoints near the place you send the embed
Then go step by step seeing object states
Maybe it's a discord issue then, they had some hard issues with embeds today
There's an announcement for that
@lyric mountain
I'd like the screenshot version of it
okay
On mobile it's hard to read codeblocks
Btw, why do you use an infinite loop?
You could simply listen to OnReactionAdd events
its easier to use a infinite i find makes there less a chance to getr a rate limit
in my mentality at least
Ratelimit for events?
yes
no nothing is
my question is how would i switch out the pages foir embeds
cause before when i tried i got this
in a node.js bot, whats the best option for error handling?
making every command file async then a .catch() in [the file that handles command execution]
using try .. catch within the command file
or something else?
.catch
This because promises may fail without triggering try-catch sometimes
i did and i did it exatly how documantaion did
how can i get a message's link?
dpy docs didnt help
than u didnt read enough
because its there
wait a link?
No, .catch is promise-only
manual?
For sync stuff try-catch works fine
yes a user has to do it
or you're just bad at reading the doc
https://discordpy.readthedocs.io/en/latest/api.html?highlight=jump_url#discord.Message.jump_url
oh well
oh
@rich ether found the issue
Like, it's a very very "it can't be" error
wym
Or "how tf didn't I notice that" error
@earnest phoenix if i pass: message.jump_url into a function
can i pull message.jump_url?
You're passing the embed object inside the content
oh fuck me
and just make it a link?
So it's getting converted to string
fuck this man i need sleep
wdym?
Lul
ughhh
it returns the string
like i have the message object right?
i do message.jump_url
it send the embed in text form instead of embed form
and i pass that in a function
Yeah
what function
its passing the url?
yeah
Did that solve it lope?
nope
yes, it's property of Message object
lemme try, thanks btw
fucking annoying ass code
Like, did u try embed=stuff?
yes but it dosent work anymore outdated
what error
syntax
i think bc of the .
Try replacing content with embed
then you must be doing something wrong somewhere
auto error
ugh ill deal with it tmrw
@earnest phoenix
To provide an alternative answer to the one already given, you should be able to edit an embed of a given message like this :
from discord import Embed ... first_embed = Embed(title='embed 1') new_embed = Embed(title='embed 2') # send a first message with an embed msg = await ctx.send(embed=first_embed) # edit the embed of the message await msg.edit(embed=new_embed)
From stackoverflow.com
see what i sent
that's not how you specify a parameter when you're defining a function
ill try to remove message
@rich ether try this

No, not like that
@rich ether send method returns the Message object it sent
that's why it's sending Message object
Don't give up
Why an AI?
Ah
yup
Hi
Wish I could understand how AIs work so I could make a bot player for my TCG
I'll never underestimate games ai now
But like, the npc would need to understand current arena state, which cards it has and which cards are best to play in that turn
im back and yes your completey right it would take the cards personal api for the ai to understand it
Still too abstract for me (btw, there's no api, I wrote the game from scratch)
It's an in-discord tcg
I'm clueless then
Maybe there's a specific way to edit embeds in newest discord.py
Ah, hm
What if you use both content and embed parameters?
Like, put page number in content param and the embed in embed param
Maybe it's getting appended because of that page counter
Also, you got a different response this time
u gud g
you're passing Embed object into content kwarg 
i got something like this, after getting the kwargs, you can do, edit(**kwargs)
sure
try edit(content=f"Page {cur_page}/{pages}:", embed=contents[cur_page-1])
that actually worked after i tweaked it a bit
Wait, did it?



