#development
1 messages · Page 1352 of 1
bot*
Well now you've hit one of the main issues
I'd say look into an async mongo wrapper once you're actually facing issues with blocking
@slender thistle oh ok thanks
also just saying using mongoose isnt very portable
austin
?
install the mongoose package
wait can we do this in dms or no
idk how you got to +1GB without a tokenization error
so the notes are saved
fine
I suppose caching
afaik mongodb free tier is 500mb no?
Use sqlite db then
how i can show my bot's prefix in python
you could just download the db
But I feel you probably want nonrelational
how i can show my bot's prefix in python
@nocturne sparrow just append the variable to a string
from discord.ext import commands
import discord
class bot_cat(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_message(self, message):
if "prefix" in message.clean_content.lower():
await message.channel.send(f"{bot.command_prefix}")
def setup(bot):
bot.add_cog(bot_cat(bot))
i am trying this
but giving error
f"{bot.command_prefix}" instead of just bot.command_prefix?
What the fuck
chill shiv
lmao
Calm is me
Okay
Why are you using a separate on_message listener just for the prefix
How can i restart all the shards but not the bot?
I couldn't say that with a straight face, shiv
Neither could I. My face is the definition of disappointment in life and I definitely shouldn't be here in the first place
ok
ok
cool story bro
is this the auger we know and love?
hehehe, i sent token
yes
i deleted
auger evolved
TypeError: Cannot set property 'commands' of undefined
at /home/runner/Kano-BOT/index.js:12:16
at Script.runInContext (vm.js:130:18)
at Object.<anonymous> (/run_dir/interp.js:209:20)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47Hint: hit control+c anytime to enter REPL.
anyone here
i deleted
@earnest phoenix It's invalid anyways
still rocking that 💻
You know it
yeah you're trying to get the property commands of something that's undefined.
How can i restart all the shards but not the bot??
wot
you code the javascript source
anyone have that "fundamental misunderstanding" copypasta for bots link
though not a good idea
^^
One message removed from a suspended account.
/home/runner/Kano-BOT/index.js:56
if (message.author.bot) return;
^^^^^^
SyntaxError: Illegal return statement
Hint: hit control+c anytime to enter REPL.
now it's like this
i hate when give me error
Illegal return statement
Uhoh, calling the cops
I'm trying to get all the members from my guild in my logs and this is what happens when I run the command
My code
hey
who knows mongoose
mongoose.connect("mongodb+srv://The:Bot@tg.mx0br.mongodb.net/TG?retryWrites=true&w=majority
")
mongoose.connection.on("connected", () => {console.log("Connected to mongoose.")}
mongoose.connection.on("error", err => {console.error(err)}```
that shows
/home/container/server.js:3
mongoose.connect("mongodb+srv://The:Generator@tg.mx0br.mongodb.net/TG?retryWrites=true&w=majority
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Invalid or unexpected token
at wrapSafe (internal/modules/cjs/loader.js:931:16)
at Module._compile (internal/modules/cjs/loader.js:979:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
at Module.load (internal/modules/cjs/loader.js:879:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47
You are trying to connect to you cluster?
Why is my Bot shown DND?
``` @indigo flax
hmm
@pure lion ^ is that the error
SyntaxError: /home/runner/Kano-BOT/config.json: Unexpected token / in JSON at position 19
Hint: hit control+c anytime to enter REPL.
what's the error now
😦
Why is my Bot shown DND?
@weary socket .
change your presence or status rather
@steel violet what happens when you run the command?
change your presence or status rather
@faint prism Ah my Bot is all the time Disturbe.....So only put it online?
Not sure what you just said, but you change it typically via the setStatus iirc
@umbral zealot this
184 server
i found the issue @steel violet
you need GUILD_MEMBERS_INTENT
I have more than 2 users in my guild so I don't understand
oops
it was like
codereigierhgeiurhgeiurhgiurhgieruhgierwuhgiwer
second part of the code
@steel violet you need guild members intent enabled on bot settings page on discord
Are you stroking out
mongoose.connection.on("connected", () => {console.log("Connected to mongoose.")}
^
SyntaxError: missing ) after argument list
at wrapSafe (internal/modules/cjs/loader.js:931:16)
at Module._compile (internal/modules/cjs/loader.js:979:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
at Module.load (internal/modules/cjs/loader.js:879:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47```
then use the intent
It is already enabled
mongoose.connection.on("connected", () => {console.log("Connected to mongoose.")})
Discord started enforcing the GUILD_MEMBER intent requirement TODAY
If your bot has stopped being able to access cached members, you don't have access to the privileged Guild Member Intent. You need to fetch the member manually.
GUILD_MEMBERS is a privileged intent, it is not sent to bots that have not been allowed to use it. You need to request this privileged intent from Discord through https://dis.gd/contact (general request), or figure out how to fetch members only when necessary.
b
ok thx
when connecting to gateway
@steel violet perhaps your bot isn't actually requesting it?
bot.users.cache.get("331222209299349504").send("embed"); bruh is that why this isnt working
Bot says: "embed"
shut up
error please
the user is not cached then
that user isn't in the cache
ive never used mongoose before, someone is teaching me
theb
when i start the bot
it says
(node:15) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
Connected to mongoose.```
idk if thats an error
or a success
Connected to mongoose.
well idk, it says its connected
Hello
Discord started enforcing the GUILD_MEMBER intent requirement TODAY
If your bot has stopped being able to access cached members, you don't have access to the privileged Guild Member Intent. GUILD_MEMBERS is a privileged intent, it is not sent to bots that have not been allowed to use it.
If your bot is not verified you can go turn on the GUILD_MEMBERS intent in the Bot section of the dev portal, or you can fetch the users manually.
If your bot verified, need to request this privileged intent from Discord through https://dis.gd/contact (general request), or figure out how to fetch members only when necessary.
you you are verified
See what I literally just posted, Austin.
its in a 10k member server
(node:15) 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: 2) (node:15) UnhandledPromiseRejectionWarning: Error [GUILD_MEMBERS_TIMEOUT]: Members didn't arrive in time. at /home/container/node_modules/discord.js/src/managers/GuildMemberManager.js:314:16 at Timeout._onTimeout (/home/container/node_modules/discord.js/src/client/BaseClient.js:83:7) at listOnTimeout (internal/timers.js:554:17) at processTimers (internal/timers.js:497:7)
ah ok you need the guild members intent
then no choice
you gotta wait till its verified
It don't works anymore since yesterday for me
ah ok
So turn on the GUILD_MEMBERS intent, @steel violet
yes since today they applied the update
it was turned off for everyone this morning by default.
someone help me figure out why my ready.js event isn't working. i even commented everything out and just put console.log and it won't appear, but the rest of my bot still works
definitely a lib problem, Fyrlex.
discord.js
So turn on the GUILD_MEMBERS intent, @steel violet
@umbral zealot I'll try
yeah so ask on the discord.js server
i did
they gotta fix the lib so it works without the guild_members intent on.
thanks
thanks Evie
now it works
👍
Note that it's probably a good idea to not rely on GUILD_MEMBERS. If your bot ever gets verified and you ask for it just for stats command, they'll deny it
its not only for stats command
They're not going to keep sending you half a million member's data just for a stats command.
@uncut river d.js version?
hrm interesting then
i'll regenerate token just in case
@umbral zealot Help&Support ?
yes
then general request
But they will not give you access to privileged intents just for a stats command
so you better be damned sure you have a better use case than "I wanna know how many members I got"
you need some legit reason for guild members intent
same goes for presences
if you're bot is already discord verified and has the checkmark, just open a support ticket with discord
It's not just a stat command, it's an economy part for all users
it will be up to them to approve or deny your request
What specific reason do you have to get all guild members for economy?
if it's just a leaderboard, you'll also get denied.
i dont see why you need all members for economy
discord.js v12
Error [SHARDING_READY_TIMEOUT]: Shard 0's Client took too long to become ready.
happening on multiple bots on this vps
changed nothing in the code, randomly started this morning
the ready event is fucked on d.js at the moment.
ask the devs
I forget what the fix is
how would the ready event be broken? wouldn't i need to update the package to apply any changes they make
i dont see why you need all members for economy
@solemn latch
For an automatic addition of money
thanks ❤️
let auto = await money.getAutoadd(id);
if (auto == 0) return;
else {
const list = client.guilds.cache.get(id);
list.members.cache.forEach(async member => {
console.log(member.id)
const now = new Date();
let datenow = (`${now.getUTCMonth()${now.getUTCDay()} ${now.getUTCHours()} ${now.getUTCMinutes()}`);
let time = await money.getTime(member);
let datefuture = await money.getDate(member);```
discord.js waits for guild_members to arrive and they never arrive if you do'nt have the privileged GUILD_MEMBERS intent on.
thats a lot slower than doing it through a single database call.
oh hold on, the client does start after a while, but when it starts it logs an incorrect user count and non-message events aren't working (they were working before)
Hello
thats a lot slower than doing it through a single database call.
@solemn latch
An other idea maybe?
@dense patio
Discord started enforcing the GUILD_MEMBER intent requirement TODAY
If your bot has stopped being able to access cached members, you don't have access to the privileged Guild Member Intent. GUILD_MEMBERS is a privileged intent, it is not sent to bots that have not been allowed to use it.
If your bot is not verified you can go turn on the GUILD_MEMBERS intent in the Bot section of the dev portal, or you can fetch the users manually.
If your bot verified, need to request this privileged intent from Discord through https://dis.gd/contact (general request), or figure out how to fetch members only when necessary.
Is there any bot which will automate the roles
You had 2 months to prepare, so...
at least i won't have to worry about my main bot breaking
¯_(ツ)_/¯
oh true
i haven't been paying attention to these things
didn't think it would affect me like this
excellent, now it works
thanks a lot
👍
why is this greyed out? the other one is too
this is for my main bot, which is verified
You probably weren't whitelisted to use those intents.
You'd need to contact Discord to request them if you need them.

Though you may have a hard time actually getting intents
My friend needed them for a lot of their commands and still didn't get them sadly
the intents are given for features that aren't "stats/profiles/leaderboards" or very simple things.
Hi! What are the rate limits on things such as reactions, roles and messages? I want to see if I'm exceeding it with something or if some commands should require a cooldown.
There are ways to work without intents which doesn't feel like a hack workaround
check the channel pins, there are some information there @feral kiln
also ratelimits are the maximum, and sometimes it doesnt really need to be at that speed
realistically
you still can fetch users individually without intents
There are ways to work without intents which doesn't feel like a hack workaround
@sudden geyser do you know how?
hm
You use the API to get your data. Intents are for gateway.
well my main issue is that pretty much all of my commands can be used by typing a user's username to get their id, etc.
then thats fine
you can always test it out
would keyv be a good thing to use for bot economy?
and would there be anyway to retrieve all keys from keyv
or would I have to use some other dependency
cus i used keyv for economy
and im trying to make a leaderboard
it doesn't have a way to list the keys?
well then you're fucked and keyv isn't going to work for you.
HELP ME
lol
my fucking CSS is not reloading
HOW
use a proper database instead of keyv?
what would u recommend lol
my bot is at 72 servers and has both intent options checked
i didnt ask or anything
sqlite, enmap, quick.db would be a step up.
they were just there
mongodb is great if you like working with json
and for structured databases then look at evie's message
but sqlite/enmap/quickdb are only from memory right?
ok
yeah they all store in files.
um i wanna use like an actual database, like i legit have a postgres db that i wanna use
soo..
sure, pgsql is fine.
ok
im kinda noob at this ngl
but ur sayin i could use a driver for enmap
and use that to store in PG?
no, enmap uses sqlite in the background.
You'll have to be more specific.
if yes, send me in private, i need
I don't understand what you're asking for, so refer to the guide woogie posted.
your bot is missing permissions
what command are you running when you get that error
this command is run costomCommand
So, that command has something it needs permission for, that it doesn't have
¯_(ツ)_/¯
Ok thank you bro 👍
they probably figured it out 😄 ¯_(ツ)_/¯
ok lol
.
what does this error mena
mean
this is the code
i'm trying to make my own command handler
forgot a . so it's trying to find the module from the process root
thanks!

forgot a
.so it's trying to find the module from the process root
@pale vessel does it really look in the process root, or the root of the file system
for me it checks for the process root
it's weird, fs does it differently for example
sometimes i need to use __dirname for fs
Hello! I was wondering: Does message IDs are unique across every guilds or there can be 2 messages that have the same ID if they are posted on different guilds?
Nope they’re unique as well as client and guild IDs
thanks
is anyone good at mongoose
Promise {
<rejected> Error [TOKEN_INVALID]: An invalid token was provided.
at Client.login (/home/runner/Kitana-BOT/node_modules/discord.js/src/client/Client.js:205:52)
at /home/runner/Kitana-BOT/index.js:76:8
at Script.runInContext (vm.js:130:18)
at Object.<anonymous> (/run_dir/interp.js:209:20)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
[Symbol(code)]: 'TOKEN_INVALID'
/home/runner/Kitana-BOT/index.js:40
client.login(process.env.TOKEN); //Ligando o Bot caso ele consiga acessar o token
why it's happening this?
the screenshot of index
your token is invalid
probably an invalid token
check your .env file
clearly the token is invalid
as the error says
in your .env file it must be exactly TOKEN=yourtokenhereiwthnospaceorquotes
I want my bot to print out my custom status like I am listening to Spotify so it should show "Listening to Spotify". I tried my code but it showed None as an outcome
I am sending the code
check your intents too
async def userinfo(ctx, member: discord.Member = None):
member = ctx.author if not member else member
roles = [role for role in member.roles]
embed = discord.Embed(title = f"{member.name}'s Userinfo!" , colour = member.colour , timestamp = ctx.message.created_at)
embed.set_thumbnail(url = member.avatar_url)
embed.set_footer(text = f"Requested by {ctx.author.name}" , icon_url = ctx.author.avatar_url)
embed.add_field(name = f"**Name**" , value = f"{member.name}" , inline = True)
embed.add_field(name = "Discriminator" , value = f"{member.discriminator}")
embed.add_field(name = f"**Nickname**" , value = f" {member.display_name}")
embed.add_field(name = "Id" , value = f"{member.id}")
embed.add_field(name = "Activity" , value = f"{member.activity}")
embed.add_field(name = "**Account Created On**" , value = member.created_at.strftime("%a, %d %B %Y , %I %M %p UTC"))
embed.add_field(name = '**Joined This Server On**' , value = member.joined_at.strftime("%a, %d %B %Y , %I %M %p UTC"))
embed.add_field(name = "**Roles**" , value = f" ".join([role.mention for role in roles]))
embed.add_field(name = "Bot?" , value = member.bot)
await ctx.send(embed=embed)```
you need the presence intents for this to work, as a starter.
?!
enable the Server Member Intents checkmark in your bot's application page.
Promise { <pending> }
Hint: hit control+c anytime to enter REPL.
[Error: ENOENT: no such file or directory, scandir './events/'] {
errno: -2,
code: 'ENOENT',
syscall: 'scandir',
path: './events/'
}
/home/runner/Kitana-BOT/index.js:37
files.forEach(file => {
^
TypeError: Cannot read property 'forEach' of undefined
at /home/runner/Kitana-BOT/index.js:37:15
at FSReqCallback.oncomplete (fs.js:156:23)
the error is this now
the token i changed
hey remember when we told you that you should learn javascript. 😕
clearly not enough, this is a basic error
it takes months to learn a language. not "less than a day and I'm back at asking everyone to fix my stufF"
i am making everything again
i made a bot with more 20 commands of economy, and everything
but i lost him, i think i deleted 😦
But you can't troubleshoot a simple "undefined" error?
you should look into git
it means you didn't learn anything. You need to get through a course.
or version control
Can anyone solve my issue ?
you need to return something from the async functions
and/or await the function
right now it's not awaiting anything
async function checkField(message,prev){
let filter = m => m.author.id === message.author.id;
return message.channel.send("Do you want to add another field ? (yes/no)").then(() => {
message.channel.awaitMessages(filter, {
max: 1,
time: 30000,
errors: ['time']
})
.then(async message => {
message = message.first();
if(message.content == "yes"){
var field = await getField(message).then(async field => {
prev.push(field);
var newField = await checkField(message,prev).then(async field =>{
if(newField.length>0){
prev.push(newField);
}
return prev;
});
});
} else {
return prev;
}
})
.catch(collected => {
console.log(collected);
return message.channel.send('Failed to create embed');
});
});
}
you were missing the return keyword
inboth
no it didn't return the message before
you weren't returning the first one
so it was just... executing it withjout waiting for it
you get the return value from await checkField and you should have it
Anyone know why if ChannelCategory.id == ID1 or ID2: is saying that ChannelCategory is not defined?
In Python
Do I also need to get it from then functions ?
well, did you define ChannelCategory?
@pale vessel Docs have it as discord.ChannelCategory and I already have discord imported
what are you trying to do
Limit a command to certain categories
can you show the code
Yeah, give me two minutes?
@bot.command(name='seal')
@commands.guild_only()
async def _seal(ctx):
if CategoryChannel.id == 740625967143452673 or 740723809069564056 or 740622346800463974 or 741754307216408656 or 741750821871550562:
await ctx.send(':x: | This command can only be used in rp!')
if CategoryChannel.id == 741756076126634076:
await ctx.send('(Wrong command! `r!rp-set-seal` or `r!rp-set-unseal` is the correct ones to use)', delete_after=7)
if CategoryChannel.id == 741756975762767962 or 741757122919792722 or 759865025774616636 or 743584376490557471 or 741757326045872158 or 741757481390178315 or 741757599233605712 or 759213005183123488:
await ctx.send('(Ships cannot be sealed by the bot. Use [#741756142916468868](/guild/264445053596991498/channel/741756142916468868/), [#747578010278035536](/guild/264445053596991498/channel/747578010278035536/), [#741756219064189029](/guild/264445053596991498/channel/741756219064189029/), <745682027667390505#>, or [#741756303814426768](/guild/264445053596991498/channel/741756303814426768/).)', delete_after=7)
if CategoryChannel.id == 741756416754319450 or 741756718471446579:
await ctx.send('(Wrong command! `r!areaseal`)', delete_after=7)
else:
print('A room has been requested to be sealed...')
channel = ctx.bot.get_channel(742179037643800596)
await ctx.message.delete()
await ctx.send('*the room has been sealed*')
await ctx.channel.edit(topic="ROOM IS SEALED")
embed=discord.Embed(
type='rich',
colour=discord.Color(0x339BFF),
description=f'''
**ROOM SEALED:**
#{ctx.channel}
**ROOM SEALED BY:**
{ctx.author.mention}
'''
)
embed.set_footer(text=f'ID: {ctx.author.id}')
embed.timestamp=datetime.datetime.utcnow()
embed.set_author(name=ctx.guild.name, icon_url=str(ctx.guild.icon_url))
await channel.send(embed=embed)
print('Success!')
pass
@pale vessel
Wdym by what’s it supposed to be?
what do you think CategoryChannel is?
The Category’s ID
was ist next.js?
How do you get the URL of a rich presence asset?
@pale vessel discord.TextChannel?
those are classes
Still saying not defined
How do you get the URL of a rich presence asset?
I have the application ID and the asset ID
you're supposed to get those properties/channels via objects
you don't create them using the constructor
if you want the message's channel, it's ctx.channel for example (iirc), not discord.TextChannel
ctx.channel itself is a discord.TextChannel
So ctx.category would be the category
textchannels can have the category_id property
how to get the first few options in a js map?
you would the channel using that id
Ok, so channel.category_id
yes
Alright
you can use guild.get_channel(id) to get the category channel as an object
@gentle lynx there shouldn't be three dots.
just make sure channel.category_id exists
I’ll try it when I get back to the box
yeah what should I do
../ will point to the Commands directory.
../../ should point to the process root directory.
that's all i can do to help honestly, i only used d.py once and it was just a bunch of elifs lmao
So you're probably looking for ../../index.js
thanks
how do you get the first few options in a node.js map
map?
confusing. What is a map
It's because slice doesn't work for maps
could a possible reason for my bot takign extra time to load is because it's trying to fetch members even though it doesn't have the intent?
yes
i have debug logs if anyone could help with that
that's totally the reason lmao
good to know, thank you!
how can i go about getting proper user.cache count? i have a command that displays it and some private voice channels so i can quickly see
how to get the first member that got mention avatarURL
i tried on ready.js to fetch all inside the cache
client.users.cache.size
will display the users in cache
@uncut river You can enable fetchAllMembers to true if you are using discord.js to get all memebers to cache
they don't have the guild members intent.
not if i don't have the intent enabled
@earnest phoenix client.users is a collection and using .filter returns a new one.
You could use the .first(n) function to get the first N elements in the collection.
.filter().filter() 🤔
could having
bot.users.cache.keyArray().forEach(async (u) => {
await bot.users.fetch(u)
});```
in ready.js work?
or some different form
When i use it without .slice
yes with the 2 .filter
will do, so there's no way to manually fetch all users without the intent anymore?
I am just trying to parse
https://magicalcat.is-inside.me/JPQ4MNGT.png
and .slice doesn't work
but that's the thing, where are you going to get the IDs in the first place
a lot of developers did not realize they needed this
that is true
they just see the word badge and applied as quick as they can lmao
not saying all of them but some
please someone answer me!!!
how to get the first member that got mention avatarURL
is there a way to get around the loading either?
what loading?
aah
i didn't do it for the badge, i verified so i wouldn't get limited
yeah, that's nice
remember i said my start time is incredibly long
yes, you have to remove fetchAllMembers, did you do that?
ah no i did not remove
you have to
<Message>.mentions.members.first().user.avatarURL iirc @tardy hornet
I updated my bot once and started slowing down everything, the reason was a wrong interval
otherwise it'll try to fetch all members

and boom, timeout for each guild
<Message>.mentions.members.first().user.avatarURL iirc @tardy hornet
@prisma oriole ty
np
very nice
yeah, that's unfortunate but at least it's working
you'll only get members that talk, mentioned, in VCs, the ones that you manually fetch, and probably some more
discord.js lazy cache everything
@pale vessel Ok, that worked. Now, what is the equivalent of LUA’s else if?
but it's probably for the best now that we don't have any other way
i'm not familiar with lua, sorry
@earnest phoenix slice works but u need to remap it again
const slice = new Map(Array.from(oldmap).slice())
What is that elif you were talking about?
did you try this #development message @earnest phoenix
What is that elif you were talking about?
@hasty mulch python
ok thanks
Yeah, but what does it mean?
So, it is the equivalent of LUA’s else if?
python, those weirdos
not sure
It is
get away from me!
You literally just said that elif is else if, lol
it is?
its elif
i'm not sure what you're trying to convey.
Yeah, I asked what it meant and you said else if
Anyway would elif prevent all three of the if statements from running?
At the same time?
@pale vessel
elif
aaahah
?
how do i make the dynamic true?
depends on the lib
lib is not a lang right?
no it isnt lol
its a library
discordjs, discordpy, eris, dnet
library - Code someone else makes to make your life easier
language - A way to write machine code in a human readable format
discord.js
im in discord.js
just put the dynamic: true option in your options
no i mean
i have a avatar command
and if they got nitro
i want it to send it moving
It's a gif
yeah, just set your options for get avatar to dynamic
Are you talking about a GIF
yeah, he is, but the option is called dynamic to get the relevant one automatically
{
"rates":{
"TRY":8.1529749831
},
"base":"USD",
"date":"2020-10-27"
}
how can i get the value "TRY": 8.1529749831, without using body.rates.TRY.
why do you not want to use body.rates.TRY
because i can't
why 🤔
if (args[0].toLowerCase() === 'çevir') {
if (!args[1]) {
message.channel.send(degerbos)
return
}
const dovizcevirici = `https://api.exchangeratesapi.io/latest?symbols=${encodeURI(args.slice(1,2).join(' ').toUpperCase())}&base=${encodeURI(args.slice(3,4).join(' ').toUpperCase())}`;
let DCbilgi = await fetch(dovizcevirici).then(url => url.json());
//if (!DCbilgi.rates) return message.channel.send(`**${message.author.tag}**: Geçersiz para birimi.`)
const embed = new MessageEmbed()
embed.setColor(autimatic)
embed.setAuthor(`Döviz`, bot.user.displayAvatarURL({dynamic: true, size: 1024, format: 'png'}))
embed.addField(`Dönüştürüldü`,`${args.slice(2,3).join(' ')} ${encodeURI(args.slice(1,2).join(' ').toUpperCase())} = ${DCbilgi.rates[encodeURI(args.slice(3,4).join(' '))]} ${DCbilgi.base}`)
embed.setTimestamp()
embed.setFooter(`${message.author.tag} | © ${bot.user.username}`, message.author.avatarURL({dynamic:true}))
message.channel.send(embed)
}
my code
/döviz çevir USD 1 TRY
undefined
I want to pass ${encodeURI(args.slice(3,4).join(' ').toUpperCase())} as body.rates.[HERE]
body.rates.args.slice(3,4)
like
body.rates[args.slice(3,4)]
debugging in chrome devtools is OP
im trying to get better at helping, tim does such a good job that im stealing his style

const userexist = await client.shard.broadcastEval(`this.guilds.cache.get("692021327283879957").members.cache.get("${message.author.id}")`);
``` error ```
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'members' of undefined
at eval (eval at _eval (C:\Users\shahn\3D Objects\Botcode\sharding\node_modules\discord.js\src\client\Client.js:391:12), <anonymous>:1:44)
at Client._eval (C:\Users\shahn\3D Objects\Botcode\sharding\node_modules\discord.js\src\client\Client.js:391:12)
at ShardClientUtil._handleMessage (C:\Users\shahn\3D Objects\Botcode\sharding\node_modules\discord.js\src\sharding\ShardClientUtil.js:185:82)
at process.emit (events.js:327:22)
at emit (internal/child_process.js:876:12)
at processTicksAndRejections (internal/process/task_queues.js:85:21)
having a problem xD
guild is undefined
ah wait one sec,
try with ${DCbilgi.rates[args[2]]}
same
than u need to promise it, its not fetched and you already sending the message
i guess there is something wrong with me. ${DCbilgi.rates["TRY"]} also doesn't work.
move your whole embed inside
.then(url => url.json()
//HERE
);
say what now
😄
const invitePossiblites = await client.shard.broadcastEval(`${guild}.channels.cache.filter(cha => cha.permissionsFor(${guild.me}).has('CREATE_INSTANT_INVITE'));`);
``` Why is this not working?
nhandledPromiseRejectionWarning: SyntaxError: Unexpected identifier
at Client._eval (C:\Users\shahn\3D Objects\Botcode\sharding\node_modules\discord.js\src\client\Client.js:391:17)
at ShardClientUtil._handleMessage (C:\Users\shahn\3D Objects\Botcode\sharding\node_modules\discord.js\src\sharding\ShardClientUtil.js:185:82)
at process.emit (events.js:327:22)
at emit (internal/child_process.js:876:12)
at processTicksAndRejections (internal/process/task_queues.js:85:21)
error
remove the `
where? in broad casteval @molten yarrow ?
my bad sorry :3 never used broadcastEval xD
xD
I'm trying to get the bot's avatar URL. However, client.user.avatarURL doesn't work... What should I use?
how doesn't it work
Not a well-formed URl
.avatarURL()
ok
it could be null, use displayAvatarURL() if you want to get its default avatar if no custom one is available
Good evening, I have a problem my bot is already checking but I cannot activate its
I don't know i use google translate and when i translate everything it doesn't mean anything
How could I check the discord.js version from the package file? Obviously, package.dependencies.discord.js won't work.
I don't know i use google translate and when i translate everything it doesn't mean anything
@thin cedar It is optional, and it is granted by Discord developers exclusively when you meet a criteria
channel.send(\n**Owner ID** ${guild.owner.user.id} \n**Owner Tag** ${guild.owner.user.tag})
that iss a guild create event why does it not work?
@faint prism there come user of null ...
what
TypeError: Cannot read property 'user' of null
at Client.<anonymous> (C:\Users\shahn\3D Objects\Botcode\sharding\bot.js:106:105)
at Client.emit (events.js:315:20)
at Object.module.exports [as GUILD_CREATE] (C:\Users\shahn\3D Objects\Botcode\sharding\node_modules\discord.js\src\client\websocket\handlers\GUILD_CREATE.js:33:14)
at WebSocketManager.handlePacket (C:\Users\shahn\3D Objects\Botcode\sharding\node_modules\discord.js\src\client\websocket\WebSocketManager.js:386:31)
at WebSocketShard.onPacket (C:\Users\shahn\3D Objects\Botcode\sharding\node_modules\discord.js\src\client\websocket\WebSocketShard.js:436:22)
at WebSocketShard.onMessage (C:\Users\shahn\3D Objects\Botcode\sharding\node_modules\discord.js\src\client\websocket\WebSocketShard.js:293:10)
@faint prism that error
dunno. looks like guild.owner is null
it is not working more since today
one day ago it worked
it sent this message before 10 hours
and from then one it did not work
ah found the problem , new discord js intent
when ur bot cpu usage is .2% cuz you forgot to get guild members intent
Anyone here knows the error that the bot is online but is not responding (JDA)
I made a url shortener command with discord.js
const TinyURL = require('tinyurl');
const uri = message.content.slice(12)
if (!uri.length) {return message.channel.send('Non hai inserito un link.')}
TinyURL.shorten(uri, function(res, err) {
if (err)
console.log(err)
message.channel.send(`Ecco il tuo link: ${res} (${uri})`);
})}```
Is it correct? Becausa this command returns some errors on my cmd
any other JDA devs running into issues with their bot this morning?
ayy I'm with you @tranquil copper
@tranquil drum TF JDA is acting weird
i just hit 10k servers
and now
thanks god
It started this night when my bot was acting weird with the server count
and then it broke
I thought it was server count related too but my test user is broken too
and now its not answering anymore
Only in like 5 servers and it's also having the same problem
Do you know anything to solve it
I guess JDA is broken with latest Discord API or something
lemme use 3.0 lol
intents™️
Ahh yeah intents fixed it
@tranquil copper
just use GatewayIntent.DEFAULT if you don't need extras
JDABuilder.createDefault(token) if you just need DEFAULT
instead of the old new JDABuilder()
im working with shardbuilder
shard builder is deprecated 😦
or tell me how to use jda builder and sharding at once
JDABuilder.createDefault(token)
.useSharding(Loader.SHARD, Loader.NUM_SHARDS)
okay thanks
I don't have a shared state manager though
And what does the first int at usesharding do? @tranquil drum
How to shard with JDABuilder @tranquil drum
wait found a way arround it
list.members.cache.forEach(member => console.log(member.id)); ```
This gives me 2 of 40 id on the guild, with GUILD_MEMBERS intent Enabled and verified by Discord
```const client = new Discord.Client({ ws: { intents: ['GUILD_MEMBERS', 'GUILD_MESSAGES', 'GUILD_MESSAGE_REACTIONS', 'GUILDS', 'GUILD_WEBHOOKS'] } });```
I don't understand
does anyone know why this keeps happening
looks like something broke when playing the track
well duh
How can I read both the attached file and the url.
let qrcode = `http://api.qrserver.com/v1/read-qr-code/?fileurl=${encodeURI(args[0]) || encodeURI(message.attachments.first().url)}`;
I dont understand, you want the fileurl query parameter?
https://www.npmjs.com/package/humanize-duration
@queen crescent Great package. Thanks
Hi!
How could I access to the properties of every command defined as a Commando framework command?
you're missing parentheses
take a guess
😉
hint: look at where the error is pointing
im dead ass fucking sped
Countdown to night command
does anyone know why guild.owner.user.username doesnt work anymore all of a sudden
intents update iirc.
guild.owner wont automatically be cached on startup
yeah, intents are now enforced
Discord started enforcing the GUILD_MEMBERS intent requirement TODAY
If your bot has stopped being able to access cached members, you don't have access to the privileged GUILD_MEMBERS Intent. GUILD_MEMBERS is a privileged intent, it is not sent to bots that have not been allowed to use it.
If your bot is not verified you can go turn on the GUILD_MEMBERS intent in the Bot section of the dev portal, or you can fetch the users manually.
If your bot verified, need to request this privileged intent from Discord through https://dis.gd/contact (general request), or figure out how to fetch members only when necessary.
oh snap
ya intents fucked up my old music bot
that explains my count issue
Discord will not give you privileged intents just so you know how many people are on your bot's guilds though
just remove this feature if it's your only reason for needing this.
That explains why this number isn't >2000 like it used to be
Uses a machine learning model trained for detecting text sentiment
🙂
my music bot got all fucked when intents came out
Would keyv be a scalable way to maintain an economy
in other words,
is keyv crap for bot economy
im using objects (as value) to store ppls inventories
Anyone know what this might mean? https://cam.is-ne.at/mJiPOJ.png
bitfields follow rules, you cannot put any random thing within those rules
so... what might have triggered it?
The last interaction was a PATCH request that responded 200
I usually see bitfields and discord in conjunction with roles
seems to be encountered whenever anyone but me sends a command, but IDK even where to start debugging
on the command handing probably
Would keyv be a scalable way to maintain an economy
in other words,
is keyv crap for bot economy
im using objects (as value) to store ppls inventories
Found the issue. It's checking if a user has the false permission lol
sounds like an invalid bitfield lol
keyv is just a wrapper isnt it?
no I think it's a full on thing
how can i show the number of servers on the bot page?
how can i show the number of servers on the bot page?
@fading siren on your website ?
Is there like a php guy here?
@earnest phoenix I think I can help with PHP
Okey
I put Y%T"S22jT&=y>>=
What does the error say
Then it goes to timeout for some reason
and if I remove the " in it, everything works fine
I don't remember PHP looking so unfriendly
and if I remove the
"in it, everything works fine
@earnest phoenix Try replacing with %22
On a local server everything works fine
It's a password, can't choose it
@earnest phoenix Try replacing with %22
@near stratus
It's a password, can't choose it
@near stratus
@earnest phoenix Oh it was post (I thought get)
Just use rawurlencoder
And then decode it again
https://www.php.net/manual/en/function.rawurlencode.php
Get help from here
The request to the file is not even being made when submitting
Are you using curl to make request ?
It's a form btw
@earnest phoenix HTML ?
Direct to PHP file
Can anyone help me figure out why I cant get my MemeBot to work? Been offline for a few hours now for me.
Was a bot already made-
Not sure either, cant contact the creators and other people seem to have made it work. No one let me know what they did.. so Ive just been sitting here.
lots of bots went down because of an update to the api. you can ask the bots owner to fix the bot
otherwise it will remain down 🤷♂️
I cant add them as a friend :/
@earnest phoenix Then you shouldn't have any problem with the code like:
<form method="POST" action="main.php">
<input name="uname"/>
<input type="submit" value="Submit"/>
</form>
true
Its up to them to figure it out there's nothing we can do, @random wyvern
Well, at least I tried. Thank you-
<body class="main-bg">
<div class="login-container text-c animated flipInX">
<div>
<h1 class="logo-badge text-whitesmoke"><span class="fa fa-lock"></span></h1>
</div>
<h3 class="text-whitesmoke">Please Login</h3>
<p class="text-whitesmoke">By logging in, you accept our <a href="//studio.spacelab.club/legal/privacy-policy" target="_blank" class="text-spacelab">Privacy Policy</a> and our <a href="//studio.spacelab.club/legal/terms-of-service" target="_blank" class="text-spacelab">Terms of Service</a>.</p>
<div class="container-content">
<center>
</center>
<form class="margin-t" method="POST" action="/login.php">
<div class="form-group">
<input name="username" type="text" class="form-control" placeholder="Username" required>
</div>
<div class="form-group">
<input name="password" type="password" class="form-control" placeholder="*********" required>
</div>
<div class="form-group">
<center>
<div class="g-recaptcha" data-sitekey="6LfkvsYZAAAAAMbM5HZJ-6T410DvIx2dqNGbNumX"></div>
</center>
</div>
<button type="submit" class="form-button button-l margin-b">Sign In</button>
<p class="text-whitesmoke text-center"><small>Do not have an account? <a class="text-spacelab" href="./signup">Sign Up</a></small></p>
</form>
<p class="margin-t text-whitesmoke"><small>Copyright © 2017-<span id="currentYear">2020</span> - Spacelab Studio | All rights reserved.</small> </p>
</div>
</div>
</body>
But I do have an issue with this
well that's some big code part lmao
and the PHP uses
$un = $_POST['uname'];
echo($un);
??
Something like this ?
Don't post the whole code here
basically when i submit with password Y%T"S22jT&=y>>= it won't request the file /login.php
in that code part
<center> is deprecated, isn't it
Just try making a Request with curl in your terminal
To check if the /login.php is working
Also check the directory
./ or /
well, does it's job so idrc
it is in html5
@faint prism Who cares we'll use CSS anyway
replaced by
text-align: center
replaced by
text-align: center
@faint prism doesn't work for boxes
To check if the /login.php is working
@near stratus It does work, just remove the"from the password and it works fine
there is a lot of ways to center elements
It's because of that god damn "
Then use Js to replace the " with a certain symbol (ex:%22) and then in PHP again change %22 to "
there is a lot of ways to center elements
@faint prism I know 3
w3schools lists a bunch of methods
Anyway, How long does it take for a bot to be approved or declined ?
1350+ hours
So they just keep pinging my bot to check if it stays alive through that time ?
If it isn't online when they randomly decide to review it, it's denied
@faint prism That's almost same
what is the reason the bot sees members offline?
Not really, but okay
@earnest phoenix Discord gateway intents 
"Almost same" 
@earnest phoenix Discord gateway intents :SlidingParrot:
@earnest phoenix So is there anything I can do
Yes
Add needed intents to your bot and code
case 'test':
const premium = [
'723081690792067143',
'707997274722140261',
'369742714855620618',
'712666880115998730',
]
if(message.member.id !== premium){
return message.reply('you cant use it')
}
message.reply('sup mate')
break;```
will it work?
tias
@humble gyro my bot was rejected on top.gg because it was offline today, I have been waiting 5 weeks and just because its bugging today because of an outdated JDA it got declined. I am putting the bot online once the VPS has restarted, can it be rereviewed please?
ouch
Thanks, this was honestly the worst time to review it
I feel that
case 'test':
const premium = [
'723081690792067143',
'707997274722140261',
'369742714855620618',
'712666880115998730',
]
if(message.member.id !== premium){
return message.reply('you cant use it')
}
message.reply('sup mate')
break;```
will it work?
@tardy hornet will it work?!?!?
no it dose not
why did you ask if you were just going test it
i test it before
but idk why i thought it will be better asking that instead why its not working
its always better to give us correct and relevant info
if something doesnt work, its better to say so
@lucid nova
Hello everyone,
I have a really big problem! My bot is starting and is online, but it doesnt answers any messages I send and it doesnt find any users and servers. Please help : (
@lucid nova
@chilly bison hey
@lucid nova what language?
My mother tongue is german, but my english is pretty fine, i think
no I meant like python
programming language
or node
The bot worked in the past, but when I restarted it today, it stops working. The code doesnt even have changed
My mother tongue is german, but my english is pretty fine, i think
@lucid nova loll
Read #discord-news
the discord api had some changes
those bots deserved it 
the discord api had some changes
@solemn latch Yeah, but my code doesnt make any error messages
do you have something like
try {
// ...
}
catch(exception) {
// doing nothing
}
Not having intents don't cause any errors, you just don't receive the events
Enable them if you're willing to
The bot is online, but it doesnt know any users or servers
that's verified only though right
nope
oh sick
70
neat
Gotta wait another 5 weeks for review of bot, because it went offline because 1 functionality was depricated and made the VPS crash, the day of review. Just shoot me now 
nevermind discord misinformed us
nice, fixed my issue
#commands message
it's 100 guilds
@onyx flume more like 4.8 mil seconds at the very least rn
According to #support pins
Um how do i use 5he bot mudae
Well then you have 4.8 million seconds to get it back up

@prime fjord how do you what?
-wrongserver
@zinc fable
@prime fjord
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 :(
just incase
Ty
Hmm oh well, just gotta wait 👍
Anyone having delay times when starting up bots?
That depends on what your bot does at startup, mine doesn't have any delay
client.on('guildCreate', theNewGuild => {
theNewGuild.owner.send('')
})```
why is it send of undefined...
owner isn't cached?
@earnest phoenix yeah, I have them enabled but nah
const client = new Client({ ws: { intents: ['GUILDS', 'GUILD_MESSAGES'] } });```
@merry shuttle owner can't be undefined btw, it's null
yeah?
No, (new Intents()).add(["GUILDS", "GUILD_MESSAGES"])
How do I use an older API version with jda in maven. My bot doesnt work anymore. pls help
I just get that error and after a while the bot starts
like I said, yesterday it was working perfectly fine
it's not an error, it's just a warning that you're using old api
Yeah
just change ensureIndex to createIndexes
I will, but my problem is that starting up the bot takes around 4 minutes
I never had that issue
oh well idk how to solve that
nope
How many guilds is your bot in
1
It's a bot for testing
trying something brb
yeah, tried with my old bot which had no issues
still the same issue
idk what's causing it honestly
hmmm




