#development
1 messages · Page 973 of 1
whats wrong?
I press the authorize button and then the same screen comes once again
route.get("/", async (req, res, next) => {
if (!req.query.code) throw new Error('NoCodeProvided');
const code = req.query.code;
const creds = btoa(`${CLIENT_ID}:${CLIENT_SECRET}`);
const response = await fetch(`https://discordapp.com/api/v6/oauth2/token?grant_type=authorization_code&code=${code}&scope=identify&redirect_uri=${encodeURIComponent(DOMAIN)}api/callback`, {
method: 'POST',
headers: {
Authorization: `Basic ${creds}`,
},
});
const json = await response.json();
const [{ username, discriminator, avatar, id }, tk] = await getUser(json.refresh_token);
if (!id) return res.redirect('/login');
res.cookie("refresh_token", tk, {httpOnly: true})
res.cookie("theme", "light");
res.cookie("avatar", avatar);
res.cookie("userid", id);
res.cookie("username", username);
res.cookie("discriminator", discriminator);
res.redirect(`/`);
});
anyone help me ??
just wait for someone to reply
...
@flat obsidian you are trying to use python in javascript wtf
Im noob
you cant mix languages
then learn how to use it first
ok dont tag?
sry

@quartz kindle Hey, I've seen that some people can set the STREAMING status, but without having to insert a link from twitch.tv. I tried, but I couldn't. Do you know how to do that?
@balmy knoll are you sure? im pretty sure url is mandatory, it has to be either twitch or youtube
Is there a way to stop one of my commands running without stopping my entire bot's process?
@quartz kindle Yes yes, but in fact the scream was there but it referred to the bot's website. But I can't put a link that isn't from twitch.
depends on your code
async
This isn't #memes-and-media
x2
i cant find a unban method anywhere in the docs. I know ban is in discord.js

why is the then inside the options lol
you can do message.guild.members.unban(..., ...)

