#development
1 messages · Page 1393 of 1
lemme check
Could honestly make the hovers go below
.tooltip .tooltip-text
opacity: 0
text-align: center
padding: 2px 6px
position: absolute
z-index: 100
.tooltip:hover .tooltip-text
opacity: 1
maybe its because of that z-index there
lol
never noticed i had it
my bot is like my and my gfs child @ocean cedar
nope removed that and it didnt fix it but that's the tooltip code
😅
try giving them a negative zindex
so like z-index: -1 or
the world needs more people like you, really appreciated it man
ye
didn't work
the world needs more people like you, really appreciated it man
@ocean cedar I hope so 😊
they still seem to overlap the search box
goodnight
they are probably behind the background now
the negative z-index stops them from showing
yeah
so it needs a slight z-index
i think
and then try to give the search box more
check if you find a z-index value that works, if not, try giving the search bar position:relative (if it doesnt have position) and a z-index higher than them
so give the tooltips z-index: 1 and the search bar z-index: 2
is that public or localhost only?
localhost only as it's just an index.html file with some assets
ah
does .tooltip have position:relative?
position absolute
i think
it's kinda weird how im doing it but it works
<p class="tooltip">
<button class="bg-indigo-300 bg-opacity-25 hover:bg-indigo-200 hover:bg-opacity-50 text-white pl-2 pr-2 pt-1 pb-1 rounded transition duration-300 ease-in-out">
<img src="https://icongr.am/jam/grid.svg?size=24&color=ffffff" />
</button>
<span class='tooltip-text bg-indigo-200 bg-opacity-50 text-white p-3 rounded bt2 transition duration-500 ease-in-out'>Switch collections</span>
</p>
hard to say without seeing it =P
i can send you the code
one option would be to make the search bar position:absolute
it's just kinda messy
but that will likely screw something up
just added that
doesnt break it
but same issue, doesn't stop the tooltips
lemme dm you
is there a way for me to somehow detect and continue a timeout after a bot restart in javascript?
nope
you need to save some kind of status in a file or database
and have the bot read it and restart the timeout if needed
oh ok then, is there a way for me to reload the entire bot without interfering with those timeouts?
run them on another process possibly
but that can get messy
define "reload"
just reloading commands or events and all
ok thanks i think i will just make my bot save the remaining time when restarting
because reloading is basically impossible for me because of the writing behind my bot
yeh but... (invite) bottoms has their name on css
sorry if I am bad
I dont know too much of css
~~<
Anybody use discord-paginationembed?
@sterile ridge Es simple 
I need help changing the addField values.
@sterile ridge Es simple :Felix_cool_FB:
@ionic dawn aaahhh
Anybody use discord-paginationembed?
you almost made me happy af
thx
you almost made me happy af
@lyric mountain WYM?
Hey I don't know if this fits in this category but I am just wondering where I can host my Discord Bot for free or pretty cheap, I have tried Heroku but since my bot sends a lot of messages (I think about 50k each day, don't ask) it stopped running it.
I have published a lib called pagination-utils for java
I code in JavaScript
@orchid flare Yes its possible, especially for cheap, go to IcedHost LLC, for 2.99 a month you get pretty decent stats.
Hey I don't know if this fits in this category but I am just wondering where I can host my Discord Bot for free or pretty cheap, I have tried Heroku but since my bot sends a lot of messages (I think about 50k each day, don't ask) it stopped running it.
@orchid flare use either glitch or repl both are great
Use a .env file
not if you use environment variables
@lyric mountain Is it possible that its easier to use?
do you guys know of any tutorials for that then? im new
no, not at all since javascript != java
But if your bot is responding to 50k commands, I would recommend you go with more dedicated hosting.
but yeah, I made it as minimal as possible while leaving enough room for customization
if you ever come to java make sure to give it a look
although I'm struggling to properly publish it at maven central
Time to make pagination-utils for js
exports.paginate = (inp, maxlength) => ((a,b)=>Array.from({length:Math.ceil(a.length/b)},(e,r)=>a.slice(r*b,r*b+b)))(inp, maxlength);
That isn't quite pagination but still a pretty useful function
I just don't know how to paginate and could use a little help if at all possible
Well
((a,b)=>Array.from({length:Math.ceil(a.length/b)},(e,r)=>a.slice(rb,rb+b)))(text, 2000)
exampleChannel.sendMessage((Message) pages.get(0).getContent()).queue(success -> {
//Pagination-Utils is just this line below
Pages.paginate(success, pages, 60, TimeUnit.SECONDS);
});
not if you use environment variables
im not quite sure how to use enviroment variables, I just realized my bot token is stored in settings.json (I realized cause I am using DBM, dont judge)
iirc that function is meant for something else with arrays but if you pass in a single string it'll split it up into an array of strings of max legth
Similar to that. There's a npm module called dotenv
Oh and this is probably a noob question, how would I go about stopping my Discord.Js project.
Yeah
If you're executing it via terminal, just ctrl + c
If on heroku just turn off the dyno switch
thanks!
I'm writing an app and I need to include a bundle identifier so I have a unique ID. The recommended convention is to use reverse domain name notation, which transforms site.com to com.site, but I don't have a site (nor do I need one) to base it off. What could I use in replace for com.site?
For reference, think of Apple's bundle identifier (com.site.app) and Java's groupId/base package identifiers. I currently have it set to com.example.lite, but I should need something to replace com.example.
Is there a way to create a file that holds message embeds to reference for use?
@sudden geyser where is it hosted?
Like , the source code
If it's on github, u can use com.github.username
but that would imply the company is github. Shouldn't it be a bit more distinct?
and there's no guarantee I don't change it
It already is distinct enough
hmm
Because u include the username there
Pretty much all github projects use that format
Including mine which got approved by sonatype for an official repo in maven central
So I guess you're free to use github domain for that purpose
I guess the same applies for bitbucket and other source code repos
sorry if this is the wrong channel for this, but does anyone know if it is still possible to have someone else verify your bot for you? provided you move it to a team with them added ofc
@lyric mountain sorry to bug again, but my nickname on GitHub is LiteLT instead of Lite. So I should set the identifier to com.github.litelt, correct?
Exactly how it's written in the url
alright, ty again
Trying to make bot.js file private like you do with a bot token in .env file
Is this possible?
I recently got my bot on top.gg, and after I added the listener for votes, my bot didn't work anymore, even though I followed exactly how the API docs has it set up. Can someone assist me?
My error
dbl.webhook.on('vote', vote => {
^
TypeError: Cannot read property 'on' of undefined
at Object.<anonymous> (/home/ec2-user/impassive/tic-tac-toe/index.js:25:13)
at Module._compile (node:internal/modules/cjs/loader:1083:30)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1112:10)
at Module.load (node:internal/modules/cjs/loader:948:32)
at Function.Module._load (node:internal/modules/cjs/loader:789:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:72:12)
at node:internal/main/run_main_module:17:47
Anyone know how to fix this error?
UnhandledPromiseRejectionWarning: MongoError: Sort exceeded memory limit of 104857600 bytes, but did not opt in to external sorting.
It's related to monog db. A command works on one server, but does not work on another.
@boreal flume i think its because there isnt a webhook on your dbl
you gotta provide either a port or a server for the webhook to listen on
I found the issue.... I may have skimmed over an important part of the docs that initializes the webhook lol
oh lmao
So how much days will it take to get it approved?
pls help me ``` const user = client.users.cache.get(args[0]) || message.mentions.users.last() || message.author;
const guildUser = message.guild.member(user);
let adminperms;
if(guildUser.hasPermissions('ADMINISTRATOR')){ ``` return ```guildUser.hasPermissions is not a function```
message.member is a thing
message.member.hasPermission('ADMINISTRATOR')```
And it is hasPermission no s
checking for single perm not multiple
Trying to make bot.js file private like you do with a bot token in .env file because I want to host my bot with repl.it since I had a reccomendation but I have to pay to make my project private but I don't want to make my project open-source , so I thought I could just put my code in a .env file and then people wouldn'ty see it but it will still work on repl.it
@blissful coral what if i have to check mention user perms ?
You can shorten your code to const guildUser = message.guild.members.cache.get(args[0]) || message.mentions.members.last() || message.member;
Any suggestions then?
hasPermission() supports array where you can provide multiple permissions
- OVH: https://www.ovh.com/us/vps/
Starting at $3.35/mo for 1 core, 2GB RAM, 20GB SSD- DigitalOcean: https://www.digitalocean.com/
Starting at $5/mo for 1 core, 1GB RAM, 25GB SSD- Linode: https://www.linode.com/
Starting at $5/mo for 1 core, 1GB RAM, 25GB SSD- Vultr: https://www.vultr.com/
Starting at $2.50/mo for 1 core, 512MB RAM, 10GB SSD- Amazon(AWS) Lightsail: https://amazonlightsail.com/
Starting at $3.50/mo (first month free) for 1 core, 512MB RAM, 20GB SSD- Time4VPS: https://www.time4vps.eu/
Starting at €3.99/month for 1 core, 2GB RAM, 20GB SSD- VIRMACH: https://virmach.com/
Full Windows and Linux Desktop VPS starting at $7/mo and $1/mo respectivelyℹ️ This is a list of hosting providers, not a backing/support for them. You will need to make your own decision. All $dollar prices are in USD.
@blissful coral
i have 1.5$ vps for 3 months
Thanks
but only 500mb ram
You can get a free VPS that has like 350mb of ram with no root access on Library of Code
Good for testing
Should tell me the name 👀
@pale vessel link pls
How do u use that?
@orchid flare you buy it ?
Yeah
Ah you're talking about WitherHosting
Is it good?
@orchid flare yea
Voltrex also uses WitherHosting iirc
you know cedar ? owner of cosmic bot list ..
hi
cedarblocks
Ah, yeah
@orchid flare dm me ill tel you
Tel?
Hmmmmmmm
he gift me witherhosting vps 😆
Alright
May you use grammar correctly?
what is grammer
lmao
._.
Did u go to school?
Bruh
Ask google for the answer
lmao i am soo struggling making a music commands
let me try again
The presence of users and the total number of members are not working, is it because I did not activate the intents? If so, how do I activate?
My bot has already been checked and the options are blocked.
is it because I did not activate the intents?
Yes.
You could contact Discord asking for the intents, but I doubt they'd accept it.
They won't gave for privileged intents for cases like " userinfo"
Member chunking etc
Please stop judging people thanks
Ah ok
@earnest phoenix maybe you still have the Manage_messages message there
check the bot for yourself
maybe you're trying to delete the fire command
the command that executed the message
No, I already checked my code and the poor thing and it does not ask for it
For that reason I resubmitted the bot for review
Did you ask the corresponding moderator? maybe they can tell you what command they used and what the response was
Was that
But I check the code and it doesn't ask for permission
The only permission it asks for is to send messages
can you DM Alex D. later? https://cdn.hopefuls.de/ltSn
Since they declined your bot, they can tell you more about it.
Maybe it was a false decline, that can also happen, nobody is perfect
Or maybe you're just missing something very obvious, everything can happen
Or maybe you're just missing something very obvious, everything can happen
@rustic nova I don't think so, the command only asks for the permissions that are in the capture array, nothing more, within the command code, no individual permissions are verified
Maybe it was a false decline, that can also happen, nobody is perfect
@rustic nova I will ask him, because I don't know what to fix if everything seems fine
try removing every single permission from your bot except send_message
and see if you get any error
but i assume you did that already
It works as it should, it does not ask for permission to manage messages, as you can see there is no error, and the message is sent by dm
How do you see at no time am I asking for that permission
Yeah contact Alex then later when he's online. They will explain why it didn't work then
Yes, I will, because I have no idea what to correct if everything is fine
maybe they read this part and thought the bot was asking for manage_messages perms https://cdn.hopefuls.de/V3AU
Yes, if he does not have that permission, he will send it to you by private message, because if you grant it in the same channel, he will make an embed page
But I am not asking for that permission on a mandatory basis
yeah a misunderstanding then, contact them later 
I will do that, thank you

I am creating a bot using mysql. The database contains data as shown in the photo, but the last two digits of the data acquired by the select command have been replaced with 0. How can I cure this?
connection.query("SELECT id FROM user WHERE joinchannel = " +message.channel.id,(error,results) => {console.log(result)})
// result of console.log [ RowDataPacket { id: 661793849001246700 } ]
@rustic nova, Do you know how to contact him? I can't find it on the server
i don't want to ping them though, give me a second
dm them through their last message
Thank you, I appreciate your time

How would you go about (in nodejs) setting it up so that you can run a block of code on a set time scale so it would run every two minutes.
How would you go about (in nodejs) setting it up so that you can run a block of code on a set time scale so it would run every two minutes.
@uncut vortex Excuse me for mentioning ... Can't you do what you want to do? (I'm sorry if You've already tried this)
const cron = require("node-cron");
cron.schedule("* */2 * * * *", () => {
//Write here what you want to do every 2 minutes
});
I haven't tried anything. I didn't even know where to start looking so I asked.
Besides the above method, you can also use "setinterval".
need a help
Who needed help I dont mean code :)
https://scs.twilightgamez.net/iFGjr.png
i wanna make something like this but how?
@earnest rivet use the webhook system and then count 86400000/2 after, and then send the reminder
You can just use setTimeout or a schedule thingy
ok
so theres a website here https://brawldb.com/player/stats/38449685
and i want to webscrape the number 1714 next to ELO.
i am using cheerio to webscrape but am not quite sure how to make this work lol
can somebody help me with that? thanks lol
my bot is written in .js
Brawlhalla stats
Does anyone know a solution to this?
#development message
Give it an ID
@pure lion mind if i ask how this works lol im newer to js
Sorry lad I don't know SQL (@earnest phoenix)
@royal crescent the element, give it an ID
Unless it's not your site
That's fine
hi
@royal crescent you wanna fetch that webpage with node-fetch and then pass in the fetch.text() to cheerio
Once you do that I'll help you with scraping
but doing stuff in the terminal is WAYYY harder than doing stuff in DOM cuz we have things like buttons
no idea what that means but i shall do my research
so should i use a normal HTML page or go nuts tryna do it in the terminal
thanks lol if i figure out how to do that ill ping u in the morning
i want to make my bal command async, but i dont know how to make it async in this command handler
module.exports= {
name: 'bal',
description: "see your bal",
execute(message, args){
const Discord = require('discord.js');
let user = message.author;
let bal = await db.fetch(`money_${message.guild.id}_${user.id}`);
if(bal === null) bal = 0;
const balembed = new Discord.MessageEmbed()
.setTitle(`${message.author.username}'s balance`)
.setColor("GREEN")
.setDescription(`${bal} coins`)
.setTimestamp()
message.channel.send(balembed)
}
}
@tardy hornet sqlite3?
@tardy hornet make the execute command async ig
i tried
async execute(...) {}
Piggus
Also you don't need to do that asynchronously
Also you don't need to pass in a string or not use .'s
@pure lion are you talking about this node-fetch https://github.com/node-fetch/node-fetch ?
aight thanks
so like that:
didnt work
Also update your quick.db, you don't need to use underscores any more
What's the error?
Show me your new code
module.exports= {
name: 'bal',
description: "see your bal",
async execute(message, args){
const Discord = require('discord.js');
let user = message.author;
let bal = await db.fetch(`money_${message.guild.id}_${user.id}`);
if(bal === null) bal = 0;
const balembed = new Discord.MessageEmbed()
.setTitle(`${message.author.username}'s balance`)
.setColor("GREEN")
.setDescription(`${bal} coins`)
.setTimestamp()
message.channel.send(balembed)
}
}

