#development
1 messages · Page 718 of 1
an error stack
people whomst listen for reaction events
having more then just yourself working on a project is so nice
oh yeah about that shh
i'm the only developer of 5 projects at once
im good yes
how good
i need a dev
very good
hire me and get 1000000 lines of code 100000 lines are in /**/
like really
he's stephen hawking
you being serious about working with us @mossy vine ?
cause ill straightup do it
rn
i have 1mil lines of fuck me
i mean just like at any startup hire anyone whos decent
@earnest phoenix fuck yeah
all written manually
@valid frigate ye we got the best of the best 
good
my library is probably about 2000 lines or something
maybe ill help you with your logo but luke is dead rn isnt he
uber just yoink me already pls
What library whats only 2k lines long, nice.
tryna be funny in #development
all written by me
im no mod but what the fuck man
me? @valid frigate
@restive furnace what
yoinked
i'm hiring devs dm me to apply i can give free premium web hosting costs $500/m for free just by being a dev
lol
really need one
imagine a whitename
anyone? lol
welp
lol i can hear you typing @earnest phoenix
i can't speak rn @earnest phoenix
lol
you sound like as if you are drunk
ohh
do you see the screen shot above
the error screenshot
yes
there is no client.js file
ok
they keep resetting my token :((
no the actual thing has changed
i think
can my webhook token be the issue?
i'm using a webhook
and when i do that cmd
it's coming
that error comes when i do that cmd
n0o
yes
wait i'll screenshare
welp
this
is a problem
I'll ask again since my question got yeeted
Does anyone know which perm do bots need to fetch invites
lol
☺
see the discord.js docs for perms it's easier than asking @earnest phoenix
...
it better to give a bot administrator perm instead of giving each perm manually
Wrong.
huh?
If you give a bot administrator right you might have some perms you didn't actually need to give it
It's prone for errors and possibly abuses
While if you do each perm it's explicit
It's like saying 'you should use your root user instead of making a new user'
its getting users with the ids from 0 to a.length-1
chances are, they are not valid ids
Can u give me correct code ?
no
Why
cuz idk the correct code
ok.
I am asking for admin perms currently if you want to know which invite was used since I can't for the sake of it find which perm is needed to fetch invites
My guess was manage guild but I wanted to confirm
That's your guess and that was also my guess, but did you actually try it..?
Doesn't seem like that much effort to try it out
MANAGE_GUILD, yup
What does a DeprecationWarning mean?
what do you think it means
It says pass a function instead
I know that, but how do I fix it
A report command
that's not what i meant when i asked what you're doing i-
you want my code?
on which line does the warning occur
Line 23
there's not even 23 lines in your hastebin
Line 15
take a look at docs https://discord.js.org/#/docs/main/stable/class/Collection?scrollTo=find
Hey guys , I was wondering if “selling bot currency is allowed”
You mean rewarding users with your bot's currency for donating?
Yeah
I want to set up a donation page with cards displaying how much they donate
Haven't seen people get in troubles for that
So like €1 = 1000 Credits
As long as you give the product you claim to give, you're good
So that’s allowed ?
Should be
What about selling the currency if you get me
Huh?
Never mind thanks 🙂
You're welcome, I guess 
Big, small bots do that and I haven't heard of cases where they get in troubles for that
so i could do the same basically , putting plans for like 2$ for premium or somewhat
damn
i guess ill do that then 😂
As long as you don't scam people
yeah i guess
Just don't go crazy there
It is allowed many bots has premium feature and they are not in trouble.
Hello! Currently, I have this:
client.fetchUser("592716014588788736");```
and it's giving me this:
```js
Promise {
User {
id: '592716014588788736',
username: 'Splash',
discriminator: '1337',
avatar: 'a_39f3d3470e7cd6aed3b966e408df0d6d',
bot: false,
lastMessageID: null,
lastMessage: null } }```
How do I access the username?
not really, no
use await client.fetchUser in an async function
async code is code that is not synchronous, it doesnt give you an answer right away
a promise tells you that there is a result that will be returned later, but not now
so you have to tell the code what to do after the promise arrives
one way is to use await to tell your code to wait until the promise arrives
the other way is to use .then() to tell the code what to do after the promise arrives
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
?
One message removed from a suspended account.
you bot is {prefix}!ping = 100 300 ms ?
One message removed from a suspended account.
ohk
One message removed from a suspended account.
One message removed from a suspended account.
1 mins
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Not sure why but my "on_guild_role_update" event for discord.py is always called twice when I edit a role, I checked and I don't have this event somewhere else in the project and I dont have two processes running
The console output after the following code is
@everyone
@everyone
Moderator
Testing
@commands.Cog.listener()
async def on_guild_role_update(self, before, after):
print(before)
print(after)
^ i fixed it by just returning after the code, but is there any fix to it without having to check for the [at]everyone role
@sage bobcat the ping is the bot's websocket ping
its the latency between the bot's server and discord's servers
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
the websocket ping is always low
One message removed from a suspended account.
where do you live?
One message removed from a suspended account.
discord's gateway is in new york or something like that
yes
34 seems like a normal ping between miami and new york
One message removed from a suspended account.
because bots usually measure REST ping and not websocket
One message removed from a suspended account.
Does anyone know on discord.js how to correctly use aliases?
I did already make on end of command
exports.alias = (type == 'alias') => {
alias = "aliashere"
}```
i did add on my command handler
```js
let props = require('./command/${f}');
let aliasName = props.alias.alias;
client.alias.set(aliasName, props);
and on messahe handler
//as usual
const command = its from an idiots guide same;
const cmd = client.commands.get(command);
const alias = client.alias.get(command);
if(!cmd) {
if(alias) {
alias.run(command);
}
}
if (!alias) {
if (cmd) {
cmd.run(command);
}
}```
you should format that
@restive furnace you're defining exports.alias as a function
so client.alias becomes function -> prop
which you cant .get() properly
ok thx for the info
One message removed from a suspended account.
One message removed from a suspended account.
does totalmem return in bytes?
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
perhaps this let mem = Math.ceil((os.totalmem() - os.freemem()) / 1024 / 1024 / 1024)
One message removed from a suspended account.
One message removed from a suspended account.
happens
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
how many servers?
One message removed from a suspended account.
Well that takes into account the other processes running too right?
One message removed from a suspended account.
just looks at total and total free
One message removed from a suspended account.
One message removed from a suspended account.
I mean it's really hard to tell if it's actually right
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
It returns the memory in bytes doesn't it?
So by doing / 1024 3 times
Wouldn't that make it GB
Besides that
You are aware that you're checking the total memory usage on your entire operating system, right?
Not just the bot
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
What did you think os meant 
One message removed from a suspended account.
soRrY
One message removed from a suspended account.
One message removed from a suspended account.
I believe process has some stuff you can use
One message removed from a suspended account.
To get the memory usage for just that process
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.

One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
wait it's returning an object right?
One message removed from a suspended account.
1 sec lemme test
yeah you need to do process.memoryUsage().heapUsed or .total or something. I don't know what each value means and I'm too lazy to read docs
if that's what you're interested in
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Yes you are
One message removed from a suspended account.
o
but cant spoonfeed 
One message removed from a suspended account.
process.memoryUsage().rss is the memory used by the process
One message removed from a suspended account.
no thats how much is free
You don't need to subtract it
make mem = Math.ceil(process.memoryUsage().rss)
all u have to do is math on mem alone
One message removed from a suspended account.
no this is what u did let mem = Math.ceil(os.totalmem() - (process.memoryUsage().rss))
ye
unless u already changed it
One message removed from a suspended account.
ok
same output?
then thats ur memory usage
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
I got some slick code for uptime if ye want it
you could
- use momentjs but its fat
- copy paste from stack overflow since that's what we all do anyway
2b) copy paste from stack overflow but actually try to understand what the code means
2c) disregard 2b
2ba) "But actually try to understand what the code means" We don't do that here
- ignore 2 and actualy code it yourself
^
- ignore 3 and pay someone else to do it for you

