#development
1 messages · Page 1380 of 1
we reached a quater of a million subscribers, 250,000 subscribers
we reached a quater of a million brain cells, 250,000 brain cells
what did you do lol
take an hour to realise git commit
after i use .fetch(), would it save on cache?
cryig
yes
fla-
it should unless you explicitly say no in the options
ok
const client = new Discord.Client({
messageCacheLifetime: 300,
messageSweepInterval: 600,
});
would this... get rid of member cache?
ik
how do you know it didn't cache? what was your code?
but like wtf i need to see why this isnt workin
ik it didnt cache because
let result2 = (await manager.broadcastEval(`this.guilds.cache.get('${guild.id}').fetch('${userinfo.id}');`));
if (result2[0] !== undefined) {
let result3 = (await manager.broadcastEval(`this.guilds.cache.get('${guild.id}').members.cache.get('${userinfo.id}').hasPermission("ADMINISTRATOR");`));
(sharding)
you're doing guild.fetch() instead of guild.members.fetch()
bruh
someone from my team has been compromised ;-; sad
i am legit resetting the token every minute to make sure nothing bad happens
i hate discord's new bot verification
the owner isnt even active right now
someone from my team has been compromised ;-; sad
i am legit resetting the token every minute to make sure nothing bad happens
@small prairie and thats why we use 2fa
(node:12280) UnhandledPromiseRejectionWarning: TypeError: Error when sending eval response to master process: Cannot read property 'replace' of undefined epic ok one time erro rwtf
i aint the owner i dont even know who got comprised and IF somone get compromised
it could be a real person doing that
i mean our team member
I still need to set up sharding but I have no idea how to get started any suggestions? I'm using discord.py
if(message.content === "!invites"){
const userInvites = message.mentions.members.first()
message.guild.fetchInvites()
.then
(invites =>
{
const userInvites = invites.array().filter(o => o.inviter.id === user.id);
var userInviteCount = 0;
for(var i=0; i < userInvites.length; i++)
{
var invite = userInvites[i];
userInviteCount += invite['uses'];
}
message.reply(`You have ${userInviteCount} invites.`);
}
)
}
why is my code not working once i use !invites "@" member
for fuck sake
haha
@eternal osprey it's your code. You should be able to tell us what isn't working about it
are you getting an error, or is it doing nothing
How does sharding even work though
well it should check the invites of the member you are mentioning
and it is not responding at all
How does sharding even work though
@earnest phoenix google
yes good
I've already googled "Discord.py Sharding" i've read most of it but it hasn't really helped explain it to me
google "sharding" itself
Just from the code block, may it have to do with your syntax (like why you have (invites => {...})) separate from .then?
Auric that's very vague.
So we need to shard a database?
no
the servers get sharded
I thought this was totally different that's great then
how many servers is your bot in
Never mind
200ish
u don't really need to shard
but I want to get it out the way
do what u want tho
it increases resource usage to shard
Auric that's very vague.
@sudden geyser idk any better way to explain
I don't even know how to start it though
Like my amount of confusion is unexplainable
i use discord.js so i wouldn't know discord.py sharding
I know that's why it's so confusing for me
Most good sources are for a different language
and the sources I can find with google are just confusing
idk if that helps
Yeah I looked at it the documentation was the first place I checked but it didn't make much sense sadly
wdym by "it's didn't make sense"
Just hope someone can point me in a good direction or explain it better lol
are u able to implement it or not?
I don't understand it
Like it's beyond my understanding
Lite, can u explain?
I know I'm probably being annoying and stupid
nah lite will explain or something
lol don't you just need to change it to AutoShardedBot
it does everything else for you
he doesn't understand it that's all
what
I don't know what "it" is
That's the problem
sharding
sharding is the process of seperating your bot into separate processes or "shards"
I know kind of what database sharding is
discord only lets one connection be responsible for 2500 guilds
so sharding is the way to have multiple connections for more than that
You asked how sharding works (first message I saw). You can find some good responses by searching, like Tim's answer:
a shard is a connection to discord. they only allow each connection to have 2500 guilds, so if your bot has more guilds than that, it needs to start "sharding", which means splitting itself into multiple connections, each handling a specific number of guilds
And the documentation is useful. See the longer detailed info on sharding here: https://discordpy.readthedocs.io/en/latest/api.html#discord.AutoShardedClient
The difference between this line and what Auric sent you is this one is the base class.
yes
OOOOOOOOOOOOOOOOOOOH
AutoShardedClient
I'm a complete dumbass
same
mm waffles
I know Auric but Lite and Flaze really helped me a lot
at JSON.parse (<anonymous>)
at AsyncFunction.main.getFilters (C:\Users\---\Downloads\---\chika-bot\node_modules\ytsr\lib\main.js:76:23)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)```
I installed ytsr recently and when I try to run the code this error appears. Can someone help me?
Show the code
@haughty bough it's ytsr problem
Is there any way to fix it?
It's probably trying to parse HTML as JSON.
Since it comes from a library, you should see if anyone else is complaining about it on the GitHub repository issues tab.
Sad :c
is there a way to check if a certain user is in a discord call?
I wanna make a bot that kicks my friend at random times
nope
If the call is taking place in the server (voice channels), you could.
I wanna make a bot that kicks my friend at random times
Check if the message.member.voice.channel.members (map) includes your friend
Assuming js
async function kickThibo(client) {
let randomTime = Math.floor(Math.random() * 10) + 5;
await wait(randomTime);
let thibo = client.users.cache.get("610465200876814338")
if(thibo.member.voice.channel) {
thibo.member.voice.kick();
}
await wait(5000)
if(thibo.member.voice.channel) {
thibo.member.voice.kick();
}
kickThibo(client)
}
This doesnt work "voice" of undefined
you're trying to read a member property from a user.
thibo.member
no shit didn't see that.
mihz, read. it says thibo.member /s
what are you doing anyway
what member?
what guild?
how can a user be inside a VC
since when does a user have a member property.
never ever been
exactly.
how would I do it then
Tryna kick my friend at random times out of the voice channel
are you DCing the bot at random times-
oh
get the guild first
the guild your friend is in
then the member - then the voice state.
async function kickThibo(client) {
let guild = client.guilds.cache.get("538460586564911119")
let randomTime = Math.floor(Math.random() * 200) + 100;
await wait(randomTime);
let thibo = guild.members.cache.get("610465200876814338")
if(thibo.voice.channel) {
thibo.voice.kick();
}
await wait(5000)
if(thibo.voice.channel) {
thibo.voice.kick();
}
kickThibo(client)
}
For some reason he basically gets kicked every second
function wait(time) {
return new Promise((res) => {
setTimeout(res, time, true);
});
}
I can't find the mistake tho ;-;
well it gives true to the function but that does nothing
Any feedback? https://pix.pixsite.repl.co/
An anonymous, free, and efficient image uploader.

Hmm, i think that could be just
async function kickThibo(client) {
let guild = client.guilds.cache.get("538460586564911119"), randomTime = Math.floor(Math.random() * 200) + 100;
return new Promise(r => setTimeout(() => {
let thibo = guild.members.cache.get("610465200876814338");
return r(thibo.voice.channel ? thibo.voice.kick() : null),
kickThibo(client);
}, randomTime));
}``` @tulip ledge
someone link me to sharex
@blissful coral https://getsharex.com/
thx
@cosmic forum it's simple (which I like), but it feels like an empty void wanting to be filled. Maybe you could make the Upload an image button stand out more, like making it take up more of the frame?
I'd also suggest pinning the copyright to the bottom of the screen.
@cosmic forum it's simple (which I like), but it feels like an empty void wanting to be filled. Maybe you could make the Upload an image button stand out more, like making it take up more of the frame?
I'd also suggest pinning the copyright to the bottom of the screen.
@sudden geyser Ok, thanks for the feedback. I'll try and add all that in!
how do i completely remove the dark theme option from my page
like if a user has dark theme already enabled, it forces white theme on my page
You'd need to look in the HTML and apply CSS to your page, but why would you want to do that? The user would probably not like that, considering they enabled dark mode to stay away from the light.
you cant enforce light theme styling lol
there'll always be things like dark reader
imagine having no adblock
Imagine being bothered by small ads
^