does chalk have a client-side version
no the noodle javascript moodule
When you say client side do you mean DOM or discord?
@pure lion what makes you think discord
Tic
Hi
is there any endpoint to check the user's custom status?
Yeah
oh any docs on that?
i meant can i use it on DOM objects to change the color and background-color CSS properties
why are you sending them to the dev portal
My bot glitches when there's code in the deleted message logs lol 😅
discord.js already has it built-in
u mean the discord.js.org lmao
User#presence iirc
ye but that returns online,offline or dnd only righ?
tho you'll need to go to the dev portal anyway to enable presence intent
ye but that returns online,offline or dnd only righ?
@ivory seal there are more
ah ok
playing status custom status spotify status playing status streaming status watching status
that clarigied my doubt
the whole list
why are you sending them to the dev portal
They didn't say a lib so I sent them to the general dAPI docs
plus DND, online, offline and idle
invisible mode appears offline to everyone
Error: Cannot find module 'quick.db'
Require stack:
- C:\Users\rsama\economybot\commands\balance.js
- C:\Users\rsama\economybot\index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
Help!
im getting this error
i installed duick.db thought
though
@pulsar perch quick.db is not installed in the node_modules of the current folder
try re-installing the package with -g parameter if your host allows
You need windows build tools
Or just build tools
@pure lion they said they successfully installed it
@pulsar perch no
npm i quick.db -g
@pulsar perch yes
module.exports= {
name: 'weekly',
description: "get weekly money",
execute(message, args){
const db = require("quick.db");
const Discord = require('discord.js');
let user3 = message.author;
let timeout2 = 604800000;
let amount3 = 2500
let weekly = db.fetch(`weekly_${message.guild.id}_${user3.id}`);
if(weekly !== null && timeout2 - (Date.now() - weekly) > 0){
let time = ms(timeout2 - (Date.now() - weekly));
return message.channel.send(`you've already collected your weekly award. Come back in ${time.days}d, ${time.hours}h, ${time.minutes}m, ${time.seconds}s`)
} else {
db.add(`money_${message.guild.id}_${user3.id}`, amount3);
db.set(`weekly_${message.guild.id}_${user3.id}`, Date.now());
const weeklyembed = new Discord.MessageEmbed()
.setTitle(`Successfully added ${amount3} coins to your balance`)
.setColor("GREEN")
message.channel.send(weeklyembed)
}
}
}
``` for some reason it send the balance command as well
You don't need to globally isntall
they need to require the package in a folder where it isn't available
save space by just installing it globally and using it wherever needed
h
im gonna try it
i
lol
So I'm currently using nodejs's PassThrough readable class for guild streaming, in which I am piping a mp3 file chunk by chunk into the buffer, then outputting that in a livestream via express- to safe myself memory, after each chunk is output in the stream, I drain the streams buffer
I noticed that after around .5 million chunks written, the nodejs drain function stops operating properly- even if the buffer size is at the highWaterMark when drain is emitted - anyone possibly know why that may be
example code:
trackStream.pipe(throttle).on('data', (chunk) => {
radio.streams[0].write(chunk)
radio.streams[0].emit("drain")
})
this has worked well so far, till now, not sure what's up
I also tried calling drain after the "end" event is emitted from the track piping, and it still results in it eventually stopping
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module 'quick.db'
Require stack:
- C:\Users\rsa
I was only able to find 1 similar case on stackoverflow, from 2 years ago, and it was never answered lol
Help!

ig just cd to your commands folder and install it normally without -g
ok
better-sqlite3@7.1.1 install C:\Users\rsama\economybot\node_modules\better-sqlite3
prebuild-install || npm run build-release
prebuild-install WARN install No prebuilt binaries found (target=14.15.0 runtime=node arch=x64 libc= platform=win32)
better-sqlite3@7.1.1 build-release C:\Users\rsama\economybot\node_modules\better-sqlite3
node-gyp rebuild --release
C:\Users\rsama\economybot\node_modules\better-sqlite3>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild --release ) else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild --release )
Is this like normal?
that sthe whole error
do you not know how to read
No
you'll need to compile it not just install it
there isn't a compiled format to install/use for your os

ok so i think i found a solution to my issue, so im posting it here incase anyone searches for it down the line
basically, even if you emit the drain event, if you happen to be writing data in a nextTick format, it will ignore it
F
therefore, calling .cork() on the write stream to block new data from flowing, piping the data, then using .uncork() will have passed your data to the stream, but then flushes the buffer
meaning no memory leak, and it does the same thing
node is weird ¯_(ツ)_/¯
also make sure to uncork the same amount of times you corked, or data won't begin to flow again
cork uncork wtf's that
https://nodejs.org/api/stream.html#stream_writable_cork @earnest phoenix
an update- my solution works- the unit test passed 👏
what are streams
well its basically a continual flow of data from a file in chunks
Or a flow of chunks from another stream, streamception
k
where is the Discord API? country?
thanks
Poland is good localization for host discord bot?
Hi, I'm making a tempmute command and there's a problem. I use ms for my tempmute but whenever I type a invalid time like 12sdho, my bot instead reply sth like: I've muted user A for 0 Seconds. - How do I fix if user typed the wrong time format??
Hey, im using npm and whenever i want to install modules it installs it into "C:\Users\XXXX\AppData\Roaming\npm\node_modules"
and its also the prefix no matter from when im running "npm config prefix" I still gets this directory, how to make it so the prefix will be the closest parent directory for node_modules ?
@steep sun use isNaN (is not an number, in js)
@vagrant bison Poland should be fine, as long as its a good hosting provider
@earnest phoenix Can you try to explain it a other way?
Since I dont get you
im in: "C:\Users\XXX\OneDrive\Desktop\bots\test-bot"
and I did "npm install"
Yes
to install dependencies from package.json
but its installing it to "C:\Users\XXXX\AppData\Roaming\npm\node_modules"
Did you do npm init ?
instead of "C:\Users\XXX\OneDrive\Desktop\bots\test-bot\node_modules"
ye
@steep sun use isNaN (is not an number, in js)
@earnest phoenix Will I be able to enter10mstands for 10 minutes,3wstands for 3 weeks?
@vagrant bison Poland should be fine, as long as its a good hosting provider
@earnest phoenix Canada or Poland is better for hosting dbot?
@steep sun No you won't I think
I built my own package.json with the needed content
@vagrant bison I would say, canada but I'm not sure
okey
You'd have to manually convert those to appropriate operations and possibly evaluate
@steep sun No you won't I think
@earnest phoenix Technically I need the format: s, d, m, h, w for my tempmute. But when I do like :1hfeios, it return as 0 Seconds
Maybe find a way to ignore the last arg
You'd have to manually convert those to appropriate operations and possibly evaluate
Could be done via regex
I have a problem with my bot and I dont know how to fix it. My bot now only replies to messages after 2 mins+ and not within a few seconds. Does anyone have any idea why?
Can someone please tell how to make a logger type of thing which welcomes users and sends the welcome message to the channel where it's logged
finnaly i made hastebin command lol
discord.js
About #development message. Was self resolved. Thank you very much!
Can someone please tell how to make a logger type of thing which welcomes users and sends the welcome message to the channel where it's logged
@sick fable on_member_join and on_member_remove
server admins configure a channel (ID of a channel) that you then use to get a text channel object and send a message to
wdym custom channel
server admins configure a channel (ID of a channel) that you then use to get a text channel object and send a message to
Ok lol i gotchu
(node:8632) UnhandledPromiseRejectionWarning: DiscordAPIError: Two factor is required for this operation
what it means
@unborn ridge the server the bot is in has enabled the 2 factors requirment to have power. So no one can do any moderation action before the user has enabled 2FA and (in your case) the owner of the bot should have 2FA
I have a problem with my bot and I dont know how to fix it. My bot now only replies to messages after 2 mins+ and not within a few seconds. Does anyone have any idea why?
@river wing does anyone have any idea why
@river wing your bot has a high latency
its maybe rate-limited
Can I pass an express app object to socket.io straight:
const express = require("express");
const app = express();
const io = require("socket.io")(app);
Instead of passing it into a classic node.js HTTP server then passing that server into socket.io:
const express = require("express");
const app = express();
const server = require("http").createServer(app);
const io = require("socket.io")(server);
The examples on socket.io's website all do the classic HTTP server method with some express.js sauce (yeah)
@quartz kindle halp
how do i check the rate-limited issues? @earnest phoenix
@river wing add this:
console.log("Rate limited")
})```
would it be or something
it doesnt show rate limited
hi, I wanna ask. I'm using discord.py and how to get an image that sender sent and save it to server? is it possible?
aiohttp
Get the attachment's URL, send a GET request to it and save the received bytes
to save the image into a file, open() a file with rb mode
does anyone have any alternatives for cooldown managements? right now im running a database stored with the cooldown values of individual players and every second remove 1 from each component and i think its lagging my bot out.
I dont use a database, I just use a map.
I store the expiration time and compare it to the current time. If the current time is higher than the expire time they are no longer on cooldown.
in that case are u able to tell the remaining time left for the cooldown
aiohttp
Get the attachment's URL, send a GET request to it and save the received bytes
@slender thistle ok thanks, solved 👍
Yes, its just the expiration time minus the current time.
does map reset on every restart?
Usually you don't need a database for command cooldowns
Yes, which if you need it to work between restarts then use a db.
But I would cache that data
In a map
Or any caching method
I also have a db for my week long cooldown commands
so if you are using a db you store the expiration time?
I store the submission time I think for the longer times, but it doesn't really matter if you know the length of the cooldown.
If you are using a db, most also can auto remove entries once they get too old, which is how I clear my cooldown db.
im using mongodb rn with cooldowns
if your cooldowns are like 5-10 seconds, you dont need a db
^
Since by the time the bot restarts its already over.
Even a few minutes not really needed.
mapping is actually pretty easy as soon as you get how it works
I thought it was kinda hard at first
but after understanding, I can now use is more frequently in situations like that
fun fact
every object in js is just actually a map lol
well, they have differences from maps internally
but they behave the same
Well, regular js objects can only hold strings as keys, but the Map class can hold any type as key
Hello, help me
I want to install discord-canvas, it gives an error