2 kinda sucks since you dont learn by spoon feeding
and alot of people there have a habit of that instead of just explaining the answer or whats wrong with the code
Do I have to port forward the --inspect debugger on node to access it with devtools?
Coding yourself is always best!
You will learn so much more and even for a small thing it becomes worth it
You can then apply what you learn to other areas and boom better coder
People who get into the stack overflow loop STAY in the stackoverflow loop
pay someone to convert milliseconds into a human readable format yes big brain
lmao
Agreed
A pro gamer move
https://discordapp.com/api/oauth2/authorize?client_id=Your-Bots-ID&permissions=8&scope=bot would invite the bot with administrator
if thats what you mean
A bot can send two different embed messages to two different channela at the same time with no issues, right? Discord.js
Don't try to get your bot invited with admin powers, you almost never need it
I always had admin perms on my bot
After a while people would always come to me with issues and a lot of the time it was bc the bot lacked a certain permission. I added a permission check for each command but still its better for the developer to just keep it at 8
no it's not
If you keep it at 8, approx 83% of guild owners will keep it there
use permissions your bot needs
not all people are going to trust your bot with admin permissions
Just check ALL the marks, so your bot still does almost everything if people don't give admin 😛
Approx 17% of users that actually cared
I never see users actually care about the url/permissions granted, its always only other devs lol
Users generally blindly trust bots just like how devs blindly trust all the junk they npm i
Lol
people who lead ecomm guilds or just generally large guilds do care
trust me lol
used to work for a few owners
I know, and they usually just untick and do a custom role anyways
All the super big guilds usually want custom bots entirely tho
And those bots are usually admin
You can give a bot admin powers as long as you know who to beat up IRL after the bot deleted the entire server
This sounds like a stupid question, but was there a change within the Python API surrounding the status things?
@bot.event
async def on_ready():
print("Connected to Discord Servers.")
print("Ready for start up.")
print("Running on v" + str(version) + " on the account " + bot.user.name)
status = ["Tetradon Gen", ".help"] # Change the status here!
# Changes the status messages on the bot
await bot.wait_until_ready()
msgs = cycle(status)
while not bot.is_closed:
current_status = next(msgs)
await bot.change_presence(game = discord.Game(name = current_status, type = 2))
await asyncio.sleep(60)```
this is my code for it and Idk if there is something wrong with it because my bot won't start
I always make sure to give my bots only the perms it needs, just helps alleviate some of the liability when someone gets their server deleted because they don't know how to configure stuff
There is no type, is_closed is a function
wdym?
It's also activity now
oh ok
change_presence(activity=
To get Listening and Watching, you'll need discord.Activity
I'm just blindly assuming you recently updated to the newest discord.py version
yup
Who knows how to see the list of permissions for roles?
type will be within discord.Activity if you use it, discord.Game is only used for the "Playing" status
You'll need to call bot.is_closed since it's a function
You should read some changelogs on discord.py docs :p
I'm trying to make a backup bot but I can't save the role permissions
Librairie: discord.js
@slender thistle
Oh okay
From discord.py 1.0.0 starting, discord.Activity was introduced. discord.Game and discord.Streaming were kept, but to get Listening and Watching statuses, you'd need to use an instance kf discord.Activity where a keyword argument type would be an Enum for your status (discord.ActivityType.<x>)
From basic Python, a function is called by adding () after the function name. To use bot.is_closed, you'd need to put parentheses after is_closed
while not bot.is_closed()
current_status = next(msgs)
await bot.change_presence(activity = discord.Activity(name = current_status, type = 2))
await asyncio.sleep(60)
What do I need to change about this?
Don't forget :
ok
Do you want your bot to display Playing?
Listening
discord.ActivityType.x where x is the status you want
What would you use for listening?
Hm?
What should I change in my code, sorry if I sound short, but I need to finish this quite soon
Yeah
when the value of argument type needs to be an enum/class
discord.ActivityType.x where you replace x with either watching or listening
so ```Python
await bot.change_presence(activity = discord.Activity(name = current_status, discord.ActivityType.listening))
Thanks
there is an error with
while not *bot*.is_closed():
current_status = next(msgs)
await *bot*.change_presence(activity = *discord*.Activity(name = current_status, discord.ActivityType.listening))
await asyncio.sleep(60)
The things w/ ** around them
What's your discord.py version
how'd you check?
thought it was xd
Latest is 1.3.0
ooooooooooooooooooooooooooooooooooooooooooooof
I am behind
now how do you update your version lmao
If you keep it at 8, approx 83% of guild owners will keep it there
Because those are all stupids
It's nice to have your bot in some decent servers too
And people should rly learn not to give bots admin
Giving a bot admin is very much the same as giving the bot owner admin
@golden herald you have the choice to let your code stay like it was before I started giving you crap or migrate to the actually latest version now

