#development
1 messages · Page 799 of 1
i regened
ah ok then
i have new token
ok! i got less errors from the quickstart site
I load it in from environment
my token is in another file
it loads it in on boot
saves me being an idiot and sharing it
i still need to work out webhooks so i can set up voting and some donation rewards
thats whats happening?
Invalid syntax.
crap... i leaked my token
Read the error.
and ur gonna need to reset token again
how do i fix the syntax?
they shouldnt be on the same line
huh?
Start with en empty code before you stick in a tutorial bot. Btw
there is half a million errors
@static trench do you have any python experience at all?
a little
how much
i did python in school before new years
Also. Delete al of it. Then paste in a starter bot.
You have 2 bots in that file.
because you should be able to fix syntax errors
I'd highly recommend a python tutorial
Before you get into bot making
You can't do much if you don't know how to use your tools
where can i get a bot to throw into pycharm jsut to feel good about myself?
fr if you cant fix syntax you wont be able to get a bot done in a reasonable amount of time
i remmeber seeing one on github
smh script kiddie
@static trench that quickstart bot I sent
huh?
As long as it's the only thing in the file
from discord.ext import commands
import logging
import discord
logging.basicConfig(level=logging.WARN)
def get_prefix(bot, message):
prefixes = ['%','>']
if not message.guild:
return '%'
return commands.when_mentioned_or(*prefixes)(bot,message)
bot = commands.Bot(command_prefix=get_prefix)
@bot.event
async def on_ready():
print("Bot ready!")
@bot.event
async def on_message(message: discord.Message):
if message.author.bot:
return
if message.content == "hello":
await message.channel.send("hi")
await bot.process_commands(message)
bot.run("token")
that?
That should work yes.
how didnt it
there was a ton of errors!
like
its still offline
It's probs one error and a stack trace btw
i put in the token
Imma hop on my laptop. This is wiwrd.
ok
I see zero reason why that doesn't work
The heck wym
inb4 he hasnt even downloaded the lib or something
2 secs
i have to go . thanks 4 ur help! @earnest phoenix i will learn python and try again .
if you get it to work . feel free to DM me
i mean
https://github.com/crazygmr101/AnsuraBot/blob/master/main.py this is the original file
and it works fine
ok
so i am very confused, unless @smoky quartz you have any idea?
only error i get is yelling at me cos i dont have pynacl
i cant put my token in the one from github
yes
i cant imput my token antwhere
if you're talking about the one i sent, it goes there
or just change os.env(wqerthjgkh) to yours
i probably havnt installed python right . i have to go . i will try to figure it out! thanks for your help
thx
Ahem, sorry for repeating myself but . . .
It says error for some reason
(node:2712) UnhandledPromiseRejectionWarning: Error: An invalid token was provided.
When I put the token in the config.json file that happened, it also said this along with the warn code.
(node:2712) 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: 3)
(node:2712) [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.
here is the code again
const Discord = require('discord.js');
const { prefix, token } = ('./config.json');
const client = new Discord.Client();
client.once('ready', () => {
console.log('Bot is now online!');
})
client.login(token);
Reset your token and add it again
@pine bear try regenerating the token, if you are also uploading to GitHub don't upload the token as it will get auto regenerated
Well could use a .gitignore to ignore the file with the token in it on upload but yeah that too
so I have to regenerate the token and replace the token but the token works
it's from the config file also if I replace the "token" in client.login(token) with the original token the bot comes online.
@pine bear so then it's having a problem reading it from the config try something like this
const config = require('./pathToFile');
const Prefix = config.prefix;
const token = config.token
do console.log(token) once
Should allow you to call it VIA token
That's the exact thing I did
I mean, you never actually called the require function.
Damn,
^^ that to
We dumb
that would explain it
I'll separate them thank you
uhh?
const { prefix, token } = require('./config.json')
Not
const { prefix, token } = ('./config.json')
you're trying to get the properties from a string, which obviously does not exist
@pine bearalso make sure when you do the path to the file you do const name = require('path') you forgot the require
Ok thank you for the help
np
Lol
What do yall do for showing the uptime of your bot?
I have a boottime variable that gets set when everything is initialized, but discord.js client also has an 'uptime' variable thats based on when the bot client entered the 'ready' state in ms. Which one would you show? or both?
the uptime is probably more accurate
well
It probably wouldnt matter
I'd just use uptime because it's already there
I dont know a whole lot about python
but wtf are these https://oliy.is-just-a.dev/qf1gl5_2938.png
try player != "rock" or player != "paper" or etc
or you could player not in ["rock", "paper", "scissors"] as well
uptime really isnt accurate though
it shows my server rebooted 24 minutes ago
but it didnt, there was no issue whatsoever
not even a lagg
then use and if it's not equal to any
so that was mb
player != "rock" and player != "paper" and player != "scissors"
my bot wont show its status, whats the correct code?
lemme send
i cant even find it now
i didnt save it
whats the correct code? and btw im using discord.js
How do you grow servers better?
Have a good bot?
Lmao, I started to add commands into the bot
would this be right?
server.member_count
or should there be:
len(server.member_count)
or:
len(server.members)
can someone help?
Lang?
May help if you provide what language
Python
len(guild.members)
ok thank you
No
oh?
I have a tag for this
Python is an OOP (Object Oriented Programming) language...it uses the concepts of objects to house information about things. The most important thing to understand is the difference between a Class and an instance .
A Class defines what an instance of said class will look like, and an instance is an object created based on that class. An example would be a Class of Fruit....an instance of this class could be apple.
An example seen in discord.py is this:
discord.Guild.id
This id attribute is an attribute of the class Guild....This means to use it you must have an instance of the discord.Guild class. This can be obtained in a number of ways, through a message: message.guild through searching by id client.get_guild(id) etc.
TL;DR: OOP is a very base concept of python, if you do not understand OOP then learn this first before creating a bot.
(Yes, static methods and classmethods exist....this is only detailing the basic class/instance interaction)
you dont
iirc
TypeError: object of type 'property' has no len()
whats the line of code
that is an error
ik
send code
server = discord.Guild
embed.add_field(name='No. of server members: ', value=f"`{(len(server.member_count))}`", inline=False)
guild.member_count
no len
an int doesnt have a length
oh?
ye
value=f"`{guild.member_count}`"
wouldnt it be server though?
nope
since: server = discord.Guild
no
discord.Guild is a CLASS
right
you'll want to get the current guild (if it's a command, prob ctx.guild)
ye
embed.add_field(name='No. of server members: ', value=f"`{ctx.guild.member_count}`", inline=False)
ooo
i never thought of that
also in python, to say a var is a type, you do this:
a: int = 4
b: discord.Guild = ctx.guild
etc
but ye follow @stable horizon's advice and learn how OOP works before you get into that