Pls Help Me😭
@earnest phoenix show the error
send a PrtScn
So when djs14 will be released?? 😆
@earnest phoenix which command did u use to install?
So when djs14 will be released?? 😆
@rocky hearth dunno
sometime after 13 @rocky hearth
u need to install it globally
@solemn latch Nah djs13 will never be released
Only the node even versions are the main versions
going the windows 9 route?
@earnest phoenix npm i -g node-canvas
ok Pls Wait iam Ts
t
root@bbzo:~/discordbot/bot/A# npm i -g node-canvas
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/node-canvas - Not found
npm ERR! 404
npm ERR! 404 'node-canvas@*' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-11-18T11_59_12_130Z-debug.log
wait a sec.
Okk
@earnest phoenix Show ur package.json
@earnest phoenix run npm i -g canvas
@rocky hearth doesnt need, theres no node-canvas registed, cuz it's called just canvas
@rocky hearth
"name": "Cranly",
"version": "1.0.0",
"description": "Elite Cranly",
"main": "index.js",
"scripts": {
"test": "node index.js"
},
"repository": {
"type": "git",
"url": "https://persiangames98.ir/"
},
"keywords": [
"Cranly",
"bot",
"Cranly",
"example"
],
"author": "Androz2091",
"license": "ISC",
"bugs": {
"url": "https://persiangames98.ir/"
},
"homepage": "https://persiangames98.ir/",
"dependencies": {
"@vitalets/google-translate-api": "^4.0.0",
"audit": "^0.0.6",
"axios": "^0.21.0",
"binding": "^3.0.3",
"build": "^0.1.4",
"chalk": "^4.1.0",
"cheerio": "^1.0.0-rc.3",
"common-tags": "^1.8.0",
"convas": "^2.0.0",
"discord-giveaways": "^4.2.1",
"discord.js": "^12.4.1",
"fix": "^0.0.3",
"fortnite": "^4.3.2",
"get-json": "^1.0.1",
"giphy-api": "^2.0.1",
"google-translate-api": "^2.0.3",
"install": "^0.13.0",
"js-beautify": "^1.13.0",
"moment": "^2.29.1",
"ms": "^2.1.2",
"nekos.life": "^2.0.7",
"node-fetch": "^2.6.1",
"node-gyp": "^7.1.2",
"node-pre-gyp": "^0.16.0",
"novelcovid": "^3.0.0",
"npm": "^7.0.12",
"parse": "^2.18.0",
"quick.db": "^7.1.3",
"request": "^2.88.2",
"simple-youtube-api": "^5.2.1",
"snekfetch": "^4.0.4",
"soundcloud-downloader": "^0.2.0",
"sqlite": "^4.0.17",
"steamrep": "^1.0.1",
"string-progressbar": "^1.0.1",
"uglify-js": "^1.3.5",
"weather-js": "^2.0.0",
"wokcommands": "^1.0.1",
"yo-mamma": "^1.3.0",
"ytdl-core-discord": "^1.2.4"
}
}
I checked the repo
@earnest phoenix run
npm i -g canvas
@outer perch Pls wait Me Test
convas???
Erorr
follow this guide
just do the Install Manually guide
Ok
Thaks
erorr :/
try clearing your cache
how ?
whereyouinstallnpm\Users\urmainuser\AppData\Roaming\npm-cache delete the npm cache folder
@earnest phoenix
Ok Wait Pls

