#development
1 messages · Page 1372 of 1
OK, I solved the issue I had above, but now.. I am encountering ERROR DiscordAPIError: 405: Method Not Allowed when attempting to delete a message. This occurs every now and again, other times.. it works.
try with a throw error on the first line is some WOKE level of coding
@snow urchin if the message it is trying to delete is by a higer role it wont be able to
i think
how can i put how many servers my bot is in, in its tag thing
@restive notch <Client>.guilds.cache.size
its made by the bot..
method not allowed? thats weird
ty
Np
using PATCH rather than POST maybe?
but he said it happens when deleting a message
that doesnt look like a message delete error
@quartz kindle i know, thats what i wanrt
I will double check and be sure that is what it is from
but like
method not allowed should be wrong type
it says the same error
get/post/patch/delete
no matter if the person is an admin or not
What would cause ERROR AbortError: The user aborted a request., I get that a lot too.
@snow urchin maybe you are trying to use a user token instead of a bot token
no..
Ok
bad internet or code stopped/halted being executed, most of the time
@earnest phoenix it will always say 'DiscordAPIError: Missing Permissions' because thats what you told it to say
aaaa
try with a throw error on the first line is some WOKE level of coding
@snow urchin abort error happens when a request takes too long, or the connection fails for some reason
should you be coding a bot without programming knownledge beforehand?
Could it also be the webhook throwing 405? The webhook does not appear to be sending anymore
should you be coding a bot without programming knownledge beforehand?
@opal plank ive been scripting for 2 years
just not js
c# and lua
Cool
korabi i wasnt talking to you why did u just appear out of nowhere
Here is the code btw https://hastebin.com/kocisuyixo.typescript
I was not talking to you
the throw statement will intentionally throw an error, and interrupt the script, so anything after the throw will no longer run
Duh
so how can i make it so if i get the "DiscordAPIError: Missing Permissions" error, it doesnt actually error
remove your throw
you need to catch errors from the discord.js methods, not throw your own error
Lol
in order to catch errors from promises using try catch, you have to await the promises
so in your case, you have to await all those lines
otherwise the try catch wont catch anything
i think i have a handy snippet from somewhere
try {
user.send(`You Have Been Kicked From ${msg.guild.name}: ${reason}`);
msg.channel.send(`> ${user.member.tag} Has Been Kicked.`);
sleep(500)
member.kick();
msg.delete();
} catch(error){
if(error === "DiscordAPIError: Missing Permissions") {
console.log("Unable to ban other administrators")
}
}```
so like this
sync code cannot wait for async code or wait for promises with .then
async code can wait for sync code but cannot wait for promises .then
promises with .then can wait for async and sync iirc
if(error.message === ...)
and you need to use await
Something in this code is creating a 405 error.
https://hastebin.com/oqegecoyem.typescript
this is really weird tbh
Why not rather use the .includes() function instead of a strict operator?
you should also change the order of the calls
you should try to kick first, and only send messages after the kicking succeeds
That would not work
^
Cuz it would not be in the guild
the bot and user no longer have a common guild
Yea
therefor screaming "CANNOT SEND MESSAGE TO THIS USER"
function sleep(milliseconds) {
const date = Date.now();
let currentDate = null;
do {
currentDate = Date.now();
} while (currentDate - date < milliseconds);
}```
would this overclock
but then you will tell them they have been kicked, but they were not kicked if it fails
setTimeout() works too you know
@earnest phoenix that will block your code and use 100% cpu
but then u cant tell them they have been kicked at all
for that amount of time
Yes
Wair
Wait tim what is ur bots name
recommendation, dont use while, unless you ABSOLUTELY need it
@sharp thicket Astrobot
i learned that in lua
for() wouldnt work for this instance
while is notorious for breaking shit up quite easily without proper breaks
this is really weird tbh
@opal plank how so 😄 Blame PreMiD owner
@earnest phoenix the correct way to sleep in js, is using setTimeout
Yes
preferably inside a promise for ease of use
infinite loops for one
Like i mentioned earlier
wtf?
I am their bot dev, as of like 3 weeks ago
premid should be on browser, why you even calling it there?
i doubt premid desktop runs on js
user.send(`You Have Been Kicked From ${msg.guild.name}: ${reason}`);
msg.channel.send(`> ${user.member.tag} Has Been Kicked.`);
setTimeout(function(){
member.kick();
msg.delete();
}, 500) ```
so like this
the app, i mean
thank god
@earnest phoenix yes, but you still need to await the promises, or else try catch wont catch anything
how do i await promise
ye anyways erin, idk why my webhook aint sending anymore!! this is frustrating LOL
thanks
await
its amazing that they have their app in ts
Bruh use await
version 3.0 soon omg its sexy
how do i await promise
@earnest phoenix @quartz kindle
ive said too much
mhmm
try {
await user.send()
await msg.channel.send()
setTimeout(() => {
try {
await member.kick()
await msg.delete()
} catch(error) {
...
}
},500)
} catch(error) {
...
}
which code
or you taking stuff mid way thru?
Ye
@quartz kindle what exactly does await do
hmmm lemme try see, error is something about method not allowed right?
it awaits the promise
Bruh its called await wtf
do you have time for liveshare? could help speed things up haha
it forces that specific block of code to not proceed until the promise resolves
a promise is an async function, that will eventually complete
js is synchronous, it can only do async code by pushing it elsewhere then returning to it later
Bruh its called await wtf
@sharp thicket thats a stupid argument, thats like saying "its called for, it clearly shows possession"
Example:
const msg = await message.channel.send(“smth”)
msg.edit(1)
Bruh its literally self explanatory
again
@sharp thicket thats a stupid argument, thats like saying "its called for, it clearly shows possession"
@earnest phoenix
Bruh
in the above example, if you dont use await, you cant use msg.edit() because the code will immediately try to edit the message before it finishes sending
i'll do it for you lmao
Lol
so is the promise in js try { await user.send() await msg.channel.send() setTimeout(() => { try { await member.kick() await msg.delete() } catch(error) { ... } },500) } catch(error) { ... } this, the try?
await for me is most used in my eval command
@earnest phoenix user.send() returns a promise, because it needs to connect to discord and ensure the sending process is completed, which takes time, and js cannot wait for this
same thing with msg.channel.send()
same with member.kick()
same with msg.delete()
all these functions return a Promise instance
which means they initiated the sending process, but did not finish yet, its a promise that will eventually complete at a later time
installing external modules isnt exactly basics
every lua scripting software ive used is typically part of the ide
like
you dont require anything
How do you call an event on lua
Hm
did this not work?
To install Luvit, visit https://luvit.io and follow the instructions provided for your platform.
To install Discordia, run lit install SinisterRectus/discordia
Run your bot script using, for example, luvit bot.lua
instance.event:Connect(function()
end)```
although youd probably do something like that
Whats end for
Oh
its a pretty verbose language
To install Luvit, visit https://luvit.io and follow the instructions provided for your platform.
To install Discordia, run lit install SinisterRectus/discordia
Run your bot script using, for example, luvit bot.lua tim said this btw
You said you’ve been scripting for 2 years now? You should know how to do this...
I think it would be easier for you since u alr know lua
You said you’ve been scripting for 2 years now? You should know how to do this...
@sharp thicket
ive never done things like this
roblox studio and love (its an app)
nono i know u would think roblox scripting would be a stupid simple version of lua
Its a gamw
its actually suprisingly difficult
there are many implementations of Lua and many Lua engines out there
Yes
Luvit is one of the most popular ones, its similar to node.js and includes a package manager
So its a runtime?
Oh okay
based on LuaJIT
my gf is texting me and its 3 21 am
why she awake
ok i installed it on command prompt
why u awake
now what
after installing luvit in your system, you should be able to access its package manager lit from the command line
Now i have turned into a 10 yr old
so navigate to a folder where you want to run your bot from, and run lit install SinisterRectus/discordia
did you restart cmd?
after you install a runtime its usually recommended u restart ur pc
weird lul
but anyway you were able to install discordia right? did it create a folder for installed packages?
Huh
but anyway you were able to install discordia right? did it create a folder for installed packages?
@quartz kindle where would that folder be
from what i understood, you installed it in /users/james
and it created the deps folder
and a file package.lua
so if the install fails elsewhere, you should be able to copy the deps folder and the package.lua to the folder you want, and itshould work
ye
i'd take everything
i never used lua or luvit before, im just following common sense here
is it a folder or a txt
a file, the same as the package file inside the discordia folder
but with different contents
nothing in /user/james?
nope
done
the same you did in js
and copy paste the basic discordia code
local discordia = require('discordia')
local client = discordia.Client()
client:on('ready', function()
print('Logged in as '.. client.user.username)
end)
client:on('messageCreate', function(message)
if message.content == '!ping' then
message.channel:send('Pong!')
end
end)
client:run('Bot INSERT_TOKEN_HERE')
and then try to run it with luvit bot.lua
see if you need to install a lua/luvit extension in your ide
but that doesnt mean it wont work
did you restart cmd after installing luvit
yes like 20 times
try restarting your pc
i installed luvit yesterday tho
i just didnt know how to use it
see i have it downloaded like 3 times
can someone tell me how I do a ping command without editing the message? The command should display the server latency
You could run a ping test every once in awhile and save it in a variable.
Or if you mean a websocket ping
@quartz kindle send me link to that website
You can use that
where u saw that
wrong token
ye
here's the docs for discordia
you should be able to continue from there
you will need to configure luvit as the runtime
alright
i have seen bots that rename themself to like this (emoji bots) how is this possible?
does it create a new instance of the bot?
webhooks
how can i use js to show html?
yes
could you be more specific
how can i show / hide html elements?
last time I bother ye people
if (this.acceptedAt) embed.setFooter(`Ticket chat lasted ` + moment.utc(moment(Date.now(), "DD/MM/YYYY HH:mm:ss").diff(moment(this.acceptedAt, "DD/MM/YYYY HH:mm:ss"))) + `.`)
why does this return "NaN" 😄
@snow urchin I'll help you, but first tell me, which terminal are you using?
wdym, that looks like vsc
ikt, I was asking for that colors on left
it's just console text background color
but vsc doesn't have that by default. Like, I use zsh terminal in vsc
i'm aware
the text background color is something you programatically set / use ANSI codes
how to get bot info api
wdym?
Read #topgg-api pins
ik now
? (node:2224) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token < in JSON at position 0 ? at JSON.parse () ? at module.exports (C:\Users\xxxxxxx\xxxxxxx\Bot File\node_modules\ytsr\lib\main.js:18:23) ? at processTicksAndRejections (internal/process/task_queues.js:97:5) ? (node:2224) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag--unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) ? ? (node:2224) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
anyone know why this is happening?
it is a discord music bot
Hey guys i cant make the setImage
its doesnt show anything
@earnest phoenix
const Discord = require('discord.js');
exports.run = async (client, message, args) => {
const embed = new Discord.MessageEmbed()
.setTitle(":mdHelp: Information Centre")
.setColor("RANDOM")
.setDescription("This is a quite easy to use which contains: **Moderate** | **Information** | **Fun** & more systems.")
.addField("Invite", `[Click Here](https://discord.com/oauth2/authorize?client_id=727448017799479296&scope=bot&permissions=878181502)`, true)
.addField("Support", `[Click Here](https://discord.homes/spwoobky)`, true)
.addField("Developer", `@clever vector @gray sun`, true)
.addField("Goal", `Our current goal is the let the bot reaches \`75 servers\` and \`Verified Developer Badge\``, true)
.setImage("https://top.gg/api/widget/727448017799479296.png")
.setTimestamp()
.setFooter(`Requested by ${message.author.tag}`, message.author.displayAvatarURL())
message.channel.send(embed);
}
It looks like u've missed/added a quote somewhere, but y I can't see it
If its not popping any error and the embed is showing without the image is probably cuz you cant load the image that way
the preview doesnt show up
Maybe because is not an static image on that link, it generates when you check it prob? I dnt really know
maybe if you request it with node-fetch or whatever and upload it as an attachment
Yeah
@clever vector
? (node:2224) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token < in JSON at position 0 ? at JSON.parse () ? at module.exports (C:\Users\xxxxxxx\xxxxxxx\Bot File\node_modules\ytsr\lib\main.js:18:23) ? at processTicksAndRejections (internal/process/task_queues.js:97:5) ? (node:2224) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag--unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) ? ? (node:2224) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
^ anyone know how to fix this /
Its the static image
You're probably trying to parse HTML as JSON.
How to let it work?
OHh
same problem, it's just ytsr
i need a little help with one of my servers. can someone please help me?
What can i help you dear?
so one of my voice channels is showing as inactive and idk how to fix it. can you please help me?
Okay
yo if anyone does discord.py dm me i’m working on sum need some help making an eco function
Sure
I know but like what do u need help with?
Also no dms lol @earnest phoenix
Ping when ur back
Wew
If there any requirements, like i the bot is too simple then it might not get approved?
I think they’re adding like 50 more bot reviewers
ye
Read rules
U need a couple commands
Like 5
And u can’t copy bots code
U can do same stuff
But can’t just rip off code
my bot just doing some scrapping using puppeteer
thank you for your answer, now i think i have to add more functions
console.log('a')
const emoji= client.emojis.cache.find(emoji => emoji.name="peepoHappy");
message.channel.send(`${emoji}`);
}``` for some reason, even though i type :peepo: it still doesn't consolw anything pls help
I mean just 5 commands
Even if u copy a bot, u can just add 5 cmds
@grizzled thistle
i mean but why would u copy a bot?
if it gets converted to an emoji, then it's not ":peepo:" anymore
also, it's emoji.name ===
not =
thank you
well it didn't get converted into a emoji @pale vessel and thank u i'll change the emoji.anme
but even then
it doesn't console
show what you sent
add console.log(message.content) in your message event
kk
weird it doesn't console that either
let me paste my message \event
console.log(message.content);
if(message.content.includes('!peepo!')){
console.log('a');
const emoji= client.emojis.cache.find(emoji => emoji.name==="peepoHappy");
message.channel.send(`${emoji}`);
}
});```
are you sure the event is triggered in the first place
isn't the event triggered when u send a mesage?
yep i just changed it
the message event doesn't work?
console.log("this works")
});``` i cahnged it to this but it still doesn't console
hmm
So you aren't receiving message events
There are a few reasons for that, such as disabling intents.
Or the scope.
Or not logging in
But you should receive them typically
For developers who've used Hypixel's API in the past, have any of you dealt with rate limiting? Does Hypixel tell you how much time is left until the rate limit is over (maybe in the headers)?
@sudden geyser i have logged in , i can check that with my cleint.on(ready)
but i haven't enab;ed intents but i don't need it either
So you have no intents enabled whatsoever?
i don't need it either
you NEED it
what's guild.mfaLevel?
if this is enabled, it will be 1, otherwise, 0
what does that stands for, malicious factor authentication level?
multi factor authentication
how do i make my bot leave all servers?
It's either a 1 or 0 - the user has it or not.
how do i make my bot leave all servers?
@hazy sparrow what library
though I ask why
d.js
client.guilds.cache.tap(g => g.leave()) im not sure
that won't work for the record
No i mean what if i delete the bot acc in the developer portal
how many servers u were in?
you NEED it
@pale vessel i need it? ok
how many servers u were in?
@rocky hearth umm like 81
it was a trash bot anyways
I wanna start fresh
but y delete the entire bot?? delete project itself
because i wanna see it grow from start again
umm how do you create a bot invite link again
I forgot
how to make a when mentioned prefix in javascript?
if the message starts with a mention
but i need to know it on javascript too
if the message starts with a mention
@fluid basin is that it
yeah so check if the message starts with the mention
parse-ms
okay ty
Any buddy know redirect websites without skip button
@bitter karma here
Ok
Ask here, send some info to get helped along
From Which Channel Can I Add My Bot?
@proper maple You can add your bot on Top.gg, once you sign into your discord account there’ll be a button that said “Add my bot”, or something like that. The button is located on the top blue bar. From there you’ll need to fill out some information and you’ll be done.
I boost it with heroku
Have you tested your bot to make sure it’s able to turn on?
Can you explain your problem, because I am having trouble understanding, do you not know why your bot is offline?
for some reason its not letting me download quick.db
Can you explain your problem, because I am having trouble understanding, do you not know why your bot is offline?
@earnest phoenix yes
for some reason its not letting me download quick.db
@tardy hornet Do you have any error log?
But now Is off
Check the error logs
Oh and i am italian
not added it gives error
@proper maple Did you fill out the information it says you to do? Or did you type the character limit in the descriptions?
Such as the brief description and the in depth description.
@tardy hornet Do you have any error log?
@ionic dawn yes
look:
so many of those lines
cant fit in 1 image
Yes
@proper maple What does the error say?
@tardy hornet http://pastie.org/
@ionic dawn http://pastie.org/p/5AbgFY04I0Ps3p3g01gjbC
@earnest phoenix short description says short
now I describe the problem of my bot in Italian, could you translate it into English? Because I don't know English very well @earnest phoenix
Ah, you have to fill the character limit, you can’t be short.
now I describe the problem of my bot in Italian, could you translate it into English? Because I don't know English very well @earnest phoenix
@bitter karma Sure.
Ok
I filled it but it gives an error again@earnest phoenix
If you filled the character limit you won’t be able to type any more characters.
Can someone help me with bots
Pws
@tardy hornet py version?
È da 2 settimane che provo i comandi del mio bot, funzionano tutti, ma ieri sera quando ho provato a pubblicarlo su Top.gg è andato offline e quando per 1 minuto torna online non funzionano i comandi e torna offline, è possibile che sia in fase di approvazione e devo aspettare qualche giorno? @earnest phoenix
no, i use js
@earnest phoenix What do you need help with?
Merhaba
And i use Visual Studio Code, Javascript @earnest phoenix
@tardy hornet py version?
@ionic dawn i use js
But you have python installed?
But you have python installed?
@ionic dawn no
i dont use python
@bitter karma I saw you said you hosted the bot on heroku? Is that correct?
Yes
@tardy hornet You need it in order to install it
@bitter karma I saw you said you hosted the bot on heroku? Is that correct?
@earnest phoenix yes i Hoosted it with heroku
Hoosted
https://www.npmjs.com/package/sqlite3 read below
I’d suggest taking it off heroku for now until you know that your bot is stable and would be on 24/7. Try turning it on using VS code and see if the commands work.
VS code as an, Visual studio code.
OHHH
@tardy hornet You need to install python in your computer/VPS and then run npm install sqlite3 again.
Also, do you have the required files for your bot to work on heroku?
I use it
Vs code Is Visual Studio Code?
@bitter karma Yeah.
Also, do you have the required files for your bot to work on heroku?
@earnest phoenix yes
Has your bot worked with heroku before, as an it has turned on and operable.
with Heroku the bot has always worked for me, since last night I put the bot on Top.gg the bot no longer works for me
Hmm.
Well putting the bot on top.gg won’t make your bot not work. It’s either a big issue or software issue, such as the site for updated or something else.
@tardy hornet You need to install python in your computer/VPS and then run
npm install sqlite3again.
@ionic dawn now what?
Well putting the bot on top.gg won’t make your bot not work. It’s either a big issue or software issue, such as the site for updated or something else.
@earnest phoenix oh, ok
Heroku server Is bugged?
You know how these node packages like kinda, show the possibility's with a function
ex: you type:
function(someth
then 'something' should show up, i want that too. how do i do that?
Try and check the files and make sure it’s up to date.
Ok
Now what?
Heroku file or Visual Studio Code file?
If you have python installed you shouldnt get any errors again
Try both. I can’t narrow down the issue though.
attention please #development message
Try both. I can’t narrow down the issue though.
@earnest phoenix ok, thx
attention please #development message
@surreal sage me?
what
Nothing
If you have python installed you shouldnt get any errors again
@ionic dawn still the same error
Now is on but the commands don’t work @earnest phoenix
Did you add Python to PATH
did i make some mistake in the script maybe?
Maybe, check your error logs.
Did you add Python to PATH
@slender thistle how?
A checkbox when installing Python
ok im giving up on that thing, how do i make that it will save the user bal so it will be:
it one server he will have 500
and on the other he could have 6000
Hello, I'm crurrently using discord.py for my bot but I can't run it from my mac.
it gives this error
help me :((
const { owner } = require('./config.json');
holy fuck AHHHHHHHHHHH
Just rewrote an entire Discord lib (discord.net) to use a newer json lib from newtonsoft to C#'s built-in new one in .net 5.0
I can actually kind of get the bot started with no code issues but i need to rewrite the custom json parsers which convert stuff like strings into ulongs

@dawn ether maybe try running open /Applications/Python\ 3.9/Install\ Certificates.command
@earnest phoenix u dont have config.json in the same folder as of this file.
Hello please help me.
if(command === 'send'){
const allarg = args.join(' ');
client.channels.cache.find(c => c.name === 'general').send(`**${message.author.username}:** ${allarg}`);
}```
I wanna send this: (`**${message.author.username}:** ${allarg}`) to all client guilds.
How can i do it?
do I need to create a loop?
How can i fix it?
client.channels.cache.each(c => {
if(c.type === 'text' && c.name === 'general') c.send(`**${message.author.username}:** ${allarg}`);
})
I updated it a bit, try again @earnest phoenix
😎
The key here is that, u need to first check if the channel is a text channel. Because it has other channel in it too
Hey guys my bot static api don't work with .setImage
hola
Hi
.
Hi
I need hellup
Im making a giveaway edit system; but I want you can change the time in hours, minutes, seconds, days.
But, Im working with 1 argument. So the person could do !gedit <messageid> 1h, and it sets it to one hour, but it could also be possible that they do !gedit <messageid> 1d
Someone know if there is a way on discord js to add multiple roles once? And when not how hight needs the cooldown in between adding roles to be?
@earnest phoenix u dont have
config.jsonin the same folder as of this file.
@rocky hearth error solved... I added single.instead of double
Someone know if there is a way on discord js to add multiple roles once? And when not how hight needs the cooldown in between adding roles to be?
@rare plume like give 2 roles to a person with 1 line?
Yeah someting like that
You can give them separetely
I know but i am not quite sure if its api abuse
wdym shinchan?
I think i need to add a cooldown in between then
@rare plume u can do that easily
member.roles.cache.add([role1, role2]);
Any djs bot Dev's who wanna help a fellow coder make a bot from scratch with 0 knowledge
@rocky hearth Really, can u just add via array?
yeah , y not, or it can be a collection also or a string
Okey, i try that thanks
@junior kite yeah y not
sure
I am trying to make a blacklist guild command , where I store guild id and reason by using postgreSQL ,
Code:
@blacklist.command()
async def guild(self,ctx, guild_id:int,*, reason:str=None):
results = await self.bot.db.fetchval("SELECT guild_id from blacklisted_guilds where guild_id = $1", guild_id)
if results != None:
return await ctx.send(f"{emote.xmark} | The guild is already blacklisted.")
await self.bot.db.execute("INSERT INTO blacklisted_guilds (guild_id, reason) VALUES ($1, $2)", guild_id, reason)
guild = self.bot.get_guild(guild_id)
if guild is None:
return await ctx.send(f"{emote.check} | Successfully blacklisted the guild.")
await ctx.send(f"{emote.check} | Successfully blacklisted the guild.")
try:
embed = discord.Embed(description=f"Hello {guild.owner.mention},\nYour Server **{guild.name}** has been blacklisted by **deadshot#7999** for **{str(reason)}**\nI will take a leave from your guild now.\nIf you would like to appeal, feel free to join the [Support Server]({config.support_server})", colour = self.bot.colour)
embed.timestamp(datetime.utcnow())
await guild.owner.send(embed=embed)
await ctx.send(f"{emote.check} | Successfully sent ban news to guild owner!")
except:
await ctx.send(f"{emote.xmark} | I couldn't send ban news to guild owner.")
await guild.leave()
try:
await ctx.send(f"{emote.check} | Successfully left {guild.name}.")
except:
await ctx.author.send(f"{emote.check} | Successfully left {guild.name}.")
I store guild_id as bigint and reason as text. this command worked fine for 2-3 times than I start getting the following error:
Ignoring exception in command blacklist guild:
Traceback (most recent call last):
File "C:\python38\lib\site-packages\discord\ext\commands\core.py", line 467, in _actual_conversion
return converter(argument)
ValueError: invalid literal for int() with base 10: 'testing'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\python38\lib\site-packages\discord\ext\commands\bot.py", line 903, in invoke
await ctx.command.invoke(ctx)
File "C:\python38\lib\site-packages\discord\ext\commands\core.py", line 1329, in invoke
await ctx.invoked_subcommand.invoke(ctx)
File "C:\python38\lib\site-packages\discord\ext\commands\core.py", line 851, in invoke
await self.prepare(ctx)
File "C:\python38\lib\site-packages\discord\ext\commands\core.py", line 786, in prepare
await self._parse_arguments(ctx)
File "C:\python38\lib\site-packages\discord\ext\commands\core.py", line 697, in _parse_arguments
transformed = await self.transform(ctx, param)
File "C:\python38\lib\site-packages\discord\ext\commands\core.py", line 552, in transform
return await self.do_conversion(ctx, converter, argument, param)
File "C:\python38\lib\site-packages\discord\ext\commands\core.py", line 505, in do_conversion
return await self._actual_conversion(ctx, converter, argument, param)
File "C:\python38\lib\site-packages\discord\ext\commands\core.py", line 476, in _actual_conversion
raise BadArgument('Converting to "{}" failed for parameter "{}".'.format(name, param.name)) from exc
discord.ext.commands.errors.BadArgument: Converting to "int" failed for parameter "guild_id".
here is the cog : https://mystb.in/AsnSavageCashiers.python
i don't see anything wrong with code
ping me if you answer
client.shard.broadcastEval(`this.channels.cache.has("738409360488661142") ? this.channels.cache.get("738409360488661142").send({
^^^^
SyntaxError: Unexpected token 'this'
at wrapSafe (internal/modules/cjs/loader.js:1054:16)
at Module._compile (internal/modules/cjs/loader.js:1102:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
``` why is this happening?
Doesn’t look like the right syntax to use templates.
case 'work':
let user3 = message.author;
let timeout2 = 600000;
let work = await db.fetch(`work_${message.guild.id}_${user3.id}`);
if(work !== null && timeout2 - (Date.now() - work) > 0){
let time2 = ms(timeout2 - (Date.now() - work));
return message.channel.send(`you cant work again for ${time2.minutes}m and ${time2.seconds}s`)
} else {
let amount2 = Math.floor(Math.random() * 80) + 1;
db.add(`money_${message.guild.id}_${user3.id}`, amount2)
db.set(`daily_${message.guild.id}_${user3.id}`, Date.now());
const workembed = new Discord.MessageEmbed()
.setTitle(`${message.author.username} worked hard and earned ${amount2} coins`)
.setColor("GREEN")
message.channel.send(workembed)
}
break;
its letting me use that command every time
and i put a timer
it should not do that
timeout - (Date.now() ...
That doesn’t make sense at all.
If u save the timestamp in the database and fetch it, then check if ((Date.now() - work) > timeout2)
@weak parrot ads
timeout - (Date.now() ...
That doesn’t make sense at all.
@boreal iron i did that with a daily command, and its working fine there
Yeah but the math is nonsense
(now - last_runtime) > timeout
Is one step less to calculate
Just a question... what’s the data val type for the field ur saving the date into?
how i fix this
can someone help me with a ban command in javascript?
I am trying to learn C#, so I am creating a game with it. Although, while trying to create a inventory system, I am getting a bit stuck.
This is how I am setting up the inventory;
public struct Inventory
{
public Items.Potion[] Potions;
public Items.Weapon[] Weapons;
public Items.Armor[] Armors;
}
and this is so far of an equip method
static void equip(int id, string type)
{
if (type == "weapon")
{
Items.Weapons /* also tried Inventory.Weapons*/ weapon = Array.Find(Inventory.Weapons, w => w.id == id);
}
}
and then I hit an error, CSOI 20: An object reference is required for the non-static field, method, or property 'Player.lnventory.Weapons' I see this when hovering over Inventory.Weapons
I am new to C# so I don't know most of the things in it
some data in my mongodb collection keeps getting deleted randomly, not all the data but some. in my code, nothing tells it to delete the data otherwise it would happen to all of them so the db must be deleting them, is there any reason for this to happen
Hello, i'm using discord.js library in my bot. Is there a way to set prefix in guild by guild? I want to do a command like ;setprefix that command set bot's prefix in this guild only. Thanks.
@orchid cobalt how are you using the command?
what are you passing as arguments?
?blacklist guild 1234566 reason
123456 is let's say guild I'd
And reason is the reason
ValueError: invalid literal for int() with base 10: 'testing'

somehow testing was passed
@slender thistle do you know why? #development message
Read the cog and you will know
If you don't get the what is wrong even after reading the cog , then welcome to the club buddy 😂
some data in my mongodb collection keeps getting deleted randomly, not all the data but some. in my code, nothing tells it to delete the data otherwise it would happen to all of them so the db must be deleting them, is there any reason for this to happen
@queen crescent You sure no other process is using those collections?
lmfao
positive
I was basically shadowing the guild sub command
Show me your bots kidos
Try to remove the int typehint for guild_id
how can i create a category, then create a channel, then move the channel into the category
is there a way to revoke readWrite access from all people who enter the db (mongodb)
unless they have a role
You still didn't get it , I was using the same guild subcommand for both blacklist group and whitelist group , that was the error and now it's resolved
Thanks for asking btw
Eh it happens
is therer any way to build an anti raid feature by monitoring join and leaves
if yes, can you link me any guides or documentation?
What is anti raid though?
anti...raid...
but i'm not smart 😕
do you know what a raid is?
to attack in large quantity
Defenition of raid:
A cult of people who join online groups for bad reasons
and do you know what anti is?
Then anti raid means to stop peoples from joining a server at the same time.
Hmmmm if so, then how could a bot prevent them from joining.
By kicking them of again?? or wat
probably not "from joining server at the same time"
more like preventing multiple users spamming
but they either kick or ban them, i guess
well cause ik a bot which was able to see if there was many joins in a specified time and ban those mmebers
Well, some bots check the date the account was created, with that they can determine alts
ah ok
how can i create a category, then create a channel, then move the channel into the category?
you can skip step 3 by creating a channel inside the category
how?
there is a method guild.channels.cache.create()
well this is my code:
message.guild.channels.create('category', {
type: 'category'
})
where do i put it
there is bunch of options thre https://discord.js.org/#/docs/main/stable/class/GuildChannelManager?scrollTo=create
ok
thank you
:\Users\NoUcantSeeMyNameIdiot\Downloads\bot>npm i mysql2
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for git@0.1.3: wanted {"os":"linux,darwin,freebsd"} (current: {"os":"win32","arch":"x64"})
npm ERR! notsup Valid OS: linux,darwin,freebsd
npm ERR! notsup Valid Arch: undefined
npm ERR! notsup Actual OS: win32
npm ERR! notsup Actual Arch: x64
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\NoName\AppData\Local\npm-cache\_logs\2020-11-08T13_01_18_776Z-debug.log
``` Im having this error, but in the npm package it litterly says u can download it with windows
const client = new Discord.Client();
client.on('message',(message)=>{
console.log("this works")
});
client.login("a")``` for some reason this message event doesn't work like there is no console
pls help
i changed it for this lmao
K
i won't leak my token
the message event doesnt works??
ye
Is ur bot able to see the channel?
O
it has admin so...
nope
console.log(`${client.user.tag} is logged in!`)
})```
it logs that its online?
yep
how to make @earnest phoenix to type what i want
I thought i added it to the server but apparently didn't lmao
i didn't even notice
i added it to the wrong server
Lmao
we're not support of that bot
@earnest phoenix on that bot site this link was there
yep
but thats the support server for this site
and not for the bot
...
-wrongserver
uhh
oh ok
This Luca's dp, seems like a globe and also man wearing a hat to which he is touching
lmao
const channel = member.guild.channels.cache.find(channel => channel.name === `welcome`);
if (!channel) return;
const { guild } = member
const { name, memberCount, owner } = guild
const joinembed = new Discord.MessageEmbed()
.setColor('GREEN')
.setTitle(`Welcome to "${name}"`)
.setThumbnail(member.user.displayAvatarURL())
.addFields(
{
name: 'New user!',
value: member,
},
{
name: 'Member count:',
value: memberCount,
}
)
.setFooter('Time Joined', member.guild.iconURL())
.setTimestamp()
channel.send(joinembed);
});```
no more working
i think api changes or whatever
oh, do I?
yes
thats new
enable it in developer portal and in your bot's code
yes, and what library are you using?
I'm using node js
ye
I just saw people using
const client = new Client({ ws: { intents: Intents.ALL } });```
maybe this is it
you need to enable the guild presences intent too for that
Can I have my 4 fields inline but in 2 rows?
you need to add an inline blank field after every second column
afaik, there are 4 inline fields per row
only up to three
if I add a thumbnail then? 2?
nope
it used to be like that
discord fucked it up so its still three even when theres a thumbnail
it's annoying
why did they do that
I remember I read it in guide, that if there is no thumbnail there can be 4 inline fields
but now its not working
only three
What does hash mean here?
quick question:
fetchAllMember client option goes timeout
so i am not able to cache members
hence i can't retrieve from cache
user user id
what should i do
if i use fetch to fetch user if the user id is wrong it will take huge amount of time
if the server is big
@rocky hearth a hash is a unique identifier, like 3ht973hg9374hg9374g9734h
you need to build the url yourself, something like cdn.discordapp.com/assets/guild/934h93c4t938n4f934n.png or something
idk the exact structure
@vague imp you need to enable the server members intent in the dev portal
its enabled @quartz kindle
the fetchAllMembers should work
yes
@earnest phoenix I work with emojies like this
And they work fine without any issue
how do you find a specific webhook in discord.js?
channel.createWebhook(`${message.author.username}`, { avatar: `${message.author.avatarURL()}`, }) .then(webhook => { webhook.send(message2send); webhook.delete() })
and also if i do this it returns UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Webhook
please help
@ivory seal what you may have is a race condition.
How do I make an execute command (an eval command, but it sends a result instead)?
You should await webhook.send(...)
As there's no guarantee the message will be sent first as .send() and .delete() are promises.
So if delete -> send happens, that error will come up
well .send works
if i don't include webhook.delete
it works perfectly
but when i include it....
Resolve your promises.
got it
Either with async/await or .then and .catch
dont break your promises
You've already done it with createWebhook so now do it with send 😉
evie you grabbed the mouth of my words
ah ok
now I'm sadge
dont break your promises
Also: 🎶 don't go breaking my heart! 🎵
For the record, you can fetch webhooks with <TextChannel>.fetchWebhooks(...) so you aren't creating a webhook for a one-time operation.
is there any way this would work..
let webhook =channel.createWebhook(`${message.author.username}`, { avatar: `${message.author.avatarURL()}`, })
not without async/await
take a look at this: https://js.evie.dev/promises#async-await
oh wait so
let webhook = await channel.createWebhook....?
@umbral zealot aren't you the developer of enmap?
I am!

#development message
Anyone?
that doesn't return NaN that returns...
^
when I stick it into a string in a footer, iit shows NaN, either way, why Invalid date?
debug it
you stacked so many methods in a one liner
split them up and find the method that's causing you trouble
Make sure to print all the values and their types, too, to make sure they're what you're intending. For example, timestamps are integers, usually.
in client option fetchAllMember is not working. It gives timeout
yes guildMember intent is enabled
https://media.discordapp.net/attachments/402150235071184918/774996146724536340/unknown.png
error:
Error [GUILD_MEMBERS_TIMEOUT]: Members didn't arrive in time.
at /root/Node Apps/Menhera Chan/node_modules/discord.js/src/managers/GuildMemberManager.js:317:16
at Timeout._onTimeout (/root/Node Apps/Menhera Chan/node_modules/discord.js/src/client/BaseClient.js:83:7)
at listOnTimeout (internal/timers.js:554:17)
at processTimers (internal/timers.js:497:7)```
@vague imp what version of discord.js are you on right now?
12
v12.4.1
the latest one
const Discord = require('discord.js');
const intents = new Discord.Intents();
intents.add(
'GUILDS',
'GUILD_MEMBERS',
'GUILD_EMOJIS',
'GUILD_MESSAGES',
'GUILD_MESSAGE_REACTIONS'
);
const client = new Discord.Client({
fetchAllMembers:true,
ws: { intents: intents }
});```
@vague imp the intents.add is formatted incorrectly i think so
shouldn't you pass an array?
thats an array
no... that's a list of arguments though
smh
const Discord = require('discord.js');
const client = new Discord.Client({
fetchAllMembers:true,
ws: { intents: ['GUILDS', 'GUILD_MEMBERS', 'GUILD_EMOJIS', 'GUILD_MESSAGES','GUILD_MESSAGE_REACTIONS'] }
});```
like this right
still the same
timeout
try intents: new Discord.Intents(['GUILDS', 'GUILD_MEMBERS', 'GUILD_EMOJIS', 'GUILD_MESSAGES','GUILD_MESSAGE_REACTIONS'])
And then go scream at the d.js people to make the docs better on the subject 😄
lmao
i have asked many programmers even youtubers who do djs coding no body could helped me
change what?
if that doesnt work then discord is on drugs
the intents
that's the bitfield for your intents
You've asked many programmers but have you asked the discord.js developers that wrote the code you're using? You really should.
but why more code
i have 2 questions
1)Is there any rate limits for webhooks
2)is it possible to create 2 webhooks with the guildCreate event for each guild and use the same webhooks in the message event?
intents: 1547
🙃
You've asked many programmers but have you asked the discord.js developers that wrote the code you're using? You really should.
@umbral zealot
staff don't reply and the other programmer couldn't help
@ivory seal there are rate limits on message sending
That's not what he asked
@earnest phoenix I work with emojies like this
@rocky hearth thanks. Good
you need to pass a function into .catch()
.catch() takes a function
^
im dumb lol
no, just inexperienced
lol today i did a even dumber thing lmao
both actually
I do not see how I am getting invalid date.
i forgot that i never added my bot in a server and i was like why wasn't this working
then when i saw it i was like .....
@snow urchin you're trying to do moment.utc() on an object that's already a moment object
why
@vague imp by fetching all members you mean to count them or get every single member
@vague imp by fetching all members you mean to count them or get every single member
@ionic dawn NO it;s a client option to cache all member
is there a limit for webhooks in a channel
what is the command to set a badge into an user profile? (already made just forgot command.) eval db.set but from here i am stuck
u forgot the command of ur own bot?
We can't tell you how your own code works my friend.
ping me for python help!
discord.js
You can't read all the badges of a discord user profile without oauth2 so discord.js cannot provide that
you can run ifs
is there any limit for the number of webhooks in a particular channel?
if user has flag
is there any limit for the number of webhooks in a particular channel?
@ivory seal why would u need dis?
i thik there r ofc
What is db ? what's flags_id ? what are you even talking about at this point Narcis?
mmkay so what does sqlite have to do with user flags/badges?
that number is an emoji
the thing is im creatign webhooks but if i delete the webhook all the messages gets deleted too
you can run a check to see if member has badge flag
So this is your own code and we can't tell you how your own code works
in dpy at least
so i thought lets just not delete the webhooks
so dont delete them lol
this
My youtube api not support live stream why anyone know
Is there any chance that the ready event handled with on method, could emit more than once?
WELL HOW DO U WANT TO DO IT
Why
@rocky hearth you can run just on ready
@umbral zealot look at photo