would it just be .unban instead of .ban in discord.js
(node:8259) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions
@frosty swan u fixed it?
sounds like a loop
ur code?
route.get("/", async (req, res, next) => {
if (!req.query.code) throw new Error('NoCodeProvided');
const code = req.query.code;
const creds = btoa(`${CLIENT_ID}:${CLIENT_SECRET}`);
const response = await fetch(`https://discordapp.com/api/v6/oauth2/token?grant_type=authorization_code&code=${code}&scope=identify&redirect_uri=${encodeURIComponent(DOMAIN)}api/callback`, {
method: 'POST',
headers: {
Authorization: `Basic ${creds}`,
},
});
const json = await response.json();
const [{ username, discriminator, avatar, id }, tk] = await getUser(json.refresh_token);
if (!id) return res.redirect('/login');
res.cookie("refresh_token", tk, {httpOnly: true})
res.cookie("theme", "light");
res.cookie("avatar", avatar);
res.cookie("userid", id);
res.cookie("username", username);
res.cookie("discriminator", discriminator);
res.redirect(`/`);
});
on the account you're on do you have any servers on it @frosty swan
Does anyone know how to make a magic 8 ball?
no spoonfeeding
u creating ur own auth?
yes
well the guy isn't even answering my question smh
noice
Huh
it looks like the if(!id) bit, instead of redirecting them, console.log not logged in or something, see if thats where it breaks
@frosty swan
How do you unban someone with a ID? im trying to use a mention like <@id> but its not workinh
const unbanID = args[0];
and check if the id is banned
and if not then return
await message.guild.fetchBan(unbanID); you can use this in a try catch
@still merlin
Is there a way to slice from args
^
From args
yes
I think I solved the problem
Ok ty
nice, you finished ur auth?
yes
gj
lmao yh tbh idk why you joined my server to say kid as well
like well done you are still mad
meh
smh this is a #development channel too
i use next-auth for authentication
i like it cause i can use both ssr and csr
and it shows the same thing
nice
the only problem really is that my site runs on vercel which uses serverless functions
and it takes a bit to connect with the database each request
oh gotcha
How i change avatar in top.gg?
such as this bot
@earnest phoenix didn't i tell you already
also you can't do it on top,gg
hm? then why him can?
There are 52 collections and how can we delete them quickly below -_-
the bot is on 10 servers and is pending approval at top.gg, I hope it won't give you a change when administrators try it, I will have to wait 3 weeks again
the token that changes me alone
i need help this is bugged
aaaaa
its normal if your token changes when you refresh the page
the old token still works
i always forget you can do custom css on your page
and on top of that glich goes crazy and gives me error in everything
WTF
I have formatted the bot alone
Thank God I have it on github
I think don't use glicht
and what do I use
instead I suggest VDSs in Google Cloud to host the atom cloud text editor
yes
ok thanks
ok thanks
If you want, I can give you one
That isn't allowed here unfortunately, due to security reasons
You aren't allowed to host someone else's bot
If you want, I can give you one
@frosty swan I don't even know what it is but well
Someone know where i can find something like "Login with discord" to add to a website
Discord OAuth2
You have to code it in
Yae no worries there
ok
Thanks
np
100% free -> glitch / heroku / repl.it
1 year free -> google / amazon
not free -> vps (virtual private server)
@earnest phoenix
Thank u tim
vds is more expensive
100% free -> glitch / heroku / repl.it
1 year free -> google / amazon
not free -> vps (virtual private server)
@quartz kindle this is what i need, thanks
i give it free xd
i hear not to roll your own auth
VPS's and Dedicated servers are better, which is why they cost more
is that accurate?
vds = virtual dedicated server, is the same as a vps but more expensive and more powerful
o
we don't need to say we know them ..
I thought he just made a typo
what does?
lol
what does?
@quartz kindle google and amazon, and i think about the vps
and how I host it on google
google compute engine f1-micro is free forever if you dont hit the usage limits
but you need a credit card to create an account
If you are looking for cheap but also reliable, here are some ones that might be good:
https://contabo.com/
https://www.skysilk.com/
German server provider | #VPS from €3.99 / mo | EU and US Locations available | 15+ years of experience | 70k+ happy customers | #hosting #cloud #infrastructure
oracle has a free vps but it's really shit
they wont charge you unless you sign up tho
i have credit card from the deep web
also you need a debit/credit catd
ummm....
this is the vps i use
which
@earnest phoenix so a stolen credit card?
is this just for your bot
uh oh stinky
yes
@earnest phoenix so a stolen credit card?
@coral trellis no, is a credit card fake
@strong tundra
xd
REDACTED no, is a credit card fake
@earnest phoenix so it won't work?
yes my money
how many users does your bot have then
dedicated servers are better than vps or vds, but they are the most expensive
if you have money sure, go for dedis
and unecessary for a bot of small size
I better use my debit card and now
yeah it's very much unnecessary
is this???
you could probably run a decently sized bot off a pi
yes
yep
okay okay
160k users as in guild.memberCount?
no
i don't think anyone uses it though
how do you count your users?
ah
users is not a very good metric
because this server alone has 100k +
and other servers have like less than 10 users
yes
my previous bots are up to 450 servers then my account exploded
then they made the dm announcement from the bot
lemme go check how i get users
lol
im using sublime text 3
xd
ok weird
i have never used sublimation text
when you have your bot on 75 servers what do you do, because yesterday I arrived
lol
you go to your discord developer portal and click on the bot verification
@strong tundra how are you measuring your ram usage?
aaaa
which column?
I have been waiting for 2 weeks. What time do you think is approved?
mine took 3 weeks
..
hmm not sure
show a pic of your htop
@quartz kindle Spotify things it has a grand total of 200 Users lul
lmao
Idek why theyre even cached
still same thing though, one mem column
how can i make it more easy??
weird
wait my bot isn't even on there
try installing htop
anyways i'm too lazy to rebuild to make myself sudo
@silent cape You didn't always open the server and add your bot to your servers, right?
hmm
If you don't have this bot with a friend, are you doing it alone?
@quartz kindle Are you using vds or vps?
Is it too expensive : P
im using vps
Discord decided that your bot gained many servers in a short period of time
@quartz kindle how many gb upload speeds on average?
You'll be able to apply again later
@silent cape
If you're seeing an inorganic growth warning when attempting to verify, that means we determined that a significant number of the servers your bot is in are owned by the same user or set of users. This is considered inorganic and disqualifies a bot for verification. You will need to examine your bot's guild membership and work to fix this issue before being eligible to apply for verification.
Note that our Support team cannot typically undo this flag, and you will need to work to fix this issue on your own.
it does say cached
.......
i am getting 2gb upload speed with 1.5gb@quartz kindle
lmao
ctrl z
not working
then select and delete lol
@strong tundra how are you getting the memory usage?
to show in the bot info command
oh nvm
i don't use top
pmap $1 | head -n 2 | tail -n 1 | awk '/[0-9]K/{print $2/1000}'```
hmm this might be outdated
lol
lmao
ur token gg
you put your token on github?
no
lol
oh i bet it's a crate called procinfo
yeah got it
first I empty the glich repository, then my token comes out on github
what's going on
i'm currently in the middle of removing those scripts and using another sysinfo crate called heim
seems to be pretty nice
apparently all it does is open the proc files in linux lol
lol
lol
File::open(&format!("/proc/{}/statm", pid))
why would you send something like this...
also statm measures in pages not in bytes
how many languages should iadd
@strong tundra what does it show if you run pmap -x <pid> | grep total?
french
how many languages should iadd
@frosty swan as many as you can. Ask people to translate for you if you want to add more languages
your bot's pid is 1?
yeah
interesting lol
this is in a docker container
ah
on mine, the closest thing to memory usage as seen in top is the second value from pmap -x total
first value should be virtual memory, which is simply a predefined value the process tells the OS to prepare for
the actual memory usage should be the resident set
apparently yes
although you have a 4th value and i dont
so idk whats up with that
hmm yeah
i'd say your virtual memory is 147mb, and resident set would be either 96mb or 88mb
both of them would make sense
they would yeah
30mb should be the shared memory
still not sure why my bot says 10.55mb though
hopefully it changes once i use heim and use it instead of bash
here's what man pmap says
Kbytes: size of map in kilobytes
RSS: resident set size in kilobytes
Dirty: dirty pages (both shared and private) in kilobytes
hmm i see
so i guess yours is splitting shared and private while mine isnt
oh that last one is swap btw
yeah
so i guess pmap -x | grep total would be a good way to measure it
seems like it
g
ok i switched to heim for my mem/cpu
seems reasonable
although idk how i have 19 guilds now instead of whatever i had earlier
lmao
32 gig of ram for a bot in 19 servers. nice
what
i also have a plex server and someone else hosts multiple minecraft servers where this is hosted
lol
also i guess some people left and serenity didn't take it out of cache
idk
What's the command for mute at dc.js
wym?
I dont know the command for mute at dc.js
dc.js wont exists, if you mean discord.js use instead djs or d.js
I guess he means DisCord.JS
Which is djs
What's the command for mute at dc.js
@flat obsidian technically you can't mute with djs like you would ban or kick someone, you have to make a muted role and give it to the user you wanna mute
you dont have to make a role
@sudden geyser yes
Hello, I have a private bot and I realized that it is on 5 servers, how do I get it to get out of those
I can do the same bot and put the token on the command line
: (
Do you have an eval command?
Also, make sure you make your bot private in the developer portal
Then there's no way it's in 5 server if it's already private. If it's private then only you can invite it
- Get the member the command caller wants to mute.
- Do some condition checking like if the author has permission to use the command or if they can mute the specified target.
- Check if a mute role already exists. If it does, use it. Else, handle it your own way (creating a new role or telling the author no mute role exists)
- Apply the mute role and tell the author the member has been muted.
Does it sound vague? That's because we can't just give you the answer. You'll need to attempt it first, or try looking at how other bots have implemented it and go from there as an example.
just iterate through the guilds and leave them @earnest phoenix
make a command and do it
what language are you writing it in
- Get the member the command caller wants to mute.
- Do some condition checking like if the author has permission to use the command or if they can mute the specified target.
- Check if a mute role already exists. If it does, use it. Else, handle it your own way (creating a new role or telling the author no mute role exists)
- Apply the mute role and tell the author the member has been muted.
Does it sound vague? That's because we can't just give you the answer. You'll need to attempt it first, or try looking at how other bots have implemented it and go from there as an example.
@sudden geyser
im updateing from discord.js v11.6.4 to 12.2.0.
Why is :
console.log(`${bot.guilds.map(guild => `> ` + `[${++guildindex}] - `.bold + `${guild.name}\n`.red.bold + `Members - ` + `${guild.memberCount}`.red.bold).join(`\n`)}`)
Not a function anymore xd
i using glich hello express sorry xd
guilds.map was changed to a manager in v12
code a command that leaves all guilds
@sudden geyser How could i rewrite that function with 12.2 ?
To get rid of the problems, I make another bot and put the token to the command line
huh
@clever tree bot.guilds.cache.map
@quartz kindle thx
haii im looking for a solid way to run a background timer? i used start = time.time() while time.time() - start < 10: so that everything in the while loop happens until 10 seconds are hit, but it never hits 10 seconds for some reason, as i've left it for several minutes and its still inside the loop. any ideas?
a timer that occurs while my other code is being played out, not smth that stops everything like asyncio.sleep
asyncio.sleep isn't blocking
and when the time limit is hit it pulls me out of that code
So you want to run stuff continuously for 10 seconds
i believe so
Hello! I made my own command off of a daily reward command and i want to make the cooldown 10mins and it sort of works but you can do the command and get money however it doesnt give you a cooldown can someone help
And thats while your other code is still being run?

the aim of my code is to ask a question, and check for the right answer for 10 secs
@jade jungle you defined a timeout and did nothing with it
Why not have a timeout?
Hmm
@quartz kindle How would I fix this, i'm new XD
Maybe you could use client.wait_for?
oh is that in the py api?
ah im using that already
@jade jungle there is no automatic way to create a cooldown, you have to code your own cooldown system, which isnt hard, but it requires a few lines of code and a bit of knowledge
unless the code or framework you copied from already has a cooldown system built in
timeout=10? 
@quartz kindle It has a cooldown but the cooldown isnt working
I'm not sure if its because it has .daily at the end or
my full code is
`start = time.time()
while time.time() - start < 10:
while not secondphase_correct:
msg = await client.wait_for('message')
if msg.content == right_answer:
secondphase_correct = True
await message.channel.send(f"Uh huh. Well done!")
if not secondphase_correct:
lives = lives - 1
await message.channel.send(f"Uh oh! Took too long. {lives} lives left. ")
if lives == 0:
await game_over()
return`
if that helps
no no no
oop
Wait for only takes one response
Aubee wants it so you can put as many answers as you want untill one is right, all in 10 seconds
while not secondphase_correct:
msg = await client.wait_for('message', timeout=10)``` 
timeout (Optional[float]) – The number of seconds to wait before timing out and raising asyncio.TimeoutError.
can you input multiple messages that arent correct in that time?
if so then thats perfect lol
Every time they get it wrong the timer resets tho
oop
```language
Code
I mean, not providing a timeout will basically make your code hang forever until the bot receives a message from somewhere
Wait_for is blocking
no it should stop when the timer gets to 10
and move ontoif not secondphase_correct: lives = lives - 1 await message.channel.send(f"Uh oh! Took too long. {lives} lives left. ") if lives == 0: await game_over() return
Make a global dictionary where the key is user ID and the value is a list (consisting of a boolean value (False by default) and time.time()). After sleeping for 10 seconds, see if correct answer was provided later in the code
In on_message, get ID from the dictionary and if ID is there, compare answers. If correct, edit bot.dictionary[user_id][0] to True
ah,, problem
im not in on_message and the game im making is supposed to be very multiplayer, so it needs to allow up to 13 people to have an answer
i changed the code before sending it so people wouldnt think it was weird i wasnt using message.channel.send bc that wasnt the focus of my problem
You'll utilize on_message and get the message author's ID from the dictionary
unless I'm missing the part where multiplayer isn't possible following my logic?
i took it that user ID meant a singular id from one player
well that's why I suggested a dictionary 
does dispatcher.destroy exist (on v12). I’ve look through the docs
Is it possible for my bot to delet webhooks it made? I can't find the command. I tried .delete but that just deleted the message and not the webhook itself.
What lib
If I want to use the eval command to publish all messages that are sent to a specific channel, how can I do it in discord.py?
Use jishaku
It's a debuging extension
jishaku is a debugging and experimenting cog for Discord bots using discord.py@rewrite.
Note that this only works with Python 3.6+ and discord.py rewrite.
You can install it by running the following:
pip install -U jishaku
```or
pip install -U git+https://github.com/Gorialis/jishaku
To get the cog running, simply do
bot.load_extension('jishaku')
You can see the source code yourself here: <https://github.com/Gorialis/jishaku>
Why isn't this working? It gives an error if I disable dm but it doesn't return the message.
What's msg
oh F
lol
Still, it doesn't work.
Are you trying to DM the message author
Yes.
message.channel doesn't seem to be the message author
Ohhhh
dude
no no
that try catch won't work unless the channel is locked for the bot
I forgot to send the author a message inside the try method
I cannot seem to find a reason why this issue is occuring..
Sjsj
How do I remove the last comma?
code?
Nevermind I fixed it
I have this other annoying issue now
if(arsenal !== "none") {
for (let i = 0; i < arsenalarr.length; i++) {
client.con.query(`SELECT * FROM items WHERE itemid = "${arsenalarr[i]}"`, (err, rows) => {
if(err) throw err;
if(rows.length < 1) return message.channel.send(`Something went wrong please DM ChickenDev or Tomito`)
console.log(rows[0].itemname)
if(arsenallist === "") {
arsenallist += rows[0].itemname;
console.log(arsenallist)
}
else {
arsenallist += `\n${rows[0].itemname}`;
console.log(arsenallist)
}
})
}
}
The arsenallist stays at "" but logging the arsenallist it should be overwritten any idea why?
So the string is getting overwritten after the message is sent
Any idea how I let the for loop go first
And then send the message
to remove the comma just use a regexp
($,)
that should do it
@strong tundra yes, strings are arrays of characters
Anyone pls help
How can i fix this error AttributeError: 'Message' object has no attribute 'publish'? [discord.py]
dont do message.publish
@modest maple How can I do that?
The bot has to post a message that's not his own.
pls anyone help
can't help without knowing the problem
scroll
sa
Why MembersData can't print in db ???
not sure, because it's empty?
help ?
code?
code?
@digital ibex const { Client, Collection } = require("discord.js");
const { readdirSync } = require("fs");
const { join } = require("path");
const { TOKEN, PREFIX } = require("./config.json");
const client = new Client({ disableMentions: "everyone" });
client.login(TOKEN);
client.commands = new Collection();
client.prefix = PREFIX;
client.queue = new Map();
/**
- Client Events
*/
client.on("ready", () => {
console.log(${client.user.username} ready!);
client.user.setActivity(Music | ${PREFIX});
});
client.on("warn", (info) => console.log(info));
client.on("error", console.error);
/**
- Import all commands
*/
const commandFiles = readdirSync(join(__dirname, "commands")).filter((file) => file.endsWith(".js"));
for (const file of commandFiles) {
const command = require(join(__dirname, "commands",${file}));
client.commands.set(command.name, command);
}
client.on("message", async (message) => {
if (message.author.bot) return;
if (!message.guild) return;
if (message.content.startsWith(PREFIX)) {
const args = message.content.slice(PREFIX.length).trim().split(/ +/);
const commandName = args.shift().toLowerCase();
const command =
client.commands.get(commandName) ||
client.commands.find((cmd) => cmd.aliases && cmd.aliases.includes(commandName));
if (!command) return;
try {
command.execute(message, args);
} catch (error) {
console.error(error);
message.reply("There was an error executing that command.").catch(console.error);
}
}
});
uh
wot
🤦
Who have bot with mute command?
you can search on the website
Hello
I want to ask about bot getting online for 24 hours.
Can i get the step/tips ?
get a vps if you haven't already and use a process manager
make sure to handle errors
I'm using discord.js code, after copy paste to glitch or github & connected to monitoring web, the code not response
do you know what the copypaste code does
What ? I want learning
Is it possible for my bot to delete webhooks it made? I can't find the command. I tried .delete but that just deleted the message and not the webhook itself.
what lib
and it most likely will be delete, but you're doing it on a message
in d.js it's <Webhook>.delete() https://discord.js.org/#/docs/main/stable/class/Webhook?scrollTo=delete
Could someone help me with something. I want to make an info-user command, but the problem is that I don't know how to make for someone else like !info-user @earnest phoenix else
I have this already
if(msg.content.startsWith(prefix + "avatar")) {
const user_mention = msg.mentions.users.first();
const embed = new Discord.RichEmbed()
.setColor("RANDOM")
.setTitle(`Voici l'image de profil de ${user_mention.username}`)
.setImage(user_mention.avatarURL)
msg.channel.send(embed)
} else {
const embed = new Discord.RichEmbed()
.setColor("RANDOM")
.setTitle(`Voici l'image de profil de ${msg.author.username}`)
.setImage(msg.author.avatarURL)
msg.channel.send(embed)
}```
@rigid maple https://top.gg/api/docs
bored
and looking for a challenge
any fun commands you think i'd be able to add to my bot?
please, ping me. Thanks
How can I get message.mentions.users.first() in v12?
same with v11
Yes
can you show code

And it's working when using eval command but..
Wtf.. now it's working... The same code.. but what was the fking problem...

const moment = require('moment')
setInterval(function(){
console.log(moment().format('HH:mm'))
if(moment().format('HH:mm') === "00:19"){
console.log("ok")
}
}, 60000)```I would like to take action at a specific time.
can anyone help me with node-ytsr. sometimes it comes back blank
@earnest phoenix wrong channel
thats #memes-and-media
Is it possible to make it so anyone that has a name like nword in their username automatically gets banned? For discord.js?
@torn ravine same happens to me
what I do is that I just call the command again from within the command
until it's not blank
how would I do that?
recursion lmao
I was thinking I make an embed with the refresh emoji and when you click it, it refreshes the results
I have the pagination plugin
but I just do some recursion and checking
its not that much work
if it's empty then I do the job again
so awaiting won't work?
until it's not blank anymore
it depends
is use yt-search
it does not return a promise iirc
tho if for some reason it never goes from blank to having something you may get into a stack overflow
if your command is a function just call the function lmao
let's say
function veryCoolCommand() {
veryCoolCommand()
}
it'll get called until it gets to a stack overflow
ofc you can make the call conditional
using an if statement
so if the data you need is stll blank then call the function
mmmh Deprecation warning: value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info. Arguments: [0] _isAMomentObject: true, _isUTC: false, _useUTC: false, _l: undefined, _i: async() => { await console.log(moment()) debugger; }, _f: undefined, _strict: undefined, _locale: [object Object] Error
until it's not blank anymore
just if (!videos.length)
0 is false
so if videos.length is 0 you can negate it and then it'll be the same as <Array>.length === 0
remember
0 is false and anything above and below is true
Is there a way to send a DM to a user on a different shard with JDA?
Actually does anyone know if the latest version of JDA support opening DM channels for fake users?
Looking through the code it doesn't look like it throws IllegalStateException on fake users anymore
how do you get the user's badges in discord.js v12 ?
i tried looking at the docs: nothing
but it returns like a bitfield ?
UserFlags { bitfield: 64 }```
ah yes
thanks ^^
I'm having issues with the way some brackets are, does anyone know the issue? https://sourceb.in/56e8ff688d
btw just found out how to do it
it returns someting like a number
if you convert the values from https://discord.com/developers/docs/resources/user#user-object-user-flags to an integer, you get the same thing
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
^^
and btw with .toArray() you get the strings
it's easier i guess
how would I execute a statment that uses try again
what would be giving me this on bot startup? (node:42536) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body content: Must be 2000 or fewer in length. at RequestHandler.execute (C:\wildcat\node_modules\discord.js\src\rest\RequestHandler.js:170:25) at processTicksAndRejections (internal/process/task_queues.js:93:5) (node:42536) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 5)
it's on start up...the only thing it every does on startup is console log that it's online
I stopped getting it...I am randomly having bot problems today and I don't have time for any of it 😅
now it's not doing it wtf 😩 😂
Hey i have a question where do yall store data for rest api
In project or database if db what db you guys use?
you can't store in your project because that's memory
you have to use a database
i personally use pgsql for APIs
love working with it especially when doing REST
Has anyone here done a migration from JDA v3 -> v4?
There's a guide on migration on the GitHub wiki page: https://github.com/DV8FromTheWorld/JDA/wiki/0)-Migrating-to-V4
I've been using that
But they don't talk about .toJSONObject() on MessageEmbed
It looks like .toData() is what I'm looking for but I'm not sure about the full ramifications
im trying to use this welcome image api but its not working so well
client.on('guildMemberAdd', async member => {
const channel = member.guild.channels.cache.find(ch => ch.name === 'welcome');
let embed = new Discord.MessageEmbed()
.setImage(`https://welcome-imgs.some-random-api.ml/img/4/sunset?type=join&username=${member.displayName}&discriminator=${member.user.discriminator}&guildName=Some%20random%20api&memberCount=71&avatar=${member.user.displayAvatarURL}&textcolor=white`)
channel.send(embed)
})```
(node:19416) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
embed.image.url: Not a well formed URL.
at RequestHandler.execute (/Users/sadashivappakenchannavar/Desktop/dino/node_modules/discord.js/src/rest/RequestHandler.js:170:25)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:19416) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:19416) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
flags is undefined
no, whatever is before flags is undefined
are you sure member is a guildmember?
are you sure member is a guildmember?
@quartz kindle yes
isn't it fetchFlags?
@pale vessel I don't know: c
console.log(member)
read docs
there's no flags property for a user
you have to fetch it first by using user#fetchFlags()
as ?
there is actually
but its not documented for some reason
@cerulean hornet did you console.log(member)?
the error says "cannot read flags of undefined" which means member.user is undefined, which would only happen if member is not actually a guild member
exactly
your member is not a member, its a user
so doing member.user is the same as doing user.user
yes
mentions.users and message.author both return a User object, not a GuildMember object
how can I do now ?
learn the difference between them
docs be like
message.author = User
message.member = Member
mentions.users = User
mentions.members = Member
member.user = User
docs be like
@pale vessel don't talk about it there
User = username, flags, avatar, etc...
Member = nickname, roles, etc...
@cerulean hornet learn the basics then?
@cerulean hornet learn the basics then?
@earnest phoenix the basics I know more I got lost in this command
??
I'm using a translator sometimes the translation goes wrong: c
K
but did you understand now? Member and User are two different things
I'm using google translator, sometimes the translation goes wrong.*
but did you understand now? Member and User are two different things
@quartz kindle yes yes
@hardy vector avatar URLs are functions in v12
for example displayAvatarURL({format:"png"})
console.log
ik
i didnt think before i asked
thats why i said nvm lol
ok it logs this
and when i click on it the welcome card is ther
but uh the avatar isnt showing
idk why
Yh ik my message sent very slow
@hardy vector it seems the api doesnt support webp
which is the default format
so you need to set format to png
i showed you how
oh yea
lol
now the url sends to a proper one and tha avatar shows up but in the embed it doesnt send
:/
probably because it doesnt match an image extension
you'd need to add it as an attachment and rename it, or use a redirect that ends with .png
how do i do that
embed.attachFiles({attachment:urlhere,name:"myimage.png"})
embed.setImage("attachment://myimage.png")
ok
so i have todays date stamp and a time stamp in the future (ie. 12 hours away)
how do i then convert the time stamp to text (ie. 12 hours away to "tomorrow at 12am")
how do i log people who vote for my bot
how would i webscrape a site that uses cloudflare
so uh
i have a warning bot
and my friend helped code
he added thi
``/**
- The permissions for posting porn images.
- @type {string[]}
*/
const permissionsPornImageBot = config.pornImageGroups;``
what does that do
just off of that, all i see is a variable being assigned to something that i have no context on
^
Error: Cannot find module 'dotenv'```But i had added module's dotenv
You didn’t install it, that’s what the error is saying @prime glacier
Can you show us your package json file
^
hm, did you reload the project/made sure the dependency is actually installed
hm, did you reload the project/made sure the dependency is actually installed
@sudden geyser dependency?
A dependency like dotenv
@indigo flax isn't it self explanatory?
clean up your dependencies. remove fs (built-in), ytdl-core/ytdl-core-discord (depending on which one you actually use), etc.