@pseudo wadi erorr Again
what error

I'm unlucky
@earnest phoenix where are you hosting?
did you install the required dependencies?
Yes
this?
sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev
Yes
@earnest phoenix which linux are you using? ubuntu?
let res = await afetch("https://nycpokemap.com/raids.php?time=" + new Date().valueOf())
let data = await res.json();
const getName = id => nameList.filter(el => el.i === id)[0].n;
let raids = data.raids.filter(raid => getName(raid.pokemon_id).toLowerCase() === options.name.toLowerCase() && raid.level >= (options.level ? options.level : 5))
const reactionEmoji1 = message.guild.emojis.cache.find(emoji => emoji.name === 'valor');
const reactionEmoji2 = message.guild.emojis.cache.find(emoji => emoji.name === 'mystic');
const reactionEmoji3 = message.guild.emojis.cache.find(emoji => emoji.name === 'instinct');
if (timer !== null)
{
clearInterval(timer)
}``` TypeError: Cannot read property 'toLowerCase' of undefined
my whole code:
i have no clue why it is undefined?
where do you have it?
line 52 is the error
which line is line 52?
oh nvm
you pasted it
getName(raid.pokemon_id) or options.name might be undefined
why is is that?
i clearly defined everything
and i am pulling the external info (raid.pokemon_id) etc from a site (nycpokemap)
@earnest phoenix are you sure you installed the dependencies correctly? that error usually happens when they are missing
try installing them again
sudo apt install build-essential libcairo2-dev libpango1.0-dev
then restart the machine just in case
if it still doesnt work, try using node 14 instead of node 15
sudo apt install build-essential libcairo2-dev libpango1.0-dev
@quartz kindle iam installed Error 404
error 404?
?
uh huh whats the problem
wdym by get the command?
this may be simple but i juss woke up lol
ok
any errors in the console?
do you have code that reads the file?
u need a command handler that reads your files in said folder
so like e.g= i have a folder called commands and the handler reads the files
ok..
@earnest phoenix r u usin Discord.JS?
k
@pseudo wadi r u usin Discord.JS?
@outer perch yes its not my problem tho
can i send iv or no
@earnest phoenix yes
wrong tag xD
await ctx.guild.add_roles(ctx.author, role)```
alr whats wrong with this
simple code
@slender thistle
ur python god