fax
imagine dragons
not even small but okay
yea yea thats what i thought
how am i supposed to select these intents? its greyed out and wont let me click them
< 10% of screen size
is your bot past 100 servers?
you have to request those intents
wheeze
well when you originally got verification you where supposed to.
if not then yeah you gotta go the long process with their email
i verified before they were mandatory 
Türk varmib
there should have been a section for what intents you needed even at the early stages afaik
yeah, i never checked it then
didnt know i was supposed to lol
@timber cloak it shouldnt remove it if you styled it properly which im guessing you didnt, make your selector for the background flexible
but i cant get ahold of anyone to un-fuck it up for me at discord support
wym flexible
adaptable
body {
color: #000000;
background-image: url("https://cdn.discordapp.com/attachments/609162277312266280/745083199121522748/7356d5738f57e25e662172bc7d38ffe3.png")!important;
height: 100%;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}```
a lot of devs did the same, so they probably have a lot of emails about it
!important @timber cloak
so see what changes when you enable dark mode and select that too @timber cloak lol
that too
lol nevermind
thanks to the nature of dbl's website
a literal dumpster fire i don't know who made this but it's horrible
not yet
bruh
!important where
what
your css is going to be overriden regardless on dark mode because whoever made this does not know how to use css properly
nah it's auto set by none !important
but
whoever wrote that
deserves to be fired from dbl
lol
bruh
yes
how do i keep my background from changing to black doe
it's auto set by none !important
firefox just expands it
expand dong
you can't
i explained above why
i mean you can, with js
but you need cert dev for that
whoever writes styling for dbl really needs to be fired this is hot garbage
why didnt you do that

i dont think these people ever heard of css variables
LOL
"oh yeah bro just set z-index to sum really big"
tfw when you follow w3schools
big brain
atleast im not the only one who just does random things to get the css to work
they're working on a rewrite
god knows when it will be finished
but it better be not shit
watch them mash together random css in hopes it works
hello i need help for my project
1 i created a fivem bot and i have a command /players in a embed
and when the players are 34 and more the console send me this error
(node:11080) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
embed.fields[0].value: Must be 1024 or fewer in length.
at RequestHandler.execute (C:\Users\30699\Desktop\FiveMStats\node_modules\discord.js\src\rest\RequestHandler.js:154:13)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async RequestHandler.push (C:\Users\30699\Desktop\FiveMStats\node_modules\discord.js\src\rest\RequestHandler.js:39:14)
(node:11080) 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:11080) [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.
and my question is how can i filter the first 32 players and send an embed and after tha send an other embed with the other players remaned
can someone help ?
create an array of strings; do a for loop on your array and keep concatenating your string with the players up until it crosses 1024 chars, once it does, start concatenation on another new empty string
ok thanks
@earnest phoenix read his presence lol
😬
people trying to figure out on their own, a rare person.
with how rare it is in here, im practically proud.
//pseudo
let strings = [""];
let stringArrayIndex = 0;
for(let i = 0; ....)
{
let player = //index your array here
let el = strings[stringArrayIndex];
if(el.length + player.length > 1024)
{
//switch the index, create empty string, reassign el
}
el += player;
}
this should be the base logic for it, it can be obviously improved i wrote this on the go in discord lol
the logic should obviously be adjusted if you want to introduce anymore characters i.e. newlines
how can i delete a reaction from a message?
inspect element
Wat
same thing: use inspect element and css
ah ok
you can use css inside your long description by using <style> tags btw
send what you entered inside the <style> tags
ok
pastebin if it's long
</style>
</head>
<body>
<h1>Pill Buttons Example</h1>
<button>Button 1</button>
<button>Button 2</button>
<div></div>
<button>Button 3</button>
<button>Button 4</button>
</body>```
Is that long?
i think I found it but I want to confrim
yeah that's not how it works
unless you want the buttons inside your long description
Yeah no
Ok
woops wrong one
god damnit
how do i add a background to longdescription?
with css
use inspect element to find the css selectors
so you can use <style> inside your long description in order to override them
when i added it, there was no background
did you use the correct selector?
.longdescription {
background: url("https://images.app.goo.gl/2Wefcj6CCJNX9Si29")!important;
}```
i tried both background-image and background
did it change to only something like this (not my bot, just a random one i took off the page) https://cdn.hopefuls.de/oojp
with a color for example
no it didnt change any elements lol
is it even possible to put a background image behind the text
yeah
o
o wait
i added a linear gradient to background: and it appeared behind the white box
like urs
the css selector for the element behind the test is called "content"
oh ok ty
html body section#bot-details-page.page article.wrapper-page div.container.is-widescreen div.container.is-widescreen div.longdescription div.content
is where it is

.longdescription .content {?
ahkk
background-image: url(https://example.com/cat.png); for example
any other commands i should add?
Don't forget #deletebot
Yes

#password seems bad enough though
it dosent display servers displays numbers, and it sends a random generated password
Why would you ever use that command
So everyone else can see the password you're generating?
wym dev tool
no its dmed
F12
ohhh
dude
no console log or anything
Inspect tool
not everyone is new to chrome elements
??
any other commands you think tho?
idk man
Ur bot seems pretty random so...kinda hard to tell you anything
where the hell are these white triangles
@timber cloak finding the selectors is a pain sometimes
i managed to get rid of them when i had my own bot
removing the position: relative property in the .atag seems to get rid of it @timber cloak
what bot should i make

how do i make a dash board?
uhhh
Coding it
code one
ok
in html and js and c#
o
or get someone to make one for you
ah that would be nice XD
they will definitely not do it for free though
yes they would def not
visual code is the best ide right?
sure
I keep getting pinged
ok
leave
uh
make a command
but have a timeout
so it stops at a specified time
I keep getting pinged
@fair rover poor dude, your name is being used in examples
in html and js and c#
@young flame well you don't need c#
how do i make a dash board?
@earnest phoenix do the same as you would go about downloading ram
Or downloading printer ink

shit thats fucking deep

V
downloading happiness
@rustic nova ReferenceError: happiness is not defined

it's always been this way.
@young flame oof
wut
how is it the same lol
and @earnest phoenix there r many things to a dashboard (I’m assuming it’s for ur bot)
it's a joke
the punchline is they think fullstack development is as easy as opening a car door, so they'd be gullible enough to believe you can download ram
good for you
who is able to help me with html/css for my bot page? I have no idea where to even start
inspect element is the way to go 
F12 right? That should open up the stuff to see it?
try it and see
didn't even know that was a thing lol I don't do this stuff ever 😂
i have absolutely no idea what I'm looking at when I inspect it...that's why I asked for help...in a development help channel
the best thing is to see what elements you would like to change
How would I inspect my bot’s page?
because I tried to do it, it took an hour and it didn’t work 😐
Hiiiii
hewo
Ummm do y’all know how to invite bots to a server on iOS ????
wrong channel
something like this @fast trench https://cdn.hopefuls.de/c3ut.gif
Its hard to find someone who can help me code api scraping
what
I need someone who can help me code a bot
That helped so much to find the correct element in the side panel...I'll look for a bit and see what I can think of then ask if I have issues
the only tip i could give is to compare the colors. If you mess anything up while testing, you can always just reload the page and it should be back to normal
i was about to ask if I should test in VSC and a live server in case I royally fuck something up lol
nah you can literally test the css inside the actual inspect element. Once you find something you like, you can simply copy the whole class and insert it into the style tags on your long description
oh so do tests in the inspect then just copy and paste it in the edit page? sorry if I'm confusing everything
I've done some minor html and css but this is new ground doing it this way
favouriteOs = input("what's your favourite os?")
if favouriteOs == "ubuntu":
print("wise choice )
else:
print(favouriteOs,"is cool but linux and Ubuntu is best")
Would this work
I keep inspecting my page but it doesn’t save
i
thats not how it works
yes
that's inspect element
if you want to edit the contents
there's an edit button
Ohhhhh
dam it. All my work gone to waste
¯_(ツ)_/¯
Do I have to use the detailed description?
Ah ok
Who can help me pls?:((((
I am trying to call the variable but via the result name; for example:
${client.emojis.cache.get(ops.giemojis.Keqing)} to ${client.emojis.cache.get(ops.giemojis+`${body[result].name}`)}
But it doesn't detect anything, it gives me the result as 'undefined' ... how could I do it? Thank you
How I get my bot online?
...run it?
Q_Q
Cost money??
new Image() exist on javascript but doesnt on nodejs
im trying to check if a file is a valid image (not a gif or apng) but new Image() doesnt work on nodejs so i need an alternative
without needing to download a image
how do you check if a fruit is an apple if you don't have the fruit
google
let img = new Image();
img.src = 'image link';
image.onload = function() {
console.log('valid');
};
image.onerror = function() {
console.log('invalid');
};
^ would work on js on browsers
but not on nodejs
yes
because that's just a html element
html does not exist in node
setting the src downloads the image
lol
ik but like, it kinda saves it in well most browsers cache but ram usage or something im being dumb rn
it.... doesn't?
"idk im being dumb rn"
i found this on google http://roufid.com/javascript-check-file-image/
Step by step tutorial to learn how to JavaScript check if file is image using pure JavaScript function and JQuery on Roufid.com
but... wtf is acceptedImageTypes lmao
i alr tried google
it's literally equivalent of doing <img src='url' onload='load()' onerror='error() />
https://www.npmjs.com/package/is-image is one of the closest things i got but idk if it has url support
download the image into a buffer with node-fetch and use https://www.npmjs.com/package/validate-image-type
imma stop being lazy and just make the image be uploaded
I am trying to call the variable but via the result name; for example:
${client.emojis.cache.get(ops.giemojis.Keqing)} to ${client.emojis.cache.get(ops.giemojis+`${body[result].name}`)}
But it doesn't detect anything, it gives me the result as 'undefined' ... how could I do it? Thank you
you need to be more descriptive about your issue
there's a package for anything because node devs are known to be lazy
jesus christ
${client.emojis.cache.get(ops.giemojis.Keqing)} gives me the code of an emoji. what I want to obtain from all this is that with the name of a character "Keqing" I already obtain the code.
(ops.giemojis.Keqing) -> (ops.giemojis+`${body[result].name}`)
https://prnt.sc/vhouhq
this is where the node_modules meme comes from, you end up downloading half of the universe, erwin 
let arrayOfValidTypes = [];
let test = name.split('.');
if(arrayofValidTypes.includes(test[test.lenght - 1])) return true; else return false;```
There i made the package
array of valid types
split on .
get last entry
check if array inlcudes it
gg ez

