#development
1 messages · Page 1680 of 1
read the docs
I'm still getting this error, what is this
I made all of the codes v12
and im using shard.js
But the thing that I don't understand is I have the permission in the oauth .. why does it has no access to the old channels then?
The oauth permissions only gives the permissions to the role the bot is given on invitation. That doesn't mean it will have those permissions for every channel as you can still set specific role permissions per channel.
anyone knows how to fix this?
discord.js-light is better than discord.js?
depends by what metric
Tim might say yes because he created discord.js-light 

i try to be unbiased and objective
i dont know pls help
here my discord.js v11 bot
why are you using v11?
im updated v12 but
looks like you didnt update
e
gives the same error
Did you bother restarting after updating?
did you update correctly?
npm i discord.js@latest?
😳
discord.js@v12
or discord.js@12
i forgot which
or simply uninstall discord.js
then install normally
its v12 by default if you dont have it installed
Is v11 over?
yes
FUCK OMG
v13 is almost out 
but if it does, it will probably have many broken things by now
didnt people tell you to use v12 like 1 year ago?
OMGGGGG
They don't listen, "Ha nerds...... I'm still on v11"
okay I switched to 10% v12
Good luck with the rest I guess
You might need this
🙏
it's just search and replace + intents 4head
new discord api change broke my bot