Frozen in time as we both close our eyes and dance
I know I’ve been wasting my whole life just waiting for you
okay what
oh
Oh
use add_roles on ctx.author
hello just wanna ask
ah
what's the proper cooldown between commands
thank youu
to avoid being rate limited
Usually you'd just let your library handle ratelimits
which is a minute
Users spamming commands isn't exactly a thing you should be worried about unless those commands are resource-heavy
also shiv what u mean use add_role on ctx.author
i replace ctx.author with add_role

my cooldown commands are 2 seconds

sometimes the bot lags
you do member.add_roles(role)
ctx.author is Member when a command is used in a server
k it worked
yeah i never work with role creating and deleting
and for delete role
i just do delete_role
await ctx.guild.delete_role(name=".")
nice
kk lmao
You use https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild.get_role to get a role object and call .delete on the returned object
unless None was returned
sometimes the bot lags
@earnest phoenix make ur cooldowns asynchronous
well it didn't work so lemme read
You can use CSS in the long description
@sudden geyser yes but how do i know which elements to edit
You can use inspect element. I've rarely worked with HTML & CSS myself.
alrighty thanks
so i want to mute my friend in voice channel
so this is what i have
`module.exports = {
name: 'talovic',
description: "this is a talovic command!",
execute(message, args){
if (!message.member.hasPermission('MUTE_MEMBERS')) {
return message.channel.send(You cant use this command! 🔒)
}
let talovic = '482183229571334176'
talovic.voice.setMute(true);
}}`
and it sends error
TypeError: Cannot read property 'setMute' of undefined
should a say command requier some sort of permission or should everyone be alowed to use it?
Hello,
I have a question regarding a website dashboard. My shards cache stats info and guild settings in memory. Now when someone changes stuff via the website dashboard, the corresponding values can easily be changed in the underlying remote databases, but the actual shard is then still running with the old settings in cache. What is the best way of letting the correct shard on the correct vps know that a specific guild it holds has changed settings and needs to be reloaded?
@viral spade Nobody is going to read that
i did
anyone can use a say command, but if you think it should have a perm, you can do that.
@cunning kiln
short version "how do i tell my bot it needs to recache database"
@cunning kiln Ok well you just wasted like 5 minutes of your life 
5 minutes?
1
for 2 sentences?
at max
{node:24) UnhandledPromiseRejectionWarning: TypeError: client.users.setActivity is not a function
at Client.<anonymous> (/home/container/index.js:24:17)
at Client.emit (events.js:315:20)
at WebSocketManager.triggerClientReady (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:431:17)
at WebSocketManager.checkShardsReady (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:415:10)
at WebSocketShard.<anonymous> (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:197:14)
at WebSocketShard.emit (events.js:315:20)
at WebSocketShard.checkReady (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:475:12)
at WebSocketShard.onPacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:447:16)
at WebSocketShard.onMessage (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
at WebSocket.onMessage (/home/container/node_modules/ws/lib/event-target.js:125:16)
(node:24) 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:24) [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.
help? d.js v12
It looks much larger on mobile...
short version "how do i tell my bot it needs to recache database"
Oh boy, this one is quite complicated
@hazy sparrow client.user.setActivity
Are events emitted in an inter-shard manner?
not .users
oh, my bad lol
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/lib/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack at ChildProcess.emit (node:events:329:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:277:12)
gyp ERR! System Linux 4.19.0-8-amd64
gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /root/discordbot/bot/A
gyp ERR! node -v v15.2.0
gyp ERR! node-gyp -v v7.1.2
gyp ERR! not ok
Help
oof
Me ?
how to mute specific user with id?
i mean mute in voice channel
How to make a bot
Please
go to discord api
Api
?
create an aplication
Then
I have done this
How to get the current shard?
how do i tell my bot it needs to recache database?
get discord.js or simular
I want to add my bot in discord bot list
i use botghost because i dont have a pc
Please help
I want to add my bot in discord bot list
@earnest phoenix go on the site xD
Which
log in via discord
When some will search
how do i tell my bot it needs to recache database
WHERE HAS TIM GONE?
only helpful person
Probably busy with his libs and support server.
how do i get the number of guilds my bot is in?
what lib are you using
d.j v12
<Client>.guilds.cache.size
yep
Forgetting about OOP and all that, is there a straightforward simple way to create a music bot in discord.py?
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/lib/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack at ChildProcess.emit (node:events:329:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:277:12)
gyp ERR! System Linux 4.19.0-8-amd64
gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /root/discordbot/bot/A
gyp ERR! node -v v15.2.0
gyp ERR! node-gyp -v v7.1.2
gyp ERR! not ok
PLS Help Me Sry
Gyp moment
Iam install Canvas
Error :
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/lib/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack at ChildProcess.emit (node:events:329:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:277:12)
gyp ERR! System Linux 4.19.0-8-amd64
gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /root/discordbot/bot/A
gyp ERR! node -v v15.2.0
gyp ERR! node-gyp -v v7.1.2
gyp ERR! not ok
what version of npm and node are you running
Full Version
Lasted Version
So, i'm making a video host website, and I am wondering how to embed a video or just send the image in general from the website. ( For example https://tryitands.ee )
Per: https://github.com/nodejs/node-gyp/wiki/Updating-npm's-bundled-node-gyp
Try doing: [sudo] npm explore npm -g -- npm install node-gyp@latest
sudo is optional depending on if you're root
Well, I installed this, what should I do now?
@regal creek If I'm understanding you correctly, you want a website url to send a embed or video within Discord. If so, you would use meta tags https://www.wordstream.com/meta-tags#:~:text=Meta tags are snippets of,a web page is about.
Meta tags can have a larger impact on SEO and your website than you may think. Find out more about the importance of meta tags and learn how to write meta tags that max out your SEO.
try installing cavas again
@earnest phoenix

@regal creek If I'm understanding you correctly, you want a website url to send a embed or video within Discord. If so, you would use meta tags https://www.wordstream.com/meta-tags#:~:text=Meta tags are snippets of,a web page is about.
@prisma oriole is there any way to do that on Nginx directly?
Meta tags can have a larger impact on SEO and your website than you may think. Find out more about the importance of meta tags and learn how to write meta tags that max out your SEO.
looks like a python issue now lol
does the bot/code erros if i code it to send a dm to someone and they have blocked the bot?
@regal creek I'm not too keen on nginx with SEO, I've only seen meta tags done within html tags
looks like a python issue now lol
@prisma oriole what do I do
@regal creek I'm not too keen on nginx with SEO, I've only seen meta tags done within html tags
@prisma oriole alright thank you
yep
yep
@prisma oriole Excuse me, where can I see it? 🌟
i said yep to jon, python isn't your issue (node-gyp errors are like finding a needle in a haystack so I got confused). It seems this is a common issue with node-canvas. You can try following: https://github.com/Automattic/node-canvas/issues/913#issuecomment-342275618
I will go and try and announce the result
root@bbzo:/usr/lib/node_modules/npm# npm install pkg-config cairo pango libpng jpeg giflib
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/giflib - Not found
npm ERR! 404
npm ERR! 404 'giflib@*' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-11-18T14_43_50_844Z-debug.log
@prisma oriole
How would I link to a voice channel in discord?
Seems that doing it same way as it works for normal channels isnt working.
Please @ me when answering
does the bot/code errors if i code it to send a dm to someone and they have blocked the bot?
yes you need to catch it
@waxen tinsel
user.send('Your message').catch(error => {})
?
if you want to dm someone, do that as it will catch if it fails
Did you mean to @ the other person?
33 servers
@south sinew ?
e.e
user could be whatever and is a placeholder, message.author would work, etc
@molten yarrow is it a differnet type of catch that i dont know of? because my error handler isnt detecting it and it sends a unhandled promise rejection in the console
Ill take that as a yes since you defs are not talking about anything I said @south sinew
I am just using invite links for my thing anyway, I was being dumb. I believe you mean to be talking to @hazy sparrow.
if you want to send an error, you could:
user.send('Your message').catch(error => message.reply(`Unable to send a DM! Make sure I'm not blocked and your privacy settings don't prevent me from DMing you!`);
yes bow pro
im dumb lmao
lmao
sorry for the ping
ur all good lmfao
ok, thanks!
np
When , I run a command, I want that the bot pulls the code from a private git repo , will this work?
cool
36
Anyone knows a way to create a graph?
For example i give it 5 parameters for example the ping every minute and it builds me like a pic with the graph 
from a private git repo
@tired panther you cannot pull from a private repo when you're not authorized
and have access to the repo
I am the owner from the private repo xD @rustic nova
yeah no, but you said you want to "make a command that pulls the code from a private git repo"
how is your bot able to pull the code when it's private?
eyyy,
yeah no, but you said you want to "make a command that pulls the code from a private git repo"
@rustic nova I give the bot access to my repo, I mean the server , where it is running
you'll need to authorize the pull request then, use some kind of library for that for example
actually
yeah
how do you use it in d.js
just put competing or competing in as a type
Anyone knows a way to create a graph?
For example i give it 5 parameters for example the ping every minute and it builds me like a pic with the graph
@earnest phoenix your question is quite ambiguous. Do you want to build it programmatically? What language are you using? Have you tried looking if there's a library which can accomplish this for you? Do you want to use an API so you can view the graph remotely?
I'm using JavaScipt, I'm okay with using a library or an API my target is to make the bot send a graph that is built. I would like to make a graph of how many reactions the bot receives or maybe a ping graph and then send it as a image to the discord channel.
ik this is a dumb question but how do i get a object from a array of objects
im trying to get the users status
message.author.presence.activities activities is a araay
what
that'll just join the array they want to return an object
@ivory seal custom status?
yep
lol
use the find method on the array (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find), the name property should be Custom Status
ye ok thanks
im so stuckkkkkkk im trying to install discord.py but i keep getting an syntaxError.
the laptop just came today as an 32bit-x64 so if i need to go to an 64bit to use discord py then that sucks
what is the command you are using to install?
py -3 -m pip install -U discord.py
Windows I assume
mhm
Can you show the error
Like wrap it in code blocks or something
Aka what got printed to the console/standard output
how do i do codeblocks?
```py
content here
```
^
mmk
File "<stdin>", line 1
py -3 -m pip install -U discord.py
^
SyntaxError: invalid syntax```
im using 3.9 (32bit) currently....
maybe try updating pip?
python -m pip install --upgrade pip
ok
uhhh
File "<stdin>", line 1
python -m pip install --upgrade pip
^
SyntaxError: invalid syntax```
I don't think it has to do with 32-bit. Though, I don't use Windows myself, it doesn't treat -m pip as valid.
huh ok
it also may not be installed (which doesnt make sense as it installs with python)
check just by doing the help command
pip help
ok, so it isnt installed
oh thats wierd
https://bootstrap.pypa.io/get-pip.py
copy paste that into a text file (thats the install script for pip) and name it get-pip.py
then navigate to the directory and run the install command
python get-pip.py
when you say directory you mean the application from the .exe right? to paste python get-pip.py into right?
it could be anywhere, i recommend your documents folder as you dont need special permissions like you do in any of the program files folders on your pc's root directory
mmmk
directory implying wherever you put get-pip.py
ahhh ok
so i shouls open an note paste that into there and make it an py then past the python get-pip.py
after installing
Carpal could you try entering dir as a command and pressing enter.
It should list all files in your directory.
says built in function dir
so paste the text from that link into a file named get-pip.py, then run in command prompt python get-pip.py
So that would mean you're in the python interpreter
rather than the command line
which is why you keep getting that syntax error
You should be running the install command from the command line, not the Python interpreter.
powershell or command prompt would work
if you use an ide like vs code, it has a terminal built in
im so confused...
ohhh visual studio
i see
btw ur kinda quite...
yup
i see....
im only used to bdfd lol so ill definetly be using yt for help
used w3school for css before
ty
np
what is bdfd?
google it, it's the first thing that comes up
guys I get this error UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Message a lot and I don't know where this even comes from so I can't fix it, can anyone please help me, it's been spamming my console for weeks now
@fast quail take a look at https://docs.rs/serenity/0.9.1/serenity/
API documentation for the Rust serenity crate.
their github Repo https://github.com/serenity-rs/serenity
thanks






