#development
1 messages · Page 1911 of 1
is it a good idea to put an a.button inside an h1 inside an article inside a div.tile.is-ancestor inside a div.hero-body inside the main.hero
like does a screen reader think of the heading as also being a link or just an h1
i cant wait for some actual "challenging?" computer science exam questions for a levels
i dont think we get to learn interrupts though
make fizzbuzz but with the words fizz buzz deez nuts sus for 6 9 4 2 0 numbers each
fizz buzz deezz nutzz
¡ CONECTADO A MONGODB !
(node:3105) Warning: Accessing non-existent property 'distube' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:3105) Warning: Accessing non-existent property 'distube' of module exports inside circular dependency
(node:3105) Warning: Accessing non-existent property 'distube' of module exports inside circular dependency
(node:3105) Warning: Accessing non-existent property 'distube' of module exports inside circular dependency
(node:3105) Warning: Accessing non-existent property 'distube' of module exports inside circular dependency
(node:3105) Warning: Accessing non-existent property 'distube' of module exports inside circular dependency
(node:3105) Warning: Accessing non-existent property 'distube' of module exports inside circular dependency
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ ┃
┃ RAILBAN ESTA ONLINE | ?help ┃
┃ ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
What is this
eh, circular dependency lul
helpp
helppp
my shards are not getting calls from certain servers
idk why
but it says all shards are up
im using auto sharding
i can see the shard clusters
umm bulma the text is supposed to look different?
but idk why tf they not getting calls from servers
help
i put the bot on 2 different servers tho, maybe that's a reason why?
man fk i cant even split my code to run on diff servers
help
how many servers u have?
2?
then ur bot isn't sharded, I guarantee
you didn't
yes i did
u said u put autoshard
autoshard only shards above 2000 servers
...u said it was in 2
i meant, i deployed it on 2 VMs lol
tried to code split between servers
to handle only certain commands
but the commands are not working from seom guilds
sdc servers
u need to select which shards each server will get iirc
how
else both will listen to all shards
can u please stop speaking 1 sentence per line?
mhm, can you help me out here pls
idk how to do it, but u can't just run the exact same code on two vms
it'd be the same as starting the code twice
yeah which is why i tried running different one's but in that only some dc servers were able to reach the shards on the second server working other were not
what u could do is like, get shardid from client and if (<shardId> % 2 == 0) return;
I think it’s more complicated than it’s worth imo
Unless it’s a really big project that needs high performance
kinda is
load balancing is only worth above a hundred thousand servers
hmm
6k servers is nothing computer-wise
but i have a 4cpu 8gb VM which for was causing 160% cpu usage due to influx of players
160% is only 1 cpu at 100% and 1 at 60%
and depending on what you're doing, there's probably a way to optimize stuff
yeah i'm aiming for that in the long run but for a quick fix i tried moving some of the commands on anotehr vm
I have 9k guilds and still use internal sharding and it works fine
i have 2 vms currently
you should always try to optimize first before moving to another vm
^^
if u have a badly optimized code there'll be do budget that can support it
internal sharding can get incredibly far
Things like caching members/presence intent will take a lot of ram/cpu, especially if you don’t need to use them
ik im not doing any of those
presence is the least useful I'd say, unless u need to check whether a member is online or not
and it's a real performance hog
is your code open-source hoax?
@opaque acorn before u ask, circular dependency
nono
nop but i just wanna say i'm always trying to optimize it with little time that i get, but at the same time im also trying to scale better,
i dont going to ask
i dont wanan kill the bot until its fully optimized
i can work asynchronously, currently just wnat to make it stable
well, buying a second vps is not the answer
there're probably a couple or two open knots in ur code
i was ognna use that until i optimize stuff and stabilize it for some time
if i want to check if the channel is nsfw i have to do if (message.channel.nsfw) { } else { } ?
I guess so, check the docs
also one other thing, what if i split the code myself and start 1 app with few commands and other app with few commands in this case even if both vm spawn shard 0 it should work for all the guilds trying to access this command right?
yes but then you will be putting twice the work on your network
since youll be receiving all events twice
unless you split it by intents as well, ie process 1 handles messages, process 2 handles memberUpdates
and youll have to deal with split caching too
How do I do a post request in Express with Authentication?
I wanna make my signup for a fuck ton more secure
I’m gonna make it send requests to /new which will make the API requests instead of making the form submit direct to the API, which allows me to add authentication and makes it a bit more secure
right but this was not the case, the shards on vm2 never received the events from some discord servers but was working for few
You’re not using relative pathing
Use ../commands/whateverdirhere
Forgot the extra dot for whoever read that ^
readdir uses paths relative to the directory from where you started the process
you can also just use absolute paths
* Serving Flask app '' (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
* Running on all addresses.
WARNING: This is a development server. Do not use it in a production deployment.
* Running on http://172.18.0.70:4365/ (Press CTRL+C to quit)
172.18.0.1 - - [29/Oct/2021 16:53:25] "GET / HTTP/1.1" 200 -
I'm in
CoolZone-Assistant#2747
PY for a Friend. Can someone help?
with what
It runs then it stops running.
Hello, I'm getting this error, discord.js
I tried to attach a .mp3 file and this's what I got
The thing is that this worked just fine back in July, when I tried to do the same thing
The file is 74.73MB size
Is there a way I can bypass this?
the attachment limit is 8mb lol
Not for bots?
Like they have Nitro don't they
upload it to your own cdn and share the link as embed
bots dont have nitro
they have some special permissions and rules
some parts of nitro are included, but not all
You're right, but even then, as I said I did the same thing back in July this year and it worked perfectly, for some reason it doesn't allow me to do it now
I feel like bots did once have it, but not anymore.
Idk if Discord set a limit recently or something
May I ask how can I do that?
The main file currently looks like this
There are many ways! What do you use for hosting your bot? Repl.it , Vps
HostSapling, a VPS & hosting service
Okay,do you have a domain?
I don't think so
The most reliable of hosts 
You can get one at freenom or buy one .Since it would be bad,if you reveal your ip
you dont need a domain to host a file
So you will share the ip?
Just looking at the hosts bot services their highest end bot plans only include 256mb of ram. Hosting even a few 75mb files might turn into some issues.
Yeah I just wanna upload it in a ask-me-anything-sessions channel we've created recently
The main file is in other similar channel but we're planning to mix some of these amas channels into one single channel, so I'd just like to embed these mp3 files into the new channel
My server is a free one I got due to some sort of giveaway, it has low specs but they're more than enough for what our bots do
Well, just a note hosting these files yourself very quickly increases the ram usage
If your storing these files in memory even temporarily a 75mb file takes up like a third of your memory if your on 256mb(if that's the plan)
Yeah my server has 256mb, but what I question is the fact of why if I did the same thing some months ago it doesn't work now
you dont need to store them in memory
I know right, I don't even do that
This is what the code looks like:
if (message.content.startsWith(`mm!embed`)) {
let args = message.content.split(" ");
if (message.member && message.member.roles.cache.has(roles[0]) || message.member.roles.cache.has(roles[1])) {
message.channel.send({files:[{attachment: `file link here`, name: `QnA_with_Tokeeto_1.mp3`}]});
message.delete();
}
}```
if you dont need to programmatically generate the file
just upload it somewhere like google drive
and link it
Isn't there a way to embed it directly on Discord? Just like the last time
not without nitro afaik
Don't bots have perms to upload up to 100mb size files? 😔
not afaik
just like Nitro users
then how did da bot do it last time
idk
I still think it changed at some point.
same
Well thanks for the help, I guess I'll ask a mod with Nitro to pls upload these files onto the other channel 👍🏻
compressing would be an alternative solution.
can you help me please i tried oauth2 for my website but instead of showing the name of the person it shows the whole script of index.html
lol
Which framework are you using?
replit
Thats a hosting service 🤦♂️
IDK
oh
@earnest phoenix but
what is it framework I had already heard about it but I never looked at what it was
hum oh it's .js and .html ?
Like express
send a ss of your repl folder structure
ohhhhhhhhhhhh
so you use express can you go to index.js and send me a ss
is it the auth code from discord.js guide?
yes I used some code from the discord.js guide
so..... ? @earnest phoenix
first of all, you didn't update the redirect uri, so this will redirect to something you dont have access to
essentially not being able to obtain the access code
second, you should probably update the urls as thats the older ones
might not have an impact on usage, but would be beter
better*
that is how your code should look like
And dont just copy-paste it, try to understand the code, how it functions
Hummmmm okey thanks you very much
Agd
And
Second question
How I make for show the profile picture
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
important part for you is the avatar hash
https://discord.com/developers/docs/reference#image-formatting to then get the image url from the avatar hash
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
ooffffffff
Fully reading this should help
thanks 
You could also see a pattern when you for example get a users avatar from a avatar command on a bot
https://cdn.discordapp.com/avatars/669452973755072524/efdc7047b63c6e0198fee59a740c4489.webp?size=2048
669452973755072524 being my user id
efdc7047b63c6e0198fee59a740c4489 being my avatar hash
should be explained on the image-formatting though
another spam server invited my bot
anyone getting spammed from 895776092441436170?
I didn't get spam guilds yet weird.
they invite a bunch of bots and then send the !help command to them
one help command gets a response from every bot
Is this a guild or user?
guild
the name is 2 Invites = Nitro
Ah, spam servers like these.
I suggest using the .leave() method and leave that particular server.
Otherwise, if you are for more servers, keep it.
there was a spam guild with ~23k bots and that prevented my bot from logging in. i had to use the api to remove them first
give their id
i'm making a server blacklist db
898782595750428712 and 901538946222293002
epic ty
What's wrong with bot farms with verified bots? 
everything
ratelimiting
install 23k bots
call help command once
spam discord with 23k help responses
and then spam the help command
Discord client will crash. 
should i make the server blacklist api with express or quart/flask
main intent is probably to try to make discord die
yep
report them to discord
https://support.discord.com/hc/en-us
i reported the first two a couple days ago.
Ah, but how does that affect my bot?
He adds 23k bots, and he wasted his time doing that for no reason.
attempting to ratelimit and crash the bots
affects the discord api as well
Ratelimit as in how?
Does the message intent fire 23k times?
a lot of them spam !help etc
spam !help for 23k bots to ratelimit and attempt to attack the API
cloudflare will ratelimit all of the bots
I understand for 23k bots, but if you think about it, each bot sends help message one time which is not considered rate limit, so. 👀
instead of sending the usual 5-6 messages at one time when you do !help, it will send 23k at one time and it could affect the api
i mean cloudflare ratelimiting
iirc cloudflare will start timing out connections when a massive spike in requests happens
i mean not one bot ratelimit
cloudflare will start slowing down requests and timing them out if there is a massive spike
Ohh.. 👍
for example, 23k more requests at one time
Where can I see that massive spike?
you can't
Yikes...
well you can technically
Unyikes...
bots will slow down
Yikes..
as its not publicly visible as only discord can view on their cloudflare panel
Well, lucky them. 😂
lmao
just add cooldowns,then you are safe
Hm
Is that possible to get channel from guildCreate event, that bot actually can type in, not just random one
alr so
val = [
('Peter', 'Lowstreet 4'),
('Amy', 'Apple st 652'),
('Hannah', 'Mountain 21'),
('Michael', 'Valley 345'),
('Sandy', 'Ocean blvd 2'),
('Betty', 'Green Grass 1'),
('Richard', 'Sky st 331'),
('Susan', 'One way 98'),
('Vicky', 'Yellow Garden 2'),
('Ben', 'Park Lane 38'),
('William', 'Central st 954'),
('Chuck', 'Main Road 989'),
('Viola', 'Sideway 1633')
]```
Mysql 
how do i get data from a json and put it in a list like the format above
basically for example
val = [
('userid', 'reason', 'moderator', 'date', 'evidence'),
('471409054594498561', 'idk i nuke servers or some some shit', 'big.bun#6969', '29/10/21', 'https://capybara.bar')
]```
Are you using NodeJS and the sql package?
well
its either that or make a for loop and do 1.7k of those requests
If you interact with MySQL you dont have to format it
I dont quite understand your question correctly tho
Do you want to put data into your SQL database, or get data from your database?
put data into the databse
i'm migrating from json to mysql
Ok then you have two options:
Format your JSON data so you can insert multiple VALUES with one query
For-loop your JSON array and do one INSERT on each line
the other option is doing py sql = "INSERT INTO blacklist (userid, reason, moderator, date, evidence) VALUES (%s, %s)" val = (user, bl["reason"], bl["mod"], bl["date"], bl["evidence"]) mycursor.execute(sql, val) for every json entry, where there 1.7k entries
I'd do the 1.7k queries because it's easier 😄
i'm using a tutorial lmao
ok I'm sometimes using commit
idk python that well but I have something written that uses mysql like you do
I guess you can mycursor.execute() multiple things
and .commit() once at the end
It's a fresh database so it doesnt matter if you have to delete it 😄
wtf
import mysql.connector
mydb = mysql.connector.connect(
host="absinthe.hostns.io",
user="username",
password="passwod",
database="db name"
)
mycursor = mydb.cursor()
sql = "INSERT INTO blacklist (userid, reason, moderator, date, evidence) VALUES (%s, %s)"
val = ("test", "test reason", "big.bun#6969", "29/10/21", "https://capybara.bar")_
mycursor.execute(sql, val)
mydb.commit()```
OH WAIT
underscore
sorry ignore my stupidness
i fixed the error
sql = "INSERT INTO blacklist (userid, reason, moderator, date, evidence) VALUES (%s, %s, %s, %s, %s)"
val = ("test", "test reason", "big.bun#6969", "29/10/21", "https://capybara.bar")
mycursor.execute(sql, val)```
wdym
well you can give the date field a date option
I think it mainly saves on space
because you are inserting a string right now into everything
you can also limit the length of the userid field to discord-snowflake-ID-length
the date is the same for all the json ones atm as i stupidly didn't start logging dates today
only i add users and i validate if a user exists before blacklisting
Well there's an option in MySQL for that too 😄
If you set userid as a unique field you can never insert two rows with the same userID
it'll error out
ah alr
but since you already have a system it's not worth it to rewrite
But in MySQL you preferrably work with "Never have two of the same records" by using primary keys (and maybe AUTO_INCREMENT)
ayy
good boy
send me data once script is done
alr
no
na records check he means
yes
that's a stupid idea
I dont have to know why @jolly notch you for example got banned
Just show the reason when you login and log out the user
Well like
lets say bun didn't want to give me the data
but I still wanted to use his service
I am not allowed to use his stuff on my servers
so I would just call the api to check if you are banned
ok for something like that it's not bad
But then it should just return banned: true/false
it won't show ss evidence
it will just show a basic text output of their name and the reason for blacklist
alr so
how do i get a specific row
like how do i get the data from the 471409054594498561 row if it is blacklisted
You have to refine your search
select * from users where id = 471409054594498561
Or transactional:
SELECT * FROM users WHERE id = ?
And use the value field
val = (userid,)
you gotta give it the comma at the end, otherwise mysql wont accept it
(If a user can input that data it's always better to use transactional statements to prevent SQL injections)
Here for example you dont have to commit
You can use
mycursor.execute(sql, val)
myresult = mycursor.fetchone()
print(myresult[1])```
To get the reason
all written to the db?
send me the .sql
ok
alr so
new thing
as mentioned earlier, i wanna make a form which you can check a user id to see if they are blacklisted
how can i do this without redirecting anywhere?
for example, if the userid is blacklisted, popup with blacklisted with reason etc
all 23k help messages will be received in your bots message event
also that
the flow:
user submits id on form --> checks using api --> if api returns true, popup with "User blacklisted" etc with reason, if it doesn't then popup saying "User not blacklisted"
I did that with ajax
You define a <script type="text/javascript"> function that does an AJAX call to your API, and your submit button calls that function
ah alr
There are probably other ways too
preventDefault()¿
gonna start making the template on my test domain so i can show it
using tailwind because i'm lazy 
still have no clue lmao
its been nearly an hour and i still have 0 braincells
hey baes
hey marshy
hey bae
ah alr
is there a way to listen to an event when an error occur?
i have this bug in my code that keeps crashing the program and idk what the bug is
nor dont know where it came from
what language?
nodejs
idk when my program crashes it just restarts itself and clears out the error :/
is there a way to temporarily make it NOT restart itself?
idk tbh
if it clears out the error, then you should fix that first
is useless to try to blindly fix something
you have to figure out how to get the error logs to stay first
if you're using one of those pterodactyl hosts, ask their support

also how do i know if it errors or not?
i only suspect it crashed bc the uptime of the bot like reseted
help
?
that
i want my program to listen when it crash yk what i mean?
Well you need to differentiate crashing and exiting.
An app will not notice an unexpected crash.
If you speak about a node app I highly doubt it crashes.
I guess it ends it process for a specific reason.
You can try to create an event listener for the node process.
And log the results in a text file if your console is empty after a restart.
for(const event of ["exit", "SIGINT", "SIGUSR1", "SIGUSR2", "SIGTERM"])
{
process.on(event, () =>
{
…```
Aww… fuck that mobile Discord shit
You shouldn't try to handle exit codes yourself unless you really know what you're doing, because you can fuck up when it comes to handling the process exit correctly and a mess would ensue.
that's so fucking weird I was literally just thinking of that
The proper response to crashing is to write code that doesn't cause the process to crash in the first place
SIGINT and SIGTERM are also through the course of user intervention and you should not cover those unless your app tries to cancel whatever it is it's doing in risk of an error occurring
how would i get the results?
i am trying to do that but when it crashes it's just restarts and clear the console :/
And log the results in a text file if your console is empty after a restart.
Well true but I bet his app isn’t crashing but instead getting a SIGTERM signal
Or just exists because of an unhandled rejection… who knows
^
These should be handled, too
?
write your logs somewhere then
your can create a write stream to a file temporarily, doesn't have to exist in the code base forever (just make sure that you name the file something where the process won't overwrite existing crash logs)
You’d just have to proxy writes to process.stdout to your own handler
im confused 
I see what you wanna do but before over complicating things just try to listen to the mentioned events to check if the "crash" may has an obvious cause
Like an unhandled rejection
In a newer node version
process.stdout.write("hi"); // equivalent to console.log("hi");
const file = require("fs").createWriteStream("log.txt");
file.write("hi");
process.stdout = file; // replaces the write stream. Console output will no longer be possible unless written to stderr

Look to google for debugging help. Just don't listen for exit codes to try to handle them yourself.
personal experience; it wasn't fun
again, ask your hosting service about the logs being cleared. there has to be a way to get them, otherwise logs are useless
google compute engine free tier (requires credit card)
then you only alternatives are glitch and heroku
and i believe replit is somewhat better than both of them
glitch blocks uptime services lol
so if you ping your project constantly then your project can get deleted with your account
and yea replit is better for me
if you write your bot as an interaction url endpoint then you can use all those services as intended
How to make this buttons inline?? 
My code:
async def test(ctx):
msg = await ctx.send(content="Buttons! Buttons! Buttons! Buttons! Buttons! Buttons! Buttons! Buttons!", components=[Button(label="Button", custom_id="button1", style=ButtonStyle.blue),
Button(label="Second Button", custom_id="button2")]
)
interaction = await bot.wait_for(
"button_click", check=lambda inter: inter.custom_id == "button1"
)
await msg.edit(content="Edited")
await interaction.send(content="Button Clicked")```
inline?
I mean like
It should be Button Button
But now it's
Button
Button
add []
Ok
Does the free tier of mongodb atlas offer serverside logs? Im trying to find them to debug an error but i cant find them 
It can't ?
components=[[Button(label="Button", custom_id="button1", style=ButtonStyle.blue), Button(label="Second Button", custom_id="button2")]]


Anyone know how to fix this? Everything is working fine but it throws this error
C:\Users\great\OneDrive\Desktop\Watcher\node_modules\discord.js\src\rest\RequestHandler.js:298
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Unknown interaction
at RequestHandler.execute (C:\Users\great\OneDrive\Desktop\Watcher\node_modules\discord.js\src\rest\RequestHandler.js:298:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (C:\Users\great\OneDrive\Desktop\Watcher\node_modules\discord.js\src\rest\RequestHandler.js:50:14)
at async ButtonInteraction.reply (C:\Users\great\OneDrive\Desktop\Watcher\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:98:5)
at async Client.<anonymous> (C:\Users\great\OneDrive\Desktop\Watcher\main.js:112:5) {
method: 'post',
path: '/interactions/903910639460814868/aW50ZXJhY3Rpb246OTAzOTEwNjM5NDYwODE0ODY4Okkyb3hXdUpyU3pTMXF1bTd5Y3ZKS2VWRlVLSzFXQUZ1Wm1qaTJVTDEyZHZHVWt5R2pDSGcwQWZ6VlRJNEtWb0w4OEUySXBhQXNhV3hrUTNCRXZQMzlNVXpINHBFdjhCa0JSZEFrQkJSMk0xWjNibWd5bFlNRjY2UTdCWjdvV3M2/callback',
code: 10062,
httpStatus: 404,
requestData: {
json: {
type: 4,
data: {
content: 'The role <@&875064681117655101> was added to you',
tts: false,
nonce: undefined,
embeds: undefined,
components: undefined,
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: 64,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined
}
},
files: []
}
}
you need to respond to a interaction in 3 seconds
Wdym?
if you dont respond to a interaction in 3 seconds, you cant respond to it anymore
I don't have the timer setup anywhere in my code? How is it 3 sec?
🗿
it's documented right there on discord api docs
How can i fix it?
https://srcb.in/dNmUdpmBze
Does anyone know how to get every url of a image on a website into an array
Like every image url on the page?
Yea
I want to get all the icons from here https://minecraft.fandom.com/wiki/Block
hello my vdsim is giving an error can you please help? @hexed bear
Use puppeteer web scraping
Where do i find that?
Do u want to get urls through bot?
Did you say it to me
No i just need the urls of the icons
Try npm install --save lzma-native
How about inspect?
ok
Too many things

It gave me 'cannot find module /usr/bin/chromium-broswer'
Have to install chromium, puppeteer is a large npm package
Wait I thought you were doing sth like
The user use command like
block and you show the image of the block
Yes
And like blocks randomly appear and you can claim tjem and like theres only a limited amount of them
Thats why i need urls
same error again
I just have no idea how to get just urls
Since there are too many icons, better use web scraping
Wheres that
Also i tried using like a regex thing that tries to find sll the urls but it doesnt eork i dont think
Oh it worked
Too small tho when you click on the images on the website its big

you want to get it just once?
Like
https://minecraft.fandom.com/wiki/Block_of_Raw_Copper shows block page
So,
Set url of
https://minecraft.fandom.com/wiki/<block name> in puppeteer
And then getUrl (selector) of the image element by inspecting
I want to get the url of all the blocks
https://minecraft.fandom.com/wiki/<block name> 
See how do i get that image
Use puppeteer
if the content is static there's no need to use puppeteer
just fetch the html data then parse it using cheerio then get the images
Uhh yes cheerio also works
<meta property="og:image" content="https://static.wikia.nocookie.net/minecraft_gamepedia/images/b/b5/Vector_dirt.svg/revision/latest/scale-to-width-down/1200?cb=20180202214450">
I found it
yes manually
Yes but i can just get the og:image property thing on all of them
I dont know how but
u want to do it for all blocks?
Yes
u can get the block list first then loop over all of that to get this image
I can just find a piunt i can split it at i think
split('<meta property="og:image"').join('').split('">')
Eould that eork
thats gonna give content="https://.....
response.data
Yes that works let me try
Okay it works
const axios = require('axios')
axios.get('https://minecraft.fandom.com/wiki/Stone').then(res => {
let html = res.data
let string = html.split('<meta property="og:image" content="')[1].split('"/>')[0]
console.log(string)
})```
Thank tou
np
Do you know anywhere i can get a list from?
this?
Yes but they are formatted with colums and stuff
Acacia Button JE3 BE2.png Acacia Button
Acacia Door JE4 BE2.png Acacia Door
Acacia Fence JE3 BE2.png Acacia Fence
Acacia Fence Gate JE3 BE2.png Acacia Fence Gate
Acacia Leaves JE2.png Acacia Leaves
Oh i could copy it and split after .png
hmmm
Can you copy and paste it all? Its not working for me
Oh this one
Use a regex catch group to find the data
I am sure there is a meta parser on npm
html.match(/\<meta\s+name="og\:image"\s+content=(.+?)/j)?.[1]
@earnest phoenix ig you could try $("meta[name=og:image]").attr("content")
i don't need it 
why is it not sending message on reaction
It detects it but doesnt seem to detect channel id
You used 3 equal signs it should be 2 equal signs
are you ok
same thing
This gives null
yeah its caching problem, weird it worked few minutes ago
but it doesnt listen for old messages ;d
I mistaken it for discord.py
Sorry

there's literally an example below that isn't it
yeah i followed it but it didnt work
works now tho, just had to add partials
I didnit
I finslly did it
No i havent
what do you mean, Size is not an Integer js return await progressBar.splitBar(100, percentage, {size: 10, line: `[▬](https://teddie.statuspage.io, Nice progress you've got!)`});
k
same
😦
when i remove whole mcd
it shows syntax error in some other cmd under i
try retyping out the message
@bot.event
async def on_ready():
#code here```
name:'say',
description:"say what the user says",
execute(message, args){
if(message.member.permissions.has('MANAGE_MESSAGES')){
const messageSent = message.content.slice(5).trim()
if(message.author.bot) return;
await message.channel.send(messageSent).catch(err => console.log("cant send message"));
message.delete()
}
}
}```
my say command, there's no error but if I run the command in a channel where the bot doesnt have perms to text then I get this error:
``` throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Missing Permissions```
I dont mine giving my bot perms, just that its in like 200 servers and if it doesnt have perms in any server and they run the command it exits the node
so i tried to catch error so it doesnt exit node but didnt work
fixed ty
please don't just delete your past messages and resend
if i can't help i won't so repeatedly sending will just slow everything down
np
sorry there like so many separate messages so i just combined them into one so it's easier for others to refer
How to make bot reply in embed on button click?
My code:
@buttons.click
async def pokemon(ctx):
embed = discord.Embed(title="test", description="Test")
await ctx.reply(embed=embed, flags = MessageFlags().EPHEMERAL)```
I found databases should always use strings otherwise at least on mongodump you lose the int64 data
depends on the library you use
most databases support 64bit ints, depends on the library to respect them
especially when using js

discord.py doesnt support interactions
It do
It certainly does
Yes!
there is nothing related to "button" in their docs
Hmm, so do you find any solution for my error?
so you have to use a separate library on top of discord.py
which means i wasnt wrong lol
from discord_components import Button
from discord_components import ButtonStyle as s
from discord_components import DiscordComponents, InteractionType
@commands.command()
async def creators(self, ctx):
await ctx.send(
"Follow our fellow creators!",
components=[
Button(style=s.URL, label="Spooky_Ellis", url="https://www.twitch.tv/spooky_ellis"),
Button(style=s.URL, label="Tijgersword", url="https://www.twitch.tv/fake_tijgerswordd"),
Button(style=s.URL, label="AnoukO_O", url='https://www.twitch.tv/anouk0_0'),
Button(style=s.URL, label="IcyyLIVE", url='https://www.twitch.tv/IcyyLIVE'),
Button(style=s.URL, label="StrayTheFox", url="https://www.twitch.tv/straythefox1")
]
)
from discord_components import DiscordComponents, Button, ButtonStyle, InteractionType
@commands.Cog.listener()
async def on_ready(self):
await self.bot.change_presence(activity=discord.Streaming(name='A_Hidden_One', url='https://www.twitch.tv/a_hidden_one'))
DiscordComponents(self.bot)
@lilac mist , Which code do you use to type that? (For the colours) Example: css
py?
Wow, thanks!
if isinstance(error, [what to put here] ):
await ctx.send("You are not connected to any voice channel")```
Assuming it's d.py, the voice attribute of Member objects is optional, just check whether or not it's None. If so, the member isn't connected to a voice channel / you don't cache voice states.
pst you dont have to be that much of an asshole at someone wondering how to use syntax highlighting 
So it actually happened stackoverflow is now in readonly mode
only for 2 hours
hot
i need to make the actual api use the mysql db instead now
good
Nodejs?
yep
Don’t use var 
blame old code from stackoverflow
That should work right?
Algolia
Your website must be a technical documentation of an open source project or a technical blog. We do not index commercial content.
So they won't index the docs of my discord bot. Since it isn't opensource.
I already have the doc generation. I currently use Vuepress,but i need the search bar,which is better than the default.
anyone?
your bot crashed before it became ready
i dont understand why tho
Actually my question is ,what is defined under ** technical blog**
That's for you to figure out
a tech blog is exactly as it sounds
a blog about tech
or the technicalities of a project
generating docs for something kind of destroys private source nature
okay thx then ,I will have to find an other way 👀
i'm having some trouble with fetch()
fetch("https://blacklister.xyz/api?userid="+ x +"&apikey=APIKEY")
.then(data => {
console.log("2")
return false;
alert(data.text);
})```
i did console.log("1") before this but only 1 is logged
fetch("https://blacklister.xyz/api?userid="+ x +"&apikey=APIKEY").then(res=> res.json()).
.then(data => {
console.log("2")
return false;
alert(data.text);
})
Is probably what you want
use the thunder client thing I shown you, what data is returned?
return false; stops it from refreshing but it doesn't even reach that point
(using original api, not migrated on there yet)
no wonder it doesn't work
what about it
It works for me
fetch("https://blacklister.xyz/api/?userid=1232131&apikey=APIKEY").then(res => res.json()).then(data => console.log(data.response));
I get 403 Unauthorized!
lemme dm you an api key
in frontend it's automatic
i'm trying to run locally
i installed node-fetch
i'm running as a js file on my pc
then you need to import it from "node-fetch"
use require
how do i add return false; in that
so it doesn't refresh the page
you code it good
code better
if only
skill issue
yeah a skill issue

you probably don't want to send this data to the browser
Ah ok
if i write JSON data as a whole, without appending, can it get corrupted?
yes if:
- you try to write it again before the previous write finished
- if the process exits or crashes while it is writing
What if you make it atomic
there is always a chance someone spills water on your components
I would just use a database, solves all your issues
Good ones are mongo or mysql
there is only one way to write files atomically on most operating systems
write to temp file -> rename temp file
rename operations are atomic in most operating systems because its just a change in the file descriptor, it doesnt touch the file itself
I would support this
write to a temp file with a randomized name every time to avoid concurrency conflicts
then replace the old file by renaming it
That was what I was referring to, cuz I saw R. Danny does it
didn't work
did console.log for the output and got this
first you have to do format c:
fetch = require("node-fetch")
async function returnData(x) {
await fetch("https://blacklister.xyz/api/?userid=" + x + "&apikey=APIKEY").then(res => res.json()).then(data => {
return data;
});
}
async function submitForm() {
var x = "471409054594498561"
if (x == "") {
alert("User ID must be filled out");
return false;
}
else {
data = await returnData(x)
console.log(data)
}
}
submitForm()```
returnData doesnt return anything
i don't usually use js so i'm absolute shit as it
oh
remove the second .then
its not doing anything
and return the fetch
no need to await it
you are aalready waiting returnData
👍
what do you guys think: should enums be plural? (Color.RED vs Colors.RED)
its now not working on my form
Singular makes the most sense to me unless it represents bit fields
Ok is this even Possible if so how do i do it?
Ok
Help Me
When I use the join command I get this:
Uncaught Promise Error: TypeError: Cannot read property 'connection' of undefined
Full picture is on the bottom
& Here's The Code:
module.exports = {
config: {
name: 'join',
aliases: ['joinvc'],
category: 'music',
description: 'Join The User\'s VC **NOTE! this cmd is kinda brokej so dont use it! tnks!!**',
usage: ' ',
accessableby: 'everyone'
},
run: async (bot, message, args, ops) => {
const { channel } = message.member.voice;
const serverQueue = ops.queue.get(message.guild.id);
try {
if (!channel) return message.channel.send('**You Need To Join A Voice Channel!**');
if (!channel.permissionsFor(bot.user).has(['CONNECT', 'SPEAK', 'VIEW_CHANNEL'])) {
return message.channel.send("**Missing Voice Permissions!**");
};
if (message.guild.me.voice.channel) return message.channel.send('❌ **Bot is Already In The VC!**');
if (serverQueue || serverQueue.playing) {
return message.channel.send("**Cannot Join Another VC While Playing!**")
}
await channel.join();
return message.channel.send("**✅ Joined The Voice Channel!**")
} catch {
serverQueue.connection.dispatcher.end();
return message.channel.send("**Something Went Wrong, Please Try Again!**");
}
}
}
Discord.js Version: 12.5.3
serverQueue is undefined
So what I'm gonna do about the serverQueue?
I am getting ghost server leave events 😦
It doesn't leave any guild but I get the event with guild as an object with undefined properties
you're not the only one
Ah
Do you know why it's happening like that?
Because of your rainbow console logging
lmao
Hey guys
I want to make a new user that has access to only 2 folders in /root/ folder
Please guide how can I do so
in ssh ^
Tried this
But any way, https://superuser.com/questions/149404/create-an-ssh-user-who-only-has-permission-to-access-specific-folders worked for me
Thanks for help
What was the outcome of the 1st method
It was too long and I knew there was an easier way to do that, just couldn't remember.
I gave up on 1st method after 2nd step

https://sourceb.in/ATQtoxALAJ
can someone help me convert this command into a slash command please?
I tried and it doesnt even work, I know how to do for normal messages, just not embeds (yet)
I am trying out slash commands now
just this one please,will do the rest myself
You first need to register the slash command which is completely different from how message based commands work. Read https://discord.com/developers/docs/interactions/application-commands. It has everything which you need to know about. From how to create a slash command and how to use it.
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
yep yep I've done all that
I then created a command handler for slash commands where I add commands
so this is a new slash command and I want it to send an embed
so is the code alright now?
command and event handlers
Your command structure doesn’t change at all.
All depends on your command handler.
But instead of pushing message as argument to your execute() function, you gonna push interaction as argument.
^
If the slash command is registered correctly, this looks about right.
As I said the base structure is the same, but you’re working with the interaction not with a message anymore.
I wonder why you import a slash command builder you obviously didn’t use anywhere, but yeah that’s up to you.
ohh
thanks guys :)
hey so while sharding
if i pass in a shard list something like [0, 1, 2] shard 0 is never started for some reason
TIAS
EnGlISh
Try it and see 
I believe shard 0 is usually the DM shard
Have you tried seeing if the bot responds in DMs?
nop it also handles guilds i believe, since it says the bot is online in some guilds but is offline in few
Ah
ye, im passing a list [0, 1, 2, 3]. i see shard #1-3 is online but shard #0 is never started, i waited for sometime also
weird
shard 0 does indeed too handle guilds
Does anyone know how to make bots online 24/7? Actually I followed the instructions but it didn't work :(
Hmm, whats ur host?
why don't yall use pylon or something

Lmao
hi
How to use " " in discord.py
Example: await ctx.send("Hi "Just a test"")
"Hi \"Just a test\"" or 'Hi "Just a test"'
Hello, this is not a "code development" question precisely, it's more about the application management. I've entered in the process of my bot's validation in Discord for it to further grow and I'm getting this weird vague error that I don't know what it means. If anyone could help it would be greatly appreciated.
Does it not have this? https://safe.kashima.moe/60p4o1ncl9nk.png
Wow, didn't even though of it, that might be it. Since I wrote its description for advertising websites only like this one never thought of changing in there. Thanks!
Yeah that was it thank you so much :)
CODE test.js https://sourceb.in/NV2mUupjQH
ERROR been getting this error constantly. tried a lot and nothing worked, help me please
commands.push(command.data.toJSON());
^
TypeError: Cannot read properties of undefined (reading 'toJSON')
at Object.<anonymous> (D:\Bots\slashcommandsbot\deploy-commands.js:11:29)```
i sent test.js because the error occurs only when I try to deploy the test.js command, if i remove it, then everything is fine
here is deploy-commands.js https://sourceb.in/7QA3DSmP8v
command.data is undefined
you are trying to require a file that does not export a data property
this implies that ALL js files in /commands MUST export an object that includes a data property
i like how you emphasised your message
CODE test.js
ERROR error
hi all, is this the place to ask questions about bot development?
yeah, I just read it....sorry
I am trying to shard my bot. I am new to sharding, and am trying to learn (my bot is in JS, using Node), about converting to functions like broadcastEval. I understand that the objects returned from calls within this scope are stripped of their true object properties, and come back as arrays of objects. I would like to understand how to access an object to do further queries. the documentation implies that it is possible, but everything I do simply returns the arrays of JSON'ed results.
for example: the documentation implies that within the helper function scope (serverLookup) I'll have access to the objects before it leaves scope, and then could do a subsequent query, like my "guilds.fetch" but this fails because it still returns an array of objects like the broadcastEval does.
what I'd ideally want is that the 'guilds.fetch' call, gives me a Guild object, and then a subsequent call to it allows me to get other nested properties, etc. Without this ability, I'm trying to understand how sharding can accomplish basic tasks. If someone has a good reference github etc...I'm all ears to study and teach myself.
That's what I do
you already overpay colleges so that's perfectly fine
college and universities have such poor level of teaching intervention
for what you're paying you should be receiving 24/7 round the clock support
a = int(input("Enter first number "))
b = int(input("Enter second number "))
oper = input("What caluclation do you want? ")
if oper == "+" :
if a == 56 and b == 9:
print(77)
else:
print(a + b)
if oper == "*" :
if a == 45 and b == 3:
print(555)
else:
print(a * b)```
it is multiplying when i give + as an input
and vice versa
Hello how I make for remove the subdomain www ?
Because my code in itself is the error
wtf
faulty calc.
b u t w h y
at least make it make sense
what can i even do

A trick you can use here is creating a dictionary of operators and mapping it to functions you can execute
def add(a, b):
return a + b
def mult(a, b):
return a * b
# etc
operations = {
"+": add,
"*": mult,
# etc
}
def do_stuff():
a = get_input()
b = get_input()
operator = get_operator()
operation = operations[operator]
result = operation(a, b)
print_result(result)
main thinkg is that it is MUltiplying on adding
overkill
hmm
this is for normal calc.
here we have been mentioned that there are two cases
where calculator should print wrong
you can just declare that as an if statement inside the operation functions you define
check my code
whenever i give input as +
it multiplies
and vice versa
i am bit confused :(
you can still do that with the setup I mentioned
Anyone can help me in updating pip in vs studio
i respect that
but still i am curious
whats wrong with my code
god imagine if python was a good language and let you do
def add(56, 9):
return 77
def add(a, b):
return a + b
hahah
....
you are def. functions
could you try
sudo python -m pip install --upgrade pip
or
pip install --user --upgrade pip
Okh
or if you're using windows try using cmd as admin
How to use in admin?
I am in windows
if oper == "+":
# ...
else:
print(a + b)
what do you think is wrong with this code
Thks I will try
look over it again
if the operation is + do something, if it's not +, add the 2 numbers together
doesn't sound like that's doing the thing you want
that's what i want
you want all addition operations to be wrong?
noo... i was thinking that if those numbers aren't match then computer should simply add them
but that's not what you're checking
you're adding numbers together when the operation is NOT +
because it's in the else branch
oh fk
now i understand
computer will now go for *
- will not be counted as if statement is held wrong
thanks buddy, gotcha :)@woeful pike
Xetera, (no tag per channel rules)....I posted a question above...if it scrolls far enough before another dev or person can suggest an answer, should I repost? What's the protocol?
b = int(input("Enter second number "))
oper = input("What caluclation do you want? ")
if oper == "+" :
if a == 56 and b == 9:
print(77)
else:
print(a + b)
if oper == "*" :
if a == 45 and b == 3:
print(555)
else:
print(a * b)```
btw i refined my code, i adjusted my intendation
now it works fine
i have to make a faulty calc.
Ehh, ok I guess xD
haha
hey there! could you try:
py -m pip install -U pip
I think you can repost yea
import random
a = int(input("Enter first number "))
b = int(input("Enter second number "))
oper = input("What caluclation do you want? ")
messup = random.randint(0, 1)
if oper == "+" :
if messup:
print(a + b + random.randint(2, 5))
else:
print(a + b)
if oper == "*" :
if messup:
print(a * b + random.randint(2, 5)
else:
print(a * b)
:P
Why does this say; TypeError; Code is not a function
const code = require("@hapi/code");
const suggestontoken = code(10);
let embed = new Discord.MessageEmbed()
.setAuthor(message.author.username , message.author.displayAvatarURL())
.setDescription(suggest)
.setFooter(`Suggestion Token: ${suggestontoken}`, message.guild.iconURL())
.setTimestamp()
check.send(embed).then(m => {
m.react('✅')
m.react('❌')
message.author.send(`Suggestion Creaed in ${message.guild.name}\nYou will be DM'd when a admin replies.`)
db.set(`suggest_${suggestontoken}`, m.id)
db.set(`suggest_${suggestontoken}_msg`, suggest)
db.set(`suggest_${suggestontoken}_user`, message.author.id)
message.channel.send(`Suggestion Sent!`)``` `:(`
ok thanks. I see in the search/pins there are some people that work on sharding, maybe I can wait until they are online, and then more likely to get an answer. I don't want to spam or bother. 🙂
you can also ask in other programming servers
@hapi/code might not be a function