Discord.js !== Discord API
+1
And how did it break your bot exactly
My bot keeps saying this
/home/fire/Desktop/bots/node_modules/discord.js/src/structures/Guild.js:523
.replace(/'s /g, ' ')
^
TypeError: Cannot read property 'replace' of undefined
if("discord" !== "guilded.gg") return;
I never used any editor other than Notepad++ until I switched to VSC
Uninstall discord.js and install discord.js@12
I'm on v12
They're already on the latest version
12.5.1
Its weird
Those are mainly on bots that are sharded though
1 million users and 35 thousand servers cannot use the bot right now due to my laziness. BRUH
every other bot that isn't sharded is working perfectly fine
My bot haven't experienced a single error since the new discord API change
Some bots are affected for some reason
That is weird
Mine isn't affected either. I've been on API and gateway v8 for a very long time. The active session also was not created on v7 or less
This only recently happened when I've seen my bot keeps spitting out errors in a loop about that, plus the Error [SHARDING_IN_PROCESS]: Shards are still being spawned. too.
What's this "new api" I'm hearing?
Not really a new api, just a new change that dropped.
Oh
V8 has been a thing for many months.
^
v8 is pogging
😳
Reminds me. I need to submit PRs to Daswolke for their Discord modular interfaces. Updated them to TypeScript which is pretty poggers
That gives me an idea. There should be a new HTTP status code which description is poggers.
Similar to how Twitter "standardized" 420 "Enhance Your Calm"
Does anyone know the event name for when your bot joins a server. Is it @client.event(on_server_join)
For discord.py. Solved
error 906: 
Find it yourself https://discordpy.readthedocs.io/en/latest/api.html#event-reference
ty, i could not find the docs anywhere
Does anyone know how to do message replies in Discord.js? I've looked in the docs, and I tried doing "message.reply("test reply")" but that just says like "@message author, test reply"
I mean like the actual replies, like these ones
You'd need to use Discord.js master or wait for v13
what is the master thing?
you can also use client.api() if you really need it
GitHub branch
I just fixed the issue I had
just have a bunch of guild.available checks
if you want to be cool you can still use it: js client.api.channels[channel.id].messages.post({ data: { message_reference: { message_id: "<reference message ID>" }, content: "A reply" } });
what would <reference message ID> be?
The message (ID) to reply to
so would that just be "message.id"?
Yeah, sure
If you want to disable ping, you can add allowed_mentions: { replied_user: false } to the data object
aight i prolly will, thank you for the help!!!
@pale vessel rude
hey, do you know if its possible to send reply EMBEDS? I tried doing this with my code but it only sends whats in content.
if (message.content.startsWith(`${guildPrefix}reply`)) {
const embed = new Discord.MessageEmbed()
.setDescription('me when the funny')
client.api.channels[message.channel.id].messages.post({
data: {
message_reference: { message_id: message.id },
content: "this is embed :flushed:",
embeds: embed
// allowed_mentions: {replied_user: false/true }
}
});
}
i also ttried embeds: [embed]
embed: embed.toJSON()
ill try that
only webhooks can send embeds
wasnt it 10?
wait, how would you send multiple in one message?
embeds is an array of embeds and can contain up to 10 embeds in the same message
like <Message>.channel.send(embed,embed1,embed2)?
array
it might be a combination of website/image/embed
[embed, embed, embed]
not strictly messagembed
yup
oh cool i honestly had no idea you could do that
it only works with webhook tho
ah ok
normal messages can only send 1 embed
is it possible to run a py webserver while in a dpy cog?
so the bot would still run
but would have a websever without blocking other code
yes its possible
Relax mate
i updating
300 js file
v11 to v12
im crying bro...
i'm dying
var activevar = [
"!!yardım | !!davet | !!p Şarkı",
"!!cortex | Benle konuşsana :3",
"Özel mesaj at, cevaplıyım UwU",
];
var activities = activevar[Math.floor(Math.random()*activevar.length)];
client.on('ready', async () => {
setInterval(async () => {
await client.user.setPresence({game: {type: 0, name: activities}});
}, 7 * 1000);
});
``` i how to update v11 to v12 this code pls help
oh shit
I forgot to delete it
anyway
i don't feel my brain
One message removed from a suspended account.
var activevar = [
"!!yardım | !!davet | !!p Şarkı",
"!!cortex | Benle konuşsana :3",
"Özel mesaj at, cevaplıyım UwU",
];
var activities = activevar[Math.floor(Math.random()*activevar.length)];
client.on('ready', async () => {
setInterval(async () => {
await client.user.setPresence({game: {type: 0, name: activities}});
}, 7 * 1000);
});
``` how do i convert this part to v12
@sage bobcat can you help me please
how about just checking the docs?
Discord.js is a powerful node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.
Anyone know how I can parse data from this json response?
{"abilities":[{"ability":{"name":"limber","url":"https://pokeapi.co/api/v2/ability/7/"},"is_hidden":false,"slot":1},{"ability":{"name":"imposter","url":"https://pokeapi.co/api/v2/ability/150/"},"is_hidden":true,"slot":3}]}
My js code:
let abilities = [];
for (let i = 0; i < json.abilities.length; i++) {
abilities.push(json.abilities[i].ability.name);
};
res.send(`<b>Abilities:</b> ${abilities.join(", ")}`);
Yet it keeps returning an error, anyone know what's going wrong?
...JSON.parse() ??
oh right, you already parsed it
also
use map to clean up your code
in the end your code would look something like this
const obj = JSON.parse();
const abilities = obj.abilities.map(x => x.ability.whatever);
also also
if that's an API request
um
follow REST principles??
Wait, here's the full code for it:
app.get("/:name", async (req, res) => {
let name = req.params.name;
fetch(`https://pokeapi.co/api/v2/pokemon/${name}`).then(r => {
if (!r.ok) {
return res.send("Invalid Pokemon");
} else {
r.json();
};
}).then(json => {
let abilities = [];
for (let i = 0; i < json.abilities.length; i++) {
abilities.push(json.abilities[i].ability.name);
};
res.send(`<b>Abilities:</b> ${abilities.join(", ")}`);
});
});
¯_(ツ)_/¯
i'm testing discord.js-light and the bot send two messages, why?
I was just used to calling fetch requests that way
you have two listeners
You're probably running the script on two instances?
i literally change
import Discord from 'discord.js'
to
import Discord from 'discord.js-light'
No
sure, that's a totally valid way, but the whole point of an async function is that you can await inside of it and block (and await the resolution of the promise)
Ah
using sync code in an async function defeats the point of an async function if you get what i mean
(node:999) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'length' of undefined
(node:999) 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:999) [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.
(node:999) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'abilities' of undefined
(node:999) 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:999) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'abilities' of undefined
(node:999) 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: 3)
Sorry, I had forgotten to.
json is undefined because you don't return r.json()
ah
you should convert all of that mess into async code anyways
Yeah, i'll do it rn
Check how many processes are running. If there are 2, disable one.
where?
Are you self-hosted?
i'm testing in my computer
Great! Go to your terminal and remove a process. It should look like 2: node.
okk
(Tap the garbage can)
it's only one
Anyone know where I can look for javadocs for the wrapper? The readme on github doesn't seem to suffice.
client.on("message", m => m.author.id === "your id" && console.log(m.content))
if you only see one message in your logs, then you have 2 bots running
Hey could I get some help with a command I'm making? I have a purge command, and, it was working just yesterday but now it seems to have broken. I'm writing it in discord js btw. It is supposed to send an error if the person tried to purge more than 100, and purge the specified if it is less than 100. But it just doesn't do ANYTHING
if (message.content ===(`${guildPrefix}purge`)) {
let canManageMessages = message.channel.permissionsFor(message.member).has("MANAGE_MESSAGES", false);
if (canManageMessages) {
var args = message.content.split(' ').slice(1);
if (parseInt(args[0]) < 100 ) {
message.channel.bulkDelete(args[0]).then(message.channel.send(`\`${args[0]}\` messages purged by ${message.author.tag}!`))
} else if (parseInt(args[0]) > 100) {
message.channel.send(`ooooops! I cannot purge more than 100 messages at once.`)
}
} else if (!canManageMessages) {
message.channel.send(`Ooops! You don\'t have the \`MANAGE_MESSAGES\` permission and cannot do this.`)
}
}
is that like a message logger or something