If I invite a bot and see that it asks for admin, I assume it's due to one of the following reasons:
- An actual scam/malicious bot
- A lazy dev that couldn't figure what perms their bot needs
Eh never played with permissions
I always run the cmd from admin if shit doesn't work 
ok thanks
Or that
Thanks so much!
Who can help me in discord.js v11.5.1?
I only did it bc less users complain
And again, bot developers seem to be the ones that generally care
You can't do argument=value, value_to_another_argument
Put type= before the listening status thing
Also > assuming they arent decent servers
ooh ffs since I updated it I got 109 errors
Theyre not stupids rlly, its just credibility from the bot being on so many servers
I mean today the sample size i had for the 83% figure isnt much, but back then it was decent
Well yeah as I said you'd have to take your time updating stuff
:^)
Migration docs ftw
As long as your commands.Bot or discord.Client is under the variable bot, you are good
just make sure the attributes you use do actually exist 
I have followed the migration thing and still getting errors?
idk why
@slender thistle
There's a class Messageable which TextChannel, Member and User inherit
So you would need to use .send on a channel
oh ok
Who can help me please?

who can help me for roles permissions bitfield but in discord.js v11.5.1
No, it's to store it in json.
No wait
When I want to save the guild everything is saved in the json file except the roles permissions
are you trying to clone a guild?
No i try to make a saver bot
like xenon but in js
Then it will probably be open-source.
I have got an error with this code:
before = time.monotonic()
msg = await channel.send("Starting ping test")
ping = (time.monotonic() - before) * 1000
await channel.delete(msg)
Saying this:
I have only given 1 argument, but the python thinks I gave 2
...
very helpful
Are you on rewrite?
Me?
don't think so?
no Kiyan
When did you install discord.py?
because it would be await msg.delete()
Thanks, fixed it somehow xd
It is called Reading the docs
Okay I am stupid and new and just don't get it...
const { file } = await fetch('https://'+login+':'+key+'@danbooru.donmai.us/posts.json?random=1&limit=1&tags=kanna_kamui%20rating:s').then(response => response.json());
message.channel.send(file);
How do I get the object large_file_url out of that?
use snekfetch or axios for the request
I rather not, as they are deprecated and you are highly advised to use node-fetch 😄
Okay
@fickle anvil console.log(file)
"undefined"
That means there is no "file" field in the response
Youre trying to extract a "file" field from it
I thought I specify "file" with the {file}...
but where is my error?
hmm if I take off the {} I get an object containing the json content
@fickle anvil yes
PAPI
PAPI
PAPI
PAPI
PAPI
PAPI
PAPI
PAPI
@earnest phoenix stop
PAPI
Someone call a mod
ty
np
how can I now "extract" e.g. large_file_url out of it? appending .large_file_url or the earlier mentioned .body.large_file_url won't do.
If you dont use {}, you get the full object. Then you can simply fullobject.fieldyouwant.
If you use {}, you have to specify directly the field you want
Does anyone know how to change the position of a category in discord.py?
Well, notice the first character in the response
Its a [
That means its an array
So you cannot access it directly by a field, you need to specify the array index first
Fullresponse[index].field
If you only want the first item, use index 0
console.log(file[0].large_file_url);
returns: TypeError: Cannot read property '0' of undefined
How did you define file?
It's just the bit of code you see, except that I define the login and token and include discord and node-fetch
Because as i said before, if you use {file}, its not a full response, its an attenpt at getting a field called "file" from the response
{file} is the same as fullresponse.file
ah ok, let me try something
It seems it works now
lemme check live
it works... finally.
on another json it worked the way I did it in my example
still a bit confused about some workflows
big thanks @quartz kindle !
The other json might have had a file field
it has and is not an array as I just see.
that stupid little [

so if it wouldn't be surrounded by that [] it would have worked as I tried?
@earnest phoenix there is no permissions.bitfield
Permissions is already the bitfield
Oh
@fickle anvil idealy yoi want to work with the full response, and not use {}, unless yoi know what youre doing
Using the full response, you can log it to see how it looks and navigate throigh it one step at a time
it's my first time working with APIs via javascript ^^ only did that like 15 years ago on php. 😄
okay but if it is that easy now, it shouldn't be anymore problem
the solution is quite easy, if you know how to do it
Yeah if you have php experience its mostly thr same thing
You didnt map them
Thank you i test this
"roles":[{"idOld":"367754140723445770","name":"Test1","hexColor":"#9e3838","hoist":false,"mentionable":false,"position":36,"defaultRole":false,"permBitfield":264}]```
Thank you
Does anyone know how to change the position of a category in discord.py?
Idk
Ok another question, does anyone know how to setup a vc in python
and put it in a category?
anyone know how to set the bot's presence when using discord botkit?
Nope sorry
Trying to make a ping command that gives the bots ms. I keep getting a error
start = time.time()
msg = await self.safe_send_message(channel, "Pong!")
end = int((time.time() - start)*1000)
return await self.edit_message(msg, "Pong! %sms" % end)
I'm stuck
its 1am
is this .py?
same here I need help too xd
um
one sec
@bot.command(pass_context = True)
async def ping(ctx):
channel = ctx.channel
before = time.monotonic()
msg = await channel.send("Starting ping test")
ping = (time.monotonic() - before) * 1000
await channel.send(":ping_pong: Pong! **{}ms**".format(int(ping)))
print(f'Ping {int(ping)}ms')
await msg.delete()
This is my ping command
works pretty good!
gtg now
message.guild.owner.user.username says user is undefined when i do my serverinfo command here
but it works everywhere else
I don't know how to setup a console like command. I tried storing the command params then using the variable they are stored in in a message. That does not work though.
You need to eval, also why type it like its a template literal?
Because that's the second try and I wanted to know if making it literal would owrk
Ohh
:/
what do you mean lol
async def on_message(message):
if message.content.startswith(f'@Jam_'):
await bot.send_message(message.channel, f"The prefix for Jam_ is `ja`, Use jahelp for more commands.")
Trying to @ mention the bot, just can't figure it out. I've tried, just i cant its 3am
Lol
Use
<@BOT-ID>
biggest of brains i am
i knew that
pfff
:)
Who is here?
can someone explain me what are these, in node.js?
This is for comment like //
this is for comment like
you do not know what jsdoc is
@wheat jolt it's for jsdoc and not a normal comment
yes
yea
Okay wait
async function send(channel) {
try { var x = await channel.fetchMessages({limit: 10}) } catch (e) {}
x = x.array().reverse()
for (let i = 0; i < x.length; i++) {
await newguild.channels.find(q => q.name == x[i].channel.name).createWebhook(x[i].author.username, x[i].author.avatarURL).then(async w => {
try {
await w.send(x[i].content)
await w.delete()
} catch (e) {
await w.delete()
}
})
}
await message.channel.send(`restore: ${x.length} messages from text channel ${channel}!`)
}```
I try to make a backup bot and i don't know why i have:
(node:17834) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'array' of undefined
can you send me the line the error happended on
Yes
x is not defined
x is defined
x is defined
x is defined inside the try/catch block and can't be used outside that block?
ah, i only know Java, in Java you can't use it outside a block if you define it inside a block
my bad
np
How can I fix this?
Okay
that wont do anything?
the try catch block prevents the code from stopping on error
ik
or maybe place a log in the catch, it could be that there is an error that you ignore
honestly a bunch of resources arent helping me on this but what is the difference between single & and double && in java (same with | and ||)? ik that & is bitwise but wtf does that mean lmao
The collection might be empty
I mean, the channel might have no messages
or the bot doesn't have access to view it
@blissful scaffold the error: (node:17834) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'array' of undefined
idk
Alex the bot is admin lol
lol you havent defined array
@valid frigate i cant java but im pretty sure their aliases
try { var x = await channel.fetchMessages({limit: 10}) } catch (e) {}
you ignore any errors that might happen here

@valid frigate explain
that's just the thing
like
they work the same ig
cant complain 
also dany this means you've probably defined a variable somewhere and are trying to reference variable.array despite there being none
if there is also an error while fetching messages then you will never know that and x will not be defined
@valid frigate x should be a collection and discord.js collection have a function, array()
@earnest phoenix try console.log(x)
shouldnt he be calling variable.array() then instead of trying to get a property
async function send(channel) {
try { var x = await channel.fetchMessages({limit: 10}) } catch (e) {}
x = x.array().reverse()
for (let i = 0; i < x.length; i++) {
await newguild.channels.find(q => q.name == x[i].channel.name).createWebhook(x[i].author.username, x[i].author.avatarURL).then(async w => {
try {
await w.send(x[i].content)
await w.delete()
} catch (e) {
await w.delete()
}
})
}
await message.channel.send(`restore: ${x.length} messages from text channel ${channel}!`)
}```
@valid frigate all is define
bruh
@wheat jolt okay
@valid frigate bitwise & does and AND operation between 2 primitive data types
var x = await channel.fetchMessages({limit: 10})
x = x.array().reverse()
console.log(x)```
like this? @wheat jolt
is && for non primitive?
example you can & 2 ints
no
or before?
before
Okay
.array()
& is a mathematic operator
because it'll throw the error
&& evaluates two booleans
and it won't console.log
var x = await channel.fetchMessages({limit: 10})
console.log(x)``` like it?
Okay
show me the output
Yes wait the bot restore the save, i have a bad ping
like
int x = 0;
int y = 1;
System.out.println(x & y); // prints 0
x = 1;
System.out.println(x & y); // prints 1
System.out.println(x && y); // pretty sure an error about && being used on ints
huh
& is for bitwise comparison
so obv this isnt js so yeah doing int && int where there's supposed to be boolean && boolean would throw an error
Oh no wait i don't have any emojis
@earnest phoenix you ignored any possible error that might happen while fetching the messages in your earlier code

just show alex the result
@blissful scaffold idk
Wait
I create a pastebin
(node:22659) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Access
Bruh
RIP me
I'm going to add a condition
i used to be able to change the entire page css inside the long description but it doesnt seem to work anymore
console.log(roles);
message.channel.send(`Successfully changed rolelist to:\n\`\`\`${roles.join("\n")}\`\`\` `)
Does anyone know why this is happening?
There should be two "Any" in the message
Because in codeblocks you put the language for the codeblock on the first line
Your first "any" is being put there and for that reason not being displayed
thanks that fixed it
How to make the bot execute the code that I will send to it?
Hey, does anyone know about a software that reduces your own internet speed ?
This can be done in the windows settings.
I cant find anything similar in the control panel, I have found how to set a data limit but thats not exactly what I want
why do you need this? to reduce the number of bot requests?
eval function if the bot is written in javascript
I already found a guide;)
@shadow dust look up net limiters
You can choose which application receives limited internet speed
Oh thanks a whole bunch
@safe pecan no, I have some code that executes only when something else is being requested, and its kinda hard to test with 35mb/s
that shouldnt be a reason for why its hard to test. if your code doesnt work because a request is "too fast", then the code should be reworked
async def on_message(message):
if message.content.startswith(f'@untold hull'):
await bot.send_message(message.channel, f"The prefix for Jam_ is `ja`, Use jahelp for more commands.")
Trying to mention the bot for prefix?

