#development
1 messages Β· Page 1395 of 1
I see
so after he sent me his version i tweaked it a little to match the top code and boom it works like a charm
Nice
Maybe we could play tcg someday lul
ofc g
Just kidding, you'd not understand a thing since it's br
see ya
.addField('Text Channels',`${message.guild.channels.filter(m => m.type === 'text').size}`,true)
message.guild.channels.filter is not a function
you forgot the cache part :3
:o since when did this server have replies
Hello, How do I identify if a user manually kicked the bot?
Check Server logs
I mean you can't if the bot's been kicked. So no, you can't know.
Error: Cannot find module '/app/index.js' at Function.Module._resolveFilename (module.js:548:15) at Function.Module._load (module.js:475:25) at Function.Module.runMain (module.js:694:10) at startup (bootstrap_node.js:204:16) at bootstrap_node.js:625:3
Bunun hatasΔ±nΔ± bilen varmΔ±?
Help me
@molten yarrow
sounds like there's no file called /app/index.js
note that / at the start means "at the root of the drive" in the case of a package.json
you might want to do ./app/index.js instead.
okey wait 1 minute
am trying
What should I write in /app/index.js
@umbral zealot
uhhhh your bot?
why are you trying to run a file if you don't know what to write in it???
But am new coder π¦
Ok well if you want to make a bot, here's how:
Step 1) learn a programming language
Step 2) choose a library in that language
Step 3) actually start writing the bot
Step 4) ask for specific help if you need it
π π
πββοΈ
@drifting wedge well you could use bot.wait_for or the on_reaction_add event and check if the reaction was added to a giveaway message
So basically I need the users Id and the server it was run it
But only for specific messages
Like so for example, when user joins giveaway, it dms them, saying giveaway joined etc
Ping pls
Hm..I'm not sure what the best way to handle this is
Yeah sorry @drifting wedge I can't help you because I haven't personally worked with giveaways, so I don't know the most efficient message . I suggest doing some research and checking out other giveaway bots on GitHub
@umbral zealot
I solved the problem and now my bot is active but it doesn't write to any channel
@umbral zealot
Can anyone guide me using nginx for sub domains
Actually idk anything about nginx
Can you guide from starting
at RequestHandler.execute (C:\Users\Administrator\Desktop\Almas V2\node_modules\discord.js\src\rest\RequestHandler.js:93:15)```
i still get this error

didnt the api issue get fixed
Must i add somethink special to my bot that on the top.gg website the server count work?
const Command = require("../../Base/Command");
const ms = require('ms');
class Timer extends Command {
constructor(client) {
super(client, {
name: "timer",
description: "Start a timer",
usage: ["timer <timer>"],
aliases: ["tstart"]
});
}
async run(message, args, Discord) {
const setTimer = new Discord.MessageEmbed()
.setTitle("Timer")
.setColor("RANDOM")
.setDescription(`Timer set for: ${args} seconds`)
message.channel.send(setTimer)
function Timer(){
const timer = new Discord.MessageEmbed()
.setTitle("Timer Ended")
.setColor("RANDOM")
.setDescription(`Timer of ${message.member.displayName} ended, duration: ${args} seconds`)
message.channel.send(timer)
}
setTimeout(Timer, args * 1000)
}
};
module.exports = Timer;
``` i just want this to edit time every 5s
What errors are you getting?
Then you are probably getting rate limited
bro, i have not setup
the
editing
system
that what i need and i am here for
@hasty mulch
is there any reason why my avatar command stopped working when i got a new database
hm
let user= client.users.cache.find(user => user.id === `${vote.user}`);
vote.user is an id but for some reason it comes undefined please help
Can we please see some of your code to see if itβs there, also code language?
hello once a month this error occurs and my stick does not respond to anything until i restart it and it is very, very disturbing but I have no idea why you are doing it and what the solution would be for me please help
ERROR LOG
0|yue-chan | at RequestHandler.execute (/var/www/html/system/servers/discord /yue/node_modules/discord.js/src/rest/RequestHandler.js:107:21)
0|yue-chan | at runMicrotasks (<anonymous>)
0|yue-chan | at processTicksAndRejections (internal/process/task_queues.js:9 7:5) {
0|yue-chan | code: 500,
0|yue-chan | method: 'post',
0|yue-chan | path: '/channels/742774086442287165/messages'
0|yue-chan | }
0|yue-chan | HTTPError [AbortError]: The user aborted a request.
0|yue-chan | at RequestHandler.execute (/var/www/html/system/servers/discord /yue/node_modules/discord.js/src/rest/RequestHandler.js:107:21)
0|yue-chan | at runMicrotasks (<anonymous>)
0|yue-chan | at processTicksAndRejections (internal/process/task_queues.js:9 7:5) {
0|yue-chan | code: 500,
0|yue-chan | method: 'post',
0|yue-chan | path: '/channels/742774086442287165/messages'
0|yue-chan | }
whats ur code?
i don't know which code is the error
i mean does this error come when u start the bot or when u do a command?
completely random not knowing what makes you sure not to boot
for me the bot has been running fixed for 1 month without stopping and it's just so random from one moment it happens and I notice the next day because I did sleep when the error happened
too many clusters lol 
scale
hmm
there were too many servers on each cluster again so i had to double them once more
should now be on until about 80,000 servers, which i'll probably not reach tbh
but never say never
const msg = await message.channel.send(helpss);
await msg.react('ποΈ')
await msg.awaitReactions((reaction, user) => message.author.id == user.id && (reaction.emoji.name == "ποΈ"), {max: 1, time:10})
.then(async collected => {
if(collected.first().emoji.name == "ποΈ"){msg.delete(), message.delete()}
else return message.channel.send("error")
})
error:
TypeError: Cannot read property 'emoji' of undefined
the beautiful back yes i never say never
@tardy hornet enter the name of the emoji
(reaction.emoji.name == "\ποΈ")
\ποΈ
10 milliseconds 
\:wastebasket:
the word emoji is undefine not the actually emoji
then I don't know how it just worked for me
@tardy hornet I already told you to put time to 15000.
the promise is being resolved immediately. And hence have nothing in collected.first()
If you want to produce error on timeup. you can also set that too
This is 10 milliseconds
const axios = require('axios');
const { MessageEmbed } = require("discord.js");
module.exports.help = {
name: "emoteinfo",
}
module.exports.run = async (bot, message, args) => {
if (!args[0]) return message.channel.send("No emoji was provided")
let emoji = message.guild.emojis.cache.get(args[0])
emoji = message.guild.emojis.cache.get(emoji.id)
if (!emoji) return message.chinoReply("Emoji not found")
let embed = new MessageEmbed()
.setColor('RANDOM')
.setThumbnail(emoji.url)
.addField("Emoji Name", `\`${emoji.name} \``, true)
.addField("Emoji Id", `\`${emoji.id}\``, true)
.addField("Emoji Added on ", moment.utc(emoji.createdAt).format("LLLL"), true)
.addField("Emoji Animated?", animated, true)
.addField("Download", emoji.url, true)
message.channel.send(embed)
} ```
this never works for me]
//"-"\\
you never defined animated
whats does the error says?
CAnnot find id of undefined
what actually args[0] is?
?
an id or emoji itself?
emoji
how should i do then
u can find emoji by name
@deep hearth what do you use to host your bot lmao
const axios = require('axios');
const { MessageEmbed } = require("discord.js");
module.exports.help = {
name: "emoteinfo",
}
module.exports.run = async (bot, message, args) => {
if (!args[0]) return message.channel.send("No emoji was provided")
let emoji = args[0]
emoji = message.guild.emojis.cache.get(emoji.id)
let embed = new MessageEmbed()
.setColor('RANDOM')
.setThumbnail(emoji.url)
.addField("Emoji Name", `\`${emoji.name} \``, true)
.addField("Emoji Id", `\`${emoji.id}\``, true)
.addField("Emoji Added on ", moment.utc(emoji.createdAt).format("LLLL"), true)
.addField("Emoji Animated?", animated, true)
.addField("Download", emoji.url, true)
message.channel.send(embed)
} ```
@rocky hearth
still error

omg, not like that
pls can u edit the message
const emoji = message.guild.emojis.cache.find(emj => emj.name == args[0]);
node:13080) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'url' of undefined
in set thumbnail line
@rocky hearth
only custom emojis have a url, though
its custom
try, logging emoji
and animated
i tried removing thumbnail now saying cannot find name of undefined
@rocky hearth
pls
π£
you should log emoji he said
Altimeter: {'repr': 'A3060', 'value': 30.6, 'spoken': 'three zero point six zero'}
How do I grab the value of this JSON output?
Using Python
@earnest phoenix That really doesnβt help me, cause I have response.json()['altimeter'] already
i mean, it's just as easy as working with dicts
What does the input thingy for discord py mean? Does it mean the user has to input an word or letter I put after doing input?
I'am From Turkish
How to put an attachment into an image of an embed?
ok
@hearty horizon see
Hi, do you have any docs for server webhook?
Or what types of requests can the webhook send?
I have already setup "upvote"
@waxen siren
@turbid shale
full code
i dont have a error
you need to add intents to your client
which intent ?
no its GUILD_MEMBERS for guildMemberAdd and guildMemberRemove events
also need to enable it in your dev portal
ok thx
from the shard manager(auto), should it be client.shard.totalShards.count ?
see pins
I can't see it
I see only informations for bot webhooks
Server webhook is basically the same thing as bot webhooks
POST request sent on each vote/test to specified URL with specified Authorization header
#topgg-api message data format (request body)
Javascript weird
no...
client.shard is not the sharding manager
they are two different structures
I am using the auto shard manager form discrd js
this is the sharding manager https://discord.js.org/#/docs/main/stable/class/ShardingManager
this is client.shard https://discord.js.org/#/docs/main/stable/class/ShardClientUtil
yes, but how can i pass the value form the shard manager?
what value
the shard count
from client.shard
I just wanna know the number of exiting shards
client.shard.count?
okay another question:
Does respawn kill all shards?
or can I user broadcasteval("process.exit();")
to kill all shards?
I programmed , so long on my bot, but did not ever edit a embed message!
how does it works?
message.edit?
How can I know, who has invited the member to the server?
Or can I get the link through which the member has joined the server?
nope
the only way to do that is to keep track of invite uses
you need to fetch all invites when your bot starts, then when a user joins you need to fetch the invites again, and compare which invite got its usage count increased
let msg = await message.channel.send({embed: helpmessage}).then(suggestmessage => {
suggestmessage.react("π");});
const filter = (reaction) => reaction.emoji.name === 'π';
const collector = msg.createReactionCollector(filter, { time: 15000});
collector.on('collect', r => msg.edit(testmessage));
collector.on('end', collected => console.log(`Collected ${collected.size} items`));
``` it does not edit the message, without reaction it works, with ==> no
@tired panther you're overriding the return value of the promise
Ooh wow! Nice trick...
Is there any chance the usage count could get decreased?
not that i know of
where did i overwrite it?
@tired panther ```js
let a = await x.send() // a is the sent message
let a = await x.send().then(b) // a is the result of b
the await returns the final value of the promise chain, including all the .thens you use
in your case, your .then() is not returning anything, so msg becomes undefined
let msg = await message.channel.send({embed: helpmessage})
msg.react("π");
const filter = (reaction) => reaction.emoji.name === 'π';
const collector = msg.createReactionCollector(filter, { time: 15000});
collector.on('collect', r => msg.edit(testmessage));
collector.on('end', collected => console.log(`Collected ${collected.size} items`));
``` will that work?
await msg.react()
thx, it works
@tired panther If your helpmessage is an embed. You can directly pass it to send. No need to create an extra object
@quartz kindle how can i built in a if case in collector.on
not just quick.db though
is the on_ready event changed in the discord.py? It's not working anymore, came after 4 months π
how exactly is it not working?
congo π₯³
Thank u