show your messsage event
Btw Tim, we forgot 1 thing on the cache size of djs, the clientsOption.edithistory
It's all gucci now, but for sake of learning, I might trying detritus
How do I make the creation date like this? (message.author.createdAt)
15th Dec 20
edit history was removed in djs master
yea, saw it in wip PR
ex: 123d323m123h
how can i separate it into 123d 323m 123h?
i want it to be ["123d", "323m", "123h"]
thanks. i will try
my play command of the music bot I am verifying just stopped working for no reason, everything else works
try uninstalling discord.js
Ok
There is no way to make it work, all the copies of the bot that I had have stopped working, could it be discord?
Everything worked perfectly until a few minutes ago that it stopped working for me and I have not change anything
okay, give me a second
idk python pls help
it worked on my other install
same code
idk what happened
Python good :(
uhh wut
You got 184 lines of code here you're gonna have to be a little more precise than "not work"
"℃" is invalid
when I put the prefix and play, it works fine, it tells me that I have to indicate that I want to reproduce, but when I indicate it, it gives me the error of cannot send empy message
do you have anything in your console appearing?
Before that
nope
Ascii is a way of sending letters, like all the letters I'm typing rn are ascii, maybe try using a valid letter or number? Might be websites you can check for it
.... It won't work ifyou leave "" without content in it
I see no reason for this to generate that error
i figured that out, use \N{DEGREE SIGN}
can you show us what sendError does?
same but idk pissthong
👌
but now i have a new one
Oh goodness
wasn't talking to you, I dunno pythong either.
module.exports = async (text, channel) => {
let embed = new MessageEmbed()
.setColor("RED")
.setDescription(text)
.setFooter("Thnaks fot using me :wink: | Sowi#9278")
await channel.send(embed)
}```
pissy thong 
So literally all those sends are for embeds
and all those embeds have contents
I do'nt seee how that could cause an error
It was running all day, it stopped working all of a sudden
unless it's the return message.reply(error.message).catch(console.error); lines but those would send you the errors in console first
don't work, do you think the problem is my code or discord.js-light? 
okay i give up
Import it
Might have to do a pip Install
Put "import psutil" in the code and see if it fixes it@earnest phoenix
If not watchable video on how to use pip
it is
Hm
You have way too much code for us to debug especially since you didn't write it. Ask here https://github.com/SudhanPlayz/Discord-MusicBot/issues
or find Sudhan's discord
Hold on lemme look at the code
i already gave up
U can, I'll be back in 10m with it working
Maybe
alr. it was working on my arch install and doesn on debian
ok, thanks anyway ♥♥
so something is fucky
well, considering that has never happened to me nor to anyone else who uses the library, i doubt the problem is the library

nope, prob not a lib problem
:why:
Is anyone there?
How do I make this embedded, python:
if msg.startswith("Lai hug"):
await message.channel.send(random.choice(starter_hugtext))
await message.channel.send(random.choice(starter_hugs))
hugtext is text, and hugs are gifs
I want to make it so it is one message
But I need to embed them
@thin echo
Thyembed=discord.Embed(title="input value here", description=random.choice(starter_hugtext), color=input hex color here)
Thyembed.set_image(url="input image url here"
message.channel.send(embed=Thyembed)
Should work
Might bring errors since I'm writing this from my phone
ok
@thin echo this might also help you set it up, make sure to get rid of the "" around things that are referencing other parts of ur code or it will just send it as text https://codepen.io/orels/full/egZyxq
does anyone know any web builders that do not cost money for mak8ng the website and having it public?
like a free domain?
free web builder and free domain are 2 different things
free domains are usually bad cheap ones.
As for free website "builders" that's a pretty wide definition tbh
i don't think rn i need anymore than that
Both of those things can be easily found through google searches
i found some builders but not free domains that didn't what my full name where i live and my phone number
Domain names are something that will always require your real contact information
github gives free subdomains
i believe
that's a free subdomain not a free domain though 😛
tru
tho i mean you could get like a name cheap one for $1 a year so not bad
is a subdomain one that is private?
no a subdomain is something like thing.otherdomain.com
its like site.github.com
or docs.google.com
you can get free .tk, .ml, .ga, .cf, .gq from freenom.com
o thats still better than what ive been able to find
yeah and you could use something like google sites or weebly or many other builders that let you connect a domain
I use google sites & google domains because I'm incompetent and couldn't make a website lmao
Hello
I believe google sites lets you connect any domain for free, not sure about weebly though
I mean I literally googled free domains and that was the 2nd result
it's not that hard to google, c'mon
and then boom.
yeah
Where do you speak spanish?
No
No what
ok nvm
I get an error on the last line
the whole thing
i just:
# npm uni discord.js
# npm uni discord.js-light
# npm i discord.js-light

what uh thing is that (idk what its called) like for the code block?
like how you do ```thing here
"backticks"
👍
that one's md
thanks
Does anyone know how to have per server things like filters and stuff? I have a filter for one server but other server may not like that
oh cool thanks
I usually just pin a message in my test server with all of em
i dont have that md with # to get blue, but ik other ways
there are over 100 languages, but most of them offer nothing interesting or are mostly the same
theres only like 10-20 interesting ones
ig css has # blue too
#blue
``` you just cant have the space
I'd say my most used one is js or yml cause js i use to send code easier, and yml is green and i think it looks cool
oh which color is that using what?
i use it to list items
it looks.. lime?
oh ok
allData: [{}]
how do I add to this array in js ._.
people can create and save things with my bot, and that shows a list of saved ones
allData.push("?")
Oh what bot(s) do you have? I see you have the verified bot dev flag
= I like asciidoc =
[It has nice colors]
== For commands ==
+ping :: It... like... pings. Then Pongs. And it's not Ping Pong.
my bot makes astrological charts
oh cool
xd


g2g sleep, its 3 am
gn
c ya
👋
so um can someone help me pretty sure it's a basic's basic question
allData: [{}]
how do I add to this array in js ._.
there are many ways
usually, allData.push({ new: 'thing'})
that adds to the end of the array
ahh I forgot the {}, okay ty
I mean that's if oyu want to add an object, of course.
Yeah I did wanted to
why <Guild>.me is null 
Edit: nvm
WOW
My bot got accepted today
and drumroll
.. . . . . . . . . . .. . . . .. . ... . . . . . . .. . . .. . .
22 guilds
what if I wanted to add to the object 
Nice nice, same, I got like 2 more servers when it got accepted today so that was cool
Oh yes, my fault! Replace the embed=embed with embed=Thyembed and see if that fixes jt
Umm okay
I understood
SqliteError: file is not a database
at Database.prepare (/rbd/pnpm-volume/779d4edd-06f1-4d31-b896-0195d42ffc0b/node_modules/quick.db/node_modules/better-sqlite3/lib/methods/wrappers.js:5:21)
at arbitrate (/rbd/pnpm-volume/779d4edd-06f1-4d31-b896-0195d42ffc0b/node_modules/quick.db/src/index.js:365:8)
at Object.get (/rbd/pnpm-volume/779d4edd-06f1-4d31-b896-0195d42ffc0b/node_modules/quick.db/src/index.js:48:16)
at Object.exec (/app/src/commands/Setprefix.js:7:27)
at Object.exec (/app/src/listeners/message.js:15:31)
at MusicClient.<anonymous> (/app/src/structures/MusicClient.js:60:58)
at MusicClient.emit (events.js:315:20)
at MessageCreateAction.handle (/rbd/pnpm-volume/779d4edd-06f1-4d31-b896-0195d42ffc0b/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (/rbd/pnpm-volume/779d4edd-06f1-4d31-b896-0195d42ffc0b/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (/rbd/pnpm-volume/779d4edd-06f1-4d31-b896-0195d42ffc0b/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
Umm🙄
you corrupted it
Wdym?
probably stopped the process during a write
delete database file
It will create itself?
yes but your data's gone
Np it's testing bot 😂
it'll be a problem when it's not a testing bot and you don't have a backup ::))
i did cool thing
Weebshin impact
working on a command for my bot that allows for a game to be played, in which the goal is to post words that either change one letter in the previous word, or add a letter. im using this function
function checkDifferentString(str1, str2) {
let diff = 0;
if (str1 === str2) return true; // equal return true
let lengthDiff = Math.abs(str1.length - str2.length)
if (lengthDiff > 1) return false; // checks length diff if > 2 return false
for (let i=0; (i<str1.length || i < str2.length);i++) {
if (diff > 1) return false; // diff greater than 1 return false
if (str1.charAt(i) !== str2.charAt(i)) diff++
}
if (diff <= 1) return true
else return false;
}
and it works fine if you add a letter to the end of the word (e.g. mat->math). but if you add a letter in the word (e.g. mat->malt), it says that the word doesnt follow the rules, when it does. how can i change the function so it also catches for letters inside the words?
this is the code for the checking command
if (!checkDifferentString(_word, lastMessage.content)) {
var st = 0;
if (!msg.author.bot) {
msg.react("❌");
if (!st) {
msg.channel.send(`That word doesn't follow the rules of the game!`).then((msgg) => {
setTimeout(function () {
msgg.delete();
}, 1500)
});
st = 1;
}
}
}
How can I find out which shard I am in now? I am writing with discordjs v12 for the first time. shard.id doesn't work.and also How can I find out the number of guilds.
for your second point, you could use client.guilds.cache.size
Can bots not join stage channel VCs?
why not
I tried to use one of my commands that joins a VC in a stage channel and it told me im not in a VC
it works in other channels
Watch erwin says "Maybe because discord.js bad, use detritus, it supports latest features" and he's right
idk who that is + what that is
bruh lmao i moved my bot in and invited it to speak and it crashed 
creating stage channel only available on desktop app rn?
Could I get help with a command I'm working on? I made an addemoji command. You provide an image link and then the name for it and it adds the emoji, but, when i give it an image and a name, it says it added the emoji, but it also sends the error. And, when I give it one or more things to give it an error (too long of name or too big emoji) it says it added it, but also sends the error mesage (obv it doesnt actually add the emoji) (Discord.Js) Code:
if (message.content.startsWith(`${guildPrefix}addemoji`)) {
let canManageEmojis = message.channel.permissionsFor(message.member).has("MANAGE_EMOJIS", false);
var args = message.content.split(' ').slice(1);
if (canManageEmojis) {
message.guild.emojis.create(`${args[0]}`,`${args[1]}`)
message.channel.send(`Succesfully added your emoji, ":${args[1]}:"!`)
.catch(message.channel.send(`Oops! I couldn't add \`:${args[1]}:\`. Possible errors: The name was over 32 characters in length | The file size of the image was above 256KB. | Your server doesn't have enough space for emojis.`));
} else {
message.channel.send(`oops! You don't have the \`MANAGE_EMOJIS\` permission!!`)
}
}
i have problems with some code i cant figure it out and then i need know how to put it online on the www as i have no clue i cant find out what i do wrong i get this error [dblapi.js] Warning: No DBL token has been provided. Ready to serve on undefined servers, for undefined users.
thanks, i will return if its still give me problems
@opaque fern it says not found ?
Why is this happening ?
@opaque fern yes excatly im still working on figure out where to upload my code
where to upload the bot code never made a bot for discord before now
okay so i dont need host it anywhere ? then good to know but how do it so work i hope its ok iim asking as im a noob here on this point 😉
You do need to host it yourself, Top.gg is not a hosting service
The website is only used to list your bot to the public
okay make sense where to host it ? site like heroku ?
It's up to you where you want to host it, but it's generally recommended to use a VPS
okay thanks 😉
can someone help her?
Well, it's happening because channel isn't defined
but when her changes the token the codes worker on another bot
this is pog
The scroll bar was really hard to click though
It's hard to say what's wrong without seeing any of the code
We don't know where the error is the line is not written in the error section
Is that the entire error message?
yes a very strange mistake
???
The bot works when another token is entered
show your code
looks like an internal error
someone had the same error yesterday
they were running djs v11
if you are too, update to v12
Tim has this keyboard lol
makes sense
can anyone help
i coded a music bot
and i code a cmd to stay bot in vc 24/7
but first bot is working
and idk why
2nd bot leaving channel
what do you mean, is it not supposed to work?
listen
i coded a music bot
and it stay in vc 24/7
and applied that same cmd to another bot
but 2nd one leave channel
idk why
:/
Dont use v11 d.js
There are 200 commands very difficult to convert
Coded 200 commands but can't pass them to V12?
Dont use copy paste command
yes ; (
The reason I didn't pass v12 music commands didn't work in v12
my bot too😢
did d.js kill v11 or something?
d.js v11 bug fix removed
we get the same error i guess i will pass v12 😢
Use v12
197 command 😢
This dude @grim lark
this will be difficult
this is whole cmd which i copy paste iin 2nd bot4
but 2nd bot not staying in vc 24/7
i know how to convert
but its the only solution, why did you make your bot in v11 anyways? v12 was introduced a long time ago
help ?
@median iris please specify the problem
v11 supported more commands (from those in my bot)
and i copy pastethe whole cmd and json files in 2nd bot
I tried but many commands would disappear
show the code where it keep bot in vc
then you have to manually re-write those commands, thats the only solution to seem functional
or to code a new bot / commands
😭
sorry
lemme show u error
I could not join the voice channel: ReferenceError: queueConstruct is not defined
yeah but rewriting those commands would be easier, there is even a guide for that on the d.js documentation
error
bot.js file 3000 lines
pls help
it cant find the queueConstruct function or variable
why the hell would you put 200 commands into the main bot file??????
i need to code again
neyse ben ağlamaya gidiyorum bye 😭
How? Do you use individual files for your commands or are they all in your main file?
burn it
not a single file should have more than 500 lines
holy
unless its generated types
bet he's not using command handler
My largest file is like 200 and it's my command handler, but most of it is just the discord permissions
i think he just put everything into his main file and thats it
imagine needing a command handler
are you sure?
detritus has one built internally
YES HE IS SURE
yes, im 100% sure
Even back when my commands were in index.js with an external command handler that was like 150
bet your server's running on 100% cpu & ram usage and the bot's response time is horrible, also you cant find shit in the file
then look at this
you gain a couple microseconds by not having to require other files
sounds like a poorly coded bot
My bot is at 96ms ping rn
ping is related to websocket, nothing to do with ur code
Ye ik
all commands are not in bot.js, only additional commands are there
@opal plank how do you do that thing you have with your status?
so, let me get this right, you split events, utils, but NOT your commands which is like, the main reason you would do it?

there shouldnt be any commands in the bot file
the main reason was v11
doesnt matter if its v11 or not
do you expect us to know turkish out of nowhere
Turkish but you can read on translate
frmo an image
If your bot is 3000 lines it better be fully sentient
??
100% gonna commit to translating an image to english
I'm too lazy to get out of bed In the morning you think Imma learn Turkish to read something?

This is a support place not a fight / domination place escapes
@grim lark what even is your problem
never mind
you're the one sending turkish stuff in here, its english only, but still, im giving you feedback on your code, never once have i attacked you
From scrolling up I've pieced together you're having an issue porting stuff to djs v12?
the only thing we told you was that it would be a good idea to rewrite your bot because 3k botjs
replit is ok ?
3k on any bot file is outrageous
its bad, but it works
bad? its perfect for small bots
its not
not by any strecth
you should avoid using heorku/glitch/repl
Heroku has never worked for me
why exactly is it bad
ugh, here we go again

first, they werent meant for discord bots as in, they go to "sleep" once in a while to save on resources, unless pinged. On the same not, some of them will limit the amount of hours/days or memory/cpu usage you can use, and some of them wont even allow you to use storage locally, which is a pain if you need to save some stuff in the disk. Not only that, you're much better off using your own pc due to the little amount of resources they offer you since its free, you arent getting much at all, any decent new device(from 2009+) will be handling stuff a lot better. Not to mention a vps is around $5 for some good specs, using those services shows 0 care at all for the bots quality
If you don't want to spend any money on hosting, repl is your best option
its bad, but it works
#development message
But if you’re making a bot to list on top.gg to grow it should have a better host since you’re wanting it to grow
you should ALWAYS hide ur token
Just hit up some people that yk own servers and most likely they'll let you borrow some for free if it's not resource demanding
this
Quality > quantity
i didnt know that thanks for telling me
i identify as a pointer
Discord dmed me when I accidentally leaked my token, they auto reroll it i think
Sometimes it takes a minute for the new token to work so your bot will be bricked for a while
So your better off just putting your token in a .env or something and then setup a .gitignore to hide it
ok ill use vsc
welcome to the club
well i do the same
everyone does it
Holy hell.
cool
holy
they should look at glitch + repl it tho
How do I turn these into a command
if(message.content.startsWith(`${config.prefix}modmail`)) {
const user = client.users.cache.get('774903577068044298')
user.send('Hey im just a all in 1 bot cool right')
message.reply("sent him the mail")
}
? already looks like a command to me
It's in my index.js file now I want it to be a separate command like dm.js file
use command handler
Ayo.
Is there a way to refuse it from allowing DMChannel?
I want it only for a guildChannel
guild.available can be false when a guild is in outage for whatever reason
First one it is, more like it.
The first one is more reasonable. You could also probably do if (!message.guild) return;
I'm trying to do for the channelCreate event.
so.
if (channel.type === "dm") return;
Yeah, that should work
👍
from discord.ext import commands
import aiohttp
import dbl
import discordlists.py # imports (must be over the code)
class discordbotlists(commands.Cog):
def init(self, bot):
self.bot = bot
self.token = 'api-token' # botsfordiscord
self.token2 = 'api-token' # discord bot list
self.dblpy = dbl.DBLClient(self.bot, self.token2, autopost=True) ## passed in the api token of the discord bot list bot
self.api = discordlists.Client(self.bot) ## creates an instance of a discordlists client
self.api.set_auth("botsfordiscord.com", self.token) ## passed in the api token of the botsfordiscord bot
self.api.start_loop() ## loops every 30 mins
def setup(bot):
bot.add_cog(discordbotlists(bot))
this is right for guild count on top.gg for my bot
60 seconds
O
I believe?
So many days after I m here
2 per 10 minutes per channel
@quartz kindle please
check this
u kidding me]
i need help
FUCK ME

