#development
1 messages · Page 1812 of 1
yeah that's what I want to avoid 😄
and only send messages every few seconds
I was reliefed that discord doesnt hit my bot with global ratelimits when I hammer webhooks
if you hit something like 50/s you will be tho
oh rly? good to know
Well it's far below that, it may reach 5/s or something. Maybe 10/s at most (actually no, 10/s is way too much)
Seems to have worked, ty for the tip 🙂
How is this color?
try some light gray
also try white on the colored boxes or bold font
I used Discord Colors 😓
that tone I mean
unpopular opinion: you shouldn't need shard stats because they should never be offline (unless you use k8s or something)
oh
there will be option to kill them, move them on another machines.
In other words, I need something where I can learn html & css
unless you're using k8s or some custom client stuff you can't move shards to different machines
Bold of you to assume he doesn't have a custom setup
but anyway, @tired panther, go bold white on colored boxes
black on those colors feel a bit...off
thx
@tired panther on your discord-cross-hosting, how are you sending evals? it doesn't seem as though you are requiring any IPs or anything
are you saving evals as documents in monogodb???
yeah, I will add support for tpc, udp and sql soon.
But it is currently using mongodb for saving the reposnse in the Database. The Doc gets deleted after the eval has been resolved
just use websockets
and there is no reason to use a database for that shit
websockets or an API would probably be the easiest to setup
100ms lol on 4 machines.
yeah not the best results, but good enough for my usecase
what do you check the db every 25 ms or something?
no, there is a change stream on the replica
Mongodb fires the Events 👀
ah
ig thats better than just checking all the time
its still yikes to do it that way
thats would be totally dumb
tcp for the win
follow material guidelines 
I will add it soon
is there a way to track the UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Access errors??
Yeah, just catching and handling them
That's big brain
I know... not needed to tell me
its recommended to have a process.on("unhandledRejection" listener so that the frames of the errors are cleanly printed
const DB = require('../../../slappey.json')
const config = require('../../../slappey.json')
const prefix = require('../../../slappey.json')
// const PASS = require('../config');
// const DB = require();
module.exports = class LevelCommand extends BaseCommand {
constructor() {
super('level', 'levelingSystem', []);
}
async run(client, message) {
if (!message.guild) return;
if (message.author.bot) return;
const args = message.content.slice(prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
const randomXp = Math.floor(Math.random() * 9) + 1; //Random amont of XP until the number you want + 1
const hasLeveledUp = await Levels.appendXp(message.author.id, message.guild.id, randomXp);
if (hasLeveledUp) {
const user = await Levels.fetch(message.author.id, message.guild.id);
message.channel.send(`You leveled up to ${user.level}! Keep it going!`);
}
//Rank
if(command === "rank") {
const user = await Levels.fetch(message.author.id, message.guild.id);
message.channel.send(`You are currently level **${user.level}**!`)
}
//Leaderboard
if(command === "leaderboard" || command === "lb") {
const rawLeaderboard = await Levels.fetchLeaderboard(message.guild.id, 5);
if (rawLeaderboard.length < 1) return reply("Nobody's in leaderboard yet.");
const leaderboard = Levels.computeLeaderboard(bot, rawLeaderboard);
const lb = leaderboard.map(e => `${e.position}. ${e.username}#${e.discriminator}\nLevel: ${e.level}\nXP: ${e.xp.toLocaleString()}`);
message.channel.send(`${lb.join("\n\n")}}`)
}
}
}
Failed to append xp: MongoWriteConcernError: No write concern mode named 'majority[object Object]' found in replica set configuration
what is mistake
Do they use a other white?
This white is too light
Check button docs
See what color is used for ot
It looks like your green is too green tbh
Theirs is a bit dimmer
ah, I used the Discord Branding green, not those for buttons 🤦
Color palette issues...as expected from discord
lol wtf are your imports
what sort of imports
Pretty sure json modules aren't added to require.cache, so it has to query the fs every time you require a json
you literally have 3 variables that are the exact same thing
requiring the same file
still the same error after changing
I know it's not gonna fix it. I never said it would. I'm just pointing out that you have many other issues to worry about and not just that error if you require the same file 3 times
does this looks better than the the upper one?
That looks fine. I still don't believe red text should be used unless it's for an error or something related
may be
yeah but i remove 2 of them
still the same
I don't understanf shards. What even is it?
the white is kinda hard to read on a monitor that can reach certain nits
Sharding is the method by which a bot's code is "split" into multiple instances of itself. When a bot is sharded, each shard handles only a certain percentage of all the guilds the bot is on.
Oh... that is really cool
hey guys
Thanks
Try updating. My ytdl-core seems to work perfectly fine for the time being.
I thought ytdl was shutdown
I think it was for a few weeks
Then GitHub put it back up after some sort of legal thing
What is ytdl?
youtube-dl isn't ytdl
What is wrong?

what doesn't work?
Try to console log newState right after it is declared. I bet it doesn't have the .channel property
are you trying to remove the joined user in vc?
I want to get the bot out if no one is in the vc.
Oh it's a seperate thing for javascript/node, alright
hi a beginner, i'm dad
k
Who’s developers?
I try to be 🤣
surely not the peope with the bot developer role
"peope" dank memer has no bot developer role
haha funny
anyways
can useEffect only run when the component is mounted?
pog
wait so that counter-intuitively means if i have a lot of useStates i need to put a thicc dependency array?
essentially yeah
though that depends on what you're trying to do
if you want the effect to run on a re-render (regardless of what's changed) you don't have to pass in a second argument at all
also an fyi
you can use multiple effects
code & stacktrace
Can someone help me? I have a line of code and dont know where to add it lol
Very specific information provided there
lol
so am i dumb, but mongodb locally should have faster response times than mongodb atlas, or?
well you dont have to send the data across the internet
overall i would also suggest to cache Database calls
especally Mongodb bcs it does not cache with the free version
i guess the difference is bigger, when my internet is shit
Pfft caching is for losers 
i make db calls on every presence update 
Uh
wtf?
nah nah jk
you might want to cache stuff
have the intent disabled
I fetch stuff on every message cause I’m cool
but yeah should thought more which data is good to cache
did you call every time a message is called the Database to get the prefix?
Any data that you need a lot is good to cache
since my bot is now slashcommand only, no
Since you can just update cache and db at the same time
i would cache guild configs for sure
And never really fetch again
just update it in the cache
rn im using mongodb atlas, but now im installing an ubuntu server on my pi and im looking how thats gonna turn out 
there are different methods tho, like you could write a helper to shedule writes to the DB or use a helper to update the cache on Database calls
MongoDB on a RPI, thats a good combo, like i saw so many corrupted databases bcs of this combo

Mmmm true
remember, power the pi down, not just yeet the cord
I’m more talking about set it in the cache and update in the db as well
And when fetching fetch from cache
you mean on shutdown or what?
So you always have an updated cache but at the same time when the bot restarts it refetches from the db to refill the cache
shut it down like a normal server, NEVER yeet the cord, or you will wake up to a corrupted database
im generally dont shutdown this way
like my RPI who runs a Pihole got a UPS to stay powered
UPS?
Uninteruptable Power Supply
(backup Battery)
even if we have a blackout the pi stays powered and i could shut it down normaly
it sort of Controls all the DNS requests in the local network, if it dies nobody can connect to the Internet properly
Yeah I know got RaspberryPI OS on my server, too but clients will be cut off electricity, too as well as the router 
well what if due to a bad write during a poweroutage will corrupt the SD card? electricity comes back, eventually and noone can connect to the internet
bcs the DNS requests end up in a void
lol never run into such an issue the last 10y
also the UPS powers my Switch and some POE injectors
Can’t just FedEx do the job for you
you probably have your Car/House/life Insured right?
Watch out sarcasm has been spotted
Sure not the server tho 
well you probably still want that the data on it is not at risk right?
Well I’m more worried about the host OS but no I don’t expect data corruption just by a electrical outage
get a HBA with BBU
That last one didn’t made sense
Thought about that already but common devices can held up the system for a few minutes only
I was thinking about a gas energy PGU
a HBA with BBU usually gives HDDs the ability to finish the last rotation and park the Read head.
Since there a lot of electrical outages this days
not more
Nah I was speaking about power generation
well be like my Dad, who bought a Balling Aggregate from the Military, with enough Power to power half the Village
like it where used as a Backup Generator for a Military base
The issue is the size of the house and the fact the router is placed in a different floor
If I’m gonna invest in such a system all necessary devices should be attached to it
Such as the light, server, router etc.
if we would attach the Generator to the House Circut we could just carry on not Caring about the power Outage
And probably the fridge 
Yeah unfortunately that’s not so easy as the way to the fuse box is long and I renovated a few years ago
Not willing to break up the walls again
Hello
Should have think about that before
Cloudflare blocked your request
What's cloudflare
Should I have to change the domain Just . Or anything more
Where , I can still chat
ur server
When I run my discord bot on repl.it, I get an error. within the error, I see some HTML code below. It seems like CloudFlare is blocking my bot from accessing Discord. What could have caused this?
...
check this
Okh sure 😉 thanks bro
looks like you abused ratelimits or the api and got a temp ban from the api
I use too many APIs , i think that's the reason
I used many local APIs too
@mild agate it is fixed , I just changed the domain of Website , now will fix Api problem Tommorow too .. thanks for help
discord is actively blocking free hosting ips
i don't remember if that includes replit
rate limit
Not really
People use replit to abuse discord api
Feature creep.
Hi, so I want to do: js db.collection("channels").insertOne({_id: server.redirect}) || {_id: message.channel.id, bey: "nothing", type: "nothing", answer: "number", settings: {spawn: true, dcommands: []}};
only a single time, like check if it doesn't already have a database like this and if it doesn't, it will insert it, but if it does, it does not. I hope I was clear.
Any idea how I can do that?
db.collection.update(
<query>,
<update>,
{ upsert: true }
)
could you please elaborate what this is?
I've never used upsert
So I have this array of users and their levels:
let array = [ { level: 10, xp: 50 }, { level: 7, xp: 20 }, { level: 10, xp: 20 }, { level: 2, xp: 10 } ];
How do I sort this array based on level AND xp so that the array will be formatted like this:
let array = [ { level: 10, xp: 50 }, { level: 10, xp: 20 }, { level: 7, xp: 20 }, { level: 2, xp: 10 } ];
You'd use the .sort method and compare the level and xp (in that order).
Got this error when trying to run itxl (node:6372) UnhandledPromiseRejectionWarning: TypeError: db.collection.update is not a function
yes, I already did it thank you tho!
Is Mongo working for anyone else? I'm getting error but nothing is logging in console
Hey
Can someone show me a example as to what a set channel code would look like
I been using channel id and channel name but I think it’s time to learn how to do set channel
@sick agate
@earnest phoenix, there are many ways to tackle problems and implement solutions when it comes to programming. What you're asking is too broad, however. What library are you using? What does setting a channel do? What data is involved?
Chat bot and welcome message I have both and they bot work but I been using them as channel name or channel Id
So you want users to be able to configure (set) the channels for certain logs/actions (welcome messages in x, chat bot in y).
If so, what you're looking for is a database. A database is a way to persist data even after your bot has stopped.
How would I make one
from discord.ext import commands
LOGS = []
DATABASE_CHANNEL_ID = ....
class MyBot(commands.Bot):
def __init__(self):
super().__init__(command_prefix="!")
self.discordDB = DiscordDB(self, DATABASE_CHANNEL_ID)
@commands.command()
async def log(self, ctx, *, text):
data = {
"name": ctx.author,
"text": text
}
_id = await self.discordDB.set(data)
LOGS.append(_id)
@commands.command()
async def show_logs(self, ctx):
for _id in LOGS:
data = await self.discordDB.get(_id)
await ctx.send(f"Name: {data.name}, Text: {data.text}")
bot = MyBot()
bot.run("TOKEN") ```
Oh python
You need a database (such as SQLite).
Is it something like that
Do you know what a database is?
Nope
Oh I gotta use a cmd handler also
You're already using a command handler.
As for the database, you'll need to spend the time to research what a database is and how to use it, since it takes time to learn.
I know lol that code I just sent was for a cmd handler
Ty
how do i change the "boldness" of a text/paragraph in html/css
<b></b>
or font-weight
font-weight can take like 300,400,500,600,700,800 etc
300 is thin, 900 is extra bold, 700 is normal bold
i was told that css is the best way to uhh design things 
yup
wdym by those numbers?

Numbers
the numbers r in pixels right?
no
ooh default is 400 my bad
no its the font family differences
see the numbers
Regular 400, etc
thx now i can mess around with it 
Wow 700 is bolder than 600 but lighter than 800.
Who would have expected that 
I like the guy who wrote that without knowing him
Can anyone here Test if my bot works outside the US? If u live outside the us
why would it not work outside the us?
Your bot is interacting with Discord, not the client
Unless you mean dashboard or something?
Because it has to download a a bunch of files and safe it to my raspberry pi, idk how l,one that will take if someone is outside the us
https://top.gg/bot/845463498384343051 can you just try running the *photomosaic function ?
That’s all I’m not sure about
Can anyone help me out with these errors. They are not causing any functional errors, but they are really starting to piss me off. The language is Typescript.
it has to do with how you're typing it
you typed Player as an object
an object doesn't have property .id
you can type it as a Player interface
interface Player {
id: string
}
or something
Player: any ggnoree
How would I use interface in that function?
Any gang
You use the object, not interface
Uhhh, what?
Err
That other guy made sense xD
interface Player {
id: string;
}
function something(player: Player) {
player.id; // Valid
}```
type UserData = Record<string, Whatever Individual Player Data is typed as>
You, my guy, are very smart xD Thanks
How would I list all servers my bot is in, with the guild id and owners name, using eval command
javascript ^
when i add this to make my bot's pfp a circle
.entity-header__image{
border-radius: 50%;
transition: 0.5s;
}
it make it a circle, but when i add another element :hover to it, the avatar is back to its original shape (not a circle) and when i hover it, nothing happens
.entity-header__image{
border-radius: 50%;
transition: 0.5s;
}
.entity-header__image:hover{
border-radius: 10px;
box-shadow: -5px 5px black;
}
am i not allowed to use the :hover element?
oh wait its working now
Could be shortened 
?:
this looks the nicest
oh
return suffixMap[lastTwoNumbers] || suffixMap[lastNumber] || "th"
maybe
Yeah
??, if you can
It's more practical even if there's no difference in this case
14 IIRC
@proven lantern sub and substr are deprecated
use substring
and dont mind the names
@proven lantern You can also provide numberStr.substr() directly without assigning it to a variable, since they're only being used once
why don't intellij tell me this?
It's only sub, not substr
wait i thought one mutated the string
an evil mutation function
those are the worst type of fake functions
nm, they just work differently
they better not deprecate substr()
Only sub() is deprecated
nice
I wonder what they do tho
i think that's one step too far.
string.substring(start, end)
vs
string.substr(start, length)
I only ever used slice
splice is one of those fake functions. slice is a real function
splice() is for arrays
so is slice right?
Yeah
i didnt know that worked on strings too
not splice though
splice should just be thrown in the garbage anyways
Why?>
they even say to use slice in the definition
functions that modify stuff are not pure
You can't remove/add element(s) to an array at a specific index without using any loop without splice()
So I'd say it's a pretty nifty (albeit slow) method
It has its use cases
it can always be avoided
Yeah
i see that as a code smell
.env
safest way is to save the token in a DB and write code to fetch the token
also make sure the DB is secure
the free way is through .env 
if you already have a DB then its basically free
bruh
where will you store the db passwords then
there's a reason .env files exist
U can enable IP only login. Only ur IP can login in ur db
im trying to figure out what went wrong with env files that you have to use a db
still just use a .env file
much more quicker than awaiting and getting the data and setting up a schema for it
also how do i get a website's ip im on mobile 
@errant flax or protect token from getting stolen using this hacking protection:
const token = "Nzd9w82jkdks" + "92938jeejj";
it's just not as secure. if the system with the .env file is locked down then it's safe enough for a discord bot
you could also consider encrypting the token and later undoing it when it needs to be plugged in if you're really spaz about protecting tokens
the decrypt key would need to be stored somewhere secure though right?
like the DB
GUYS I JUST FOUND GOLD
https://youtu.be/-bt_y4Loofg
MongoDB is the world’s most popular document database with powerful capabilities like full-text search, geospatial queries, data aggregation, and more https://bit.ly/3rbFIpG
I collaborated with the team behind MongoDB Atlas to prioritize this video, but I had full creative control of the content. They were kind enough to give us $200,000 in clo...
correct
@proven lantern replit has some restrictions on env files:
- repls forks dont copy .env
- scripts from the cli cannot access .env
- only multiplayer/team members can see it
- (not verified yet) the stuff is encrypted and stored
imagine forking a repl then .env is there :KEKA:
MongoDB is proud to present this awesome parody music video featuring our new Atlas technology.
For more information on MongoDB Atlas visit: https://bit.ly/3fGBDn9
Subscribe to MongoDB ►►► https://bit.ly/3bpg1Z1
Connect with MongoDB:
Website: https://bit.ly/2LjtNBZ
Twitter: https://bit.ly/3fH87gR
Facebook: https://bit.ly/3fEaIsd
Linkedin: ht...
mongodb hosting is too expensive
is actually less than any SQL database hosting
If you want reliability, selfhost
sql is disk optimized and not cpu optimized so they are bad
do you have anything to do other than shit on stuff for no reason
isnt atlas free up to like 512MB?
It is
its replit just use .env
if your going to go threw all this trouble just get a raspberry pi or something simmer
Why are you suffixing only 11 12 and 13 with th? Every number other than 1, 2 and 3 has that suffix
111th
case 'age':
const age = args.slice(1).join(' ');
const ms = require('ms');
if (!age) return message.channel.send('Invalid time provided.');
db.set(`age.${message.guild.id}`, ms);
return message.channel.send(
`The required age has been set to **${age}**`
);
break;```
err: https://media.discordapp.net/attachments/766116919983079434/865120334658142238/unknown.png
may i know why?
insticts tell me it will fix it
const ms = require('ms').args[1]; how to make this args 1?
thats not how it works
then?
its just const ms = require('ms')
oh wait
const ms = ('ms');
const age = ms(args.slice(1).join(' '));```
like that?
Looks about right, https://tryitands.ee
I'm saving this
TypeError: ms is not a function
yea.. .it is const ms = require('ms')
TypeError: ms is not a function
case 'age':
const ms = ('ms');
const age = ms(args.slice(1).join(' '));
if (!time) return message.channel.send('Invalid time provided.');
db.set(`age.${message.guild.id}`, ms);
return message.channel.send(
`The required age has been set to **${age}**`
);
break;```
(node:37) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'includes' of null
let bypassed = db.get(`bypass.${guild.id}`)
if (bypassed.includes(user.id)) return;
if (Date.now() - user.createdTimestamp > age) {
member[punishment](
`Alt detected - Account younger than ${client.decodeMs(age)}`
);```
now i get this
bypassed is null
so why is it not returning it then running the code??
how to fix it?
Make sure bypassed exists first
if (bypassed && bypassed.includes(...)) or if (bypassed?.includes(...))
there is no data in bypassed
@pale vessel
let bypassed = db.get(`bypass.${guild.id}`)
///if (bypassed.includes(user.id)) return;
if (bypassed && bypassed.includes(user.id)) return
if (Date.now() - user.createdTimestamp > age) {
member[punishment](
`Alt detected - Account younger than ${client.decodeMs(age)}`
);```
liike this?
Guys how do I make a login system to my bot website? I just want an easy login system with oatuh2 no need of guilds just need their user ID AND USERNAME
@hidden coral You are going to need this: https://discord.com/developers/docs/topics/oauth2 and some programming knowledge, not sure how I can help you past that.
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
If you come across any specific issues feel free to drop em.
which is a sin
You deserve no help 
why would cordChoice be undefined in the play function?
let nextBoard = [...initialBoard].map(row => [...row]);
let nextCordChoice = [0, 0];
let nextPlayer = "x";
while (!checkIsComplete(nextBoard)) {
const {player, board} = play({player: nextPlayer, board: nextBoard, cordChoice: nextCordChoice});
nextPlayer = player;
nextBoard = board;
nextCordChoice = nextCord([...nextCordChoice]);
console.log(board);
}
}
run();```
Just ask what you need help for and you'll see ¯_(ツ)_/¯
are you manually placing these on absolute positioning or something
oh yeah
it's all positioning issue, position using flexbox instead
no worries, you just have to put it in a flexed column and center align everything
flex-align would also be a good choice
using flexing grid controls offers better versatility in modifying the position over forcing position values
so this is my code i use to define the command variable and get the files so i can let my command handler run them but i want it so that in the commands map i can have different maps where i can have the commands sorted in (like in the image below) can someone help me what i have to do then?
code: https://srcb.in/YUkPoaDpQp
image below
anybody who can help?
Basically you want categories by folder name?
All you need to do is do exactly what your doing with files now, just with folders too
Lol
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="https://fonts.googleapis.com/css2?family=Baloo+2:wght@700&display=swap" rel="stylesheet">
<link href="animated_background.css" rel="stylesheet">
</head>
<div class="animation-area">
<ul class="box-area">
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
</html>```
html
* {
margin: 0;
padding: 0;
}
.animation-area {
background: linear-gradient(to left, #8942a8, #ba382f);
width: 100%;
height: 100vh;
}
.box-area {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow: hidden;
}
.box-area li {
position: absolute;
display: block;
list-style: none;
width: 25px;
height: 25px;
background: rgba(255, 255, 255, 0.2);
animation: animate 20s linear infinite;
bottom: -150px;
}
.box-area li:nth-child(1) {
left: 86%;
width: 80px;
height: 80px;
animation-delay: 0s;
}
.box-area li:nth-child(2) {
left: 12%;
width: 30px;
height: 30px;
animation-delay: 1.5s;
animation-duration: 10s;
}
.box-area li:nth-child(3) {
left: 70%;
width: 100px;
height: 100px;
animation-delay: 5.5s;
}
.box-area li:nth-child(4) {
left: 42%;
width: 150px;
height: 150px;
animation-delay: 0s;
animation-duration: 15s;
}
.box-area li:nth-child(5) {
left: 65%;
width: 40px;
height: 40px;
animation-delay: 0s;
}
.box-area li:nth-child(6) {
left: 15%;
width: 110px;
height: 110px;
animation-delay: 3.5s;
}
@keyframes animate {
0% {
transform: translateY(0) rotate(0deg);
opacity: 1;
}
100% {
transform: translateY(-800px) rotate(360deg);
opacity: 0;
}
}
css
Problem: when zooming its not zooming in the center
people already told you to use flexbox
google is your friend
I did 
yes
i know and i tried but it didnt work so can you help how i have to?
Can you show what you tried?
its super dumb lol
i just tried to almost copy this part and paste behind so like this
readdirSync(join(__dirname, "commands")).readdirSync(join(__dirname, "bot devs")).filter(file => file.endsWith(".js"));```
Honestly pretty close.
Or well on the right track.
Lemme hop on my pc
okay thx
did u got on pc already?
i am using replit
const categoryFolders = readdirSync(join(__dirname, "commands"), { withFileTypes: true })
.filter(directory => directory.isDirectory())
^ will get you an iterate-able of folders
you can then iterate over them just like your doing with folders.
for(const folder in categoryFolders) {
//command code your using now here, just modified to put them in their own maps.
}
spotify api is a bit different from the youtube api(spotify doesn't let you play music from the api).
the spotify docs kinda suck, but that's all we get.
okay thx
got ya
pretty close.
youll need to search for command files(commandFiles) in each folder loop(for(const folder in categoryFolders))
then youll need to modify your command require to look in the folder
const logchannel = client.channels.cache.get("id")
i have no idea how to im sorry im a bit bad at this
could you give an example maybe?
Ur welcome 
thats spoonfeeding. which is against our #rules-and-info
if you understand the code in your original sourcebin, its the exact same stuff, just done again.
this doesnt work and says there's no such file or directory but i dont know why it says
i am coming
it isnt even looking in the commands folder why is that?
idk it join my server and nothing happenimg
But I don't understand it. I am using express web server. Can u give me small code pls
i think i get it thanks
your not telling it to look in commands folder
im having a ts error when trying to do a extended client:
TypeError: Class constructor Client cannot be invoked without 'new'
the code:
import { Client, Collection } from "discord.js"
import { conf } from "../conf"
import { Logger } from "./logger";
export default class deBot extends Client {
public commands: Collection<string, any> = new Collection()
public conf: any = conf
public logger: any = Logger
public constructor() {
super({
restTimeOffset: 200,
shards: 50,
})
}
public async start() { await this.login(this.conf?.token).catch(console.error) }
}
@solemn latch see Dms bro
the thing is that i dont know how to do that
could you help me?
Just help me with this guys
pay me and i'll give you the code
Bruh

well, if you want someone to do work for you, pay them
otherwise do it yourself
welcome to capitalism
Then u must pay Veld to be in the server
veld's not doing any work for me though?
What is VIEW_GUILD_INSIGHTS exactly?
the permission? iirc it has something to do with lurking permissions
I know this is a permission but what does it do?
He lets you stay here and lose your braincells
Thanks
Guys how do I make a simple text receiving bar in html and when someone click the button it will redirect them to for eg - discord.com/TEXT_WRITTEN_ON_THAT_BAR
You will need Javascript for that.
Unless you want to do it as a query parameter like https://discord.com/?parameter=CONTENT_WRITTEN_IN_INPUT
You could just use a <form method="GET" action="https://discord.com"> form tag for that.
how can i send dm to users with ID on a vote event ( without using intents )
I'm pretty sure you don't need any intents to just fetch the user data?
if you're using discord.js you have to cause bad design 😬
😬
Hopefully it's temporary 😩
does someone know why my bot has memory leaks but only when the privileged gateway intents are enabled
??
Because with more gateway intents it caches more
privileged gateways greatly increase caching yes
yes
one is about guild members, the other about user presences
but it gets very high
if you don't need presences, turn them off
like 600mb with 20 servers
Presences are very high memory
that high?
you see, presences are cached:
A - when an user joins vc
B - when user online status changes
C - when user status message changes
D - when user joins server
and caches have a lower limit, so it'll fill up to a point, then it'll start swapping older objects with newer ones
if you're using djs, you're also using one of the libs with the worst optimization out there
well
If you use discord.js-light you should be able to switch without changing any code and disable all unnecessary caching
Or use detritus (Erwin will be happy) but that requires changing code
Or use discord-rose (Berry will be happy) for full cache control 😉
berry the platypus
Or make your own lib (no one will be happy) for whatever you want
Or don't make a lib and make direct calls for everything (You won't be happy)
pfsh imagine not modifying discordjs to fit your needs
Imagine using discordjs
imagine
imagine making discord bots
imagine dragons
imagine knowing every object value and keys of djs (well Class too)
test me
Hello there, I'm getting the following error:
"(node:24) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'members' of undefined"
But I don't see any error in that part of the code, it even used to not display any error before - Dunno if discord.js updated its API or something
Here's the code
let hotw_committee_members = message.guild.roles.cache.get(hotw_committee_role).members;```
Please ping me when replying, thanks 🙏🏼
roles aren't guaranteed to be cached
I dont think there is a members properties in role Collection
- you get the wrong ID
- The Role doesn't exist
*well they both are the same
- Exist but isn't cached
how do i do that then, was using this user = client.get_user(id) before removed intents now it say nonetype object has no attribute send nvm fetch_user will work ty for clearing intents are really not needed 👍
wait there is a get_user() ?
it work before i remove intent
I dunno tho, I dont know alots about intents
Do I need specific intents to use raw packets? (DJS)
if intents are not enabled they are not send iirc
Or is the newest version of DJS just messed up?
i am constantly updating my music bot (ytdl-core) however, it keeps falling back to its older ytdl-core build.
Mmm
Is there any reason behind that
just use lavalink at this point lol
may i tell you that your cat looks lovely
ytdl is just a clusterfuck of a repo
i have never worked with lavalink so i rather just keep on going with ytdl
i heard that they fixed everything in the latest build
but my program keeps using the older build, eventhough everything installs correctly.
not having used stuff is no excuse, like you probably never used js at one point, but now you use it
yeah but i don't have the time to start everything all over again. Maybe somewhere in the future.
wait
i actually have time this weekend
this is the same reason why people who use Json as a DB get some really stressfull days after they realized the entire json file is now useless.
Yeah wahahah that was me a couple of months ago
i now only use mongodb
😋
I guess raw events don't catch delete message content.
Yeah, they don't
Uninstall ytdl-core and reinstall it
Did that for my bot a little while ago, seemed to do the trick

aha, will try that. Thanks waff
i tried it
WARNING: ytdl-core is out of date! Update with "npm install ytdl-core@latest".
node_modules/discord-ytdl-core/node_modules/ytdl-core/lib/utils.js:175
still
same error
are you using a host which has older node versions?
Wait... are you using discord-ytdl-core?
yeah i am
discord-ytdl-core depends on ytdl-core iirc. Don’t use it. Just use ytdl-core
The reason it’s out of date is because it’s trying to update the ytdl-core within your discord ytdl
oowh
Which hasn’t seen an update in like 2 years afaik
i can uninstall it like: npm uninstall ... right?
Yes
Will do that, thanks man!
Np
I had lots of problems when I tried to use discord-ytdl-core
All of them got fixed from just swapping to normal ytdl-core
so this is my code (https://srcb.in/BRuPFiwKyO) but when i try to run a command it says (node:19288) UnhandledPromiseRejectionWarning: TypeError: command.run is not a function while i use the exact same code on my other bot and it works perfectly there
so can someone help?
Isn’t it .execute() for djs per the official guide?
Do you have the run function set exported in your commands
Paste the code for one of your commands
const Discord = require('discord.js');
module.exports = {
name: "COMMAND_NAME",
aliases: ["COMMAND_ALIASES"],
description: "COMMAND_DESCRIPTION",
catogery: "COMMAND_CATOGERY",
usage: "COMMAND_USAGE",
cooldown: COMMAND_COOLDOWN,
ignored_roles: ["COMMAND_ALLOWED_ROLES"],
ignored_channels: ["COMMAND_ALLOWED_CHANNELS"],
developer_only: COMMAND_DEVELOPER_ONLY,
async run (client, msg, args) {
//code goes here
}
}``` this is my command default so yes i have
ok
hi google
catogery? 
dont tell me ur the real google
I'm assuming there's something going with the CSS but I've got no clue what might be going on
command category i use at my help command to sort them
lol oops
I mean if it's just variable names etc. it doesnt really matter
But if it's a text string somewhere where a user can see it you should change it :]
oh god using material-ui with next.js is a pain
it is but i still changed it
did u tested it
omg @wheat mesa im sorry im so stupid it doesnt work cuz i didnt finish the command yet lmao
Yeah, I felt like that could be the only thing wrong
oh
please dont tell me this is a heroku integration to github we're talking about
why is this not in the same row?
let me show my css code
I don't like using other channels for non-intended purposes
yeah i understand
so does discord just automatically detect it now
yeah
discord has a lot of new markdown tool integrations now
they're implementing tooltips soon iirc
yeah
i'm excited for the polls
I think that's what is coming next in terms of interactions for the v9 API
and polls is a big pepega moment
The Buttons are not showed inline
.shard-button{
margin-left: 7px;
margin-right: 7px;
margin-top: 2px;
margin-bottom: 2px;
border-style: solid;
border-width: 4px;
border-radius: 7px;
padding: 2px 2px 2px 2px;
text-align: left;
font-size: 1em;
}
.shard-button.ressource{
background-color:#202225;
border-color: #202225;
border-top-width: 1px;
border-bottom-width: 1px;
margin: 0px 3px 0px 3px;
float: right;
}
<div id="shard-button<%=i%>" class="shard-button">
<p id="shard-button-name<%=i%>" class="shard-button <%=classname%>"><b>Shard <%=post.id %></b>
</p>
<p id="shard-button-log<%=i%>" class="shard-button log <%=classname2%>">
<%=post.message%>
</p>
<p class="shard-button ressource"> T </p>
</div>
weird, I moved the last line in the middle and it worked
InternalOAuthError: Failed to obtain access token
at Strategy.OAuth2Strategy._createOAuthError (/home/runner/SynapseBotList/node_modules/passport-oauth2/lib/strategy.js:408:17)
at /home/runner/SynapseBotList/node_modules/passport-oauth2/lib/strategy.js:175:45
at /home/runner/SynapseBotList/node_modules/oauth/lib/oauth2.js:191:18
at passBackControl (/home/runner/SynapseBotList/node_modules/oauth/lib/oauth2.js:132:9)
at IncomingMessage.<anonymous> (/home/runner/SynapseBotList/node_modules/oauth/lib/oauth2.js:157:7)
at IncomingMessage.emit (events.js:326:22)
at IncomingMessage.EventEmitter.emit (domain.js:483:12)
at endReadableNT (_stream_readable.js:1241:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
I do what?
passport fails to get an access token, my best guess is that your flow is wrong
my flow is wrong??
what is my flow? xD
sorry I'm french I don't understand 100% english @lusty quest x)
Your fl0w?
your workflow for how to authenticate
but sometimes its working
idk and after not works
did you refresh the auth token?
euhh, how? 😔
Can we somehow see the order in which users enter the voice channel?
Monitor the voiceStateChanged (assuming discord.js) event and store needed data
Why does the Button go under the other Button?
on the second one it works, but on the upper ones, it goes under the button.
I didnt used any z-index
(Button expands on Hover)
use flexbox
already using it.
But it doesnt seem to work 🤔
Next-js: how can I add a static image to my page
<BigAvatar>
<Image src="/static/images/avatar.jpg" alt="Avatar" width="300px" height="300px"></Image>
</BigAvatar>
File structure:
- src
- pages
- index.ts
- public
- static
- images
- avatar.jpg
Tried literally everything, I always get the error Failed to load resource: the server responded with a status of 400 (Bad Request)
Also I'm using the create-next-app template, I've barely changed anything
little JS help:
I declared
let image = 'link here'```
then on Embed I put
```js
.setImage(image)```
How can I make something like:
```js
if(image === null,undefined or something) {
return message.channel.send('Invalid')
}```?
I tried making image === undefined, but it didn't work
the let image = a link + args[0]
You may want to check if args[0] is null (assuming the user needs to add input to the command)
does anyone recommend me any Discord oauth2 in JS?
that I've done. But I want to do something like: if the link + args[0] leads to a link that isn't an image/gif, it sends an error message
is this posible?
Yes.
But how to do so depends on what the link is
For example, you could download bits of the image and determine if it's an image.
'https://play.pokemonshowdown.com/sprites/ani/' + args[0] + '.gif'
this is the link
kind of
this for example
With that link, you'll get a 404 Not Found if the image doesn't exist.
yes
You could send an HTTP request (e.g. with node-fetch) and see if it errors.
hm
I never did that 
I'll try
thx
@sudden geyser what am I supposed to fetch? Like, what should I ask to fetch
The constructed URL.
yeah, but it asks for a "fetch option"
Are you using the fetch API?
so I just don't put nothing
ok
and then how do I recieve of it the answer?
like, if image is 404 how I will recieve it?
you won't, that's the catch
Why do I get this error? xl TypeError: 'itemc' is not a constructor
Here's a portion of my code: js let stats = await db.collection("users").findOne({_id: message.author.id}); let item = parseInt(args[0])-1; let itemc = client.items.get(forsale[item]); let iteme = new itemc();
That could be coming from a lot of places
do you know where I can find them?
sorry, i copied the wrong error. edited lol
let imagefetch = new Request(image)
if(imagefetch === ???) {
return message.channel.send('Incorrect Pokémon name')
}```
I'm trying to make something like that, replacing ??? with the response object for 404 image
itemc is not a constructor (aka you can't use new)
It's probably an instance rather than a type.
it is, here: js const forsale = ["Buddy Bey Kit", "x1.5 EXP Booster 1 Hour", "Toolbox", "Perfect Constructor", "3 Premium Tickets Chest", "10 Premium Tickets Chest", "35 Premium Tickets Chest", "Void Meat", "Gift Box", "Avatar Embryo", "BeyLauncher LR"];
it's added before the lines of code I've sent
I was referring to the pre-edit error
let imagefetch = new Request(image).then(r => {
console.log(r.status);
})
if(imagefetch.status === '404') {
return message.channel.send('Incorrect Pokémon name')
}```
It's sending 404 on console, which is the error status, but it still answer the normal message on discord, not the error message
we are
Is the status is a string? “404” means string, 404 would be an integer
I tried without the string too
didn't work
yes
You're treating a promise as a regular value.
You need to resolve it first then check the status.
hm
ok
thx
sorry for being noob, I'm still new at coding and never used node-fetch before
anyone know how to scrape data off of sites? dm me
In that case 404 would be an integer
If you're new to programming, you may want to spend more time learning the language and its fundamentals.
I tried console.log-ging it and I got undefined for itemc, is this supposed to happen?
Be sure about what it is or simply don’t check the data type
Make a request to the site strategically and figure out how to process the data
Which would be == 404
ok
ok
tried so many times keep failing tho lol
Scraping is not easy for many
It's often easier to use the site's public API if it has one.
@sudden geyser @boreal iron @swift umbra Thanks so much for helping me. It worked 🙂
👍
Is it possible to disabled fs for Buffer function ?
Buffer.from() can access filesystem
I need help with my bot I can't make it be online I tried but it's still offline <@&265125253443878912>
You haven't provided enough information for users to help directly.
You could provide more insight into what's going wrong when running your bot and why it won't connect, but these are often signs of beginner issues, so you may be inexperienced.
If it doesn't connect in 3- 1 week?
Confused.
When your on the Development dashboard there is something called interaction endpoint I really didn't understand that one I know what it means but I don't know what to write there@sudden geyser
If you want to process slash commands through an HTTP server rather than a bot, you'll point it to your server's endpoint. If you aren't doing that, just leave it empty.
Oh ok
Thanks for the help
Do you know how to add Commands to my own bot?@sudden geyser
You need to process messages from users and the user's intent.
Often through a command handler.
if you ping that role it will get you muted

Didn't get it
Are you new to programming?
I got permission
Damn☠️
that doesnt give you permission
and i dont think they were telling you to ping the role
they were telling u how
with id

kekw
Yeah but I can understand if I get clear explanation
Question, are slashcommands possible in discordjs v12 or do I have to update to the dev build of v13?
I know you have to update to djs 13 for buttons and shit
i think they work on dj 12
I want to make commands for my bot
i may be incorrevt tho
what code do u use
Just explain how and I will try to understand the rest
This does not require a discord.js update! It should work as long as you're using a modern version (anything v12 would probably work, obviously v12.5.1/latest is recommended) pog
2 seperate things
well both
is djs a handler?
no..
pretty sure its a library no
i mean command handler
oh

lul
I'm new on coding ☠️☠️
well if you want to do commands you take a user's input using the message event, parse that message and check if the first argument starts with the bot's prefix if it does run the command

YouTube will make me handicap
Wdym by taking a users input message?
you take the input from a user
well
if your new to coding
its good video set
It was a joke
for a basic handler
I said he was already handicapped
banana cat
hey! What was the exact property to check if a message.author has specific roles? Wasn'tt it something like: message.member.roles.has(...)
Then you should spend a lot of time learning computer science and the language you'll be using rather than a bot at first.
tbh I learned to code by making a bot
who wants a coding challenge?
I'm fucking tired but sure
Some like to learn the language and how to program a Discord bot in parallel, but it's often inefficient as a source of learning.
const checkIsColumnWinner = board => false;
const checkIsDiagWinner = board => false;```
implement these 3 functions. 1st is easiest and 3rd is hardest
but once u get the hang of it you learn faster is what I've seen
Of course.
I need context
To learn the language you need to build a project with it.
Unless you're a massive book worm
that has no extension friend
[[null,null,null],[null,null,null],[null,null,null]]
[["x",null,null],[null,null,null],[null,null,null]]
[["x","o",null],[null,null,null],[null,null,null]]
[["x","o","x"],[null,null,null],[null,null,null]]
[["x","o","x"],["o",null,null],[null,null,null]]
[["x","o","x"],["o","x",null],[null,null,null]]
[["x","o","x"],["o","x","o"],[null,null,null]]
[["x","o","x"],["o","x","o"],["x",null,null]]
[["x","o","x"],["o","x","o"],["x","o",null]]
So I get the result of all of this?
right?
yeah, that's just printing out the automated moves
function checkDiagWinner(board) {
return (board[0][0] && (board[0][0] === board[1][1] && board[1][1] === board[2][2])) || (board[2][0] && (board[2][0] === board[1][1] && board[1][1] === board[0][2])) ? board[0][0] : false;
}
lmao
fail
lol
const checkIsRowWinner = board => {
let found = false;
for (const row of board) {
if (row.every(value => row[0] === value && value !== null)) found = true;
}
return found;
};
First one
how about without mutation?
it works tho lmao
mmmh ight I'll try
yeah, but what if the board size changes?
hey
well your example was tick tack toe
i actually forgot how to add multiple // lines in vsc
wasn't it like: //** or something
4x4 with 3 in a row for win?
nope, but it's a void function
any variation of tic tac toe is biased
am I allowed to use forEach?
ever heard of 3d tic tac toe?
nope, heard of 3d chess
the issue with ttt is that the starting player always have a clear advantage
how about 5d chess
const checkIsRowWinner = board => {
let found = false;
board.forEach(row => {
if (row.every(value => row[0] === value && value !== null)) found = true;
})
return found;
};
no, I mean, 3d ttt is a variation where you have different size pieces
bigger pieces can be put on top of smaller pieces
I can try wuthout foreach if u want
still, the starting player always wins if played right (or draw)
i was thinking of tic tac toe played in a 3d cube board
const isRowWinner = (board) => {
// #stolen
return board.some((row) => row.every((cell) => row[0] === cell && cell));
}
so pretty
mmmh didn't think of using some
const isRowWinner = board => board.some(row => row.every(cell => row[0] === cell && cell));```