@reef mantle what do you need help with
i am getting this error:
com.sedmelluq.discord.lavaplayer.tools.FriendlyException: Something broke when playing the track.
at com.sedmelluq.discord.lavaplayer.tools.ExceptionTools.wrapUnfriendlyExceptions(ExceptionTools.java:43) ~[lavaplayer-1.3.38.jar!/:na]
at com.sedmelluq.discord.lavaplayer.track.playback.LocalAudioTrackExecutor.execute(LocalAudioTrackExecutor.java:103) ~[lavaplayer-1.3.38.jar!/:na]
at com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager.lambda$executeTrack$1(DefaultAudioPlayerManager.java:349) ~[lavaplayer-1.3.38.jar!/:na]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]```
The bot is able to join the voice channel but is not playing music...
More error down side : (can not send it all at once)
at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
Caused by: java.lang.NullPointerException: null
at java.base/java.net.URI$Parser.parse(URI.java:3104) ~[na:na]
at java.base/java.net.URI.<init>(URI.java:600) ~[na:na]
at com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeTrackFormat.getUrl(YoutubeTrackFormat.java:66) ~[lavaplayer-1.3.38.jar!/:na]
at com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeSignatureCipherManager.resolveFormatUrl(YoutubeSignatureCipherManager.java:97) ~[lavaplayer-1.3.38.jar!/:na]
at com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioTrack.loadBestFormatWithUrl(YoutubeAudioTrack.java:87) ~[lavaplayer-1.3.38.jar!/:na]
at com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioTrack.process(YoutubeAudioTrack.java:42) ~[lavaplayer-1.3.38.jar!/:na]
at com.sedmelluq.discord.lavaplayer.track.playback.LocalAudioTrackExecutor.execute(LocalAudioTrackExecutor.java:91) ~[lavaplayer-1.3.38.jar!/:na]
... 4 common frames omitted```
My java version details :
OpenJDK Runtime Environment (build 11.0.6+10-post-Debian-1bpo91)
OpenJDK 64-Bit Server VM (build 11.0.6+10-post-Debian-1bpo91, mixed mode, sharing)```
plz someone help me ._.
Problem is with Lavalink
update lavalink
Mhm...
u mean lavalink.jar file?
yeah, check if there are any new nightly releases
i downloaded the recent released version
3..... something
when
2 days ago
._.
o
so.. any idea what to do?
it's just lavalink breaking, failing to parse a yt video so uh no idea since you aren't at fault
hmm
ok thanks
@sick cloud for something like that loader gif, they use ANSI Escape sequences
ANSI escape sequences are a standard for in-band signaling to control the cursor location, color, and other options on video text terminals and terminal emulators. Certain sequences of bytes, most starting with Esc (ASCII character 27) and '[', are embedded into the text, whic...
cool
Is there anyone who can help me? I have 2 bots on the site. I want to add the bot mention as command prefix. is that possible?
what lib
the idea is basically to have an array/list of prefixes, including the mention
then check for it
is the mention is like @brittle turret ?
const prefix = prefixesArray.find(p => msg.content.startsWith(p));
if (!prefix) return;
// code...```
yes
but you need to use one with <@! and one with just <@
yeah
thanks a lot
<@ is for no nick and <@! is for nick
cool
got it
for using an array, if do like just instead of 'prefix', i have to do ['prefix1', 'prefix2', 'prefix3', 'prefixn']
right?
-bots @sullen night
keep bot commands in testing channels pls
@sullen night yea
good day, guys! please help me. I can’t find the formula for the progress bar. upon gaining experience, the bar begins to increase.
formula
let progress = (point / tolvl) * 100
I experimented and changed the value to a larger and a smaller one, but bar still the same..
@zenith citrus As it seems that the bar isnt changing it seems like you never assigned that value to the bar, like .fillRect(450, 50, progress, 25);
Or the value never changed
any suggestions for getting stuff like flags on arguments? i have a command that takes as 1st a number then a string with mutiple words. i want to add something like --url URL text as a flag. (javascript)
@lusty quest split it into an array at --url and get the second item
ye found it out already
K
@earnest phoenix Same i was getting those errors with lavalink too!!! on discord.py i guess i will switch to ffmpeg, tho lavalink's quality IS SOOO GOOD
._.
i am currently using ffmpeg but these YT API quota exceeding is just... TRASH
i tried to submit form for exceed quota limit 3 times but everytime it says "try again later" blah blah...
so planned to switch to Lavalink
hmm
lavalink wont help that lmao
instead of getting hit with the quota you just get hit with an IP ban
@sick cloud all mentions use ! now afaik
well, imma try it once...
a few people suggested me to use it xd
UMM
This is a ping command @client.command() async def ping(ctx): await ctx.send(f'Your Ping Is {round(client.latency * 1000)}ms')
on discord.py\
but it gives me client ping not users
what do i write instead of client
ohhh
thats just the WS latency atm
@white anvil yeah no
<@> indicates a user mention, <@!> indicates a user with a nickname mention
top is without, bottom is with
both typed out using \@mention
you should check for both with ! and without
platform inconsistency being the main reason
android, ios and desktop discord are never consistent and every single version does something differently lol
When I used and voted
@commands.Cog.listener()
async def on_dbl_vote(self, data):
print(data)
It won't get invoked..
Anyone tell why?
thats like discord.py from 3 years ago
2
client has no join_voice_channel function
🤔
await channel.connect()
How do I map from a json?:
Like
This
or better for me:
Like, This
what
How do I make my bot say the json file like this:
1, 2, 3, etc
Would be easy and google doesn't really want to help me out
I want this to get mapped
what does shards mean?
@twin marsh well you just have to map it: js users.map(user => `**${user}**`)
can someone help me?
why this thing is not working
@commands.Cog.listener()
async def on_dbl_vote(self, data):
print(data)
I get an error
on glitch
and it wont load anything
wont load discord.js
nothing
and it says cannot find module
if (args[0] == "clan" || args[0] == "Clan") {
for (let i = 0; i < apply.clan.length; i++) {
let embed = new RichEmbed()
.setColor("#f94343")
.setTitle(apply.clan[i])
message.author.send(embed);
const filter = m => m.content.includes('discord');
const collector = message.channel.createMessageCollector(filter, { time: 30000, max: 1});
collector.on('collect', m => {
applyInfo[i] = m.content;
});
console.log(applyInfo[i]);
}
}
help
it doesnt wait until there is a message collected
just do args[0].toLowerCase() == "clan"
https://nmw03.is-inside.me/sN9KmqGG.png
using discord.js v11
is nasty
richembed
ew
hi, i got a question (did read the FAQ but didn't saw anything about it)
i've been developpinga bot that has been recently accepted, however i'm still adding features, so i'm wondering if there's any new kind of approva i have to apply to when i update the bot's code or if it's once it's in, it's in
includes this permission 2147483647 administrator
is on_loaded_extension an event of discord.py?
I highly doubt it is
hmm read it in a bot's script and it seems to be firing each time a cog is loaded, probably a custom event
¯_(ツ)_/¯
I want to loop through my mute list, is there an efficient way to do this without using up too many resources?
Mute list, as in?
e.g. I make a custom mute command, stores user data such as id, mute_time.
Loop would fetch this mute list, and then check if current_time >= mute_time (unmute if necessary)
Just wondering if there is an efficient way to do this, or is it best to just leave it in a loop
Do you store the mutes in a global dictionary?
Uh it's stored in an external database and the bot fetches it through an API, but I plan to move it into a dict not linked to the API
But upon API call the data is thrown into a dict yes
What is the overall way of the data storage? Like, how do you store it?
At the moment it's working through an API since it works with a site.
I mean, in the dictionary, do you use server ID as the key to then store the muted users?
Nope, bot is isolated to 1 server only it's not a public bot.
So it would be something like,
{
"user_id": {
"mute_time": 293838
},
...
}
Oh, I see
There's 2 loop methods I've read a few bots, some use asyncio and some use tasks.loop()
Not sure which I should use from the two
choose the one your prefer ig
So they both do the same thing then?
At the time of writing a similar system I haven't exactly cared much about performance. I used asyncio.sleep and stored mute time in database, which I then fetched from the database once again and created a background task per each mute
Oh I see
You could probably do the same
My one just loops through a muted_dict and works from there
That seems efficient, no?
My one?
Yeah what’s wrong with it
Nothing really just was wondering if there was a better way to do it, and if I should use tasks.loop or asyncio for it
I don’t know what those are but if you’re just looping through a dictionary i think you’re method is fine
Oh one more question, I saw some people make their Cogs based in folders, would I have to change the way my Bot loads Cogs then?