thats why that shit was more clogged than a BurgerKing's bathroom
idk i dont use python
looks alright, test it and see if it works
huehuehueheuehue
fucking stage channels require a channel topic
reeee
thats why it wasnt joining all of the times
legit was await channel.editTopic()
if the ratelimit is that low, it would've legit taken up to 10 minutes for it to fully connect as a speaker

where i get self.token = 'api-token' # botsfordiscord
self.token2 = 'api-token' # discord bot list
api token
@quartz kindle come join check stage channels
wat
did u not see Stage Channels?
yup
Should I change the
message.client.users.cache.get
To
message.mentions.members.first()
Cause I want to make it so I don't have to add the persons I'd and just ping them instead
You can do that.
Instead of message.client.users.cache.get('ID HERE'), use message.guild.members.cache.get(args[0]);
for mentions you use message.mentions yes
I have my v11 unplugged? no bots are working i did it from google translate may be error
v11 is dead
hi
😭
efdm dm yaz knka
yes because of stage channels. Now you have to use v12 🙂
they pushed a fix on new version
pretty sure more than a year
when was djs 12 released?
hi Tim and Erwin
slowpoke
nope :^)
me
loli_dance
I don't know if this is possible.
sus
you literally posted this at the same time the girl in the song said "what the fuck"
go watch the rest million
Is there a way to make a field in an embed that contains more fields?
noticed too
😂 👏
I did
whole thing?
11 episodes
welp
did you like or, love it, okay, or hated it?
nope
I have no anime to compare it to but it was pretty good
Very sad
been so long since I binge watched something
want some more?
What is .addfields?
i'll keep the quality up for ya if you want some more
add multiple fields at once
takes an array of fields iirc
if you dm me animes and crunchyroll links I might watch them
[{name, value, inline}, ...]
aight, deal, but you should really be torrenting them instead if you got a decent internet
its much better
watch kara no kyoukai
Oh.
theres like 6 movies
check out stremio
How fast is your download speed? In seconds, FAST.com's simple Internet speed test will estimate your ISP speed.