a s y n c
that should work.
@earnest phoenix are you re-calling on_message for every command?
yes
@slender thistle you thought me using async was dumb
dont
only call it once
and use multiple if statements in it.
if(x):
pass
if(y):
pass```
replace x and y with your commands.
@quartz kindle yeah and all the calls im doing within that short amount of time have been tested independently, but I do want to see if at that specific point in application time it also works properly
if the idea is implemented correctly, it should work regardless or that, ie: chain events correctly, use promises, no global variables, etc
Si there a way i can make this work? "trips" : {"loc": "stats.trips"}, and get the data from a object like js const p = { stats: { trips: 1}} let trips = p["stats.trip"]
p['stats']['trip']
yea ik but the loc can be all sort of stuff so how can i make it the easiest way possible
Hello everyone!
Recently one of my bot's shards has crashed without granting any error as such.
I only have this in the records (but I can't get anything clear).
ChildProcess {
domain: null,
_events:
{ internalMessage: [Function],
exit: [Function: bound _handleExit],
message: [Function: bound _handleMessage] },
_eventsCount: 3,
_maxListeners: undefined,
_closesNeeded: 2,
_closesGot: 1,
connected: false,
signalCode: null,
exitCode: 1,
killed: false,
spawnfile: '/usr/bin/node',
_handle: null,
spawnargs: [ '/usr/bin/node', '/Discord/Filo/index.js' ],
pid: 29127,
stdin: null,
stdout: null,
stderr: null,
stdio: [ null, null, null, null ],
channel: null,
_channel: [Getter/Setter],
_handleQueue: null,
_pendingMessage: null,
send: [Function],
_send: [Function],
disconnect: [Function],
_disconnect: [Function] }
(I have to admit that this shard had been online for more than 4 weeks and I don't know if that can influence the crashing)
thats just the childprocess object, you console.logged it somewhere for some reason
missing permissions
Already but I don't get any reason why she crashed
figured
@twin kestrel nothing you can do about it, except trying to set up better logging/error handling for the next time it happens
from what i've read through a forum, it has to do with roles
@grim aspen its on the /messages endpoint, it has to do with a message
It's pretty weird, but I'll see what to do
Creeper, what is the bot trying to do when it happens?
you can use that ID to check in which channel/guild it happened
does the error show the method? GET/POST/PATCH/etc
POST means its about sending a message
Maybe the bot has no permission to send messages in that channel
unless it's having to do with me putting slowmode in my support server
due to a previous raid
its a possibility
That is possible I guess
make a test, set up slow mode, and have the bot send two messages
was rich embed recently updated?
dont think so
@quartz kindle likely solved; missing package
imma give it a few minutes to see if it will do it again
what was that
not solved nvm
oh i think i know now, one of the guilds must've muted it
How would you ssh tunnel a --inspect node debug?
i was able to copy the error i'm getting
at item.request.gen.end (/rbd/pnpm-volume/71b5ddd8-2a78-46fc-aba4-68049f14880d/node_modules/.registry.npmjs.org/discord.js/11.5.1/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:85:15)
at then (/rbd/pnpm-volume/71b5ddd8-2a78-46fc-aba4-68049f14880d/node_modules/.registry.npmjs.org/snekfetch/3.6.4/node_modules/snekfetch/src/index.js:215:21)
at process._tickCallback (internal/process/next_tick.js:68:7)
name: 'DiscordAPIError',
message: 'Missing Permissions',
path: '/api/v7/channels/265156361791209475/messages',
code: 50013,
method: 'POST' } Promise {
<rejected> { DiscordAPIError: Missing Permissions
at item.request.gen.end (/rbd/pnpm-volume/71b5ddd8-2a78-46fc-aba4-68049f14880d/node_modules/.registry.npmjs.org/discord.js/11.5.1/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:85:15)
at then (/rbd/pnpm-volume/71b5ddd8-2a78-46fc-aba4-68049f14880d/node_modules/.registry.npmjs.org/snekfetch/3.6.4/node_modules/snekfetch/src/index.js:215:21)
at process._tickCallback (internal/process/next_tick.js:68:7)
name: 'DiscordAPIError',
message: 'Missing Permissions',
path: '/api/v7/channels/265156361791209475/messages',
code: 50013,
method: 'POST' } }
My bot had errors in the past because people tried to send commands to the bot in a channel where he was muted.
I now always check for permission to send messages before sending a message and if there is no permission then nothing will be send.
Another option could be to DM the person who used the command and inform him/her that the bot has no permission to answer
But make sure that person has DM's open for bots
So atm, for my dashboard, if someone doesnt have a token or token is invalid it sends a redirect back through express. However, i want to be able to detect when the OG (opengraph) is being used and send back proper OG meta tags. What, if any, is the best way to detect if something is just looking for og? My next best solution is to return an html page that just has the og metas and redirects through javascript. It seems improper however its all i can think of atm.
What, if any, is the best way to detect if something is just looking for og
there isn't
scrapers get the html on load and then they parse it themselves and look for the opengraph tags
i don't get what's your goal here
rn i do res.redirect() if someone doesnt have a token. which means the og embed from the dashboard page pulls up the discord oauth login page embed.
I just made it so it redirects through javascript. However it feels like thats not the best way. Theoretically if you were able to identify what requests are from the opengraph protocol you could send something different, in this case being the og meta tags while actual people are actually redirected.
Right now this is what the html looks like
<!DOCTYPE html>
<html>
<head>
<meta property="og:title" content="Censor Bot Dashboard">
<meta property="og:image" content="https://censorbot.jt3ch.net/censorbot.png">
<meta property="og:description" content="Change and customize Censor Bot for your server(s)!">
<meta name="theme-color" content="#ff3d00">
</head>
<body>
<script>
window.location = "<%= link %>"
</script>
</body>
</html>```
just seems inefficient but not sure 🤷
why do you not want to include meta tags?
because it directly uses res.redirect instead
and obv i cant use meta tags in those
opengraph is client side, you cannot send opengraph tags and redirect internally at the same time
either send both the redirect and the tags to the client, or send none
discord's scraper doesn't execute the javascript
well theoretically if i were able to identify if it was an og request, i could send the meta tag html, while if its not redirect()
i mean like if it has the intent of finding og or the intent of actually going to the page
thats impossible to detect
the closest thing to what you want would be to parse user agent information from the headers to know what kind of client it is (ie, browser or not)
mk
Hi
{"349667929559662595":{"NomDresseur":"enzo69007#4575","Points":0,"Grade":"Dresseur Débutant (0 - 350)","GradeG":"Joueur","BDDTitre":["Joueur"],"Team":"Aucune","Magma":false,"Rocket":false,"Aqua":false,"MachineF":false,"MégaCAP":false,"ActiveTeam":false,"Start":false,"Premium":false,"Cânne_A_Pêche":false,"NumDresseur":39,"Pokedollars":0,"Sac":["Marisson (Starter)"],"SSac":[],"LSSac":[],"LSac":[],"GSac":[],"LGSac":[],"NbPokemons":1,"Pokedex":[0],"TempsVote":0,"TempsBcrate":0,"Potion":0,"Famillier":"","XP":0,"Appât":0,"HawlloweenItem":1572275616978,"TempsCatch":0,"Niveau":0,"NiveauP":0,"TempsDailyPoke":0,"TempsInvest":0,"TempsHr":0,"TempsDy":0,"TempsPeche":0,"Quete1":1572275616978,"Quete2":0,"Quete3":0,"Quete4":false,"Quete5":false,"Quete6":false,"SoonC1":[],"SoonC2":[],"SoonN1":0,"SoonN2":0,"SoonN3":0,"SoonNA1":"","SoonNA2":"","SoonO":[0],"SoonFT1":false,"SoonFT2":false,"SoonFT3":true,"SoonFT4":true},"495855787374280734":{"NomDresseur":"Lucas.prcl#4963","Points":12,"Grade":"Dresseur Débutant (0 - 350)","GradeG":"Joueur","BDDTitre":["Joueur"],"Team":"Aucune","Magma":false,"Rocket":false,"Aqua":false,"MachineF":false,"MégaCAP":false,"ActiveTeam":false,"Start":false,"Premium":false,"Cânne_A_Pêche":false,"NumDresseur":6,"Pokedollars":0,"Sac":["Moustillon (Starter)","Héliatronc (Normal)"],"SSac":[],"LSSac":[],"LSac":[],"GSac":[],"LGSac":[],"NbPokemons":2,"Pokedex":[0],"TempsVote":0,"TempsBcrate":0,"Potion":0,"Famillier":"","XP":0,"Appât":0,"HawlloweenItem":1572279792314,"TempsCatch":1572279814403,"Niveau":0,"NiveauP":0,"TempsDailyPoke":0,"TempsInvest":0,"TempsHr":0,"TempsDy":0,"TempsPeche":0,"Quete1":1572279792314,"Quete2":0,"Quete3":0,"Quete4":false,"Quete5":false,"Quete6":false,"SoonC1":[],"SoonC2":[],"SoonN1":0,"SoonN2":0,"SoonN3":0,"SoonNA1":"","SoonNA2":"","SoonO":[0],"SoonFT1":false,"SoonFT2":false,"SoonFT3":true,"SoonFT4":true}}
With this how i can get the first "Points" ?
Dresseurs is the name of files so Dresseurs[1].Points ?
What encoding does Discord use? So i can avoid getting usernames like this
@quartz kindle no i want make loop for replace of the .Points of all "Dresseurs"
So how i can get the first ".Points" with number ?
Dresseurs[1].Points ? Does not work
if you dont know the keys, you need to get them, you can use Object.keys(file)
Mmmh
that will give you an array of keys
Dresseurs[1] doesnt exist
its a two-step thing
first transform the data into keys or values
then use those keys or values to get the data
example
let file = {"39728974892":data,"8272840":data,...}
let keys = Object.keys(file);
console.log(keys) // ["39728974892","8272840",...]
keys.forEach(key => {
// do something with each key
})```
Mmmh
another option is to use values directly:
Ok i explain
{"349667929559662595":{"NomDresseur":"enzo69007#4575","Points":0,"Grade":"Dresseur Débutant (0 - 350)","GradeG":"Joueur","BDDTitre":["Joueur"],"Team":"Aucune","Magma":false,"Rocket":false,"Aqua":false,"MachineF":false,"MégaCAP":false,"ActiveTeam":false,"Start":false,"Premium":false,"Cânne_A_Pêche":false,"NumDresseur":39,"Pokedollars":0,"Sac":["Marisson (Starter)"],"SSac":[],"LSSac":[],"LSac":[],"GSac":[],"LGSac":[],"NbPokemons":1,"Pokedex":[0],"TempsVote":0,"TempsBcrate":0,"Potion":0,"Famillier":"","XP":0,"Appât":0,"HawlloweenItem":1572275616978,"TempsCatch":0,"Niveau":0,"NiveauP":0,"TempsDailyPoke":0,"TempsInvest":0,"TempsHr":0,"TempsDy":0,"TempsPeche":0,"Quete1":1572275616978,"Quete2":0,"Quete3":0,"Quete4":false,"Quete5":false,"Quete6":false,"SoonC1":[],"SoonC2":[],"SoonN1":0,"SoonN2":0,"SoonN3":0,"SoonNA1":"","SoonNA2":"","SoonO":[0],"SoonFT1":false,"SoonFT2":false,"SoonFT3":true,"SoonFT4":true},"495855787374280734":{"NomDresseur":"Lucas.prcl#4963","Points":12,"Grade":"Dresseur Débutant (0 - 350)","GradeG":"Joueur","BDDTitre":["Joueur"],"Team":"Aucune","Magma":false,"Rocket":false,"Aqua":false,"MachineF":false,"MégaCAP":false,"ActiveTeam":false,"Start":false,"Premium":false,"Cânne_A_Pêche":false,"NumDresseur":6,"Pokedollars":0,"Sac":["Moustillon (Starter)","Héliatronc (Normal)"],"SSac":[],"LSSac":[],"LSac":[],"GSac":[],"LGSac":[],"NbPokemons":2,"Pokedex":[0],"TempsVote":0,"TempsBcrate":0,"Potion":0,"Famillier":"","XP":0,"Appât":0,"HawlloweenItem":1572279792314,"TempsCatch":1572279814403,"Niveau":0,"NiveauP":0,"TempsDailyPoke":0,"TempsInvest":0,"TempsHr":0,"TempsDy":0,"TempsPeche":0,"Quete1":1572279792314,"Quete2":0,"Quete3":0,"Quete4":false,"Quete5":false,"Quete6":false,"SoonC1":[],"SoonC2":[],"SoonN1":0,"SoonN2":0,"SoonN3":0,"SoonNA1":"","SoonNA2":"","SoonO":[0],"SoonFT1":false,"SoonFT2":false,"SoonFT3":true,"SoonFT4":true}}
This .json file have name :
Dresseurs
let file = {"39728974892":data,"8272840":data,...}
let values = Object.values(file);
console.log(values) // [data,data,...]
values.forEach(value => {
// do something with each value
})```
And i want make loop for have each .Points and replace them
Mmmh with this i can make loop for get all .Points with i ? let file = {"39728974892":data,"8272840":data,...} let values = Object.values(file); console.log(values) // [data,data,...] values.forEach(value => { // do something with each value })
that was an example yes, there are many ways to do it
what dont you understand? i already explained
you just need to think
and use your brain
Mmmh
@quartz kindle so here i do replace what by .Points or Dresseurs ?
How can i do this!? Not asunayardım asuna yardım :/
do what part specifically
hello how to make sure that if 2 bots are connected to the same script and I type a command that bot 1 receives, but I want bot 2 to tell me in my private messages that this command has been executed even if it is not on the server where bot 1 received the command
You wouldnt need 2 bots for this and it's highly unrecommended.
even if it’s not recommended I’d still like to do it please
Well is there a reason you need to log it? And why not just use console
Its pretty simple to do, but pointless as you could just do both with the first bot
well, if you really wanna do it, its as easy as js bot1.on("message", message => { // do something with message bot2.channels.get(yourChannel).send(yourmessage) })
assuming discord.js
Sounds shady to me
Why not just let bot1 DM you?
maybe he just wants to test it, so he can use it later for something else
Does anyone know how to change the position of a category in discord.py?
i think my friend had a couple issues with it not being very reliable in terms of actually positioning it properly, i cant remeber the exact command try the discord.py API docs
That is what I did and found no answer from it
Alright this ridiculous, can anyone out of the 2028 members that have made a bot help me?
I have asked last night and today too
mate ngl 1) discord.py isnt used for bots as much as others and 2) if you really need help i suggest going to a) the python Discord or B) going to the discord.py discord for help 3) last time i checked the discord.py category position Did not work
@golden herald
Aight, could you dm the python discord link, cos I cannot find it xd
quick question
how would i make it so that my bot sends the time that a user called a command?
in python
@hoary bramble
from datetime import datetime
@client.event # or what ever you use.....
Time = datetime.now().strftime('%Y-%m-%d %H:%M:%S') # the part that actually gets you the time
await message.channel.send(f"This time {Time}") # this would also work with a print statement or anything rlly
the Time var will like this when its out putted:
2019-10-28 21:56:28
str()-ing it could be enough
that aswell yes xD
I suggest doing it under the command object itself if you use the commands extension
yh
Could someone help me on my Google Cloud? She decided to give error out of nowhere, does not open her SSH, thanks in advance!