um
lol
literally the message above you xD
what if: TypeError: 'property' object is not iterable
Type annotations don't do anything in Python though?
Yeaeh
didn't know you could declare static type vars in python
So tecnically s: Guild = message.guild is redundant
its for those people
or the people who have stupid partners in a collab
"hey ffs this isnt supposed to be a bool"
but @slender thistle is helps with autocomplete
tis true
g: discord.Guild
for g in bot.guilds:
adsfghjk,m
and gives pycharm an aneurism when i pass a "wrong" value
^
Understandable
its handy in dpy too
@commands.command()
async def yeet(self, a: int, b: int):
print(a+b)
ngl ive started implementing converter-esque stuff into other user-input-required stuff
just cause its so nice
Explicit over implicit
did somebody say implicit?

Alright, so I'm using a node.js library named sharp by lovell, and I'm trying to create a donation "goal" thing.
So I want there to be my input of how much I've raised, and I want the green bar to go to that value on the thermometer, here's my current code:
var raised = parseInt(args[0])
sharp("./data/greenbar.png")
.extract({top:0, left:0, width:20, height:Math.floor((55000-raised)/100)+100})
.resize(367,733)
.composite([{
input:"./data/goal.png",
}])
.toFile("./data/flush_GOAL.png").then(() =>{
msg.channel.send({
files: ["./data/flush_GOAL.png"]
});
})
Currently, the command outputs https://cdn.discordapp.com/attachments/623707775356370954/682444749902577673/flush_GOAL.png
everytime, no matter the raised
how do you remove a single complex array object?
for example my array is like this:
[{
name: "Fiqstro",
age: 14,
nationality: "Vietnam"
},
{
name: "Eshi",
age: 14,
nationality: "Vietnam"
}]
how do i remove the first one using enmap
my bot got approved sooner than i was anticipating. what should i do now? just setup the api and stuff to update guild and player counters? setup voting and such?
set it up so it does what you want it to do!
It's not like it being accepted means you are not allowed to test and edit it!
Or maybe they were looking for ideas..?
Ah
Well, in that case, im going to be asking a similar question. What are any thoughts on what to add to my bot?
( @tawdry glen )
it already did what i wanted before i applied 😄
ah
I was going to change the markdown description for an iframe to show my bot information from my site. but the preview thing isnt showing the iframe content. Should i test publish the edit and keep all markdown and make sure that the iframe shows before i remove the markdown? or should the preview page show the iframe?
maybe do it locally
I have my bot's description written specifically for the top.gg site
(if you look here)
-botinfo @tawdry glen
Oh there is no link to the site
The Bot page link? Click the name 😏
do it locally? how can i test that topgg will show my iframe properly locally? 😄
just publish and then edit
save a backup of your current setup so you can always go back to it if it doesnt work
but the iframe should work, check your console log to see if there is any error in the iframe
its possible that is being blocked by cors
yea i was checking my sites log, it showed that the page was being contacted fine. i'll just backup the markdown and test the edit i guess 😄
check the browser console.log when you load the page that has the iframe
Firstly, wrong channel
Sorry
Secondly, you can resubmit your bot if you removed your command
How?
I dont want to wait 2 weeks ;(
Sad
/top10 isn't a server list command it shows levels
It still lists all servers
php I can edit json file?
that I could resolve this request js con.query(`SELECT * FROM prefix WHERE id = '${message.guild.id}' `, (err, rows) => { if(err) throw err; let prefix = rows[0].prefix;
in this code
what
php? that is not php lol
i want to ask the prefix to run the music bot but it does not work await problem write what to do please help
await problem
you want a custom prefix?
sql store is good too but for musicbot please download but i get error code await
what
I store the prefix in mysql
yes, and where is your sql code?
when i get it with conn.query, then the bot writes an error await
show the con.query code
con.query(`SELECT * FROM prefix WHERE id = '${message.guild.id}' `, (err, rows) => { if(err) throw err; let prefix = rows[0].prefix;
Any ideas on how to reduce loading times when I reboot the bot, or do I have to live with the slowness of my old pi?
what do you exactly do when rebooting?
create a new process and kill the old one?
what part of the loading takes the most time?
from process start until the ready event?
Sorry didn't see this
I am using systemd to do the rebooting
But even just running the program alone from node takes a long time
when a bot logs in, it does the following:
connect to discord
receive list of guild ids
confirm reception
begin downloading all guilds one by one <-- this is what takes the longest time
when finished, fire the ready event
Ah
if your bot is sharded, add 5 seconds delay between each connection
I feel it's dependent on my internet speed, which is very slow.
Also I won't be needing shards, as the bot won't ever be in 2.5k servers
there is one easy thing you can do to improve start up time, which is reduce the large_threshold value
by default, Discord considers a guild large when it has over 250 members
a large guild will not contain a full member list when downloaded
making it a much smaller download
the minimum value this setting can have is 50
large_threshold -1
so if you set it to 50, all guilds with more than 50 members will not have their entire member list downloaded by default
which will reduce the time it takes to download all guilds
this is a websocket option when connecting to discord, depends where your library put this setting
I use discord.js
new Client({
ws: {
large_threshold: 50
}
})```
Thanks
it is also possible to hack the library into firing the ready event before downloading all guilds, but this is a very advanced thing and will possibly break things lol
K
I asked this becuase I see people using webhosts and stuff retarding their bots in seconds
Then I'm waiting out 5m+ for me to be able to see if my changes worked
Lol
client.on("raw",console.log) and check your console when you fire the bot
you will see the guilds being downloaded
K
If this is a clue, I have a startup sequence in console that does stuff as it's booting
but if it takes a long time before the guilds start coming, then the problem is elsewhere
And it takes ages before it's even triggered
Also the bot maxes out the CPU and memory.
client.on("raw",r => console.log(r.t))
to log only the packet type, not the full object
I use bot instead of client becuase tbh it makes more sense
sure
time to ssh again on my phone then use nano
lmao
I think I'm getting used to this sad way of editing
very sad indeed
Because I honestly am too lazy to get up to my computer and open visual studio code
jesus christ
using ssh and nano on your phone will take 5x longer than booting your pc and opening vsc
lmfao
just spent the past hour making a nice page to embed as my long description iframe. Totally took inspiration from pokecords iframe 😄
the entire internet is built on people stealing ideas from each other
true lul
btw yea it was x-frame permissions from my nginx that was stopping the iframe earlier ~ i nub with nginx 😄
ah yes theres also that
for (let i = 0; i < Math.min(message.guild['player'].queue.length, 10); i++) {
const embed = new MessageEmbed()
.setColor('#ff003c')
.setTitle(`${message.guild.name} Music Queue (First 10)`)
.setAuthor(message.client.user.username, message.client.user.displayAvatarURL())
.setDescription(`Title: ${message.guild['player'].queue[i].title}`)
.setTimestamp();
return message.sendEmbed(embed).catch(err => this.client.emit('log', err, 'error'));
``` My queue command is not working there is 3 songs in songs and it shows only 1
i had set it all to SAMEORIGIN for basic security and totally forgot about it 😄
1 - you should remove that math.min from the for loop and set a variable before the for
as during each iteration its doing the math min calc
and you dont seem to be reducing the length any during the loop
for (let i = 0; i < message.guild['player'].queue.length + 10; i++) {
const max_length = Math.min(message.guild['player'].queue.length, 10);
for (let i = 0; i < max_length; i++) {
}```
something like that 🙂
but i guess thats just imo 😄
hmm
microoptimizations
Thanks
yea, but also better for readabilities
@earnest phoenix it shows only one because you are returning
oohh i hadnt even noticed the question lmao
hmm
also, you cant send 10 messages at once
the limit is 5 per 5 seconds
you should not be sending one message per song
you could do some kind of await wait(timems) in between each msg sending
you are trying to
assuming you have a promize wait func
you're building a loop that loops at most 10 times, and for each time, it sends one message with one embed. if you have 10 songs it will send 10 messages
Oh! But I don't want to send 10 messages I just want to print 10 songs in one embed
then you need to define the embed outside of the loop, then build it, then send after the loop finishes
like this
let embed = new Embed()
.setTitle()
.setFooter()
.etc()
for(...) {
embed.addField(song)
}
send(embed)```
or if you want to use description instead of fields:
let description = ""
for(...) {
description += "something"
}
embed.setDescription(description)```
ok I understood that but the loop?
the loop you are doing is correct, you just need to create the embed before you start the loop, and send the message after the loop block
you only use the loop to build the embed parts
ok
const cuser = message.client.user;
const queue = message.guild['player'].queue;
const limit = Math.min(queue.length, 10);
const embed = new MessageEmbed();
embed.setColor('#ff003c');
embed.setTitle(`${message.guild.name} Music Queue (First 10)`);
embed.setAuthor(cuser.username, cuser.displayAvatarURL());
const tracks = [];
for (let i = 0; i < limit; i++) {
tracks.push(`Title: ${queue[i].title}`);
}
embed.setDescription(tracks.join('\n'));
embed.setTimestamp();
message.sendEmbed(embed).catch(err => {
this.client.emit('log', err, 'error')
});```
i'd go with soemthing like that
okay let me try this
lol
also, idk there was a 'sendEmbed' function on the message object
i normally just do like, message.channel.send()
No, I use Klasa
ahhh ok, fair enough 😄
The code is working but one problem it plays current playing song but no problem I'll fix that
Thanks
np dude 🙂
ok dude
How can i make a custom background at my DBL bot page?
how can i remove the white iframe border on my bots dbl page? 😛
css in long description
Ok
would anyone here pls help me figure out what to make a bot about?
I'm making a second bot because my first one is.... Something
And I want to make a more specialised and useful one
usually you'd go the idea -> bot way, not the bot -> idea way lol
@lethal stratus don't make a bot just to make a bot lmao
- idea -> plan -> create botum
i wanna create botum -> steal idea -> create botum
I haven't made the bot yet
I don't have a problem tho
problem: discord needs more foot balls
solution: make bot that posts images of beautiful foot balls
I made the first one for the sake of existing
count how many times people say all variations of "lol"
freelance: get paid to make a bot for nub
we already have owo/uwu bots, do we have lol bots?
basically what dekita says lul
create an EA like economy system
Ok but I'm 14 XD
if you can't spend your time constructively, earn money from it
pay for help command
you don't have to be a specific age to freelance
pay for help command
This is the next step
XD
you don't have to be a specific age to freelance
Hmm.... But where would I find people who need bots?
errr the first time i created a custom bot for someone was just from a random server i was interacting in
i can make free main purpose bots
I mean, I made a bot for a friend that managed and sorted art requests since they did art
I didn't charge or something tho
i mean if you dont wanna charge then don't
the problem is, you will find people willing to pay a few bucks to get a bot made for them, but as you get better, you increase your prices, and you stop getting work
people nobody wants to pay
lmao
could check some sites like fiver or something for freelancing 🙂
and charge more than a buck ffs lol
fiverr sucks for that btw, do not recommend
1$ for like 3 10h days seems about right
^
And a lot of people looking for custom bots don't really care about quality code
it just needs to work
But would they be hosting it tho
so they'd rather hire a kid who can't code for crap for 3 dollars ig
usually there's a prerequisite letting them know and helping them set it up on a server or sumn
hello, i bought a bot, how do i turn it on?
Haha
lmao
how to make bot 24/7
I mean if it was my bot the answer would be node and systemd
I think web tutorials have done a good job in failing to give the information to everyone that they need
By that I mean they all tell you how to make a bot respond to like "hello"
And nothing else
tutorials succeeded in giving people misleading information and teaching them bad practices and opinionated coding
It's like the opposite of unity, rather than everyone having easy access, therefore a lot of crap, it's more filtered to the people who persevere and actually know what they are doing to a degree
I think it gives you enough information to weed out the lazy people who just don't wanna spend effort in learning
Because in the end a lot of people do learn from the internet just from googling, even if the resources could be misleading
the discord coding community expects people to have a basic knowledge of programming
yep
and as such, fails to teach them basic programming
Know what's funny
but its understandable, they cant be arsed with it
Originally when I was getting started on my bot
I followed one that had me using bloody discord.io
many people do lmao
And it was very far in when it was all outdated and nothing worked
That I realised I had to recode large chunks
I don't blame them ? it's hard to explain over and over again on a daily basis what a string is when the person just wants to learn how to turn bot on
And persevere through it
yeah i dont blame them either
I have to wonder
Why is it even possible to download discord.io anymore
Is it for the super old bots that people cant be bothered to recode?
the author hasnt bothered to mark the project as deprecated
I accidentally
Because a crappy tutorial when I was still learning what the heck I was doing
i got annoyed at mee6, google for a node js discord bot api, and discord.js was top of everything, so i went with that 😄
mee6 is really good or
Discord.js
discord.js has slight memory leaks all over it and caching issues
other than that it's fine
It's the only one I know how to use
@spare goblet ive noticed those leaks... quite irritating
Ideally if you know js, you should be able to work with other libs, like Eris
but Eris is a bit strange
where does it leak from?
many different things
You have to basically cut open the lib, break everything, disable everything, just to have a normal sized ram
could this be why memory use is always 100% with it open, or is that just cos I have the world's slowest raspberry pi
cpu is probably not discord js issue
I've never had cpu issues other than me frickin around too much and doin inefficient functions :^)
@spare goblet is there a topgg dummy-api so that my discord dev token bot doesnt report server counts to topgg?
My bot just got approved and I was thinking of integrating the server install counts etc
ye probably autopost
if you're using master it doesn't work
if you're using discord js stable it'll be fine
And if you don't attach the client to the constructor it'll be fine even on master ig 
its not memory leaks, its their aggressive caching nature
they cache EVERYTHING, in order to avoid hitting the api as much as possible
well ye
the problem is that the caching is too tightly coupled with the core of the library
they have discussed this in the past, but decided it would be unfeasable to rewrite it
but yeah, we have to hack it open ourselves to fix it
i made a library for that lol
ideally, there should be a core library for discord api, something that only processes gateway packets and handles rest requests, and nothing else
discord.js does have cpu issues, but not caused by the library itself, they are caused by the discord api flooding your machine with presence updates
the new intents system fixes that
yea, i broke my bot cause of presences
but that was cause i was iterating over 40k users per second and trying to store presence data...
that feature was imemdiately removed
lol
sad thing was, my bots initial purpose was to track my own activity each day, to see what apps i was in the most etc
lol interesting
im getting a 400 Bad Request when trying to use the dblapi.js-lib? Using the topgg-provided token..
are you on discord.js v12?
ye
@lethal stratus btw, if you google "how to make a discord bot", the first link, from digital trends, uses discord.io
@glass crag dblapi.js was not updated for the latest v12 changes
Ah alright
you have to remove the client from the constructor to disable autoposting
then you can do dbl.postStats(client.guilds.cache.size)
thanks man
v12 moved all caches to a .cache property
i post once per day
Sounds reasonable
i dont care how accurate the count is in the website
dblapi's default is 30 minutes i think
some people do it on every guildCreate/guildDelete event lol
hahah thats a bit hardcore
yeah, its mostly small bots lul, "oh hey we have a new guild, we must update immediately"
everyone must know!!
😄
the bots should post to every guild installed at to let them know the new guild count!!
lmao
Need help
const current = message.guild['player'].current;
const cuser = message.client.user;
const queue = message.guild['player'].queue;
const limit = Math.min(queue.length, 10);
const embed = new MessageEmbed();
embed.setColor('#ff003c');
embed.setTitle(`${message.guild.name}: Music Queue`);
embed.setAuthor(cuser.username, cuser.displayAvatarURL());
const tracks = [];
for (let i = 1; i < limit; i++) {
tracks.push(`**${i}:** [${queue[i].title}](${queue[i].url})`);
}
if (queue.length <= 1) {
embed.setDescription(`Now Playing: [${current.title}](${current.url})`)
} else {
embed.setDescription(`**Title:** \n${tracks.join('\n')}`);
embed.setTimestamp();
message.sendEmbed(embed).catch(err => {
this.client.emit('log', err, 'error')
});
}```
Not working
what isn't working
My queue command is not working
Bruh
it's not working
what's the error
we can't help you if we don't know where to start
It throws no error in my consoke
then start console.logging values and seeing what's wrong
if (queue.length <= 1) {
embed.setDescription(`Now Playing: [${current.title}](${current.url})`)
} else {
embed.setDescription(`**Title:** \n${tracks.join('\n')}`);```
this part isn't working
What is the intended output of your queue command and what is the actual output
There is no output
i'm assuming you want to send an embed
if the condition in there is true
you use message.sendEmbed
you'll have no output because all you do is set the description
so that's likely the issue
I'm pretty sure you want message.channel.send(embed)
Which is better for discord.py bot + django api hosting: Kubernetes or Docker?
send embed is deprecated too
@broken jay what
Fixed
you use k8s to manage docker
if you are hosting a bot
you can run it without docker or k8s
What?
k8s is container orchestration
I putted } in wrong place
I don't want standard VPS
I want docker/kubernetes + managed DB
DigitalOcean have Kubernetes service, AWS have Docker service
amazon also has kubernetes
if you're deciding which one to use there's probably not many people here that are gonna be able to answer that for you
?
yep
are you using a library like dblapi.js?
nope
how are you using it then?
djs
are you running a webserver?
nope
then you need a webserver, or dblapi.js
^
There are many examples on GitHub, you can check that also
follow the example on the link i posted
github examples might be outdated (if its not from the official github)
not the channel for that
Just asking one question
Anyone know how to make a captcha?
for when people join a guild?
Yes
should be possible yes
Anti raid
mine is made with javascript
you should be able to do it with whatever graphic drawing library there is for python
some sort of canvas for example
Pillow, PIL
you'll create a random string, save somewhere and draw it on an image, then check if the user's messages match the saved string
you'll probably need a database to keep track of things
Lol that is not what I meant
then what do you mean?
cant a bot just read that?
Easily possible
well, it might be able to stop generic spam bots, but anyone could easily make their spam bots copy and paste the captcha
using an image will make it harder for them to do it, they'd need OCR, and even then it might often fail
for example, mine looks like this
could i add a html file to my bot that displays the sqlite database it has
wut
Opinions wanted:
Postgresql
or Mongo
or Datomic
which DB would you choose to manage a LARGE Database
PostgreSQL I heard for good performance
what do you use to generate those @quartz kindle 
canvas
with the colors and locations of the characters randomized each time?
yup
would it be possible that the lines somehow get in a position where it's rly difficult even for a human to see the characters
i just wanna make sure people don't get screwed over
lol
yes, its possible
but the lines are thinner than the characters
so unlikely to happen
you can also use dots or circles instead
xd
i mean, the chances that someone decides to make their spambots run OCR to break into your server are probably lower than the chances of winning the lottery
but oh well
well this is for game bot
i also made mine optionally case sensitive, for some extra fuckery lmao
works well this way
and up to 10 chars
but i'd guess there's probably at least one person that has at least tried ocr
I originally had regular text that was case sensitive and people fucked it up all the time because the font discord uses can be confusing
lol
most of my problems were from characters being too similar to each other, like lower care L and upper case i
yeh that
i had to remove those characters from ever being used
also 0 and O
i use these characters now 123456789abcdefghijkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ@#$%&?
hahahah
random thought. is there a way to use decorators in d.py for command help? right now on the cog setup, i just register a command like that.
def setup(bot):
bot.add_cog(Minecraft(bot))
HE.HelpEntries.register("jping", ["%jping server","%jping server:port"], "Pings a java server")
HE.HelpEntries.register("bping", "%bping server port", "Pings a bedrock server")
class HelpEntries:
cmds = []
@classmethod
def register(cls, command, usage, helpmsg, notes="N/A"):
cls.cmds.append(core.help.HelpEntry(command, usage, helpmsg, notes))
#etc
like it'd be nice to keep the help stuff near each command
loaded on cog load
class decorators maybe?
So i've been wanting to add the ability to log changes that people make on a servers dashboard. I was wondering what would be the best way to do so? How should i store it and should there be a limit on the amount of logs etc.
kinda like audit logs?
i mean
you could always just make it simple
store the action, the person who did it, and the time
and the server
the issue would be though that people make changes to multiple things at once and save. So like it'd be multiple actions, if it was one by one i'd take a similar approach to discord but it's not.
i would be hoping to find the difference between it and store the changes and then it would list those changes in one "log" thing on the dashboard so i know that much. but don't know how to store it / best way
sql?
If the only purpose is that people can read it, then the "action" could just be a combination of actions
where's it's all just a string
if you plan to use it for other things such as reversing actions
you'd need to properly set up each action
maybe also the ability to sort the log by change type
so for example, a table with timestamp, type of change, string describing the changes
and maybe also the author of the changes
if you're using an sql database, you could have all logs from all guilds in a single table, and have them indexed by guild id as well
As for the limit, I doubt it would become an issue on your end to store it all. You'd probably just want to limit the output, but while doing that you could always have something deleting very old logs
Umm?
?
you define prefix then use config.prefix still
also what's up with that if statement
that wont do anything
yeah but the if statement wont do anything at all anyways
it will evaluate to something then do nothing then it will send ping regardless
The one above it is fine
god i am so happy right now
finally this garbage package was deprecated
maybe we can get actual good bots out of this
how does request have anything to do with the quality of a bot
all it does is make requests
and that's their choice and they will probably use it regardless
many people who make bots with it do not know how to use it properly
as the package is basically noob bait
It is still a choice
like just use the http/https modules or node-fetch
how can we make progress graphs, in discord.js?
using canvas
And that's an opinion
in my opinion canvas is annoying to work with
https://oliy.is-just-a.dev/gm8cb_2955.png chartjs is easy to work with
in my opinion
easy = boring
easy = less time wasted trying to figure out how to draw a line with points
simple math
I use gm mostly but am looking for an alternative that still uses imagemagick
if node.js, look into sharp
please my bot verify patent please
what
Oh that's why the bot sends ping when the prefix in mentioned.
yes
I would like to move to sharp/libvips but the lack of features compared to *magick kinda sets me off
also no animated gif support
which is why I can’t use canvas either
it does support gif, no?
well, vips supports writing gifs by importing magick or something apparently, but sharp didnt implement this yet
there's an ongoing PR for it https://github.com/lovell/sharp/pull/2012
requires imagemagick installed
how can i make xp line
canvas ?
what language are you using?
js
Does anyone know of a bot that can automatically whitelist players into my dayZ server?
sounds oddly specific, it probably doesnt exist
does dayz even have an api endpoint for that
Yeah you can script for it
I’ve seen it on only one server before
@earnest phoenix you have any idea on how to do that?
What you're asking I've seen it but have no idea how to do it sorry. I'm just familiar with scripting
?
@earnest phoenix think they meant to tag me lol
i did lol
is it like a private server hosted in your vps?
Yes
Ah Ok 😂
@quartz kindle
how does the whitelist work, do you have a file that you edit?
That'd be really difficult for someone else to do, you'd probably be better off making it yourself
Run a private server, when people join it grabs their steam hex or something and uses that for whitelist @quartz kindle
but where is this whitelist stored and how is it accessed?
unless you open your vps to requests and a bot lets makes a request to your server to do that
Usually via a database like SQL
then a bot could connect to it
could be a bot running on the same machine and access the local db
well idk what that is, never played dayz either
the point is, you need to know how the internals of the white listing process works
It's an app they have to manage your servers (start, stop ect)
and program a bot that can access/modify the white list
Yeah I'm sure a whitelist bot is possible I don't see why it's not
I mean I made one for FiveM that can connect to the server, ban players ect from my discord channel but I had to connect it to their API and usually if they allow scripting they will have Docs
In HTML, should I put paragraphs directly under a div that contains all necessary buttons or is it preferred I use separate divs for each one?
for each paragraph element?
Yeah
What would be the best way to approach trying to set up a “whitelist bot”?
Maybe make a single div for all paragraph elements
@open cedar honestly find their docs and their API first
Make sure they allow that and see how it's possible
Or at least group paragraphs into certain divs based on where you plan to position them
If it's only a single paragraph I wouldn't bother with having an extra div just for that
Also should I worry/bother about paragraph elements with width equal to the window width
Nitrado allows for ftp and sql connections and so has direct connect query ports. I'll do some digging and see if I can find what handles the whitelist and how to connect to it.
@open cedar that would be your best bet 😁
If you mean the paragraph is taking up the entire width of the visible screen, I'd probably change it up a bit
It's just that I'm not sure if it'll bite me later when the buttons are there
why my bot's top.gg page doesn't show my bot's avatar, even though it has been verified
Edit the page and save
what i have to edit?
Try to just re-save
okey, it works
I'm trying to implement play command on my bot through lavalink, is there any online host for me to connect to or am I supposed to run the service from my own computer?
It's a python function, here is a "placeholder" for it
lavalink.add_node("host", 2333, "youshallnotpass", "eu", "default-node") # host, port, password, region, node
Doesn't lavalink work with youtube?
Ah, I got what you're saying
You can load a local file on it
You could make a list containing the name of the files, then compare the input name with your list and load it on lavalink
Hey I need some help with the new discord.js version 12 for embeds. I looked at the docs and everything but I keep getting the same errors when ever I try to add fields to embeds
it would be great if you show the errors
console.log(fields);
then send the output
btw fields.flat() isn't a method of fields
Yeah here;s the code
ReferenceError: fields is not defined
@vague kite you're really in djs v12?
Most people are
master branch is d.js 12
@vague kite i think you can't add multiple fields with addFields addFields doesn't exist no??
have you tried passing it in as an array of objects @vague kite
addField seems to have been removed
e.g., [{}, {}, ...]
@vague kite delete the last ,
which doesnt make sense but
Oh hea have to replace the () with []
no
.addFields([{}, {}, ...])
also eslint recommends you add the comma after the last element
Okay i don't know this i'm on 11.5.1(stable)
it's not a d.js, it's a node thing
@vague kite well then there's ur answer
fields isn't defined
wait
show where u define 'fields'
like the entire code
Ahh okay so it's a node thing kl
Also just tested it using Embed object and it works fine
@vague kite by the way, your C:\Users\name is in the top of the console screenshot.
It's fine
alright, I was just wondering since you censored the other ones
when i try and sort the lb array it doesn't let me sort the property in the yt property of the array
TypeError: Cannot read property 'likes' of undefined
i'm trying to make a leaderboard command
show code
All i had was this for now (I'm using enmap);
let lb = client.db.fetchEverything().array().sort((a, b) => b.yt.likes = a.yt.likes);
console.log(lb)
you might have entries in your database that do not have a yt property
hmh
you can do .array().filter(t => t.yt).sort(...)
you can also do .array().forEach(t => { if(!t.yt) { console.log(t) } })
to see which ones dont have it
lemme try that
How do you access a server?
there shoudld be a Join Support Server button on the bot page
if not then they dont have it listed
and i believe to get the bot back in this server the owner/dev of the bot would have to Fix the problem that got it kicked (Messages on join)
Thanks for the help
Np
@earnest phoenix change the b.yt.likes = a.yt.likes to b.yt.likes - a.yt.likes if you want to sort them from highest to lowest
Discord.js
I've been trying to get a JSON file for like the past 30 minutes to no avail. Would someone be so kind as to tell me how? It's for server settings, so I've tried these:
let settings = require(`./guilds/${message.guild.id}/settings.json`);
``` and
```js
let $ = require("jquery");
$.getJSON(`guilds/${message.guild.id}/settings.json`, function(json) {
settings = json;
});
```Ping with response, please!
@floral bloom you are trying to access the contents of a JSON file?
jquery has nothing to do with json, its a waste to use it
jquery is for navigating the DOM, in browsers
and html operations
your first attempt should work, provided the file path is correct
you are trying to access the contents of a JSON file?
Yes, I am.
your first attempt should work, provided the file path is correct
It is, though it's weird because I was getting an error (I'll try it again after tryingfs.readFileSync. Thanks, ToxicDev.).
well, if you're getting an error, you should post the error, else we cant know whats going on
This is the most recent error: $.getJSON() is not a function
thats because you tried to use jquery lol, remove everything related to jquery
I would go with the first method let settings = and if it errors shows us the error
As Tim said jquery is unrelated to what you are attempting to do
Hi, done when it comes to creating a salon or joining one I can't do it, here is my code but I think there is no error
@client.command()
async def p_channel(ctx):
channel = await discord.Guild.create_text_channel('test')
await ctx.message.delete()
Lol
why ?
Why do I feel like we've gone through this already
I wonder why
Probably because in order to properly work with OOP you should get the hang of the OOP concept first
maybe
No it's not "maybe"
@dull terrace
like shivaco said, its not a maybe
In french https://openclassrooms.com/fr/courses/4302126-decouvrez-la-programmation-orientee-objet-avec-python
i mean either way, point is, you need to know how oop works before you can do much