173K weekly downloads
it's just lazy/new devs with the "muh package will do it for me 🤤 " mentality not understanding how much they're bloating their app
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
i cannot emphasise this enough
I mean it just turns a 3 line solution into maybe a 1/2 line solution
I mean, there's always the argument "why write something thats already been written a million times"
using a package someone else wrote can actually end up with less bloat depending on how neat the package you download is
I understand everything but the page menu
should I do:
element.style {
background-color: aliceblue;
}
nope.
that wouldn’t work. 😐
Use a hex value for specific blues
how do you check if a fruit is an apple if you don't have the fruit
back to the past
again, use inspect element to get the css classes
I did
Yes ik
if the override doesn't work, slap !important on it
if that doesn't work, you've got the wrong selector
ok
i’ll try
🖐️ *slaps*
@earnest phoenix im pretty sure it doesn’t know what element it’s looking for
what's your css right now
element.style {
background-color: #428h23;
}```
element is not a valid selector
yep...
right click on your element and you should be able to just
i'm on firefox
so it might be different
@earnest phoenix im pretty sure mine is on by default
what?
wat
@earnest phoenix ok got it
mine is copy selector instead of CSS Selector
@earnest phoenix it says #menu
i forgot how to make a reason thing like luca
@young flame A-reasoncommand?
Or just a reason
Just log the message ID and the Log ID
And the channel DI
Then get the channel then fetch the message then change the content
Have funnnnnnnnnnnnnnn
OKAY


where
When I do !Play
i asked where
when I open htop in my vps
I see a lot of things open
but I didnt even start anything yet.
How do you guys manage to keep it low?
segfaults shouldn't happen unless you're messing with memory or doing something you shouldn't be doing
Terminal
i
I killed
Oh @earnest phoenix your back
f9
a..
@supple oriole the segfault is more than likely because youre using replit
I am making sort of a dashboard, and I cannot seem to get the Oauth2 Working correctly, as I keep getting the error:
TokenError: Invalid "code" in request.
at Strategy.OAuth2Strategy.parseErrorResponse (/home/impassive/Coding/Express_Apps/Discord-OAUT2/node_modules/passport-oauth2/lib/strategy.js:358:12)
at Strategy.OAuth2Strategy._createOAuthError (/home/impassive/Coding/Express_Apps/Discord-OAUT2/node_modules/passport-oauth2/lib/strategy.js:405:16)
at /home/impassive/Coding/Express_Apps/Discord-OAUT2/node_modules/passport-oauth2/lib/strategy.js:175:45
at /home/impassive/Coding/Express_Apps/Discord-OAUT2/node_modules/oauth/lib/oauth2.js:191:18
at passBackControl (/home/impassive/Coding/Express_Apps/Discord-OAUT2/node_modules/oauth/lib/oauth2.js:132:9)
at IncomingMessage.<anonymous> (/home/impassive/Coding/Express_Apps/Discord-OAUT2/node_modules/oauth/lib/oauth2.js:157:7)
at IncomingMessage.emit (events.js:327:22)
at endReadableNT (_stream_readable.js:1220:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
@supple oriole the segfault is more than likely because youre using replit
@earnest phoenix Ah alr.
you didn't provide the correct oauth code, as per the error @boreal flume
Do you mean the Client stuff?
don't know what you're talking about
the error says that you didn't provide a correct oauth code
...you do understand what that is, right?
Not really, this is my first time using discord to log in
I code bots typically, not dashboards...
once the user completed authorization they'll be redirected to your redirect uri with a code url parameter
that's the code that you use to exchange for a token
you somehow provided an incorrect code
yes... this is what is redirrected me to: /auth/redirect?code=x8BFmuSQSCLkiz4KaNs5HgLEbn5LpG
log it to console and double check if they match ig
What should I log to the console, the accessToken?
#header {
display: flex;
align-items: center;
justify-content: center;
}
Is there any noticeable problems right off the bat?
Because for some reason it is not centering.
Pissin me off
the code, because the error says you provided the incorrect code
C:\Users\Raj\Downloads\Mashiro-MusicBot (2)\node_modules\prism-media\src\opus\Opus.js:64
return this.encoder.decode(buffer, Opus.name === 'opusscript' ? null : this._options.frameSize);
^
TypeError: The compressed data passed is corrupted
at Decoder._decode (C:\Users\Raj\Downloads\Mashiro-MusicBot (2)\node_modules\←[4mprism-media←[24m\src\opus\Opus.js:64:25)
at Decoder._transform (C:\Users\Raj\Downloads\Mashiro-MusicBot (2)\node_modules\←[4mprism-media←[24m\src\opus\Opus.js:189:20)
←[90m at Decoder.Transform._read (_stream_transform.js:191:10)←[39m
←[90m at Decoder.Transform._write (_stream_transform.js:179:12)←[39m
←[90m at doWrite (_stream_writable.js:392:12)←[39m
←[90m at writeOrBuffer (_stream_writable.js:374:5)←[39m
←[90m at Decoder.Writable.write (_stream_writable.js:314:12)←[39m
←[90m at PassThrough.ondata (_stream_readable.js:708:22)←[39m
←[90m at PassThrough.emit (events.js:315:20)←[39m
←[90m at addChunk (_stream_readable.js:297:12)←[39m
Another error
How would I find the code to log it?
no idea, i dont use the package since i pretty much always implement the oauth protocol manually
googling around might help
I have no clue how to implement it manually, but would that be easier?
for you? definitely not
you need to have a good understanding of https://tools.ietf.org/html/rfc6749 and https://tools.ietf.org/html/rfc2616
Ok then
Hmmmmmmmmmmmmmmm....
I am now not getting the code error
but it tells me I am unauthorized
<div style="border-radius: 50%"></div>
border radius rounds the edges, 50% makes it a circle/oval
No
just vsc
Here
CSS:
.header {
display: flex;
align-items: center;
justify-content: center;
}
HTML:
<body>
<div class="wrapper">
<div class="header">
<img src="servervoting.png" alt="Server Voting+">
</div>
</div>
</body>
Yet the image is still stuck in the top left
maybe you have another tag
Yeah wrapper
that is making is stick to thing?
But it isn't doing anything
1 sec
try align-content?
umm
Yeah.
maybe just do style?
whats alt?
The alt text describes what's on the image and the function of the image on the page.
When I align body it will do it to everything in body
what is flex?
When trying to center things it's best to use margins: auto;
what is it lol?
Doing align-items
Ooo
Ok
Wait
body {
background-color: #23272A;
display: flex;
align-items: center;
justify-content: center;
}
That is moving it
I fucking hate coding
LMAO
I found the problem
My discord Oauth2 login keeps failing... I have gotten rid of the Code error, but now it does not let me log in as it sends me to my forbidden page
how do you fetch a message in djs
how would i literally make a box in html
like a square
where i can put text in?
client.on("guildMemberRemove", async (member) => {
if (member.id == client.user.id) return;
if (!servers[member.guild.id] || !servers[member.guild.id].logs) return;
const channel = member.guild.channels.cache.get(servers[member.guild.id].logs);
const fetchedLogs = await member.guild.fetchAuditLogs({
limit: 1,
type: 'MEMBER_KICK',
});
const kickLog = fetchedLogs.entries.first();
if (!kickLog) {
const e = new Discord.MessageEmbed()
.setColor('RED')
.setTitle(`Member Left`)
.setDescription(`${member} left the server`)
.setFooter(`User ID: ${member.id} - OXYGEN Security`, client.user.avatarURL({ dynamic: true, format: 'png', size: 1024 }))
return channel.send(e)
}
const { executor, target } = kickLog;
if (target.id === member.id) {
const e = new Discord.MessageEmbed()
.setColor('RED')
.setTitle(`Member Kicked`)
.setDescription(`👮 ${member} was kicked from the server by ${executor}`)
.setFooter(`User ID: ${member.id} - OXYGEN Security`, client.user.avatarURL({ dynamic: true, format: 'png', size: 1024 }))
channel.send(e)
}
})```
It wont trigger when someone leaves
only on kick
<div style="border: 1px solid black">Text Here</div>
Is netlify better than heroku? Can I host node projects on it?
heroku wokrs fine
How can I my bot bruh
if (member.id == client.user.id) return;
if (!servers[member.guild.id] || !servers[member.guild.id].logs) return;
const channel = member.guild.channels.cache.get(servers[member.guild.id].logs);
const fetchedLogs = await member.guild.fetchAuditLogs({
limit: 1,
type: 'MEMBER_KICK',
});
const kickLog = fetchedLogs.entries.first();
if (!kickLog) {
const e = new Discord.MessageEmbed()
.setColor('RED')
.setTitle(`Member Left`)
.setDescription(`${member} left the server`)
.setFooter(`User ID: ${member.id} - OXYGEN Security`, client.user.avatarURL({ dynamic: true, format: 'png', size: 1024 }))
return channel.send(e)
}
const { executor, target } = kickLog;
if (target.id === member.id) {
const e = new Discord.MessageEmbed()
.setColor('RED')
.setTitle(`Member Kicked`)
.setDescription(`👮 ${member} was kicked from the server by ${executor}`)
.setFooter(`User ID: ${member.id} - OXYGEN Security`, client.user.avatarURL({ dynamic: true, format: 'png', size: 1024 }))
channel.send(e)
}
})
It wont trigger when someone leaves
only on kick
@zenith knoll why dont u just check that the user in your kick log is the same user that left? every time that you run that, it will basically just look at the last person that was kicked and therefore kicklog will be nonnull and that if won't ever evaluate, yes?
@zenith knoll why dont u just check that the user in your kick log is the same user that left? every time that you run that, it will basically just look at the last person that was kicked and therefore kicklog will be nonnull and that if won't ever evaluate, yes?
@sturdy gazelle if (target.id === member.id) {
yeah so it just falls through and does nothing
wdym
i dont get how even though there is no kickLog if (!kickLog) returns false
meaning there is a kicklog? but users that leave dont cause a audit log
no it means that kicklog is not null
if u do if (obj) it is basically saying if obj is defined iirc
no just make it an if...else
wdym
if (target.id === member.id) {/*Kicked!*/}else{/*left!*/}
that should work unless your ban log/audit log is slow then you could have unintended consequences
<!DOCTYPE html>
<html>
<head>
<style>
div {
text-align: center;
background-color: #222233;
width: 50px;
height: 50px;
border: 0px solid navy;
line-height: 50px
}
</style>
</head>
<body>
<div style="color: #70FF69; font-size: 21px; font-family: helvetica;">
<b>1</b>
</div>
<div style="color: #70FF69; font-size: 21px; font-family: helvetica;">
<b>1</b>
</div>
</body>
</html>
why does it end up stacked up?
Like side to side
I’m getting this issue really frequently so solving it would be awsome
try float: left;
any 1 here know any code to make ur bot join a voice channel and play music. Like MEE6 Does??
can someone pls tell me the best way to calculate level from experience for a level bot
@commands.command(name='random')
async def _random(self, ctx, arg1, arg2):
min = arg1
max = arg2
otcm = random.randrange(min, max)
await ctx.send(f'Printing: {arg1} and {arg2}')
await asyncio.sleep(0.1)
await ctx.send('Transfering to variables...')
await asyncio.sleep(0.1)
await ctx.send(f'Results are {min} and {max}')
await asyncio.sleep(0.1)
await ctx.send('Choosing a number in between...')
await asyncio.sleep(0.1)
await ctx.send(f'Chose {otcm}')
pass
Creates this: ```
Ignoring exception in command random:
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "/home/pi/Documents/Room_Sealer/cogs/room-sealer-random.py", line 18, in _random
otcm = random.randrange(min, max)
File "/usr/local/lib/python3.8/random.py", line 212, in randrange
raise ValueError("non-integer arg 1 for randrange()")
ValueError: non-integer arg 1 for randrange()
Language is Python
just typehint them to int https://discordpy.readthedocs.io/en/latest/ext/commands/commands.html#converters
..., arg1: int, arg2: int):
hhhh
hi
@bot.event
async def on_message(message):
global counter
global pkmn_list
if message.author != bot.user:
counter += 1
if counter % 3 == 0:
async def spawn():
embed = discord.Embed(
title = "A wild pokémon has appeared!",
description = "Guess the pokémon and type `p!catch <pokémon>` to catch it!",
color = 0x00ff00
)
rand_no = random.randint(0, len(pkmn_list) - 1)
embed.set_image(url = pkmn_list[rand_no][2])
await message.channel.send(embed = embed)
catch(rand_no)
await bot.process_commands(message)
async def catch(rand_no):
@bot.command()
async def catch(ctx, arg):
global pkmn_list
global rand_no
if arg.lower() == pkmn_list[rand_no][0]:
await ctx.send(f"Congratulations {ctx.author}! You caught a {pkmn_list[rand_no][1]}!")
else:
await ctx.send("That is the wrong pokémon!")
ive been trying all day and i finally made this
so after 3 messages, the spawn def takes place, spawns a pokemon
and then the user can catch it
that process_commands should not be indented inside if statements
he literally helped you
thats below the embed
Alright so how to use .replace in JavaScript
I tried it didn't work
so why will that affect it
This is what I'm doing
.replace for what
it won't run the command if you're not processing it correctly
oh wait nvm
wdym
i have the function inside which the command is
so that the commad only works after the spawn
const leavemsg = db.get(`LEAVE_MSG_${member.guild.id}`) var finalmsv = leavemsg.replace("{user.name}", member.username);
what's the contents of your leavemsg before the replace, and what's actually happnening vs what you want?
I want this
A user does s!setleavemsg {user.name} just left :( or any message
looks like that should work
And in guildMemberRemove event it will replace it
My bot sends nothing when member leaves and logs nothing
uhhh ok so what are you doing with finalmsv ?
ok so show that exact code perhaps
I'm so stupid
I was good rubber ducky wasn't I? 
I don't have guild Member intent how will I get guildMemberRemove event
:yya: I was good rubber ducky wasn't I? :ayy:
Yes
If I commit event it works fine @umbral zealot
Now I just need to wait for discord to review my Intents request
👍
Thanks for the help
like i said, if it's not sending the embed, then it's because you never call it. You're sending the embed inside spawn function, but you never call it
Is this for me ?
for Multi
why are they using events anyway
you can do those inside commands
oh nm its random
yeah it's random
so just call spawn()? 🗿
but there are some weird things though, why is it 1 space indented
wait why is it even a function
it's coroutine, so you have to await it
or use create_task if you don't want to block it
Hoi
hi
yea i didnt even need the spawn fuction so i removed it
and now it all looks like this
@bot.event
async def on_message(message):
global counter
global pkmn_list
if message.author != bot.user:
counter += 1
rand_no = random.randint(0, len(pkmn_list) - 1)
if counter % 3 == 0:
embed = discord.Embed(
title = "A wild pokémon has appeared!",
description = "Guess the pokémon and type `p!catch <pokémon>` to catch it!",
color = 0x00ff00
)
embed.set_image(url = pkmn_list[rand_no][2])
await message.channel.send(embed = embed)
await catchs(rand_no)
await bot.process_commands(message)
async def catchs(rand_no):
@bot.command()
async def catch(ctx, arg):
global pkmn_list
if arg.lower() == pkmn_list[rand_no][0]:
await ctx.send(f"Congratulations {ctx.author}! You caught a {pkmn_list[rand_no][1]}!")
else:
await ctx.send("That is the wrong pokémon!")
but then now the same pokemon is spawning everytime
which means the no is the same
but i thought the number would change everytime a message was sent
also im getting this error after every spawn except the first one
discord.ext.commands.errors.CommandRegistrationError: The command catch is already an existing command or alias.
is this for private server?
here's the thing, everytime you call catchs function, you register the catch command.
How do you get bot developer role
by developing a bot (?)
??
here's the thing, everytime you call catchs function, you register the catch command.
@earnest phoenix wdym by register
sry im new to py i dont know much
lol
I published my bot a couple hours ago
@fading hatch did it get approved
that command decorator registers the function as command, so everytime you call catchs function, it'll register the catch command
@fading hatch did it get approved
@vale garden not yet
yea so thats why you dont have the role
that command decorator registers the function as command, so everytime you call catchs function, it'll register the catch command
@earnest phoenix yea but what is wrong in registering it multiple times
cuz in a normal bot people use commands more than once
using a command multiple times is different than registering it multiple times
it's not like the command will be removed after used once
ok so do you know what i can do?
to fix it
or instead
is there a way
to collect a certain word
by using bot.wait_for
of course
- I'd use bot variables over global variables, because this way i can access the variable anywhere as long as i got access to the bot instance
- If you're planning to make this bot public, I'd use dict, with guild ids as keys and another dict which has counter, index of current pokemon and probably channel id (though you probably need to store the channel id on db) as values
- So after you send the embed, you wanna assign the necessary values to the dict.
- When someone call the catch command, you wanna check the index of pokemon of current guild is not None or whatever the default value you set, meaning a pokemon was already spawned, if so, then check if the arg is the same as the element with the index you stored on the dict.
Maybe this isn't clear enough but I hope it is
You probably also wanna make a timeout, that shouldn't be hard to implement
if(rating !== "5" || rating !== "4" || rating !== "3" || rating !== "2" || rating !== "1") return message.channel.send(`Second argument i.e Rating has to be a number out of 5 `)
Am I doing smthing wrng
My bot keeps returning this message
Event tho if i enter rating as 5
I have console loged rating
it also says 5
you checked a string against a number
you need to get rid of the "" around the numbers
ooo. ok thanks
Because you used !== it is also checking for types, if you used != it wouldn't check for types
Also that is a monstrosity
Just say
if (rating > 5 || rating < 0) { //checks if the rating is above 5 or below 0
}```
oh k thanks
If you do your first code, if the rating is anything other than 5 then it won't work, you needed && instead of ||
because it only goes onto the || statement if the first one isn't true
Assuming you use discord.js v12
Do you have at least node 12?
it's v10
can you run node -v in your terminal
node is v10
you need to update it
ok
For djs 12 you need at least node v12
you can use nvm (node version manager), that's my recommendation
alr
On mobile it does that, it's normal @crystal wigeon
Is there a fix? Because I need the border to behave properly
No there isn't, it's only so the image fits the mobile screen
Yeah it is, sorry about that
@hollow elbow you should use https://anidiots.guide for help on making basic commands using discord.js
if(cmd === `${prefix}nickname`){ if(!message.member.hasPermission("MANAGE_NICKNAMES")){ message.reply('Missing Following Permissions: ``MANAGE_NICKNAMES``') } else{ let nickname = message.content.split(" ").slice(2).join(" "); let member = message.mentions.members.first(); try{ member.nickname.change(nickname) } catch(err){ console.log(err) } } }
it says that member.nickname.change is not a function
how to do it corectly?
oh nvm i got it myself
it's member.setnickname @tribal siren and also read the docs.
oh nvm i got it myself
but still thank you
Ok
does anyone know how can I catch these errors?
https://alex.is-bad.com/4N4J8Sw.png
afaik try/catch won't work
how to turn off bot in visual studio
end the node process, by ctrl + c
oh thx
@wheat jolt What are you trying to do?
I am trying to catch that error
lol
it throws because of msg.react on a deleted message
😵
?
How to match a string
change your name to 'nothing', You have <number> seconds
the <number> can be any number from 1 or higher. How do i do that? My brain is dying .-.
in javascript
btw
;-;
anyone here good with discord.py ?
i used to be
but then i moved to discord.js
it's a ton better
so about my problem
i know that setSlowmode isn't a thing in discord.js
what can i replace it to?
oooh
anyone here good with
discord.py?
wouldn't say i'm good with it, but i might be able to help
same
so my problem is
the following code sometime return coming instead of the ID, do you have any ideas why?
msg = await channel.send(file=file, embed=embed)
print(msg.id)```
spesifically what do you want your code to do?
just to send the message and store the message id
oooh
could you take a screenshot of what it printed?
i know that
setSlowmodeisn't a thing in discord.js
@tribal siren setRateLimitPerUser()
could you take a screenshot of what it printed?
@earnest phoenix not possible since it does it at random, and I save the id on DB
oh
i've never found such thing, i always get the id, and there's nothing wrong based on those 2 lines if channel, file and embed were defined and the right types. Prolly because of the DB?
no sure, cause it started to give that problem 2 days ago
I dont see how DB could affect it 
neither do i
my friend is trying to make his own bot, and when he is trying to turn him on
its giving him this error:
operable program. Check the spelling of the name, or if a path was included, verify that the
path is correct and try again.
At line:1 char:1
+ node .
+ ~~~~
+ CategoryInfo : ObjectNotFound: (node:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException```
he tried to redownload node 5 times , what should he do
?
if(!member.hasRoles(mutedrole)) return message.reply("But he isn't even muted bruh")
what to change the hasRoles to?
my friend is trying to make his own bot, and when he is trying to turn him on
its giving him this error:operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + node . + ~~~~ + CategoryInfo : ObjectNotFound: (node:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException``` he tried to redownload node 5 times , what should he do
@tardy hornet install node
what to change the
hasRolesto?
@tribal siren v12?
he did
discord.js
he did install node @warm marsh
Added to path during installation?
yes
@tardy hornet why doesn't your friend contact us tho
Brace, member.roles.has(role)
@tardy hornet why doesn't your friend contact us tho
@tribal siren he dont know anything bout coding yet, want me to tell him to send it here?
yes
he wont get anything you will say but,,, your call
If node were installed and added to path you'd get
switch(x) {
case 1:
break;
case 2:
break;
}```
and do that over again
thx
breuhf
what's the problem
@warm marsh
TypeError: member.roles.has is not a function
What version of djs are you on?
member.roles.cache.has(role)
@tribal siren look