But the thing is I have to change p! To {prefix} in all the command where I used p!


I am running my tiny brain to think that like I have default messsage in app.js but I am able to set welcome channel can I set welcome message too
ctrl+f find and replace
make sure prefix is defined wherever you use it or it will error
yes
what is the systemChannel for the server?
Default is the #General
but I think it's deprecated
no it's not mentioned in the docs
Then it's good to go
Before we weren't able to edit or delete that channel but then there was a change and as you can see we can delete or Edit the channel and actually set a different channel for System message.
system messages aren't deprecated
they just don't get new features
they also have no default
Create a new server #gen is the default
Anyway,
How do I get id of an Emoji ?
i think discord.js has a GuildEmoji class which contains info about emojis
Default channels don't exist anymore
I'm talking about like adding a new Emoji in my server and I want to use it in my bot's embed
A guild is able to contain no channels
Yeah IK,
I was talking about old times
We weren't able to delete #gen then
escape the emoji
@near stratus there is a GuildEmoji class which extends the Emoji class
like
\:emoji_name:
It don't work
!KEKW
hm
are you talking about escaping emotes to use them in bots or do you want the actual id for some other shit
How do you do that ?
I can only escape Mention and Channels in Mobile
now just copy paste the whole thing (not just the id) then use it anywhere in your bot
you can
@earnest phoenix
:verified: this is not working
but bots can't use custom emojis without that
also bots don't need to pay for nitro
\:pogey:

I thought for half an hour on this
now you know 
awesome
does the npm package chalk have a client-side version i can use in browser javascript?
or do the color stuff only work in terminals
i-
Isn't it's supposed to be styling the terminal ?
const user = message.mentions.users.first()
const embed = new Discord.MessageEmbed()
.setColor(colors.cyan)
.setImage(user.user.displayAvatarURL())
message.channel.send(displayAvatarURL)
It says displayAvatarURL is undefined or something
I don't want to look stupid! π
Yes, it wouldn't make sense to use chalk on the client side. Unless they were emulating a terminal or something
is the bot in the server
because you're doing user.user on a User object
user is already a User. You don't need to do user.user
that's not a GuildMember my boy
I didnt use it twice
and use
message.channel.send(embed)
const user = message.mentions.users.first()
const embed = new Discord.MessageEmbed()
.setColor(colors.cyan)
.setImage(user.displayAvatarURL({format:"jpg"}))
message.channel.send(displayAvatarURL)```
OH SHOOT
π€¦ββοΈ π€¦ββοΈ π€¦ββοΈ π€¦ββοΈ π€¦ββοΈ
omg.
I should have had hot chocolate this morning.
const user = message.mentions.users.first()
const embed = new Discord.MessageEmbed()
.setColor(colors.cyan)
.setImage(user.displayAvatarURL({format:"jpg"}))
message.channel.send(embed)
lol
I need help with mimu-
I was so stupid, Sorry I am tired.
What's mimu- ?
I
huh ?
Oii
I dont think i got the right server-
Can't I make it like the picture to be full screen? Like high quality
gg
yeah
π
a nice bot

Can't I make it like the picture to be full screen? Like high quality
It's like small! π
I want it big. Any way?
you only get upto 4028 pixels
You should try this
I don't know if it'll work
https://cdn.discordapp.com/avatars/584309117380853770/44288597befe003628809bca1005fb47.png? This is my avatar
Just add size attribute after that
because you don't specify the size in the function
like:::
https://cdn.discordapp.com/avatars/584309117380853770/44288597befe003628809bca1005fb47.png?size=256
user.displayAvatarURL({ /* settings */ });
You can define size in that object
const user = message.mentions.users.first()
const embed = new Discord.MessageEmbed()
.setColor(colors.cyan)
.setImage(user.displayAvatarURL({format:"jpg",size:"your-desired-size"}))
message.channel.send(embed)
it doesnt show the greeting-
keep in mind high quality images take longer to load on people's computers
@coral trellis -wrongserver
-wrongserver @earnest phoenix
@earnest phoenix
Hey! We think you have our server mistaken. We do not provide support, help, or advice for any bot. You need to click on the "Support Server" button on the bot's page, not the "Join Discord" button at the top of our website. If there isn't a button that says Join Support Server, then we can't help you. Sorry :(
I-
You can even use 4096

_ _
quote button no exist so I'm replying with blank message
also not that every person might not have full size avatar
4096x4096 == 16777216
π€―
that much pixels in a single avatar
π
each pixel is about one byte in PNG iirc
Yeah
Imagine living in South pole and loading an avatar
16384KB size
16 MB
I'll be happy with 256
we haven't even started with dynamic avatars
Just don't set dynamic = true and size = 4096 together everrr
hold up lemme just do that
https://cdn.discordapp.com/avatars/503948134439976972/a_11c5790bc7a40220e03356e1a59dae8f.gif?size=4096
wait GIF images are WAY more compression-y than PNG
so umm

bro my avatar in PNG format is 3 KB and 3 MB in GIF
we suck at meth
@near stratus

I know I do

yes of course
is it just sending :verified: as the message or <verified:id_of_emoji>
(node:19884) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
embed.description: Must be 2048 or fewer in length.
how i can cut the text π
just type less text

or split the text into pieces at every x length and put them in array and use reactions/message collectors to turn pages
I want to create a profile card. But sources I have found are not very good. I wonder if anyone knows a good resource? With descriptive codes. (with discordjs)
so i cant edit the lyrics
then do what vigintillion said
im using some random api.ml
^^
split the text into multiple parts of 2048 characters each
how i can do that π
learn pagination systems
oh ok
can someone explain me why app.listen in express makes repl log the whole server instance in the console
I'm not the best at ejs express sorry bud can't help u
not the <% %> stuff
node version manager
Bruh I'm LoL I said jungle first now this kid started jungling and is taking all my camps ;-;
uwotm8
same thing happens to me
For me it does the same with all bot commands (module.exports).
Perhaps there's some logging setting, I'm not sure.
Switched to a proper hosting recently lol
egirls and now ejs
like
I already have a website made in html/css/js
but I also want to add a dashboard
so do I need ejs? or just express
make a php backend 
how to make a eval command ?
people hate php but i think i'll take that approach for my own dashboard, instead of learning shitton of js stuff lol
I just wanna know if I need ejs too ;-;
ejs is a frontend framework, right?
its used to put vaiables and js functions into html basically
Use ejs if you're not a masochist
yeah or react
not too familiar with that stuff but i like vue
how to make eval commanddddddddd
you can try some basic code in few of them and see which one you like
@earnest phoenix which language
just make sure others cant abuse it
coz it can be real real dangerous
quoting the site
I AM NOT RESPONSIBLE IF YOU FUCK UP, AND NEITHER ARE ANY OF THE DISCORD.JS USERS AND DEVELOPERS
if i upgrade my mongodb subscription from free to paid, will it reset my database collections? i am just confirming once
most likely no
it's definitely not going to clear your data without clearly saying so
embed=discord.Embed(description=f" Please use: `s, m, h, d or w!`", color=0xEF476F)
NameError: name 'discord' is not defined``` whyyy
did you import it
is discord defined
if i want to make an economy category etc will i need an data base?
is there one i can use thats somewhat free?
self host or interwebz host?
also what host do u use for ur bot?
how does your bot run?
im intrested how would i go about making a bot?
HOW DO U RUN IT
i miss clicked
it runs in vsc atm i havent got a hosting service ffs
ok so what programs would i need to make a bot?
u want to host db on ur pc or online?
there r free metgods for both
online if its free
which would be better
mongodb
mmk
you can host on heroku
which is free
and u can use online db
and ur good
heroku cant work with local dbs
Aku ok doh
let chx = db.get(`welchannel_${member.guild.id}`);
let msx = db.get(`welmessage_${member.guild.id}`)
.replace(/`?\?member`?/g, member) // Member mention substitution
.replace(/`?\?username`?/g, member.user.username) // Username substitution
.replace(/`?\?tag`?/g, member.user.tag) // Tag substitution
.replace(/`?\?size`?/g, member.guild.members.cache.size); // Guild size substitution
if (chx === null) {
return;
}
let data = await canva.welcome(member, { link: "https://i.pinimg.com/originals/f3/1c/39/f31c39d56512dc8fbf30f9d0fb3ee9d3.jpg" })
const attachment = new discord.MessageAttachment(
data,
"welcome-image.png"
);
bot.channels.cache.get(chx).send((msx), attachment);
});```
(node:10928) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'replace' of null
i need someone to please help remake my discord bot because me and my friend got into an arguement and he deleted it...
he gave me a backup though
Apa tuuuuuuuuuuuu
so use the backup
i cant...
f
well gl
pls
remove this
(node:8644) UnhandledPromiseRejectionWarning: ReferenceError: raid is not defined
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;
console.log(raid.pokemon_id + options.name)
let raids = data.raids.filter(raid => getName(raid.pokemon_id).toLowerCase() === options.name.toLowerCase() && raid.level >= (options.level ? options.level : 5))```
and this welmessage_$
could somebody help me with my problem?
console.log(raid.pokemon_id + options.name)
put it at the end of that code
not in the middle
@eternal osprey u can't log something that's only defined later
that's true
m
(node:11476) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'toLowerCase' of undefined
i have changed everything but it still sends an error
try raids inside the log instead of just raid
Hello everyone, someone pass me code for my bot to send memes to discord.py, I am using imgBB as image host
@hard anchor lmao code yourself
lmao
xD
oh
I am very new to python haha
so take a better look
use JavaScript
discord.js has more support for coding bots
(i believe)
hmm i have no clue what is wrong with my code.
i have been at this for atleast 3 days
could somebody have a look please?
how can i remove
i have to send welocome message
setted with quick.db
but not in there
then where'
what should i doo
wait see
i want that like
if user set welcome message
welcome ?member
?member should be replace to ${member.username}
or anything
@outer perch
no
On October 7, 2020 the events under the GUILD_PRESENCES and GUILD_MEMBERS intents will be turned off by default on all gateway versions. If you are using Gateway v6, you will receive those events if you have enabled the flags for those intents in the Developer Portal and have been verified if your bot is in 100 or more guilds. You do not need to use Intents on Gateway v6 to receive these events; you just need to enable the flags.
If you are using Gateway v8, Intents are mandatory and must be specified when connecting
let members = []
for(i = 0; i < guildMembers.length; i++) {
members.push(guildMembers[i]["uuid"])
}
console.log(members)
I am SO confused ;-;
cannot read property members of undefined
like what is that error ;-;
I'm using members as a variable not a property ;-;
you're probably in 100 guilds so you have to be verified
After our deprecation period ends, if your bot is in over 100 servers, you cannot turn on Privileged Intents until you get whitelisted first. We don't want you to have broken bots, so please get whitelisted first. :))
@cold vessel you can see :))
Yeah, you need to verify your bot on the developer page there should be a prompt at the top of the page
at the top of your bot page there should be something that says verify or whitelist or something
no :))
Can you send a picture of the page (don't leak anything)
Hmm. Did you get a system message from discord?
wait
yes it was 4 months ago
I don't know what to tell you other than you have to verify
I need to make a modrole command, but how do I use for role in ctx.author.roles: with the modroles.json file I have?
what is the eval to send a message in a certain channelID using python
ik its ctx.send
@drifting wedge
with responses
(node:9968) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'count' of undefined
at Object.exports.run (C:\Users\Win10\Desktop\bot3 - Copy\commands\votekick.js:28:41)
var NO_Count = reactions.get(disagree).count;
????
const reactions = await VOTE_TEXT.awaitReactions(reaction => reaction.emoji.name === agree || reaction.emoji.name === disagree, {time: 60000});
VOTE_TEXT.delete();
var NO_Count = reactions.get(disagree).count;
var YES_Count = reactions.get(agree);
if(YES_Count == undefined){
var YES_Count = 1;
}else{
var YES_Count = reactions.get(agree).count;
}
what prem should server and user info requre?
YES
none?
- Your bot must keep all owner commands locked to developers (e.g evals, status/presence commands and any other commands that may present vulnerabilities with your bot)
whats ment with presence commands?
help me :))
depends on what lib
i figured out how to do it
i was try download colorthief module but i got this error why ?
You probably don't have git installed
well try running git --version in the command prompt
You'll either get the current version of git, or an error.
So you either don't have it installed or added to your system path environment variable
Assuming you don't have it installed, see https://git-scm.com/downloads
i will try thx
anyone?
hello me
yep its fixed thx @sudden geyser
Halo
Git is very useful. You should try using it
Hell yeah git is great
How can I compare 2 users roles?
Code I tried:
let m = message.guild.members.cache.get(args[1])
if(m.member.highestRole.position > message.author.highestRole.position) return;
I don't see any mention of listening for other users in a voice channel.
so i cant like record users? and sell the data to google? π¦
aww man
why doing what Discord already does?
Yeah, you can't get yourself on a list 
ask to get a copy of the meeting from Discord or the NSA
is it that hard to take 10 seconds out of your day to do a google search
the solution there is manual conversion there are better ways programmatically
I've tried all the functions but the calculation either gives an incorrect value or gives an error
I am very confused
You still could've looked it up: https://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb
const ColorThief = require('colorthief');
let renkcik2 = ColorThief.getColor(url)
.then(asΔ±l => { console.log(asΔ±l) })
.catch(err => { console.log(err) })
function componentToHex(renkcik2) {
let hex = renkcik2.toString(16);
return hex.length == 1 ? "0" + hex : hex;
}
function rgbToHex(r, g, b) {
return "#" + componentToHex(r) + componentToHex(g) + componentToHex(b);
}
console.log(rgbToHex(renkcik2));```
like that ?
Why don't you just see if it works?
getColor returns a promise, you have to resolve it
what's the mysql equivalent of asyncpg?
I do not know how to do it :/
const ColorThief = require('colorthief');
let renkcik2 = ColorThief.getColor(url)
.then(asΔ±l => { console.log(asΔ±l) })
.catch(err => { console.log(err) })
var rgbToHex = function (renkcik2) {
var hex = Number(renkcik2).toString(16);
if (hex.length < 2) {
hex = "0" + hex;
}
return hex;
};
var fullColorHex = function(r,g,b) {
var red = rgbToHex(r);
var green = rgbToHex(g);
var blue = rgbToHex(b);
return red+green+blue;
};
console.log(fullColorHex(renkcik2))```
i do it this
but its sending NaNNaNNaN
your fullColorHex expects three numbers, but you are providing one string(or whatever ColorThief.getColor(url) returns)
In case you already didn't figure it out, GuildMemberManager.cache.get already returns a GuildMember.
Doing m.member is incorrect. GuildMember.member doesn't exist.
Secondly, Message.author is of type User. Users do not have roles. You might be looking for Message.member
its gives me like this
@solemn latch
Alright, Thanks!
arrays are not a number
Well then, resolve the promise as I said.
Go learn how promises work and resolve it.
Donβt be like that to him. All he wants to do is remove it from the array.
What coding language are you using?
js
let denemecik = Promise.resolve(renkcik2);
denemecik.then(function(v) {
console.log(v);
}); its gives me undefined
Javascript you can do something like this:
let returnedArray = Fill this with how you get the array with the 3 numbers.
console.log(returnedArray[1] + β, β + returnedArray[2] + β, β + returnedArray[3])
If you already have the array
Giving the 3 different numbers that will log it like
10, 50, 255 if that was the returned value
not how promises work. Go read again and actually learn instead of mashing the keyboard like a trained monkey.
How about help him instead of being a douche?
I did, I pointed them to the correct page that helps them learn about promises and how they work.
It's not nice that you speak badly, I'm trying to learn :/
If someone can't bother reading and learning correctly, I usually don't feel the need to be particularly polite.
@quick ridge Try my idea above
This one
its gives @agile lance
Hm
hi I know how to code a word in a line in a message. please help by tagging.
a word?
Like a variable?
as in a string?
Variable or a string?
yes
messages automatically return a string value.
can anyone help me with the g-i-s module, i have this code but it always returns an empty array
async execute(client, msg, args) {
const query = args.slice(1);
search(query, logRes);
function logRes(err, res) {
if (err) return msg.channel.send({embed: {
title: "Oh mateyyyy",
description: "An' err 'as occured when gettin' th image",
color: "#FB524F",
footer: {text: msg.author.tag, icon_url: msg.author.displayAvatarURL()},
timestamp: msg.createdTimestamp
}});
else
console.log(JSON.stringify(res, null, " "));
}
}```
@quartz kindle so im using svelte
and
name would be the name
and idk how to import from a folder with the file name of name
import x from 'folder/file'
I ran this code and it didnt work or print anythng
@client.command()
@has_permissions(manage_nicknames=True)
async def namelock(ctx, member:discord.Member= None, *, nickname):
if member == None:
await ctx.send("Who do you want to namelock?")
else:
bruhruhru = await ctx.guild.get_role(779063756243992606)
await member.add_roles(bruhruhru)
await member.edit(nick=nickname)
await ctx.send(f"{member.mention} has been namelocked to {nickname}.")
Are you sure the command actually exists?
wdym?
Is it actually attached to the bot in the first place?
yeah it is
like even just doing )namelock doesnt say "Who do you want to namelock?"
but its definitely in there as any command not in says "Command not found."
nibba
if you wanna learn discord.py read this first lol https://docs.python.org/3/tutorial/
what? i already read them
then read discord.py docs

uh i did
Ok i have made some edits and this is the new code:
@client.command()
@has_permissions(manage_nicknames=True)
async def namelock(ctx, member:discord.Member= None, *, nickname=None):
if member == None:
await ctx.send("Who do you want to namelock?")
else:
if nickname== None:
await ctx.send("What is the nickname you want to set the user to?")
else:
io = await ctx.guild.get_role(779063756243992606)
await member.add_roles(io)
await member.edit(nick=nickname)
await ctx.send(f"{member.mention} has been namelocked to {nickname}.")
if i leave any of the fields blank, it works but if i dont it doesnt
Good for you
alright so I'm tryna do something and I can't do it so heres the problem:
every couple seconds I'm adding 1 to a variable that starts at 0, now this is used to switch through indexes in an array basically every time it hits 80 it has to go to the next index, what I tried was Math.floor(i % 80) but this didn't work, does anyone know how to do this?
(Math.floor()Math.random()) generates a decimal between 0 and 1. If you want it to be between 0 and some number, you need to multiply the result, then you can use the modulo operator (%) as you have.
wait what
is there another way to multiply a variable by 2 besides foo = foo * 2?
foo *= 2
ty
floor? Wouldn't it be the random method?
????
π
See Lite's updated message
no I dont want it like that
So basically what I want to do is this:
<80 -> index is 0
80 && < 160 -> index is 1
etc...
So, let me get this straight. When i reaches 80, you want to go to the next element in the array by index. So, if I started at index 0 with no time, it was 80 seconds (for example), it would switch to index 1, correct?
okay so it is like that
and after another 80 seconds it swaps to index 2
Based off that, i / 80 and Math.floor could do you fine (Math.floor(i / 80)). If i was 150, for example, the expression would equal 1, but if it was 160, it would be 2.
it's basically I need to make 250 api requests, now the limit is 120 so I have an array with 3 keys and I swap between them when they reach 80
...so use setTimeout and just increment your variable
;-;
thats not-
what I meant
it's not exactly 80 seconds
and it's dependend on the api
are you trying to make a ratelimit handler
Sort of
Not for my own API
But I need to make more requests then allowed per key
So I'm using it like this
does the API return ratelimit headers or ratelimit information in the body
no, not that I know of
what I'm doing rn is every time I make a request I just add 1 to a variable
When it reaches 80 I switch to the next key in the array
that won't be accurate though
do you mind sharing the name of the API
At first I was doin this: this.apiCalls > 80 ? 1 : 0 since i only needed about 125 requests, but that doubled
you aren't making requests at a consistent rate
Hypixel does return the ratelimit.
it returns ratelimit info
Let me find my forum post about it
does message.member.voice.channel require intents?
im just wondering because its returning null for me
how do I check what ratelimit is left?
it doesnt show?
Hastebin allows you to share text files, code snippets, log files very quickly, simply and for free!
this is the response
If I make an HTTP request to https://api.hypixel.net/player?name=PotatoYT&key=..., I can see its headers. Here's what it looks like in Postman.
What HTTP library are you using?
node-fetch
Then do: js fetch(...) // ... is the URL .then((res) => { res.headers.get("...") // ... should be the name of the header, like RateLimit-Remaining });
TypeError: Cannot read property 'get' of undefined
But I think I know a diff solution
ok nvm I dont
Well obviously headers is undefined
Log your var res to see itβs properties
nvm fixed it
fetch(`https://api.hypixel.net/findGuild?key=${this.apiKeys[this.currentIndex]}&byUuid=${data["id"]}`)
.then(response => {
console.log(response)
if(response.headers.get("RateLimit-Remaining") <= 20) this.currentIndex++;
response.json()
})
.then(data => {
console.log(data)
For some reason data is undefined now ;-;
you didnt return it
lobo
i have been at this for atleast 3 days
https://hatebin.com/knkauwpabw
look at the code, line 52. TypeError: Cannot read property 'toLowerCase' of undefined
please anyone, help me out. I am literally desperate at this point.
@eternal osprey, either the call to getName() is returning undefined, or options.name is undefined. You should try logging the value of both expressions to see which one is causing the error.
getname is undefined
i tried loggin both
wait i can show you
console.log(raid.pokemon_id + options.name) this is what i am logging
it returns:
well basiocally, just the error i sent.
Okay, now that we know that, we can see the definition of getName: js const getName = id => nameList.filter(el => el.i === id)[0].n;
The next step would be to log every element in the .filter call (console.log(el)). based on the error, there are some elements passing the filter, but you grab the first one and n as a property is returning undefined.
in .js v12
Is this wrong to get the voice connections the bot is connected to on a shard
await client.shard.fetchClientValues('guilds.cache.filter(g => g.me.voice.channel).size');
You're supposed to log it in the filter as I said.
const getName = id => nameList.filter(el => el.i === id)[0].n;
console.log(getName)
this basically gave me this:
i've passed the el in the filter and logged it
it is not defined
You're not supposed to log the function. You're supposed to log the element currently being filtered. So, in the arrow function, add a block around it so you can log it.
To put that in code: ```js
.filter((el) => {
console.log(el);
return ...
})```
{
"$match": {
"finished": false
}
},
{
"$group": {
"_id": null,
"total": { "$sum": "$price" }
}
}
], function(err, result){
console.log(result);
})```
hello, is there a way to print the "total" or the whole result in an embed? using mongoose / javascript
the result returned in a callback cannot be accessed from outside
unless you promisify it
any steps / idea on how to do that?
#development message π
yeah i still could not fix nor log any of the info.
hey, using js, i've got an array, and i would like to push something in it, and put it in first position.
By example :
let array = [1]
array.push(2)
console.log(array)```Will log [1,2], and i would like to do this :
```js
let array = [1]
array.pushfirstPosition(2)
console.log(array)```And ouput [2,1]. Doest anyone know how i can do that ? And am i clear in what i say ? xD
root@nodejs-s-1vcpu-1gb-tor1-01:/botdash# npm start
> botmasdashboard@0.0.1 start /botdash
> node --experimental-modules --experimental-json-modules server.js
(node:39803) ExperimentalWarning: Importing JSON modules is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
Error: ENOENT: no such file or directory, scandir '/app/eventos'
at Object.readdirSync (fs.js:1021:3)
at registerEvents (file:///botdash/utils/registry.js:47:18)
at file:///botdash/server.js:352:9
at file:///botdash/server.js:356:3
at ModuleJob.run (internal/modules/esm/module_job.js:146:23)
at async Loader.import (internal/modules/esm/loader.js:165:24)
at async Object.loadESM (internal/process/esm_loader.js:68:5) {
errno: -2,
syscall: 'scandir',
code: 'ENOENT',
path: '/app/eventos'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! botmasdashboard@0.0.1 start: `node --experimental-modules --experimental-json-modules server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the botmasdashboard@0.0.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-11-19T22_24_25_604Z-debug.log
root@nodejs-s-1vcpu-1gb-tor1-01:/botdash#
Someone knows why this error happends to me when i try to start my bot in a Ubuntu VPS?
@ember lodge seems like you doesn't have any /app/eventos directory
from the built-in util module in Node.js, use the promisify function to convert a callback to a promise. See https://nodejs.org/dist/latest-v14.x/docs/api/util.html#util_util_promisify_original
@earnest phoenix ```js
// option 1
....aggregate(..., (err, result) => {
// do stuff with result here
message.channel.send(result)
})
// option 2
let result = await new Promise(resolve => {
....aggregate(..., (err, result) => {
resolve(result)
})
})
if those folders are in your bot's directory, user ./app/eventos
thanks!
@hasty lotus why are you trying to do that anyway
Bro
i need to do that
Well, it exists
"I need to do that" isn't exactly a good reason
@ember lodge yes this is in your bot directory
if you explain what you're trying to do, I might be able to show you how you're supposed to do it
@ember lodge its looking for /app/eventos, not /eventos
putting / will make your process search at the root directory
ohhhhh
well i've got a command
||galactus live event scrip startup (open to activate)
Nexus war event button
Galactus
Galactus has arrived message||
That's it? @hasty lotus
no
I did that bc I found the fortnight scrips to start the galactus live event
i can store multiple messages
but when i push it
if i want to get the last deleted message
i need to get the last item of the array
Then get the last item of the array?
i could
but i've also done womething
in which you can see old messages
const msg = snipes[args[0] - 1 || 0];```
when snipe is the array with all the messages
but there
if you do ;snipe 1
it will print the first deleted message
Ok I don't understand what you're saying lol
ok
i've got this array
that looks like that (simplified) :
[
{ "content":"blablabla (msg content)" },
{ "content":"content again"}
]```
and every time my bot emits the messageDelete event
does anybody knows the answer on my question?
i push ({message.content})
@hasty lotus use array.splice()
into that array
what does it ?
@hasty lotus use array.splice()
@quartz kindle can you guide me how to do it 1 by 1 if its okay? haha
Ok cool, but you're not explaining why you can't just get the last item in the list
@hasty lotus
well
il my command
const msg = snipes[args[0] - 1 || 0];
i would like
that when you do ;snipe 1
@hasty lotus
insthead of getting the first deleted msg
(the first item of the array)
it gets the last
or
when a message is deleted
@hasty lotus https://www.w3schools.com/js/js_array_methods.asp
it is stored as the first item of the array
im sure there's a method to accomplish what you're asking
yes, so you start at the end and subtract the number entered @hasty lotus
how ?
Subtract args[0] from the length of the array (snipes.length)
@earnest phoenix ```js
// option 1
....aggregate(..., (err, result) => {
// do stuff with result here
message.channel.send(result)
})// option 2
let result = await new Promise(resolve => {
....aggregate(..., (err, result) => {
resolve(result)
})
})
its returning like this
snipes[snipes.length - args[0]]
Is the first element the same as the last element...?
it returns the first item
nope
Alright well that doesn't make sense then
How many items are in the list @hasty lotus
Were*
Nvm
17 i think
They should've been different as long as there were more than 1
π€· can you show us the lines
@hasty lotus
Well that's a rip
I hope you don't go with the splice method
Which is not convention
app/utils/eventos? Typo?
it is a directory
Eventos?
Are you importing, or readdirSync?
If you are importing then your paths are cwd based. If you readdirSync, then your paths are root based
Are they in the cwd or root dir?
,
@limpid shadow did you want to say something..?





