#development
1 messages ยท Page 655 of 1
no
You need a sync
wut
Me too, my problem was lost
You also need @client.event before the definition as well
I tried to figure it out meanwhile
I used the @commands.Command() decorator with all my commands, above the async def [command name
lowercase c
Nothing came out just more errors because of throwing an async function where it shouldn't be
You were asking about the async thing right?
let muterole = message.guild.roles.find(r => r.name === "flex taped");
if(!muterole) {
try{
muterole = await message.guild.createRole({
name: "flex taped",
color: "#514f48",
permissions: []
})
``` this should provide more info
Can you post the whole code in a hastebin
the whole code for the mute command?
Yes
alright
@slender thistle it doesn't, check #265156322012561408
You have to put async in front of the main function
I'm assuming all these commands are in the message event
yes
so i have to add the async in front of all the command
wait let me see if i got it
no
You have to add async in front of (message) => {
So it becomes async (message) => {
ooooooh
```client.on("message", (message) => { message.isMemberMentioned(589151834132840480) message.reply('My Prefix is !'); });
i put that code in my bot and at every message it started spamming 10 messages. How to fix this?
#1 make sure that your bot isnt running 10 times
and how to to that?
aka make sure you dont have 10 instances of the botto
d.js @earnest phoenix
or 10 command promts of node bot.js running
@stray garnet try dis ```js
client.on("message", message => {
if (message.content.startsWith('@sterile zinc')) {
message.channel.send('lol');
}
});
but now i ger error
thx
@topaz fjord thanks, it works now. It still doesn't "mute" the user, it just gives him the role which has no perms but he can still type, you know. I will figure that out later no worries
Or have it be custom to the server
i appreciate
did you do for the background
Nope
thats why
section.page is for the background of the page outside of the embedded code
Inspect element
Inside you have to give a div an ID or class before changing the color
also, try !important sometimes
yo guys
my bot gives error 429
it means too many requests
about 50+ people using the bot at the same time, its a music bot
everything is up to day
lmao wait is your bot the spotify bot?
oh
^
already have
4 second
cool down
its just too many people using the bot
how do bigger bots deal with this
thats the thing like!!!?
they handle ratelimits
turtle how big is your bot?
2650
Yes
which makes sense but
i need a solution
handle your ratelimits
https://discordapp.com/developers/docs/topics/rate-limits#exceeding-a-rate-limit-example-global-rate-limit-response block the request for the endpoint until retry_after expires
or, alternatively, use a library which handles ratelimits for you
but error 429 is from youtube i think
not discord
you should probably go make sure where it comes from
plus discord.js api handles ratelimits
so i think its youtube
im assuming you're using the official api
wrong channel
yes
Heck sorry
i personally wouldn't use the official api
what would you use instead?
it's too restrictive, use alternatives like scraping content
you can check out how lavaplayer works
you can also use software like youtube-dl
we are using discord.js and youtube-dl and the youtube api is ratelimiting it heavy
Handle your ratelimits is kinda hard
please wait 5 minutes before you can listen to your music as youtube is taking a shit
lmao
also doesnt ytdl-core scrape youtube?
use lavalink
lavalink is trash
it gets rid of the hassle of setting up proper audio but it's trash
just wondering but is there anything which beats node-opus? lol
i think not
there's opusscript which was made by abal
i don't know which one is better in performance
api-side they're both pretty close
How do you make the longdescription transparent
as in there is nothing there
no color or anything
css
background: rgba(0,0,0,0);
np lol
but Im no good with front end
you can use filter()
Wich Discord Librairy is the most used ?
probably discord.js
d.js is easily on the top since most people decide to jump into node
@topaz fjord all them glitch tutorials use discord.js i bet
js appeals to low iqs because js logic is as messed up as theirs
so i guess im low iq for preferring a simple language that can do many things
did i say that
I mean I'm not a js-hater per se but I hate how ppl try to do too much with js
or did i say the language appeals to low iqs, i didn't say only
it's meant to be run in the browser for fuck's sake
And then node.js came long, making poor performance the industry standard for generations to come
i mean, following atwood's law, any application that can be written in js will eventually be written in js
no matter how unoptimized it is, it will be written in it
basically, yeah
but then again, it makes sense not having to learn another language for the server
Not really
Having separate langs for separate use cases is necessary
JS basically runs on a "one-size-fits-all" methodology
of course, but should beginners really have to learn a whole (like way more complicated) other language just for the server
for people who don't care about performance, they won't learn another language and will stick to theirs if possible
people who do care about performance, e.g companies will do it in a more abstract and lowlevel language
Imagine writing a desktop app in JavaScript... can't relate
chromium apps aka ram bullies
imagine having to hire 3 times as many developers to build native apps for desktop operating systems
i mean, discord has a lot of devs for desktop and they still fail to make an app performant
because ๐ธ
Yeah JavaScript and node are hip amongst tech startups
plus ui differences, and likely other differences and having to develop for +2 platforms
the performance is a tradeoff for ๐ธ and having to deal with less differences
it makes sense for the business
It's still much worse than developing with the native lang
Xcode and Android Studio are powerful tools for which no equally-competent alternatives exist
and much cheaper
Those lame electron devs who can't step outside their comfort zone don't have access to those utilities
mobile is already native tho, isnt it
wdym
discord for android and ios are already native, made with android studio and xcode, arent they?
Pretty sure it's built with React Native
If yall make my bots popular enough for it to matter what language I'm using, I'll gladly switch

guys how can i make a timed command in discord.js
what does that mean
it mean they have to wait (example. 10 mins) to use this command again
store the timestamp of when the user last executed the command and compare it to the current timestamp
okay i'll try that
Oh
!p Netflix
This is a new help command I have been working on:
https://pastebin.com/8WnEpQnw
When I go to use it, I get the following error:
(node:10323) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'name' of undefined
at /app/commands/CreatorOnlyCommands/testhelp.js:9:58
at /rbd/pnpm-volume/2aae3560-c7d1-4c22-8c96-9d911419476a/node_modules/.registry.npmjs.org/discord.js/11.5.1/node_modules/discord.js/src/util/Collection.js:483:62
at Array.sort (<anonymous>)
at Map.sort (/rbd/pnpm-volume/2aae3560-c7d1-4c22-8c96-9d911419476a/node_modules/.registry.npmjs.org/discord.js/11.5.1/node_modules/discord.js/src/util/Collection.js:483:47)
at Object.module.exports.run (/app/commands/CreatorOnlyCommands/testhelp.js:9:10)
at Object.exports.run (/app/events/message.js:128:9)
at Client.<anonymous> (/app/index.js:230:51)
at Client.emit (events.js:201:15)
at MessageCreateHandler.handle (/rbd/pnpm-volume/2aae3560-c7d1-4c22-8c96-9d911419476a/node_modules/.registry.npmjs.org/discord.js/11.5.1/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
at WebSocketPacketManager.handle (/rbd/pnpm-volume/2aae3560-c7d1-4c22-8c96-9d911419476a/node_modules/.registry.npmjs.org/discord.js/11.5.1/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:105:65)
What could be causing the error?
a.help is undefined
ye but how?
how many servers should your bot be in before you start to shard?
@steel cloak it's recommend like 2500 before sharding
@rapid storm Read #mod-logs
Tons of examples
A bot responding to "sa" (???), or spamming nonsense upon using commands or just general talking etc
Going over the rate-limit, nsfw in non-nsfw areas etc etc
@haughty rose ahh okay thanks a lot
@steel cloak @haughty rose 2500 is the max # of servers any shard can have. 1000 per shard is what discord reccommends
yeah thank you too,, you're all good giveen lol
So, Does anyone know why I can't use .bind on a module.exports = async() => {} function?
nvm, Fixed it.
Halp?
What website is supposed to look like
what discordbots.org is doing to it
wat do
@earnest phoenix make iframe height auto
That, or have a version of the website specifically for dbl
Eg, I have a desktop, and a mobile version of my post site
@earnest phoenix as we have already told you, the bot description in DBL is NOT a full website
You shouldn't be pasting a whole website's code into it
I mean
If you want to embed a separate website, use an iframe
I asked
HTML's <style> tag work? I was told yes.
Offered solution for fix? Remove HTML and Body tags
Fix the problem? No.
You aren't using it the way it's supposed to be used
You shouldn't paste a whole website into it
If you want it to show a whole website, use an iframe ^
writes documentation on HTML
uses an ASPX document
Still work if its changed to https://
yes
I can do a quick example if you want a more indepth explanation
or you can read the doc I linked
Nah
Reading it, thank you @honest karma
np
if you want to remove the ugly border go to the style tag and do iframe{border:none}
@earnest phoenix yes dank memer uses an iframe
I'd have to host the website somewhere
Yeah
No clue how to ownhost a site yet
ywait you can host on github?
Yes
holy shit I didn't know that
But its public I believe
Websites for you and your projects, hosted directly from your GitHub repository. Just edit, push, and your changes are live.
Only for static html
You can't run node or something ofc
If needed, I can host using the url neko-bot.net/yourwebsitename/html-file.html
If you absolutely need it
@west spoke did u set up cloudflare yet
I need to code a website for an upcoming bot but it's far from finished
nu I'm using a AWS-provided certificate
Is it free?
Cloudflare is free and also makes your site faster and gives ddos protection
So pretty much everyone uses it
Doesnt aws do that too?
I mean I don't have anything private.
Most private thing there is a little app I made for my parents
Aws is hosting right?
Also jake said aws is shit 
Cloudflare goes in front of your hosting, it doesn't actually host your site
What's the Acceptance Rate for newly added bots?
No it doesn't
ah
and it's 100%
And cloudflare rarely goes down
It went down a few days ago for the first time in like 6 years

Will I get the certified developer role once it's accepted?
Ni
Just developer
Cert takes a while to get
I wont be getting it for a while.
But when I do I'll have a somewhat decent social media service
Certified developer is for cert bots, bot Dev is for all approved bots

Ah
Mail it to them
That's what I was talking about
Fuck I cant talk leave me alone I'm tired
There was another outage about a week before that but that was Verizon fucking up the interner for everything
Ah, I guess Multi-Purpose bots get thrown shade lol
Yeah
Yeah it's sad
Multipurpose bots are meh
ultra sources data from numerous games and outputs it from numerous platforms
don't thing anyone has that and that's just one ftr
it'd be sad to be looked down on just because it does it all
:L
That's why the only multipurpose ones for mine are some moderation, a few anime commands (based around users posting, so that's a +) and quite literally, a posting command.
I don't get why people hate them?
Ah, my bot is also highly configurable. Is that unique in this field?
Go on c:
huuh
my goal is to make a bot 10x more powerful than everything available then uh
make it free
If by "configuable" only using certian channels, setting different moderation actions to different channels, etc.
nice
Galactic is free btw
like, entirely free
who's bot is this?
on it
404
just read all of its features
dyno is free
since when has dyno been a paid bot
Yes
maybe im thinking mee6
Mee6 is like the only paid bot, and its p useless
they've done incredibly well with Dyno
looks incredible now
webpage, panel, etc. the overall theme is wonderful
Yeh
idk why mee6 got into like,, paid sht
because hosting a bot costs money
someone let me know when y'all are gonna pay for my bot 
fine premium commands like playing music
oh wow
pretty much all big bots have premium features
huh.
Dyno is a lot of premium now
ok let me rephrase
the majority of it is free
https://oliy.is-just-a.dev/lqkei_623.png but there are some really dumb features that arent worth premium
like an embed editor
yeah
the embed stuff is pretty cool
there are also some custom command features that arent mentioned but are premium only
@bright spear I meant embed is basic bitch programming
It's real easy to do and there are some bots that do this for free ยฏ_(ใ)_/ยฏ
embeds look nice and there's like an embed genrator if you're lazy
Seems fair to those who don't want to code
@amber fractal u wat
there's no "really dumb features" that aren't worth premium
it's a whole set of features, not just one feature 
also dyno's embed editor is extremely good, intuitive and convenient which definitely makes it premium worthy for most users
You could use https://leovoel.github.io/embed-visualizer/ and/or https://discordbots.org/bot/embedgenerator for, get this free
si
first link is an 11/10
thanks @slender thistle (sry for mention) 
@amber fractal 1st link is like hey do you understand json? No? ok bye
you can pick up json within a minute
it has pretty simple rules which follow common sense
@earnest phoenix think again lul
low iqs dont count 
/app/node_modules/better-sqlite3/node_modules/bindings/bindings.js:133
throw err;
^
Error: Could not locate the bindings file. Tried:
โ /app/node_modules/better-sqlite3/build/better_sqlite3.node
โ /app/node_modules/better-sqlite3/build/Debug/better_sqlite3.node
โ /app/node_modules/better-sqlite3/build/Release/better_sqlite3.node
โ /app/node_modules/better-sqlite3/out/Debug/better_sqlite3.node
โ /app/node_modules/better-sqlite3/Debug/better_sqlite3.node
โ /app/node_modules/better-sqlite3/out/Release/better_sqlite3.node
โ /app/node_modules/better-sqlite3/Release/better_sqlite3.node
โ /app/node_modules/better-sqlite3/build/default/better_sqlite3.node
โ /app/node_modules/better-sqlite3/compiled/8.15.1/linux/x64/better_sqlite3.node
โ /app/node_modules/better-sqlite3/addon-build/release/install-root/better_sqlite3.node
โ /app/node_modules/better-sqlite3/addon-build/debug/install-root/better_sqlite3.node
โ /app/node_modules/better-sqlite3/addon-build/default/install-root/better_sqlite3.node
โ /app/node_modules/better-sqlite3/lib/binding/node-v57-linux-x64/better_sqlite3.node
at bindings (/app/node_modules/better-sqlite3/node_modules/bindings/bindings.js:124:9)
at Object.<anonymous> (/app/node_modules/better-sqlite3/lib/database.js:4:40)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/app/node_modules/better-sqlite3/index.js:2:18)
What is the problem?
It means Sqlite was not correctly installed
client.login(process.env.TOKEN)
yes
yes
try logging process.env.TOKEN to see if it even registers it
my guess is that your .env file contents dont actually register as env variables
and put this: require('dotenv').config() on the first line of your main file
what does it do?
it loads the contents of your .env file into process.env
use dotenv
yes
We wont spoon feed you, also what do you mean by "premium code"
@iron lagoon ^
m should be the message.channel.send in the setTimeout, right?
setTimeout(async function(){
let m = await message.channel.send(load1)
}, 12000)```
does it work like you expected?
nope
yeah its because of how setTimeout works
it's sending load1 then 3 then addedcodeemb then load4
yeah
if you want to wait x ms you should instead await a promise that resolves in a setTimeout
any better way to do the animation
it doesnt block the event loop and wont execute code until its resolved
like i want it to send after a few secs
so it looks legit
so like send load 1 then wait a few secs then 2 then again fe secs and so on
i added await and still the same
function sleep(ms) {
return new Promise((resolve, reject) => {
setTimeout(function() {
resolve()
}, ms)
})
}
setTimeout(async function(){
doSomething()
await sleep(1000)
after1SecondThisFunctionWillExecute()
await sleep(3000)
after3MoreSecondsThisFunctionWillExecute()
})```
๐
:))
is it working?
When mapping a guilds emojis, can you get the bot to send the actual emojis?
Because, message.guild.emojis.map(m => m.name).join(" ") returns the emojis names, but not with the : : in front of them.
(m => m.toString()).join(' ');
Because name only outputs the actual emoji name. While toString will output <:nameofemoji:>
Guys I need help
args[0] shows me the first letter not word
const args = nocomma.toString().replace(/,/g, ' ');```
Discord.js btw
does anyone have a profile card template or something i could use?
Ratelimited
nope doesnt help
i did it works later, i am aware but i am not the only dude
this was published 4 days ago
and it is true
no matter how many we rate limit it still happens
we even start caching info still happens
we never got something like this before it never happened, till about a week ago
till now
may i ask about discord.js here?
msg.react('โซ')
const Filter = (reaction, user) => reaction.emoji.name === 'โซ' && user.id === message.author.id;
const react = msg.createReactionCollector(Filter, { time: 1 * 60 * 1000 });
react.on('collect', r => {
r.remove;
})
})```
how to remove user reaction after reacted to message? `r.remove` on my code doesn't work. thanks before.
@sacred minnow Make your Own, its easy
i tried but its always shit ;-;
let me try, thanks btw
CODE: https://hasteb.in/zuxazuki.js
Problem: I can't hear sound
I already logged dispatcher and connection
@mossy vine it works but it remove bot reaction, not user reaction :(
instead of react.on('collect', r => { try react.on('collected', r => {
@sacred minnow doesn't work
Hi, here how i can remove the part of "Nbulus#1859" with splice no ?
"403159739178942464": {
"Personne": "Nebulus#1859",
"Pokemon": "Zeraora (Lรฉgendaire)",
"Prix": "10000",
"Sรฉparation": 0
},
"403159739178947464": {
"Personne": "Test#1859",
"Pokemon": "Pikachu (Lรฉgendaire)",
"Prix": "1200",
"Sรฉparation": 0
}
}```
Remove all of : ```"403159739178942464": {
"Personne": "Nebulus#1859",
"Pokemon": "Zeraora (Lรฉgendaire)",
"Prix": "10000",
"Sรฉparation": 0
}```
delete object[id]
@quartz kindle here i make : delete object[idofuser] ?
yes
How do you make a hovering profile picture
a hovering profile picture? You mean a gif avatar?
ikr I'm so confused
In other news, does anybody have any idea offhand why my mongo keeps
deleting itself
probs just switch to lowdb ffs
No I mean on disbot
Oh, as in you want your bot to have a gif avatar? Honestly not sure if that's possible. If you can't upload a gif on you developers page, I don't know if you'd be able to with the API
Ohhhhhhh
you want to know how to make your own gif
Usually it's done in video editing software. You can do it in photoshop and some similar softwares, but it's ridiculously tedious. Most people use something like Final Cut/After Effects/Sony Vegas Pro to make it a short video clip
and then they export the video clip in a format that can be converted to gif
google things like "simple animation in photoshop" or whatever software you have available to get started, there are countless tutorials
That's simple CSS
Yeah, as a frontend dev I agree with you
Unfortunately discord doesn't allow you to upload stylesheets for your bot lmao
Are there any rules on what you can and can't do there? Like if I wanted to replace the profile picture
DBL does
But the page allows you to use html / css and md
<html><style>
.columns .bot-img {
border-radius: 4px !important;
overflow: visible !important;
box-shadow: none !important;
background: none !important;
box-shadow: none !important;
}
<p>.bot-img img {
-webkit-animation: mover 1.5s infinite alternate;
animation: mover 1.5s infinite alternate;
-webkit-animation-timing-function: ease-in-out;
animation-timing-function: ease-in-out;
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
border-radius: 50%
}
.bot-img>img {
border: 4px solid #ffbb00;
background-color: transparent;
}
.bot-img img {
-webkit-animation: mover 1.5s infinite alternate;
animation: mover 1.5s infinite alternate;
-webkit-animation-timing-function: ease-in-out;
animation-timing-function: ease-in-out;
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
}
@-webkit-keyframes mover {
0% { transform: translateY(0); }
100% { transform: translateY(-20px); }
}<br>
@keyframes mover {
0% { transform: translateY(0); }
100% { transform: translateY(-20px); }
}
.columns .bot-img {
border-radius: 4px !important;
overflow: visible !important;
box-shadow: none !important;
background: none !important;
box-shadow: none !important;
}
</style></html>```
Makes your icon hover ^
Oh I see
I was operating under the impression we were aiming for discord and not DBL, that's my bad lmao
ignore all my advice
It's okay
@hybrid ruin spoonfeed ree
That's fine
He's a bot developer, not a web developer. A small copy / paste for a hovering image can't hurt, right? 


๐ฅ
...just out of curiosity, what DB's are people using for their bots?
i'm using mongoose
Mostly plaintext and my AWS s3 db
I was using mongoose, but I switched to the native mongodb driver cause for some reason I wanted every guild to be it's own mongo db. Maybe that's my problem.
I use mongodb
You shouldn't make every guild its own db
It's usually 1 db with many collections
How can I do kinds of pages with this:
"403159739178942464": {
"Personne": "Nebulus#1859",
"Pokemon": "Zeraora (Lรฉgendaire)",
"Prix": "10000",
"Sรฉparation": 0
},
"462566800505307136": {
"Personne": "Nebulus#8919",
"Pokemon": "Pikachu (Normal)",
"Prix": "1000",
"Sรฉparation": 0
},
"403152739178947464": {
"Personne": "Test2#1859",
"Pokemon": "Vukb (Normal)",
"Prix": "500",
"Sรฉparation": 0
}
}```
For example the first page show the the first 5 ads etc
And each collections holds as much data as you put in it
Ahah
Tons of people use mongodb, I was 1 of them
At least that's I how I do it for mine
But I moved over to MySQL after a few weeks of realizing MongoDB was yes a bit easier but also yes much slower
Would've made you all some noodles in the time I got my profile info
Yeah right now my structure is a little messed up tbh, databases are very much not my thing heh.
Every guild has its own db
And then there are like 4 collections per db
one collection is a "settings" collection that's only ever just one document constantly updated
what I would suggest doing is 1 DB -> 4 collections
And what you could do is put the guildID in each doc so you could easily find it
Guys How Can Guest My Bot To discordbots
wut
oh
what the proble ?
I just can't figure out why my data keeps disappearing so I'm desperate for other options. I could give the singular db another shot
The long description must have 300 characters
Spaces don't count
The brief description can only be 140 characters
talk about your bot a lot. List all of your commands. If you're too lazy to do that like I am, make a bullet pointed list of all of your features
And owner/server format should only be id
For example, your ID is 558043966663163904
if you haven't enabled developer mode you should do that
Welcome to The Discord Wiki!
How i can take this "403159739178942464": { "Personne": "Nebulus#1859", "Pokemon": "Zeraora (Lรฉgendaire)", "Prix": "10000", "Sรฉparation": 0 }
In this : { "403159739178942464": { "Personne": "Nebulus#1859", "Pokemon": "Zeraora (Lรฉgendaire)", "Prix": "10000", "Sรฉparation": 0 }, "462566800505307136": { "Personne": "Nebulus#8919", "Pokemon": "Pikachu (Normal)", "Prix": "1000", "Sรฉparation": 0 }, "403152739178947464": { "Personne": "Test2#1859", "Pokemon": "Vukb (Normal)", "Prix": "500", "Sรฉparation": 0 } }
object[1] does not work
let a = {} // this is an object
a["abc"] = "test" // create new key "abc" with value "test"
// object is now {"abc":"test"}
let b = a["abc"] // get the contents of the key "abc" of object "a"
// b is now "test"```

So here ?
How i can get just the first no with id
Example for the first without : 403159739178942464
@quartz kindle
let obj = {"key1":"value1","key2":"value2"}
let keys = Object.keys(obj) // ["key1","key2"]
obj[keys[0]] // "value1"```
but know that objects do not guarantee the key order
there is no guarantee that the value you want will always be on the first key
@quartz kindle ok thx and with this how i can show just the 10 first
you can also ditch they keys and get only the values
let obj = {"key1":"value1","key2":"value2"}
let values = Object.values(obj) // ["value1","value2"]```
No i want all of this : "403159739178942464": { "Personne": "Nebulus#1859", "Pokemon": "Zeraora (Lรฉgendaire)", "Prix": "10000", "Sรฉparation": 0 }
How i can get the first 10 ?
convert it to an array and truncate it
but first 10 according to what? what order?
let obj = {"key1":"value1","key2":"value2"}
let keys = Object.keys(obj) // ["key1","key2"]
keys.length = 1 // ["key1"]```
?
I don't want the lenght i want the first 10 in the file
ie: length = 10, will truncate the array into 10 items, and remove everything else
then you use those 10 keys to get the data from the object
I have no idea
let a = Object.entries(obj) // [["key1","value1"],["key2","value2"]];
a.length = 1; // a = [["key1","value1"]]```
just try it, use Object.entries(yourobject), then cut its length to 10
and you'll see what happens
I have no brain today ๐ข
dont try to do it blindly
is you can see what each step does with your own eyes, then its easy
do one line, console.log it, see what it did, and continue from there
I have this for start my cmd :
Showitem = 10*switcher[2]
message.channel.send("โ -" + JSON.stringify(GTS).replace(/{/gi, "").replace(/}/gi, "").replace(/"/gi, " ").replace(/ , Sรฉparation :0/gi, " P$**\nโ -").replace(/Pokemon :/gi, "**__Pokรฉmon :__**").replace(/Personne :/gi, "__Personne :__ **").replace(/Prix :/gi, "**__Prix :__ **").replace(/,/gi, "").slice(0, -3) + "\n" + Object.keys(GTS).length + " Annonces | Page : " + switcher[2] + "/" + Showitem/10)```
Now i cant make a page system with the Showitem
switcher[2] is : the page 1, 2, 3 the page enter by the user
Exemple :
thats a lot of replaces lol
why are you using a stringified object?
thats a very stupid thing to do lmao
if object are in json, just use object.item
i mean, you have a object, use it as an object. objects are made for that
^
Hum okay
Here he say all of gts.json but i want make a page system with each page show the 10 first object
you can do something like ```js
let items = []; // create empty array;
for(let item in GTS) {
let text = - ${item} : Personne: ${GTS[item].Personne} Pokemon: ${GTS[item].Pokemon}
items.push(text);
}
๐ค
its much better than using a gazilion replaces on a string
O so i remove my all of replace
And i test your system
And with this where is the page system ?
this will give you an array of all your items, formatted in the way you want it to show
then since you have an array, you can easily make a page system for it
@earnest phoenix i dont think there is a way to access console events, you'd need to get them before you log them, like a custom logging function
unless there is a way to intercept stdout or something in node
How can I create two if conditions for one set of code in discord.js?
if (thing && otherThing) or if (thing || otherThing) ?
if(condition && condition) // if both have to be true
if(condition || condition) // if one of them has to be true
if(condition) {
if(condition) {
// if they have different types of conditions or depending on the situation
}
}```
Thank you
Ok now i have my command witheout the page system if (!switcher[2]) return message.channel.send("Mettez une page ร afficher") if (isNaN(Number(switcher[2]))) return message.channel.send("Une page pas des lettres") var Showitem = 10 * switcher[2] let items = [] for (let item in GTS) { let text = `**[${item}]** - Personne : **${GTS[item].Personne}** | Pokemon : **${GTS[item].Pokemon}**` items.push(text); } console.log(items) var embed = new Discord.RichEmbed() .addField(items) .setFooter(Object.keys(GTS).length + " Annonces | Page : " + switcher[2] + "/" + Showitem / 10 + "") message.channel.send(embed)
Now i do make the page system ๐ค
So heres my plight, im trying to use express sub domain to route the api router file. App.use('/' seems to be a catchall thoigh so my app.use(subdomain gets ignored
Thots?
Guys
Great news
I solved error 429
Didn't do rate limiting didn't , didn't do nothing except disable my servers public ip
Hope this helps others
@earnest phoenix my thought is dont use express
how can i make my bot mention someone?
im using d.js
@amber fractal get with the times
@stray garnet you can either use .toString() on a member/user object, or use the member mention pattern <@id> and if they're nicked <@!id>
@amber fractal
that was @amber fractal
@earnest phoenix idk if you cant do simple subdomains is it really the time for express?
You can do simple sub domaining in express my code structure is just a bit wacky rn
Express subdomains is like 2 lines then u got a sub domain router
my subdomains arent even code 
@earnest phoenix but from the looks of it you'd need multiple routers
or that's what this https://oliy.is-just-a.dev/f6g93h_626.png looks like
Ive seen the example tarp ya dum dum
then fix ya shit
Index router is taking priority regardless
@amber fractal its undefined then
wym
Its fine ill just manually declare the index route so it doesnt catchall
Or add some middleware i write
That checks for subs
@quartz kindle how i can make a sort system of pokemon by the enter of user
I have make this but he does not work
My system other system work
So i made a message counter that adds 1 to the user in the database which I found inefficient so I made it do it through cache, but my problem is how do i keep the count consistent with the database? All data will be gone when the bot is restarted and an interval update isn't going to be best i feel
most databases are very efficient at incrementing, which db are you using?
if you feel that's not enough, the best you can do would be an interval update
what I do personally is update the state first, and then at the same time execute an async call to update the database
that way the bot has access to the data even if it's still being written
Hi, I'd like help to make a rather complex system: Make sure that when someone sends a private message to my bot, I receive it on a show from a specific server. And then, since this show, I can answer him as a BOT.
can some one help me with this issue?
i'm updating my bot with some music commands. the dispatcher does not emit the "finish" event, the bot just go mute and don't play the next queued music.
the 'play' function is this one:
bot.channels.get(data.queue[0].announceChannel).send(`Tocando agora: ${data.queue[0].songTitle} | Requisitado por: ${data.queue[0].requester}`);
data.dispatcher = await data.connection.playStream(ytdl(data.queue[0].url, { filter: 'audioonly' }));
data.dispatcher.guildID = data.guildID;
data.dispatcher.once('finish', function() {
finish(bot, ops, this);
});
}```
data.dispatcher.on('end', async function() {
});
pretty sure it's only finish on master, otherwise end on stable
Yeah, I used it ages ago and was finish but then stopped working and end started working.
thanks a lot @warm marsh
No worries.
'
how do i track who voted on my bot?
Use DBL's webhook. https://discordbots.org/api/docs#webhooks
For questions regarding it head to #topgg-api
Let's say I wanted to make an ide
Is it better to use tkinter like idle does or electron so I can do html?
i have used tkinter and hated it
Use qt, qt
Ok thanks
Really though, heard a lot of good things about Qt
Haven't really used it myself yet but looks pretty good
I'm getting Error 504 and Error 522
@quartz kindle sqlite3
Why don't you make it hey then your bot name
e.g. my bot's called Paradox, prefix: hey Paradox
or use mention prefix
I know, I gave you an answer.
Yeah
Sure it can if it's an actual prefix
Parse the channel from the parameter
Call the delete method or something
hey
would anyone possibly know of the code for .role (role) (user)
to assign a role to a user
what lib
We don't spoonfeed code
If you know how to code, then you'll know how to make that command.
Check the docs for the library.
spoonfeeding directly solves an issue
For that scenario the proper code to give would be for how to add a role to a user, without adhering to the command format .role (role) (user)
In D.js for example you could say "hey use GuildMember.addRole()", and that would be the non-spoonfeed answer
yeah
Well the docs provide example code
There's example code right there
s
anyone know how to blur an image with canvas
@broken shale ctx.filter?
Yes, blur uses gaussian blur and applies the given pixel length to blur into each other.
It's not blurring at all 
Iirc yes
Because you're not doing it right.
Then how's it done? @drowsy sentinel Sorry for ping :c
How can I do that if I don't have any code to work with.
I gotta see what you're trying to do.
const canvas = Canvas.createCanvas(500, 500);
const ctx = canvas.getContext('2d');
const background = await Canvas.loadImage('./assets/Sprites/Images/Tombstone.png');
ctx.drawImage(background, 0, 0, canvas.width, canvas.height);
const avatar = await Canvas.loadImage(msg.author.displayAvatarURL);
ctx.drawImage(avatar, 120, 200, 200, 200);```
blur avatar (msg.author.displayAvatarURL)
Did you try blurring before drawing avatar. ๐
yes?
Yes
const background = await Canvas.loadImage('./assets/Sprites/Images/Tombstone.png');
ctx.drawImage(background, 0, 0, canvas.width, canvas.height);
const avatar = await Canvas.loadImage(msg.author.displayAvatarURL);
ctx.filter = "blur(500000000px)"
ctx.drawImage(avatar, 120, 200, 200, 200);```
...
The Gaussian function will take how many pixels on the screen to blend into each other.
So tell me how 500000000px would work?
idk how many pixels
Move it down to 5px and try again.
Then up it to 10px, 15px, 20px.
Nope >:(
anybody got suggestions on why this would happen?
3|yt | at Timeout.setTimeout [as _onTimeout] (/home/tony/youtube/node_modules/discord.js/src/sharding/Shard.js:137:31)
3|yt | at ontimeout (timers.js:436:11)
3|yt | at tryOnTimeout (timers.js:300:5)
3|yt | at listOnTimeout (timers.js:263:5)
3|yt | at Timer.processTimers (timers.js:223:10) [Symbol(code)]: 'SHARDING_READY_TIMEOUT' }
(discord.js master/v12)
any ideas on why my modmail bot wont respond to any commands, yet it does when i dm it?
check if it only responds to dms
Paste your code here at least
thats js if i recall
mhm
@ember atlas go to the bot's support server
?
you know theres a py one you can use
its a self hosted bot?
it has all instructions for selfhost
and yes, i prefer dragorys.
oh ok
@broken shale listen, its online, just only responds to dms
and i was wondering if anyone has ever had an issue with that b4
just use the one thats hosted on someones vps thats in dbl
or use the python one
its a lot easier
^
so my excuse is run away from it?
I already setup the self-hosting, just the first time its ever not responded to commands
theres the python one
And I have tried that one, but ty anyways
const canvas = Canvas.createCanvas(w, h);
const ctx = canvas.getContext('2d');
load background
draw background
load avatar
apply filter
draw avatar
so what i should do is run away to a shit modmail bot?
what
Shouldn't be calling it shit if it works better than yours
you all are saying use kybers
You realize i didnt code it right?
ok
Then why are you even in #development
lol
to see if anyone has ever had this issue b4
well nobody has coded it here
Go to dragory's support server
he doesnt even have one.
Dragory's one uses sqlite
ill go somewhere else, peace
whats ur question anywayss
I've never used sqlite
@broken shale What's your background image?
My avatarURL
trying it out now
@drowsy sentinel Background has to be loaded first
since it's the base
Just a quick question
or apply blur to bg is better
Looks fine to me.
fine != good
It's good mate.
Hello! Trying to get this bot to post random gifs off of discord's tenor, Do I have to go and download Tenor's API? or is there something in discord that I can already access to do this? I would go look at the Go library on the website but the Github link is down.
Can anyone help me with discord.js
Like i say hey
Bot replys with hey @slow crypt
What is the code for that?
const spoonfeeding = we.dont.spoonFeed('here');
Fear#7005 You can do so with a message event in your main bot file
Simply detect it the message content is โheyโ
You can use the message.channel.send function to make the bot reply
@slow crypt Do you want it to tag?
It will tag?
Yes
It look will look like this
@slow crypt, hey
Yes
How
@slow crypt
client.on('message', message => {
if(message.content === "hey")
{
return message.channel.send(`Hey, ${message.author}`)
}
});
message.channel.send('Hey, <@${message.author.id}>')
message.author doesn't tag @nocturne hazel
Yes it does
ew
what
We dont spoonfeed
@hybrid ruin yo where'd you get the styling for this?
looks fancy
How can i check if the rights to read messages in the channel discord.js
@proper inlet for the bot or for a user?
<Member>.hasPermission
Thx
<channel>.memberPermissions(<member>).has("READ_MESSAGE_HISTORY")
^ for a specific channel
I want to add my bot to this server, but I don't know how to add it, can you help?
<Message>.guild.me @proper inlet
thanks
Thank you very much
I've been waiting a day, do you have any idea how long I'm gonna wait?
A while. Have patience.
I don't have cooldowns





