#development
1 messages · Page 755 of 1
Me?
pls direct all complaints about this ruling to my dms
:shrug:
ME????
I'm not arguing it
Yes sir
Moving on
@ripe tulip no
Do you have access to a laptop or PC?
Nope
then your best bet would be something with an online editor like heroku or glitch lol
or get a vps
Or if you have a friend with a vps ask them to run a code server and see if they will let you access it
K
It’s not the best thing in the world but it helps
Okay
Tbf if you go to school you might be able to access somthing like glitch on their pcs
Nope thas not happening until like 2+3 year's
why 2/3 years?
Uhhhhhh me don't want to say
are you 5 years old?
are you under 13
I maybe
rip
how far under 13
Almost 4
He’s about to be banned
-b @ripe tulip 9 years old
Banned pøwerfullKD#2338 (@ripe tulip)
XD
jeeeez
@delicate zephyr let staff agebait please
it just gets fucky when 3 people ask the same damn question
Can I report to discord ;)
Okay sorry
yea go ahead idm @lusty dew
Okay bet
oh so do you guys not actually escalate it to discord
they dont have to
F
its not their job
You technically have too
But it’s not their job
Yea
reporting to discord is just being an asshole imo, let them be and do whatever, just not under your jurisdiction. you dont need to go out of your way to witch hunt them
you;re not gonna get in trouble for not reporting someone lol
Though discord advises you to report people under 13 for reasons
realistically if they wanted to a DStaff member could just join dbl and read #mod-logs
moving
Discord rlly don't care if you report or not but I agree with dream
how to make like an status page for my bot? any templates that you can connect with cname records? @loud salmon
oops sorry
wtf
yeah yeah
he gets the idea
"Request to use token, but token was unavailable to the client."
in what way would this be caused
are there any orms for python?\
Well I know there are
but what is a good one to use?
@grizzled raven sounds like a bot.destroy()
at least I know that's one way it can happen
@sudden geyser yes that is how it happened
i know that
but how would you prevent thing
this
@lusty dew just us SQL lite or somthing for python, it's simple enough to not rlly be worth bothering with orm
Atho it's personal choice
I like using orms
sqlite is a database
an orm is a framework that helps you interact with the database
using objects
instead of writing your own sql queries
SQL lite in python is pretty much jus """INSERT INTO stuffs"""