220mbps good
LOL
you should trust it a bit more
good point
a couple ISP's do ask some known speed testing sites to bump their stuff
ah
ye speedtest says 480
😭
It's been a year, it's about damn time you update.
200 commands very difficult to pass v12
Well you had an entire year to update.
You procrastinated, now pay the price. You have to update.
But I just started writing code
What?
Well your friend is an idiot for suggesting you should use v11 and you're an idiot for listening to him since v12 has been out for a year. Sorry buddy.
There's no arguing your way out of this. V11 is 100% dead.
bit far, don't ya think
So do I v12 proof my codes?
thanks
So i've been working on my dashboard and when i try to check on a server when the server owner is offline it throws an error
let owner = guild.owner.displayName
it only happens when the owner is offline otherwise it works fine
I am not sure why the bot doesn't cache the owner, you may have to wait for another user to help as it may benefit me as well.
You have to fetch them. await guild.members.fetch(guild.ownerId)
oh okay
I believe it should assuming your bot is not verified or it does have the intents enabled.
you need intents for receiving member related events
thanks
res.render("serverpage",{user:req.session.user,count:guildobj.memberCount, pageTitle:"Edit Guild" , name:guildobj.guildname etc...
^^ This renders the serverpage which gets the guildobjects such as membercount ownername and more
async function manageguild (g_id){
let guild = bot.guilds.cache.get(g_id)
const ownerId = await guild.members.fetch(guild.ownerID)
if(guild) {
let memberCount = guild.memberCount
let guildname = guild.name
let iconurl = guild.iconURL()
let owner = guild.owner.displayName
let id = guild.id
return {memberCount,guildname,iconurl,owner,id}
}
return "You dont share mutual guild with the bot"
}
when i added async in the function it still logs it right but it doesn't show it on the page
Guys look what happend to the discord.js server 
there server logo lol
oh
Hello,
I am coming to you because I have a problem using the bot
Normally, I have the reactions in this direction the
- Validate
- Refuse
- Attempt
But there I had a weird thing. The Validate reaction displays :null:
Has anyone ever encountered this kind of problem ?
Go to the bot's support server
idk how to run node . cmd
thx
hey guys is there a way to get as a variable the number of server that uses the bot in discord.py?
dosen't work anymore i used it but now it shows 0
when did it stop working?
i dont think they changed anything in discord.py
do you use intents?
best app for coding a bot ?
i think python but js is good either
there isnt one
no
you want to actually code a bot, or you want to use an app that does everything for you?
its literally the same thing
no
Tim does async change the way how things are imported on another file?
depends
one is used more for visual the other is better in coding
f5?
if you're talking about "visual studio" then yes thats a different thing. but "visual studio code" is what both of you were talking about
one said studio code, the other said visual code, both have "code" in it, so they are both the same "visual studio code"
the one thats different doesnt have "code" in the name
Tim tel;l pls
oh i misunderstood sorry
did you ever code anything in your life before?
do you know what a programming language is?
python is pretty easy to start with
currently im using replit
const Discord = require('discord.js')
module.exports = {
name: 'dm',
run(message, args) {
const sayMessage = args.join(" ")
const user = message.mentions.members.first()
user.send(`${sayMessage}`)
message.reply("sent him the mail")
}
}
This code is for my discord bot to dm the mentioned user with my message now I tried to make it embed and I failed so can someone pls help me make it embed
show what you tried
const Discord = require('discord.js')
module.exports = {
name: 'dm',
run(message, args) {
const sayMessage = args.join(" ")
const user = message.mentions.members.first()
let embed = new Discord.MessageEmbed()
user.send(
.setTitle("Modmail")
.setDescription(sayMessage)
.setColor("#00ff00")
)
message.reply("sent him the mail")
}
}
user.send() goes to the end
user.send(embed)
the .setTitle .setDescription etc have to be right after let embed
Ow thx
so that its like this: let embed = new Discord.MessageEmbed().setThis().setThat().setEtc()...
const {userhit,manageguild,checkguild,modifyguild} = require("../bot/webapi_handler.js");
let id,guildobj,mutualguilds,webuser;
Can i import a async like this?
it started returning undefined just when i added async to the webap_handler.js
You can only import things that are exported at the top level
can you show us what webapi_handler.js looks like?
is there a way to show bc len(client.guilds) dosen't work
status = cycle([f"inside of {len(client.guilds)} guilds wow!"])
@tasks.loop(seconds=10) # does the given task every 60 seconds
async def changeStatus():
print(client.guilds)
await client.change_presence(status=discord.Status.online, activity=discord.Activity(type=discord.ActivityType.listening, name=next(status)))
?
put it inside your changeStatus function. Outside means it's evaluated once at load time and never updated, and before the bot is ready that means it's 0 or undefined.
#development message
Second code
well that's not exported now, is it
ty
It is i will make sure to show later cuz i am at work and i have smthing on my hands rn
I have no way to guess if it's exported or not
Cuz it did export without async
because the code doesn't show it
if you make a function async, then you need to await it everywhere you use it
Ohhh that explains alot
Thanks
That's... not... the same question or the same answer, I guess I'm confused.
But it still was logging it right
On that file but in the other file where it was being exported nope
I will have to await em all
And will get back in here
Anything that returns a promise must be awaited or resolved with .then(), it's unrelated to whether it's exported or not
everything inside the function will work correctly
One message removed from a suspended account.
but the return value of the function goes to limbo if the function is not awaited
One message removed from a suspended account.
sa
well
you can upload code files now
if you wanted to know
if anyone wanted/needed it for this channel
To set permissions for my command do I use
if(message.member.hasPermission("MANAGE_MESSAGES")
TypeError: Cannot read property 'commands' of undefined
You never define a property called commands to the client
How can I define them 🙄
By defining them obviously
Very helpful
You can define a property by either using the assignment operator (=) or by using Object.defineProperty(), here's an example:
client.commands = new Discord.Collection();```
my index exist of command loaders im not sure anymore if that also counts as handlers
TypeError: categories is not iterable
I just got fucking rick rolled by teams.js
Show code
In your DMS
Oh so no one else can help you? smh
Wdym
I mean don't post code in someone's DMs. post it here so others can help.
if you have mental issues then no sorry
huh
woah thats cool, havent seen that before
finally
i have like 60 message.txt files in my downloads folder
What the fuck kind of an insult is that? That was uncalled for, wtf.
it wasnt a insult it was a joke damn
PEP 401 just got released