Lol
SQL lite in python is pretty much jus """INSERT INTO stuffs"""
that doesn't make sense...?
also dyinglight, that was directed at chillfish, my bad
sql is a language
sqlite is a database implementing said language
inserting data into it will always be the same regardless which adapter on whichever language you're using
yeah i love using orms too
I see Dijango has an orm
i much rather prefer sticking to OOP
Yh ik cry
But SQL lite isn't rlly hard to implement by itself rather than using a orm like you could do either
And his OOp good
you still don't make any sense
Using orms are fun though
the point of an orm is to remove the need to handwrite sql queries and instead have a full OOP experience
Yea
plus, they're much more dumbproof
If I learn python I’ll probably use Dijangos orm
Why?
I read some of its documentation and it looks pretty nice
Yes but it can be used for anything
It is only like 4 functions to make a read write db
And 2 for creating a table and creating a connection
again
the point of an orm is to have a full OOP experience
you can easily set up keying, migrations and orms auto sanitize input
quick question if i'm able, can someone double check my code for the bots Playing: Server Count? I cant get it to work and I feel super dumb now.
Just post it
What is the best way to Delete an object from a JSON after it has been used the delete method isn't working (no errors either) just doesn't work
are you using json files as a database
JSON isnt for databases it is for information to be stored and accessed easily, if you want something which can delete, add, edit information use something like sql
The word delete can signify it
Not really but okay
@unique nimbus I wouldn't necessarily say database but yes I use it to store User IDs for blacklist commands ect
Store and fetch*
I also use it for things like responses for some of our Fun Commands like 8ball ect I store the responses in a JSON instead of adding unnecessary text to the actual js file if it doesn't need to be in there
If you’re storing stuff in it and using it for commands that read and write constantly then you’re using it like a database
hey could someone help me change the invite buttons color
im trying to make it a gradient
this is what i have rn
<head>
<style>
.votebutton btn btn-orange btn-2x {
color: linear-gradient(to bottom, #ff0066 0%, #cc0099 100%);
}
</style>
</head>```
also you need !important after every rule to override it
ohh
yeah
wait where do i put important
in css, using !important isn't really a good thing but in the case of bot css go crazy
sorry abt this
the end of the css rule
i havent done css in awhile
eg padding: 1px !important;
so color: linear-gradient(to bottom, #ff0066 0%, #cc0099 100%) !important;
i just tried it and it didnt work
i had it on backround
color is a text modifier
sorry im a dumbass
hmm
yeah it didnt work
hmm
my spacing doesnt seem wrong
idk whats wrong
<style>
.votebutton btn btn-orange btn-2x {
background: linear-gradient(to bottom, #ff0066 0%, #cc0099 100%) !important;
}
</style>```
Sure you have the right css classes
i did not know that uhhh
You’re probably wanting to change background color of votebutton
Either that or btn class
No problem
i havent done this in months
You haven’t done it so long that you forgot those are separate classes?
That should be easy to tell no matter how long of a break you took
Okay
How would you use a .env file in python. I’d assume you’d use a special package like python-dotenv, but are there any other ways?
I guess you could somehow source the file
but dotenv would just be the better option tbh
so im trying to remove the shadow from my bots icon on its page
im using css .bot-card .bot-img {; box-shadow: none !important; }
but it doesnt seem to be working
Try this?
#bot-details-page .bot-img {
box-shadow: none !important;
}```
👍
how do i style the lib button tho
i was trying earlier but couldnt get that to style
Mk thanks
You mean the circles and such
yes
It’s probably a background image
Iirc background image prop has a none value
Let me verify that though
Actually to be honest
You can set your own background image I think
It just won’t be in file form
It’d have to be a url
yeah but im trying to have a plain backround
Ah okay
Then just use background-image: none and change the background to how you like
Hold up let me take a look myself
If background-image didn’t work then I’m not sure what those circles are
Oh so I was right
I didn’t see that class ahaha
Override the background image in that class and change it to none then you won’t have the shapes anymore
ye thats what i did
K
ok gn now
One simple question : I don't have any money, and I need a good vps. What can I have? (I tried Google or AWS but I don't have credit card to sign-up)
edit : heroku seems okey https://prnt.sc/qf2an7
bruh heroku
its not meant for bots so yuh
has similar drawbacks to glitch
well iirc one of it was no 100% uptime
@earnest phoenix have you thought of asking friends who have a vps to give you an account as a loan?
I have a friend who gives me vps for some game items
@lusty dew youre right, and im sure if someone lends you hosting space, as soon as youre able to afford your own the offer would be there on the table to return the favour
it always was for me, i borrowed shell accounts for years from friends
they are all welcome now if they need to call in that 'debt' but they generally still have their own server and wont ask
and superhero is right, theres always the barter system, @earnest phoenix cant you offer some service to someone else in exchange for hosting, e.g. offering tech support for their server, or such? what can you do in exchange for what you want, if you dont have cash? think the way barter cultures work
maybe you can write them a bot, or monitor their bot
coding has value
@green kestrel no :'
just... make sure you trust your friend. i once got bitten bad by someone who loaned me a dedicated server to host an irc hub, and then they cancelled it without any notice, my irc network was down for days
he was working in a datacentre and had the perk of being able to put his own equipment into free rack space
A lot of my friends don't know what in the world is discord
turned out he got fired and didnt tell anyone.
Lmao
theres no way such a thing would be allowed now, this was what, 2003?
nah he was literally allowed to connect his own hardware to unused space in the racks of the DC

which is actually a really cool perk
like i said no way any sane DC would allow it now
if i was allowed to do that, i have a dell T310 i'd be putting in there.
Xd
currently it runs in my utility cupboard 24/7
Oof
i have a dedicated server at ovh where i run my live bot, and the cupboard server for dev
I was planning on buying a server rack and stuff then getting the servers
whats your internet connection like
is it generally up 24/7 without major outages?
why not get something like a raspberry pi or a protectli FW-1 and host your bot on that
mm I could never self host at my mom's house because PG&E likes to cut our power
There’s been 2 days since we had it that it went out
rpi is well within affordable, its like £30 one off
They're $35USD iirc
also if you get a cheap UPS it can run an rpi for hours or even days
protectli it is then. i have one as a router, its the size of two cellphones sat side by side, has 4 lan ports on it, and runs intel hardware
Damn
a bit more pricey than an rpi, but fanless and silent
or, go on ebay and buy a laptop with a broken screen. they go for peanuts, and they make great servers with built in battery backup. just be sure to run them with the screen open.
I can’t find it anymore
An ancient laptop is more than enough to run a discord bot plus it has WiFi so you can stash it anywhere in the house, under a bed, in a cupboard...
But there was this website that sold basically rpi but more powerful and bigger
Just keep an eye on heat
Can I run docker containers in my brain?
Yes

well you could get a UPS easily for a RPi
all you need is a decent portable charger
and then prolly some switcher so that it automatically falls over to portable charger power when your mains get cut
Never heard of protectli
prolly using a relay
@fluid basin I suppose, but by the time you've built that you can get a second hand ups off eBay that will run a RPI for days even if it's battery is pants
yeah thats true
How do I use a local image in embed?

15W isnt too much
I have one that could run an rpi but it can't run my server
and it only hits around 15W when running on full load
I bought it to run my server but it doesn't have the VA
Supposedly 750VA, turns out those figures are marketing bs much like megapixels on cameras
750VA can't run a small tower server.
@glacial mango depends on library, but iirc message attachments are allowed in embeds
supposedly
Don’t some companies sell servers?
750VA is around 6A (on 120V) or only 3A (on 250V)
Like ya know something you can own yourself and have in your house
which is like
As in physically sell you a server you can plug in at home yes
@fluid basin I use js
almost nothing
That's how I got mine
Second hand reconditioned, nice spec server for £600
As opposed to thousands
Sure but where will you rack mount it
this https://stackoverflow.com/questions/46734519/how-to-use-local-file-as-thumbnail-in-discordjs-embedded-message and this https://stackoverflow.com/a/50917444 @glacial mango
Is it possible to use a local file as a thumbnail for an embedded message with DiscordJs?
"thumbnail": {
"url": "../img/025.png"
},
This doesn't seem to work.
(node:34721)
@green kestrel well 750VA literally means 750W
Willi is smart
@green kestrel in my small ass closet that has no other use
no me is dumb
Xd
750w should have been more than enough @fluid basin , the server spends 99% of its time idle
Again where in your home will you rack mount it
I have a closet that could fit 10 of those
how much is its rated capacity
If you're putting it in a cupboard you'll need good airflow
drills some holes
I put it behind a louvred shutter
But I doubt it’d use a huge amount of power
how can i add stuff to a json? like this is an json: json { "1": "12" } but i want it to add something on it
{
"1": "12",
"2": "22"
}``` just adding an array to an json not editing
bruh
Fs?
you use fs#writeFileSync
y
@fluid basin When I do this it sends the embed without image
const embed = new DiscordJS.RichEmbed()
.setTitle("Food")
.setImage("attachment://./API/Food/oMRKkMc4RSq7N91OZl0O_IMG_8309.jpg")
msg.channel.send(embed)```
but that overwrites
not really
@glacial mango u need to attach the image as well
so if i have an json
?
it only overrides what you add
@fluid basin what do you mean
well
literally what it means:
message.channel.send({embed: {
description: "This is some text",
image: {
url: "attachment://twitter.png"
}
},
files: [{ attachment: 'images/twitter.png', name: 'twitter.png' }]
});```
if I have {a:true}, I would put it in a variable and add to it and use writeFileSync to write the variable to the file
but people like to copy and paste because people don't wanna learn how to code / read documentation 
btw we got our servers for work from bargainhardware on my advice. the specs of both are: 2x xeon 8 core cpus, 384gb ram, 16 1TB drives in raid 10
someone hasn't heard of sarcasm
const embed = new DiscordJS.RichEmbed()
.setTitle("Food")
.setImage("attachment://my_interesting_file.png")
msg.channel.send({embed, files: [{attachment: './path/to/folder/my_interesting_file.png', name: 'my_interesting_file.png'}]});
theyre 2U rackmounts with rackmount kits
??
i should run my discord bots at work lol, we got 100mbit leased lines here.
You can use different variavle name
did you know that fact?
default= url
@green kestrel you should let me run my bots at your work xD
lol nope
thonk 10mbit should be enough just for text
unless you need to send audio/visual stuff
im the IT manager, i spec and install the hardware, i could get away with it, but hosting 3rd party code? that wouldnt fly
😛
how many servers is your bot on
Discord.js
i could give you a shell, but i cant offer you any support
it would just be a basic ssh session
But ima try and make it in d.pu
I already have a server
it would be up to you to install anything you need in your home dir
inb4
It ‘‘twas a joke
sudo rm -rf /
I have a friend lending me some space
ah wait getting you muddled up with @earnest phoenix
My vps rn is like 512mb ram 😂
Lol
yeah thats where i'd make the ssh shell
tfw your country is already so small that it literally has no space for datacenters (or maybe)
and like the only option is to host it at home
but I gotta deal with the cooling + network and power
i have a digitalocean VPS, $5 a month jobby, all i use it for is a small ircd and a socks proxy
it has space for a small js bot
finland is cold country so here is many datacenters
well ofc I'm talking about dedicated servers not vps
@restive furnace if you consider a datacentre a bunch of servers plugged in outside on a glacier, sure
its bloody overpriced here that it is almost impossible to get one unless you have the budget
wheres here?
SG or just asia in general
my dedicated server costs me £70 a month, ish
yeah prolly £70 could only get a server 2/3 of your specs
cant really afford it, but its my hobby, in the same way others might play xbox or go out down town
well thats true
this is off-topic
no its about development, and where to put your development 🙂
:/
hmm, we dont really have a #hosting channel, Mods/admins can we pleaaase have one?
well development should suffice, anyways back to the topic im still looking for a decently priced 1U server
to buy physically or rent
ok
ebay for sure
because you mentioned asia
postage for a company to asia from anywhere but HK would be major ouch
ok ebay
but any specific models thats nice?
dell R620 is awesome, and it has hardware raid and a fair chunk of ram
ouch doesn't post anywhere outside EU
actually that one is awesome, just no hard drives
if i was in the market for a new server i'd consider it
there are ones that do, that was the first i found
storage shouldn't be a problem, planning to buy a few ssds for the speed
dell R620 even comes with idrac which is a kvm/ip solution
mine also has that
generally any that have a model starting with R means rack, and T means tower, so mines T310 meaning tower and that ones R620 meaning rack
only thing to look out for is servers are fussy about hard disk capacity and speed if you want to run raid
you cant just buy any sata hard disk
you have to look up the specs and buy ones that are compatible, multiples of the same type
they arent that old, try a lower model number
something like that perhaps
1 xeon cpu, 4gb ram
oh and if you can, get hard disk caddies with it even if you dont get disk
because the caddies are really expensive, its like "ka ching, enterprise"
you might also get a better price looking at supermicro instead of name brand like dell or HP
thats an example, that particular one is collection only from london though 😛
who pinged me
this one is £45 and posts to SG
hmm yeah lower price would be better
me lumap
oh
wait does the latter link has 2 systems in 1??
What do you advise as host to make housing?
no thats just one server @fluid basin
oh, hmm well that still needs quite a bit of upgrade if I get it
for running a discord bot? probably ok
international shipping for big stuff is rather pricey
👀
imo d.js just waste ram when using the default options
says free shipping paddle
@green kestrel yeah ofc a discord bot will definitely be fine
to uk and various countries
😄
ofc you do need to get a couple of sata hard disks
yes rip https://i.wilz.cf/Dxi69NswzX.png
@vital lark agreed node.js is a waste of ram in general. this is why i write my bot in C++ 😄
free shipping to sg, £45 GBP, buy-it-now auction
oh I didn't see that
just add hard disks
nice wtf https://i.wilz.cf/ADJFR9IbYE.png
thats why living in asia is a pain sometimes
yeah postage is the way to trick and earn more
you could contact the seller and arrange your own shipping after paying perhaps
since postage doesn't need VAT
And I thought it was horrible enough for the customs price in Finland
if you buy something outside of EU and it costs 20€+ they take a fee
sometimes its huuuuge
heh... when i bought my protectli fw-1 i got it from america... had to import it, and i was stung on import tax. import tax on a £300 piece of computer hardware isnt small 😦
@green kestrel I never said node.js itself is a waste of ram, but ok then 
you mean its not? 😄
it's detable
sigh, might as well build my own server now
at least parts are way cheaper than one set/rack
this is true
if you buy a cheap sata raid card, and a sturdy case, you can build something server grade for cheap from second hard parts
how to convert this message.createdTimestamp in hours with Math.round ? and with minutes?
Math.round won't help.
use Date
// example
const timestamp = Date.now(); // 1577187054194
const time = new Date(timestamp);
Date has methods for getting hours and minutes.
gonna try
Could someone help me changing my bot's page button color & form?
How do I make my page buttons like these
From what Bot is That?
with your css code
see the class the buttons are using and overwrite it in your description with the style tag
finding the classes in there is hard af for me
what
inspect element
and read the html
lol
on Phone? yeah sure
Could just use a PC/laptop
Mine died 1month ago
i mean there is the view-source protocol on chrome
it keep was heating to 90° in 10mins
Laptop or PC?
also you can always like not use chrome, i use firefox on my phone because i value my data lmaoo
and they allow addons
I have this now, how do I change the vertical text position?
<!DOCTYPE html>
<html>
<head>
<style>
.button {
background-color: #8572ff;
height: 20px;
border: none;
color: white;
padding: 20px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
.button1 {border-radius: 80px;}
.button1:hover {
background-color: #7661ff;
color: white;
}
</style>
</head>
<body>
<button class="button button1">Add to server</button>
</body>
</html>
You put all that inside of the description?
@warm marsh laptop
Fair.
Hi! I have a preobleme with my DIscord bot, can you help me?
What problem?
Asking for help without providing what you need help with is completely useless.
if(error) {return console.error(error);}
let jsfiles = f.filter(f => f.split(".").pop() === "js");
if(jsfiles.length <= 0) {return console.log("Aucune commande en cours...");}
jsfiles.forEach((f) => {
let props = require(`./commands/${f}`);
console.log(`${f} commandes en cours...`);
client.commands.set(props.help.name, props);
});
});```
On index.js
On commands.js
module.exports.run = (client, message, args) => {
let embed = new Discord.RichEmbed()
.setColor("RANDOM")
.setTitle("Commandes/Events de PorkeyBot")
.setDescription("Contient toutes les commandes et tous les events de PorkeyBot.")
.addField("Informations")
.addField("Events", "newmember")
message.channel.send(embed);
};
module.exports.help = {
name: "commands"
};```
And I can't use commands.js
But I don't have an error on the terminal
Then that probably isn't your issue.
if(message.author.client) return;
if(message.channel.type === "dm") return;
let prefix = config.prefix;
let messageArray = message.content.split(" ");
let cmd = messageArray[0];
let args = messageArray.slice(1);
});```
This?
All index.js?
Yes
if so you're missing vital parts.
you need something to get the command from your map/collection
like ```js
let command = client.commands.get(cmd) || false;
if (!command) return;
command.run(client, message, args);
You're missing the part where you get the command from your collection
and then you need to call the function and pass the parameters.
But honestly, Don't just copy and paste code because you get stuff like this and you have no clue what it does or why it "doesn't" work.
OKya👍
But its still showing me nothing? This code comes from my old bot (6 months ago), and it worked, but I forgot everything about Javascript.
Help please (JS)
for (const guild of data.guilds) if (!client.guilds.has(guild.id)) client.dataManager.newGuild(guild);
^
TypeError: client.guilds.has is not a function
@warm marsh
How do I remove the white line next to my bot's avatar?
either border or border shadow or outline
@earnest phoenix try using the console.
Add console.log(client.commands); in your message listener.
Ok
@earnest phoenix I don't see border
@glacial mango try this for white box shadow https://discordapp.com/channels/264445053596991498/272764566411149314/658868770730672159
Thanks that works
I changed the color for
html, body, p, ol, ul, li, dl, dt, dd, blockquote, figure, fieldset, legend, textarea, pre, iframe, hr, h1, h2, h3, h4, h5, h6```
to white for 'Commands Prefix' & 'Bot Tags' but now is all the text in my long description also white, how do I change that?
Doing that to all those tags will cause that btw are you using chrome or firefox?
I recommend this extension for css editing
Firefox: https://addons.mozilla.org/en-GB/firefox/addon/live-editor-for-css-and-less/
Chrome: https://chrome.google.com/webstore/detail/live-editor-for-css-less/ifhikkcafabcgolfjegfcgloomalapol
I use inspect on chrome
Do you know which tags are for long description and which are not?
ctrl shift I after highlighting what you want
async function configSet(name, response) {
try {
if (config[name] === undefined) {
} else {
delete config[name];
}
if (response.toString() === "") {
} else {
config[name.toString()] = [response.toString()];
}
fs.writeFile("config.json", JSON.stringify(config, null, 2), function(err) {
if (err) throw err;
});
} catch(err) {
}
}
Sometimes, when I restart my bot, something like this happens:
{
"this": [
"thing"
],
"is": [
"not"
],
"working": [
"."
]
} ] // <- so I have to always manually remove that
}
I don't want to use SQL
a good example of why not to use json dbs
im not gonna make a web or anything
or else people will prob try to hack
honestly, that doesn't help
I use python, and it has global variables
oh lol
global variables = bad
I suck at python
I just slap a class variables and then variables.name = value
so i gave up
class vars are bea
let me try updating my node.js
bea?
How do I show my website in long description?
How long does it take for the bot to be verified
2 weeks atm
Yeesh
im guessing fs spam caused the problem
how can i change the theme of my bot page
add css using style tags in your bots long description
i couldn't understand
you use html and css
In your bot's description: ```
<style>
.selector {
property: setting;
}
</style>
Hello my bot is so cool
ok let me try
Not that exact codeblock though... you have to use your own css
How can I improve this landing page for my bot:
https://sinistrecyborg.github.io/Manatee/
Yet another Discord bot that does all sorts of stuff. You're welcome.
Idk what else I'd need to put in there
That itself took a while to make lmao
@opaque eagle im a web designer and i will use my own css, thanks for showing intrest to help me
Is there a bot that can send customizable private messages when clicking on a reaction?
what is the class/id of invite button
So uh
If someone clicks on a reaction
Is there a bot that will send a customizable message in DM's depending on on what reaction that person clicked?
Im sorry for bad spelling, im from germany. xD
i think that might be a bit to specific
you might have a hard time finding somthing like that
Mhmmmmm.
maybe try hiring someone from fiver or somthing
Does anyone know how Discord bot tokens are generated?
someone had a good diagram of it
but basically it takes the date it was created, a unique code, and another thing
Just look up how an api token is made, they usually follow the same basic process
yh
well pretty much but to be precise its in python/itsdangerous module
hmm didn't know a diagram existed
dankies shiv
@warm marsh why would you need to know how they are generated though?
I presume you are making your own or something?
Why does Discord need to use its own epoch
- makes it easier to count your token age from start of discord (basically how old in terms of discord's age)
- because it reduces the number so it kinda saves some space
- why not
Yeah I just wanted to know how they're made I've made an API for my chat, Just using it for testing and wanted to know how it was made.
And because the unix epoch is running out of numbers lmao
No time soon of course
https://en.wikipedia.org/wiki/Year_2038_problem in 2038 tho 
18 years pretty close 
I never said close
in the early 2000's there was this time traveler guy online who claimed he came back from the future because he needed unix hardware to fix the unix time problem 😄
How often can the ban method be called?
follows the same rate limit as Editing messages and sending like messages every 12 seconds i think
but its kinda just blurred cuz is differs
Thanks
idk why you want to call the ban method many many times without having some sorta malicious intent
You are allowed to call it a few times in short succession, but not too many times.
I think the rule is something like no more than 5 times per minute
If you need to ban 2 people you are allowed to do it without delay
In python what is __name__ and __main__ for?
Google?
I have
so basically say I have this
initial_cogs = [
'cogs.owner',
'cogs.mod',
'cogs.fun',
'cogs.general'
]
if __name__ == '__main__':
for exstensions in initial_cogs:
client.load_extension(exstensions)
print('Successfully loaded {0}'.format(exstensions))
Then I do this which is my if __name__ == '__main__': check
it will strip off the cogs and leave owner, mod, fun, general?
that just essentially determines weather the program is being started directly or not
e.g running the program in idle or pressing the run command in pycharm
Wait what
i have two python scripts
the one you see here
is the program i use to run everything else
doesnt make any diffrence
this is the program i want to call with my main program
the __name__ if statement wont run if i call / import the file Caller and then run it with my main program
only if i run the file manually
Hi i need to help
so i only get this result when i run it
connection.connect(function (err) {
if (err) throw err;
connection.query('SELECT * FROM erensibot', function (error, results, fields) {
if (error) throw error;
console.log('Result: ', results);
});
connection.end();
});
``` Code Was Working But When I Starting the Code again i give err
what is the error
PROTOCOL_ENQUEUE_HANDSHAKE_TWICE
connection.connect(function (err) {
if (err) throw err;
connection.query('SELECT * FROM erensibot', function (error, results, fields) {
if (error) throw error;
console.log('Result: ', results);
});
connection.end();
});
message.channel.send(`:ehayir: Oto as zaten ayarlı.`)
connection.connect(function (err) {
if (err) throw err; -- ERROR Was Here
var sql = mysql.format(`INSERT INTO erensibot (deger, sonuc) VALUES('sas_${message.guild.id}', 'acik') ON DUPLICATE KEY UPDATE deger='sas_${message.guild.id}', sonuc='acik'`);
connection.query(sql, function (err, result) {
if (err) throw err;
console.log("1 record inserted");
});
connection.end();
.
.
.
@modest maple I figured it out thank you hehe :3
if (err) throw err; -- ERROR Was Here
im not rlly sure what is going on castial
I think the problem with the query is the way callbacks are triggered later, so you may be trying to connect twice (just my guess)
@earnest phoenix ir(err) throw new Error(err); ?
If*
Error: Cannot enqueue Handshake after invoking qu
it.
:/
To Me Problem is connection.end();
not fixed
Can I Try To use MySQL Pool
im try only ```
connection.connect();
connection.query('SELECT 1 + 1 AS solution', function (error, results, fields) {
if (error) throw error;
console.log('The solution is: ', results[0].solution);
});
connection.end();
But Same Error
i write +saas code was Working Good But When i write 2th time +saas code was break
'PROTOCOL_ENQUEUE_AFTER_QUIT' error
From the name alone it seems to be that you ended the connection and tried to add information to something which isn't open
query probably async meaning you're ending the connection before it's finished the query
How to make it that when for example when the User Count is 28000 that it adds to 28000 so that it is 28,000?
what lang? js?
there's Intl.NumberFormat
const formatter = new Intl.NumberFormat('en-US')
formatter.format(1234) // 1,234```
no additional dependencies
Nah found an easier way by myself
.toLocaleString()
but still ty
Message DyingLight#7276: p$dog
Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "dog" is not found```
Did I setup my cogs wrong?
initial_cogs = [
'cogs.owner',
'cogs.mod',
'cogs.fun',
'cogs.general'
]
if __name__ == '__main__':
for exstensions in initial_cogs:
client.load_extension(exstensions)
print('Successfully loaded {0}'.format(exstensions))
File "star.py", line 32, in <module>
client.load_extension(exstensions)
File "C:\Users\Username\Desktop\PyStar\venv\lib\site-packages\discord\ext\commands\bot.py", line 625, in load_extension
self._load_from_module_spec(lib, name)
File "C:\Users\USername\Desktop\PyStar\venv\lib\site-packages\discord\ext\commands\bot.py", line 577, in _load_from_module_spec
raise errors.NoEntryPointError(key)
discord.ext.commands.errors.NoEntryPointError: Extension 'cogs.owner' has no 'setup' function.
I am confused by this error
What setup function does it want
Wait what
you need add a function to add the cog itself
Can you still ban someone before they join your server?
you can actually
I thought you were able to ban using ID even if the user isn't cached
@west spoke Thats not working for me
You can ban anyone regardless of whether they're in the server or not
Most libraries usually implement banning as <Member>.ban but there should also be <Guild>.ban that takes a user ID/snowflake object
Oh dang
erm
right
anyone know how to reconnect to disconnected tasks using pycharm
as it would apear
i might of lost a couple bot programs that are running
with no way to reconnect to them
is there a better way I can load the cogs in the folders
rather then just doing
initial_cogs = [
'cogs.owner.kick',
'cogs.mod',
'cogs.fun.dogs',
'cogs.general'
]
i mean all its doing is just essentially doing all the from <folder> import <program> and simplifying some of the stuff so you dont have to keep writing some long line of sutffs
but won't I have to do that for every file I add into the fun or owner folder
that just seems tedious to me
and pointless if there is a better way
tbf you could use an automatic system to auto list everything and load it
rather than manually doing it
How so?
but it gets a lil complicated with it
well essentially all youre doing is adding strings to a list of the objects
so in theory, altho i havent tried this with the inbuilt system
you could use listdir() and get the folders and their internal files and just use some string manipulation to get the list
Hm
I will test it out
Is there a specific way to specifying the folder and such?
path = '/Users/SecretUsername/Desktop/PyStar/cogs'
dir_list = os.listdir(path)
I did this and it returned an array of folders
would I have to individually load each folder and its contents?
essentially yh
just get the list of folders
then edit the file path cuz you can use somthing like an f string
and iterate throught the list and have somthing like a dictionary or 2D array or somthing
Hm
so like
fun = '/Users/SecretUsername/Desktop/PyStar/cogs/fun'
dir_list = os.listdir(dir_list)
for files in dir_list:
#get the files and load em
Something like that?
yh
well it would be folders your get from the loop
but you could then do
filepath + folder = Newfilepath
and then listdir for each new file path and append to a list
so you then have a 2D list
yh
So what are you talking about
idk
🤔
Yea
const { resolve } = require('path');
const walk = require('walk');
class CommandHandler {
constructor(client) {
this.client = client;
}
async load() {
const walker = walk.walk('./commands');
walker.on("file", (root, stats, next) => {
if (!stats.name.endsWith('.js')) return;
const Command = require(`${resolve(root)}/${stats.name}`);
const command = new Command(this.client);
command.aliases.forEach(r => {
this.client.aliases.set(r, command);
});
this.client.commands.set(command.name, command);
console.log(`[Command Loaded] ${command.name}`);
next();
});
}
}
module.exports = CommandHandler;
Anyone can tell me that when i use aliases the aliases wont work?
what
Do you mean
path = '/Users/SecretUsername/Desktop/PyStar/cogs/'
fun = 'fun'
dirFun = path + fun
dir_list = os.listdir(dirFun)
for files in dir_list:
#get the files and load em
huh
@modest maple is this what you mean?
sorta
but you dont need to have a var for each folder
just
My Cogs list = []
Defualt-Path = "xyz"
for somefolder in thelistListdir(FilePath) gives:
NewFilepath = f"xyz/Somefolder (formatted duh)"
TempList = []
for somefile in thelistListdir(newFilePath) gives:
TempList.append(LeFiles)
My cogs list . append(Templist)
etc...
gives you a two dimentional array
e.g
List = [[1, 3, 4], [4, 5, 6]]
i mean it might be easier just having a dictionary and making the key the folder and the values the file name
and then just interating over it and formatting the string so its like cog.folder.file
it just sorta depends on how you wanna do it
but as a rough idea
Hm okay
what dose this do becuase once i click it says it is not streaming
saorry for my spelling
wdym
Bot devs can use it to set if they are streaming on twitch or if other people are streaming on twitch
Then it links to said persons twitch channel
Has someone a idea how to make that the bot profile picture hovers at a top.gg site? f.e. https://tayron.is-inside.me/E84ufx3n.gif
and how to make the Page grey like this? https://tayron.is-inside.me/MWCUkHLI.png
It would be good if u send a code or sth because i'm not so good at CSS and HTML
But how? I'm not good at site stuff
Whats Animista?
google exists
ahh and how do i use that in my bot page?
use the style tag to use your own css
find the class that the avatar on the page uses with inspect element
and add the animation to that class in your css
Okay i'll try it
282859044593598464
ProBot ✨
5803
Welcome images, voice/text levels per guild, global levels, logs, high quality music, moderation and many many more!
Eris
(Customizable)
56607
14138
121620 Servers | 80 Shards
@muted junco
@tiny crag
Bot commands in #commands or #265156322012561408

const { MessageEmbed } = require("discord.js");
module.exports = class extends Command {
constructor(client) {
super({
name: "database"
});
this.client = client;
}
async exec(message, args) {
let embed = new MessageEmbed()
.setAuthor("Destiny's Datebase")
.setDescription(`\`\`\`${this.client.db}\`\`\``)
.setColor(this.client.EMBED_COLOR)
message.channel.send(embed)
}
};
help me please
Why are you trying to send the entire bot DB? And why are you redeclaring client?
Anywho, uh, use util's inspect function
cog_list = []
for folder in os.listdir(defaultPath):
newPath = f'{defaultPath}/{folder}'
tempList = []
for file in os.listDir(newPath):
tempList.append(file)
cog_list.append(tempList)
if __name__ == '__main__':
for extensions in cog_list:
client.load_extension(extensions)
print('Successfully loaded {0}'.format(extensions))
@modest maple you mean something like that?
Somthing like it yh
But you'll need to remember that the cogs list seperates it with a . as it acts like an object
okay
So you'll want to append to the array "cogs.{folder}.{file}"
But you might need to remove the .Py at the end of each file
But youre along the right lines
when you print out cog_list it doesn't print out anything
Oh wait
I see why
there is a + in the path
Hm
I'm new to uh code
Where can I run a const thing?
I'm being dumb enough to use git right?
const is a declarement of a constant variable, means you cant change it, it just stays how it is
1/10 would not recommend
the usage is ```js
const someVariableName = "Some value"
or numbers if you desire, booleans are possible too
just like var and let, just not changeable
so I'm new to writing bots and found this line on the discordjs.guide site "By default, up to 3 fields will display inline. If a thumbnail is set, this will change to 2", but when I try to get two inline fields per line I get three even with a thumbnail:
'''const statsEmbed = new Discord.RichEmbed()
.setTitle('Match Info')
.setAuthor('PasteBot', 'https://cdn.discordapp.com/embed/avatars/0.png')
.setThumbnail('https://cdn.discordapp.com/embed/avatars/0.png')
.addField('Oc', '9/0/0', true)
.addField('a','a',true)
.addField('Ben', '0/9/9', true)
.addField('b','b',true)
'''
is there any way to get it to restrict it to two a line?
That's normal, and no you cant
so is the line on the website just outdated or something?
.addField('Ben', '0/9/9', false)
.addField('b','b',true)
``` @cinder dome
I don't know
🤔
This is a "test"
wait youre not allowed to style the buttons?
@earnest phoenix you can
okay phew
Lol don't worry
also do you guys think this looks good
Yes you can :)
This is good
Gn devs
gn dany
Ty
:)
still kinda confused, removing the title still puts 3 per line and I would like the third line to still be inline with the fourth so making it not inline doesn't work. I can get it to be two per line by putting a blank field inbetween fields 2 and 3, but that makes an awkward space. I'll go with that if it's not possible to make it limit to 2 per line, but the discordjs.guide page seemed to indicate that adding a thumbnail would restrict it to 2 per line.
thanks for the help either way
like the amount of text or the font size?
the amount of text
what you could do
is make an empty field
yeah, if I can't get it to limit it on it's own that's what I'll go for. It leaves some empty space which I don't particularly like but it's not that bad
no worries, thank you
I tested with longer strings and now it just looks like my bot is screaming at me
Merry Christmas Eve to ya guys
Yo too
-botinfo @agile fern
611723981019545622
Ellie
9051
Ellie is a bot that has useful commands such as Moderation Commands and Economy Commands, and Verification Commands.
discord.js
$
15
3
No server count
@junior aurora
Why do I get all those question marks next to all the files/folders in NERDTree?
nvm im dumb, just had to install a font
xD
for folder in os.listdir(defaultPath):
newPath = f'{defaultPath}/{folder}'
tempList = []
for files in os.listdir(newPath):
file = os.path.splitext(files)[0]
tempList.append(file)
cog_list.append(tempList)
Real question is
how would I append tempList and folder to cog_list
actually
if I was to try and load this as an exstension would it error?
I think it would but I don't know
What
The []
The ones inside the strings
cogs.general.[]' for example
Yes



