#development
1 messages · Page 1382 of 1
~~aren't you always drunk ~~
maybe
Erwin: "I'm poor"
Also Erwin: says "I'm drunk" almost every time he's in chat
EY the booze is given to my by my neighbors and friends
bold of you to assume i have money to buy booze
barely got any for food
Well I'm not sure how I didn't think of that

I thought you kept spamming money at beer cans

the day i have money to buy booze everyday my coding productivity will skyrocket
ya'll shall address me as bill gates 2
That's little too rich
bye
@opal plank btw, you could just make it this no?```ts
let channel:Discord.TextChannel = await client.channels.fetch(args[5]).catch(x => null), linkContent:Discord.Message;
if(channel) linkContent = await channel.messages.fetch(args[6]).catch(x => null);
console.log(linkContent)
xD
i know, i gave it a perfect 5/7
lol why is there :
dev challenge, make my code better
because typescript
js be like
that's strange
typescript screeches at you for doing that shit
Its better javascript
js be like: nah, i'll run it
lol
Should be using scratch

js forces you to be pessimist
you have to think of all possible ways your code could fail
and prevent them all
ts makes you an optimist, you dont check anything because ts will check for you
tim backing me up 
Yes, pessimism best way to view life
Oh btw thank you for that code Erwin I finally figured it out after so long 
no problemo
js forces you to use jest or some other of testing tool to get the bugs coming so you can patch them.
ts checkes MOST(ts isnt perfect, a lot of stuff will fly by) of the stuff before it even compiles, so you'll spend much less time actually debugging code
Luckily, errors are fun. Doing things properly isnt
that affects your user experience
masochist
its much better to do stuff from the get go rather than have users flood your ticket systems or bug trackers with bugs
And thats why I'm struggling to get past 50 guilds with my bot

If I put a quarter of my time i spend in this server on my bot my bot would be amazing.
if i were drunk 50% more of my day my productivity would triple
lets hope shiv doesnt see that, he'd bonk me
Lol I have a bot that has like 250 guilds but i m pretty sure 50% of them are fake lol
for(let a of guilds.cache) if(guild.memberCount < 5) guild.leave() 
oh
im pretty sure half of my guilds dont even know what the bot does or why they have it
^
mine is the other way around, im strict about which guilds have my bot
Activity is mostly dead
im pretty sure half of my guilds dont even know what the bot does or why they have it
@quartz kindle lmao
imagine having a auto leave system based on activity 
Why would you wanna limit your bot's guild though is it because it's not verified?
oh
Would result in me having 0 guilds erwin
cuz im not interested in fake growth, why would i care about how many guilds my bot is in if half of them are dead servers or bot hells?
Inb4 my bot leaves my support server
True but wouldn't it help grow ?
when im creating a table of contents for the long description, the links dont direct to the headers properly on top.gg but do on any other markdown viewer
im one of the few people who follow what discord said. its not about that badge, its also not about the numbers
my main advertising is on twitch
i couldnt care less if discord gets bigger or not

¯_(ツ)_/¯
tis about the journey and quality of the bot.
quality > quantity
they add target="_blank" to all your markdown urls
manually rewrite them as html instead of md
damn ok
@stark abyss why did you ping me
Sorry where?
Idk I just got a noti with your name
Are you sure?
It might not of been you
I don't have a memory of pinging you
this doesn't work?
@client.command()
async def age(ctx, idnumber):
idnumber= int(idnumber)
person = client.get_user(idnumber)
await ctx.send(person.created_at)
It says:
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'created_at'
?
person is None
pretty sure that gets the user from the cache
kk
Howcome whenever I try to run my bot on the VPS I bought it gives me
AttributeError: module 'discord.ext.commands' has no attribute 'Cog'
And yes, I do have the latest version of discord.py, or atleast that's what it tells me when I try to upgrade it
Nevermind, apparently it had an old ass version of python pre-installed and I didn't bother to check it
any js developers want to help with a bot, paid.
im interested
Take this elsewhere
so i know there is api abuse for changing ur bots status too often and i have a restart command which changes the status to restarting, pls wait and then on ready, it always changes to thinking about connect-4 and then on fully completed init it goes to playing connect-4. in all this takes about 3 seconds, but sometimes when connection is slow or computer is bogged down can take a lot longer. and ofc, only i can do this command and my question is: is this considered api abuse?
I wouldn't consider it API abuse since you are only changing the status 3 times, all of which happen in a relatively short time and not just a continuous 'spammy & abusive' manner.
pog
before you ask
kid from support
const embed = new Discord.MessageEmbed()
.setTitle(`This is a title`)
message.channel.send(embed)
let channel:Discord.TextChannel = await client.channels.fetch(args[5]).catch(x => null), linkContent:Discord.Message; if(channel) linkContent = await channel.messages.fetch(args[6]).catch(x => null); console.log(linkContent)
let channel:Discord.TextChannel = await client.channels.fetch(args[5]).catch(x => null), linkContent:Discord.Message;
if(channel) linkContent = await channel.messages.fetch(args[6]).catch(x => null);
console.log(linkContent)
?
how to trigger??
through a command...
Can someone link me a good tutorial on making discord dashboards in discord.py?
Suggest you learn it then before trying to make a discord bot
Suggest you learn it then before trying to make a discord bot
@blissful coral idk when i can learn :(
bye
@steel canyon imagine if something like google existed
Just me or did images that are attached to embeds disapear/stop working? I know that my code works because it was working before and the messages that sent before had their images disapear and getting the embed to send again it doesn't show the image and there are no errors.
edit: just as I though its discords side
was just about to ask this, ive had images attached to embeds stop working as well
yea thats happening to every bot and on every server
thats fun, good to know im not doing something wrong on my end
yeah dapi is fuck rn
where do u add the intents u need for djs?
ah
screeches
don't you dare send an invite link here
@pale vessel what intent does user roles being cache go under?
@clever mortar No
yea thats fine
i need the guild ids
cuz im using it for the patreon premium shit
Oi @blissful coral
Just bc u have nitro and u have boosted this server. And... Ur a bot developer dodent mean u can be a rude little fucking shithead.
Thanks
what
how to solve the automatic response when we type the bot prefix, for example, my bot prefix is 'm!' when I send the prefix, my bot responds
slice the message and check if second half is empty?
yeah
How does nitro have anything to do with me talking in a channel not wanting to deal with someone’s bs
Your adding fuel to the fire
Suggest you drop it

like if (!message.content.slice(prefix.length).trim()) send()
assuming there will be " " is kinda non-flexible
from what i'm seeing, cmd could be "", which is falsey. you can try doing if (!cmd) return doSomething(); after declaring cmd
umm ok wait
Alright so I am about to ask something which I know will make you laugh at me
If a user puts 1:20 I want my bot to convert it into seconds
Which will be 80 seconds
In a vps, if I run it, it doesn’t appear lol
If a user puts 1:20 I want my bot to convert it into seconds
Which will be 80 seconds
Is it possible ?
I mean yea it is
But idk how
how the frick do u get everyone with a certain role in a guild
you can have flask, but nginx allows you to flexibly add stuff to it, like isolating your flask from the real world (and running it locally, proxying requests through nginx) and/or putting https over it
@delicate shore you can split it by : and count the values yourself or use a parser
yea?
@delicate shore you can split it by : and count the values yourself or use a parser
@pale vessel Can you elaborate a bit 😉
@pale vessel all right, the problem has been solved. Thankyou
assuming you already did checks (make sure it's a number, etc.), you can probably use something like string.split(":").reduce((acc, element, index) => acc + (index == 0 ? element * 60 : element))
only works for x:xx durations though
you can, if args is a string
yes it is
you can replace string with args then
kk
Thanks
Can u use isInteger()
to check if args is a number
Oh but
It will fail
you can use args.split(":").some(x => isNaN(x)) where it checks whether one of the element is not a number or not
yeah
you need to make sure that args.split(":").length is 2 otherwise the function won't work properly
Any here have any useful bot code??
That they are ok with sharing??
In the coding language pydroid.3
If so pls dm me xxd
- pydroid isn't a language

- no spoonfeeding ig
it's probably an array then
can you show your code?
your args need to be your message content but with your prefix cut out
what is args?
you need to define args
const args = message.content.toLocaleLowerCase().slice(config.prefix.length).trim().split(/ +/g);
const command = args.shift();```
This is how i define it
huh
well you did use message.content but you split so it becomes an array
you have to join it back using array.join(" ") before splitting it again
and for this, you should change it to just if (args.split(":").some(x => isNaN(x))) return ...
This is how I define my args
const args = message.content.slice(matchedPrefix.length).trim().split(/ +/);
!== "true" will never work since true is not a string
toLocaleLowerCase() isnt this supposte to be toLowerCase()
it will work if you use != since it's not strict but i recommend you to just use if (!something) or if (something) instead of using !== true or === false
I still get the error args.split not a function ;-;
This is how I define my args
const args = message.content.slice(matchedPrefix.length).trim().split(/ +/);
I think our is pretty similar
yeah, I dont shift my args to lowercase tho since somethings are cap sensitive for me
Oh
join an array so that it becomes a string again and split it by :
I need to learn javascript
And that too A LOT
OMG OMG OMG OMGO OMGO @pale vessel I LOVE YOU
y r u gae
for(let a of client.guilds.cache){
console.log(a)
if(client.guild.cache.memberCount < 5) guild.leave()
} ```TypeError: Cannot read property 'cache' of undefined
y r u gae
No homo
I got my music bot hosted
Hello
I am trying to make this code where if a user does the !say <@role>, it would return;
const client = new Discord.Client({
allowedMentions: { parse: [] }
});```
Does this work?
or what am I supposed to do.
I want it where if someone does the say command and mentions the role, it would not work.
or instead, how can I add an if statement in the command to not allow roles mention
?
You can filter out mentions
How?
I did this ```js
const embedErrorTwo = new Discord.MessageEmbed()
.setDescription("❌ You're not allowed to ping everyone or here.")
.setColor(colors.cyan)
if(message.content.includes("@everyone") || message.content.includes("@here")) return message.reply(embedErrorTwo)
That wouldn't be how that would work I don't think
It does work
oh
It works absolutely fine.
Well
Look for anything that includes <@& at the beginning
<@&304313580025544704>
That is the mod role mention for this server
nice example callum
What is the &
it indicates a role
Oh
^^
yep
so js if(message.content.startswith("<@&") return;?
no
or am I dumb
<@ user
<# channel
<@& role
or is it includes.
It's .includes
Yes
Np
how can i ban a user with reason ?
like, to ban someone we use user.ban() but what should we use to ban someone with reason
ping me if you know how
guys guys how can i send my bot codes to my phone to start the bot
You can use GitHub

I need help, where do I store my prefix and token data?
and what code should I use?
discord.js v12 btw
Database
@Callum#7067 hmm I only have an index.js folder
I'm new to js
@golden condor
My commands How do I do it v12?
anyone know the "ping" function in js?
@lethal grail client.ws.ping?
client.ws.uptime @royal herald
@earnest phoenix what?
what is a command uptime :D?
if(muterole.highest.position > message.guild.me.roles.highest.position) return message.channel.send("NO")
``` Is this a correct way to check if the Muted role is higher than the bot, it would return?
he deleted it @earnest phoenix
Ok
@feral aspen what is muterole. can you send muterole pls?
const muterole = message.guild.roles.cache.find(role => role.name === "Muted")
I want the bot to check that if the muterole is higher than the bot, it would return;
hm yeah its true
wait a minute brb
Yea, anyone?
Yes?
use
try{
and catch for Muted role is higher than the bot
Bro.
I did this ```js
if(muterole.highest.position > message.guild.me.roles.highest.position) return message.channel.send("NO")
like this:
try {
//code bla bla stuff
}catch(e){
message.channel.send("i cant cuz the role is higher then me")
console.log(e)
}
@feral aspen try my code then try ur code
I am trying to do it the easier way
oh
And no need for try thing, cause it would add either way but in reality it won't add.
I am trying to make an if statement for this
if(muterole.highest.position > message.guild.me.roles.highest.position) return message.channel.send("NO")
``` This doesnt work cause it keeps erroring me out `Cannot read property 'position' of undefined`
maybe you can use
if(message.guild.me.roles.highest.comparePositionTo(muterole) < 0)
Bulamadım v12 yükseltmeyi
It doesnt work
.member.roles.highest @feral aspen
👍
hm
Idk im noob and use botghost
client.on('message', async (message) => {
if (message.author.bot) return;
if (message.content.startsWith( 'n!' + 'oylama')) {
if (!message.member.hasPermission('ADMINISTRATOR')) return message.channel.send('Oylama açmak için yetkin yetmiyor.');
let pollChannel = message.mentions.channels.first();
let pollDescription = args.slice(1).join(' ');
let EmbedPoll = new Discord.MessageEmbed()
repVoteEmbed.setTitle(':exclamation: Nova Bot | Oylama')
repVoteEmbed.setDescription(pollDescription);
repVoteEmbed.setColor('RANDOM')
pollChannel.send(EmbedPoll);
}
})```
(node:9728) UnhandledPromiseRejectionWarning: ReferenceError: args is not defined
at Client.<anonymous>
at Client.emit (events.js:327:22)
at MessageCreateAction.handle Bot\node_modules\discord.js\src\client\actions\MessageCreate.js
14)
at Object.module.exports [as MESSAGE_CREATE] Bot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacketBot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
at WebSocketShard.onPacket (Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js
22)
at WebSocketShard.onMessage Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
at WebSocket.onMessage (
at WebSocket.emit (events.js:315:20)
at Receiver.receiverOnMessage
Bot\node_modules\ws\lib\websocket.js:825:20)
(Use node --trace-warnings ... to show where the warning was created)
(node:9728) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:9728) [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.
that's the error
what should i do
What is the rate limit for changing the name of the voice channel by the current bot?
const args = message.content.slice(prefix.length).split(' ');
hey guys so
i got a server on gcp with min ram 3.75GB and 10GB space. but when multipel people are using the bot it lags
can we load load balance ??i dont think so becasue both the vms will have same bot token
im thinking about upgrading the memory, but what if 7GB is alos not enough and it still lags for players?
const config = require('./config.json');
const client = new Discord.Client();
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});
client.on('message', msg => {
if (message.content === `${prefix}ping`) {
message.channel.send(`Pong! ${client.ws.ping} ms.`);
}
if (message.content === `${prefix}serverinfo`) {
message.channel.send(`This server's name is: ${message.guild.name}`);
}
});
client.login(`token`);```
none of the commands are responding
//Use msg instead of message because it is defined as msg here
client.on('message', msg => {
if (msg.content === `${prefix}ping`) {
msg.channel.send(`Pong! ${client.ws.ping} ms.`);
}
if (msg.content === `${prefix}serverinfo`) {
msg.channel.send(`This server's name is: ${msg.guild.name}`);
}
});
are you getting the logged in console log?
nothing in the console log
are you not getting logs from the client.on("ready")?
i am trying to make avatar command but the command is working only for self i mean:
n!avatar @blalblalal
but that is not working just n!avatar.
} else {
const embed = new MessageEmbed()
let User = message.mentions.users.first()
Embed.setImage(message.author.displayAvatarURL({dynamic : true}))
Embed.setColor("RANDOM")
Embed.setAuthor('Avatarınız burada.')
Embed.setFooter(message.member.displayName + 'tarafından istendi.')
Embed.setTimestamp();
return message.channel.send(Embed)
}
}```
what should i do?
You're only check if a user is mentioned nothing else.
You have no fall back if the mention is invalid.
put an or statement there?
any good server config suggestions?
when hosting to heroku, do I have to put the node modules folder in the github?
sweet, thanks.
np
How would you get a users' server join date and account created date, and format that into MM/DD/YY? I use discord.js. Please ping me with responses
https://discord.js.org/#/docs/main/stable/class/Guild?scrollTo=joinedAt Joined date of guild
and cant find the creation one
can i get the names of software/app for making making ?
read #502193464054644737
found it
https://discord.js.org/#/docs/main/stable/class/User?scrollTo=createdAt >> User creation
https://discord.js.org/#/docs/main/stable/class/Guild?scrollTo=joinedAt >> Guild join date
@wheat valve
both return a Date
which you should be able to work with
thank you so much
multiple people told you to read #502193464054644737 already.
Thank you!
client.con.query(SELECT * FROM levels, (err, result) => {
if (err) console.log(err);
console.log(result);
});
how can I loop through result
@sand dune guild.cache as far as i know
nvm xd
i don't code in js, but that's how i remember it
@sand dune @rustic nova guild extends message when its in a guild, it does not have cache since its not part of the manager.
tldr, guild exists if the message came from a guild(dm and other text channels may not have guild member)
ohh alright
yeah again, i don't code with discordjs and just mostly refer to the documentation
does anyone know how the damage in a battle system is calculated?
but thanks for clarifying
this photo's resulation is 640x640
How can i get this part in this code
ctx.drawImage(image, 0, 0, ctx.canvas.width, ctx.canvas.height);
let imageData = ctx.getImageData(ctx.canvas.width, ctx.canvas.height , ctx.canvas.width, ctx.canvas.height).data;```
Anyone know how to make a dashboard for the bot?
Like change prefix
and send a message trough it
with php, css and html (maybe js)
and oauth2.0 from discord if you wish your users to be able to login through it
Yeah using PHP to send cURL requests without libs etc. is the easiest way for this case.
Discord API is easy to use
do you guys know something about my problem
Just a few lines of code including the form checks
Yeah using PHP to send cURL requests without libs etc. is the easiest way for this case.
i got that far too, but kinda gave up when i read the oauth2.0. Working with refreshing tokens isn't really for me and i should get into that later on
Yeah there are a lot of examples how to use PHP to send cURL requests to the Discord API
Any tutorials on how to make a dashboard?
You will need to have a bit of pre-experience in working with html and css. So i suggest getting into that first before starting to make a dashboard
This will get harsh without any knowledge of HTML and CSS and some JS (for cosmetics)
is there any database for discord.js better than quick.db ?
Idk

Literally every single database out there
Like FIREBASE
But, what specific issue do you have with quick.db ?
might help direct you to the right one

I can html and css
@rough knot If so just use a simple admin (dashboard) template to start with
I can html and css
and js
@rough knot
Then you should know what to do in terms of making the dashboard website. In order to be able to have a per user dashboard, use oauth2 as i mentioned before https://discord.com/developers/docs/topics/oauth2
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
Simple admin
There are js libraries that make oauth2 easy though
https://discordapp.com/channels/264445053596991498/272764566411149314/776777720448679936 guys somebody help pls 😦
🤔 thats a good idea
ok btw wither supports quick.db ?
@quick ridge
what's wither? lol
this photo's resulation is 640x640
How can i get this part in this codectx.drawImage(image, 0, 0, ctx.canvas.width, ctx.canvas.height); let imageData = ctx.getImageData(ctx.canvas.width, ctx.canvas.height , ctx.canvas.width, ctx.canvas.height).data;```
@quick ridge maybe make a variable that sends that pic to the code?
@umbral zealot https://witherhosting.com/
THAT PRICE
@quick ridge
@rustic nova yep sorry
HOLY
my friend gift me a wither discord bot hosting :))
this photo's resulation is 640x640
How can i get this part in this code
ctx.drawImage(image, 0, 0, ctx.canvas.width, ctx.canvas.height); let imageData = ctx.getImageData(ctx.canvas.width, ctx.canvas.height , ctx.canvas.width, ctx.canvas.height).data;```
@quick ridge maybe make a variable that sends that pic to the code?
@umbral zealot btw how can i make leaderboard command in quick.db
I mean that looks like one of those ephemeral temporary hostings that'll probably disappear in a few months. Has all the hallmarks fo it
lol I don't support quick.db 😛
@quick ridge maybe make a variable that sends that pic to the code?
@rough knot i dont think so
Hey I'm the author of enmap which has a complete points & leaderboard example https://enmap.evie.dev/complete-examples/points why the heck would I support my competition? 😛
I just want to get that part of the photo, there is already a canvas module to count the pixels
@umbral zealot enmap is developed by you ?
Yep 😄
noice
xD
But this development
oh, maybe edit the pic?
@rough knot yes I want this too but i dont know how can i do
in quick.db just use js <db>.all().filter(data => data.ID.startsWith(the first part or the variable name as it appears in quick.db).sort((a,b)=>b.data-a.data)
its good for me 😄
Wouldn't it be board in da house
i dont need this pic
the red here
in code
ctx.drawImage(image, 0, 0, ctx.canvas.width, ctx.canvas.height);
let imageData = ctx.getImageData(ctx.canvas.width, ctx.canvas.height , ctx.canvas.width, ctx.canvas.height).data;
So ima remove it?
hi i have this code
@bot.command(brief = "Provides you with free coins on a daily basis")
@commands.cooldown(1, 86400, commands.BucketType.user)
try:
bal = db.get(User.id == str(cmd.author.id))['bal']
increment = random.randint(500, 1250)
new_bal = int(bal) + int(increment)
db.update({'bal': new_bal}, User.id == str(cmd.author.id))
await cmd.send(f"You have received {increment} coins.. and you now have {new_bal} coins in total!")
except:
await cmd.send('You are on cooldown.')
and when the cooldown occurs for a user, i get this error on the console
raise CommandOnCooldown(bucket, retry_after) discord.ext.commands.errors.CommandOnCooldown: You are on cooldown. Try again in 86396.79s
does anyone know how i can display this in the channel
No I just want to take the hatched area
?
hi i have this code
@bot.command(brief = "Provides you with free coins on a daily basis") @commands.cooldown(1, 86400, commands.BucketType.user) try: bal = db.get(User.id == str(cmd.author.id))['bal'] increment = random.randint(500, 1250) new_bal = int(bal) + int(increment) db.update({'bal': new_bal}, User.id == str(cmd.author.id)) await cmd.send(f"You have received {increment} coins.. and you now have {new_bal} coins in total!") except: await cmd.send('You are on cooldown.')and when the cooldown occurs for a user, i get this error on the console
raise CommandOnCooldown(bucket, retry_after) discord.ext.commands.errors.CommandOnCooldown: You are on cooldown. Try again in 86396.79sdoes anyone know how i can display this in the channel
@vale garden try cmd.channel.send
true
Replace it with ur client variable name
replace what with that
like const bot = new
no i mean what do i replace with the client var
,
wat
?
,?
Wdym
no i mean what do i replace with the client var
@vale garden
const Discord = require('discord.js');
const client = new Discord.Client();
const {prefix, token} = require('./config.json');
const { MessageEmbed } = require('discord.js');
//Bot aktif etme kısmı, durumu ve konsola mesajı
client.on('ready', () => {
client.user.setActivity('Kodlanıyor... | prefix: n!', { type: 'PLAYING' })
console.log('Bot aktif edilmiştir. Hizmete hazır!');
console.log(prefix);
console.log(token);
});
client.login(token);````
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module
thats the error what should i do
@vale garden you need to handle that error in an error handler
https://discordpy.readthedocs.io/en/latest/ext/commands/commands.html#ext-commands-error-handler
and catch CommandOnCooldown error
help please
U havent maked a token or a prefix variable
@rough knot how
help me
@strong escarp hm
oops not here
@green kestrel Is %0.2f a valid format specifier for a float value that needs to be truncated/rounded to 2 decimal places? (C++)
One of your commands does not have an exports.help object.
Any more problem? cause its got
one of them definitely does not.
Make sure all the files in your ./commands folder are actually commands that are fully formed in their structure, and make sure also that all your files are saved
ok
wait a sec is it because i split the help command to other like commands and guide?
no idea, I'm just reading off this specific error, because that's all you provided.
@green kestrel Is
%0.2fa valid format specifier for a float value that needs to be truncated/rounded to 2 decimal places? (C++)
@slender thistle yes
but if youre using that style of of format specifier, you are no doubt using sprintf(), which is really unsafe
consider instead using fmt::format, a library that is type safe, secure, stable and uses python style format specifiers
in that its {0:.2f} i think
Frankly, I don't care about safe-unsafe here. And I gave up on formatting the string entirely
But thanks for the info
(Trying to explain C++ to someone who doesn't have knowledge in programming is hard)
oh dear
why teach a newbie C++, WHY shiv WHY
do you like to punish yourself? lol
shiv going to cry assembly tears
mov al, [tears]
lul
my cs course started with cpp this year when nobody except me and another mate had any prior programming experience
it's interesting to say the least
yeah they often do that in programming courses, it seems like its a thing to make people quit
when most of the people on the course dont even know what a variable is
cant wait for shiv to have a taste of haskell
behold true pain
DOM and haskell are things im never touching again in my life
period
people using haskell for serious development:
people NOT using haskell for serious development: absolutely bloody EVERYBODY
haskell has to be some of the worst nightmares one could hope to find
@green kestrel ever tried monads?
this
but not quite
so i got this problem
i wanna divide the set slowmode into hours, minutes and seconds
let's suppose that our slowmode is always bigger than 3600 seconds
why teach a newbie C++, WHY shiv WHY
@green kestrel Not my choice. I blame his uni
hours is Math.floor(slowmode / 60)
I'm his go-to guy for anything related to programming lmfao
how to do minutes?
There's tons of code online for this, stackoverflow probably would be the top result for "javascript how to print ms in hours minute and seconds" , or you can use a library like ms or datefns
total minutes would be / 3600
or / 60 / 60
if you want only remainder minutes, you can use mod 60
a function or system that handles and processes commands
Yes, where commands are separated one per file.
its not important, its just a way to process commands that makes it easier to maintain
It makes development easier in the long term since your commands are more self-contained.
Thx
Modern C++ is quite easy
but yeah I'm not getting ANYWHERE NEAR haskell anytime soon
hi
What do you mean by "how to write upvotes"
Like Normally it just says 460
Just the word or the whole element
but in groovy it says 460 UPVOTES
yeah they definitely tweaked the CSS 😂
@green kestrel ever tried monads?
@opal plank nah I quite like having two thanks
On the numbers element
@boreal iron
I'm not good at CSS can u explain a bit more
Because I can't find number 's element through I inspect element
Sure ... being at PC in a few minutes
this
holding the tears in for my java
how to verify bot?
ohh ok thanks
@delicate shore
#points::after { content: 'VOTES'; }
Btw what's id for vote and invite button
.titleandvote .votebutton
(class)
Im a question pls, how to get a value from json, example i need get dpk.depencies. etc .. i need get discord.js version, or is a string in json package
How to get ?
how to dl mango bot for timer??
Wow that's weird English...
@earnest phoenix JSON.parse() and JSON.stringify() is what you need
didn't really understand what you need exactly but yeah
i think its a bot that sets timer for pokemon?
You think?
You are asking us how to get something and you're not even sure what it is? lol
You might have us confused with google, darling.

ayt ayt
object["discord.js"]
@delicate shore
@boreal iron
Hey thanks a lot :)
Btw
How can I make the logo rotate
need a little help I need to make an array sort of like this:
"USERID": {
"time": 77777,
},
"USERID: {
"time": 77777,
}
idk how to create an array like this, I only really know to how do it across scripts and simple arrays. thx in advance
hi
Yes
@delicate shore its fine based on the theme you are going for
@timber frost Well to be exact, what u wrote is not an array
lol its an object
[
{
"USERID": { "time": 77777 }
},
{
"USERID": { "time": 77777 }
}
]
that would be one
hmm, I just dont know how to create it
@timber frost Creating arrays like this is simple. Just use array.push(mixed val)
Just push your object into the array
array.push(object);
That's it already
wow, really that simple, this is my first time trying this. But I didn't expect it to be this easy
well thx
anyways back to 2am coding
@delicate shore Well even is CSS3 allows animations, it's not really supported on any browser today or mobile device, but you can of course spin it
shhh the police is not around
Alright
wait fake that's illegal
imma to lazy to add the { } around... just copied his text
just imagine they are THERE 
since when do browsers not support css animations?
that information is straight up incorrect
lol
the only browser that would potentially not support CSS3 animations would be IE11
just imagine they are
THERE
and what do you mean by this
#development message is invalid
which i don't even allow IE11 users to visit my site like get a real browser 
god damn... imma to lazy to add the { } around... just copied his text
shhh god bless IE

the one and only true browser lmao
@delicate shore
#bot-img div
{
animation-name: spinning;
animation-duration: 5000ms;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
@keyframes spinning
{
from
{
transform:rotate(0deg);
}
to
{
transform:rotate(360deg);
}
}
Or... just use the img element if your pic is transparent
#bot-img img to spin the image only
[...] is invalid
updated it just for your, since sarcasm is unknown to you
Thanks fake
since when do browsers not support css animations?
@quartz kindle Just wanna prevent him of doing stuff like this

lmfao
Lmaoo
remember google's barrel roll?

Still a thing
just google "do a barrel roll"
it is still a thing
I mean ... looks totally legit not confusing in any way
ouch
i love these pages
but reddit killed them with their new design
they only work in old reddit
imagine having an epileptic seizure looking on such a shit lmao
if you play league, check /r/shurima in old reddit
huh... that proves I'm too old
@quartz kindle gib help pliz
not on reddit and actually don't really know what it is tbh
nu
plez
why this no wurk?
i thought VALUES was the proper way to add prepared statements
@boreal iron boomer?
to make sure there are no escaped characters
@boreal iron boomer?
@quartz kindle GOD DAMN... don't even know what that means, got called like this a lot of times already
Lol
Baby boomers are the demographic cohort following the Silent Generation and preceding Generation X. The generation is generally defined as people born from 1946 to 1964, during the post–World War II baby boom
then you're likely still a millenial, like me
nope not born in the 21th century
Millennials, also known as Generation Y (or simply Gen Y), are the demographic cohort following Generation X and preceding Generation Z. Researchers and popular media use the early 1980s as starting birth years and the mid-1990s to early 2000s as ending birth years, with 1981 to 1996 a widely accepted defining range for the generation.
I swear! Stop pasting wikipedia results
lmao
ok boomer
ok millenial
all these new words... oof
If i made a table, lol=['hi', 'ok'] can I insert things into it
God bless NoScript
Lol
you can push elements into the array using array.push(mixed value) @dense nest
should work lol
but you dont need VALUES() if you're only using a single value
just do channel_id = $1
also, do the same for guild_id
const welcomeChannel = member.guild.channels.cache.find(channel => channel.name === 'welcome-bye')
const embed = new Discord.MessageEmbed()
.setTitle('"WRTN" - Warning System Online')
.setDescription(`Внимание! ${member} поднимается на крышу клана __"We Rule The Night"__ \n \n Двери на крышу открываются...`)
.setColor('#7150FF')
.setImage('https://thumbs.gfycat.com/AltruisticInfantileBovine-size_restricted.gif')
welcomeChannel.send(embed)
})```
why does this not work?
channel.name really is welcome-bye not like Welcome-Bye ?
ye
unless it's a vc
ye
well idk but okay, if so can't help u, dunno djs
yes
if the problem was the channel, you would get a "cant get property send of undefined" error
only if the djs has no other channel called welcome-bye in the cache
its the guild cache, so its unlikely
ah alright, well as I said not really familiar with djs
how would i connect a bot with like 2 servers?
and prevent overlap?
also how many gigs per shard?
of ram
no
i mean im intrested
but not really
i wanna know how many shards per gig of ram doe
you're using dpy?
@quartz kindle yep
i am pulling the latitude and longittude coordinates of a place.
however, it returns these: Egg 0Marcus Garvey, Malcolm X, Family and Friends Mural 040.685989 0-73.938893
look at the coordinates. They have 0's in front?
why don't u use google maps' api?
as i am pulling pokemon go raids
ah
"gym_name":"Saint Ignatius Church",
"cell_id":"9926596584236122112",
"ex_raid_eligible":"0",
"sponsor":"0",
"lat":"40.666762",
"lng":"-73.95341",
"raid_spawn":"1603484824",
"raid_start":"1603488424",
"raid_end":"1603491124",
"pokemon_id":"0",
"level":"5",
"cp":"-1",
"team":"3",
"move1":"-1",
"move2":"-1",
"is_exclusive":"0",
"form":"0",
"gender":"0"
}```
the info the site shows
sure
let me show a bit of the code?
what's the issue?
the coordinates are showing random 0's in front
040.685989 0-73.938893
like this
@drifting wedge it depends on what dpy caches, what intents you use, what your bot does, if it has music or not, and many other things. it could easily be anywhere from 100mb to 1gb ram per shard
@quartz kindle is like 150 servers per shard fine?
bot is small
400 servers ish
and i got the ram
that code is really confuse
we got ram
if you use dpy's autoShardedClient, it should create a new shard every 1000 guilds
if you use dpy's autoShardedClient, it should create a new shard every 1000 guilds
@quartz kindle o ok
but i can set shard count too
might just set it to 1-2 rn\
you wont gain any benefit from it, but sure, not losing anything either
anyone that could help me if there is any time left ?
I'm trying to understand it
@eternal osprey can you show an example of the data you receive that includes these 0s?
i can console.log the results. Hold on
the example you showed doesnt have 0s
Egg 0Marcus Garvey, Malcolm X, Family and Friends Mural 040.685989 0-73.938893
look at the coordinates at the end
0
which site where you can buy vps's uses netplans
it should be: Egg 0Marcus Garvey, Malcolm X, Family and Friends Mural 40.685989 -73.938893
because my digitalocean droplet doesn't
netplans?
netplan/01-netcfg.yaml
type of network configuration
never hear of, but in VPSs you normally configure such stuff as you would do in a normal pc
i want to add a lavalink ip-rotator
but i can't restart my interfaces file
it doesn't apply
i rebooted my vps
but still didn't apply
Hey, does someone know why I get the OperationalError: no such column: True error when I deploy this bot on Heroku? My code:
pvcCategory = await guild.create_category(name='Private voice channel', overwrites=overwrites)
pvcTextChannel = await guild.create_text_channel(name=f'channel management', category=pvcCategory)
e = discord.Embed(color=self.bot.color)
e.timestamp = datetime.utcnow()
e.set_author(name="Commands for the private voice channel:")
e.add_field(name="`!pvc invite`", value="Invite a member to your voice channel.", inline=False)
e.add_field(name="`!pvc kick`", value="Kicks a member out of your voice channel.", inline=False)
e.add_field(name="`!pvc open`", value="Opens your voice channel for everyone.", inline=False)
e.add_field(name="`!pvc close`", value="Closes the voice channel for everyone.", inline=False)
e.add_field(name="`!pvc name`", value="Changes the name of your private voice channel.", inline=False)
e.set_footer(text=self.bot.user.name, icon_url=self.bot.user.avatar_url)
await pvcTextChannel.send(embed=e)
pvcVoiceChannel = await guild.create_voice_channel(name=f"Create your channel!", category=pvcCategory)
# f"[0/{MAX_PERMIT_CHANNEL}]", category=pvcCategory)
cur.execute(f"INSERT INTO `{ctx.guild.id}`(setup, category, textchannel, voicechannel) VALUES({True}, ?, ?, ?)",
(pvcCategory.id, pvcTextChannel.id, pvcVoiceChannel.id))
conn.commit()
cur.close()
e.description = "**The private voice channels were successfully created.**"
await ctx.send(embed=e)
@eternal osprey is that from console.log(name, + "\n" + raid.gym_name, + "\n" + raid.lat, + "\n" + raid.lng);?
@whole knot
Is it wrong how I did it? 😅
why {True} and not true?
yes @quartz kindle
i can also just create a new variable and just delete the first character of each string
but i am just curious of why it happened?
also, are you sure it's a boolean column?
i can use substring(1) right?
You mean
VALUES(true, ?, ?, ?)",
```?
yes
Let me try that
This still gives me this error, that is weird 😅
Maybe I am missing something
Hi
Does anyone know how I can make my bot send a message to the main channel of a server when it joins? I mean, the thank you message for inviting the bot
i'd suggest using the system channel for that
bro nvm
@eternal osprey can you console.log(raid)?
@halcyon linden https://discord.js.org/#/docs/main/stable/class/Guild?scrollTo=systemChannel
and message.channel.send ofc
just wondeing
why is my setinterval still not working?
it just times the bot out for 10 seconds
and then send all the messages in queue like a fucking train
anonymous interval inside command
No xD, is not message.channel.send
use the textchannel you get from systemChannel and send a message into that channel
so i am basically intervalling nothing?
not exactly
Will try this
It was guildCreate, they already told me
you see, every single time someone uses "!raids" it'll add another interval to the queue
Thanks a lot!
yeah
and since it's anon, you'll never ever be able to cancel it
Make them look like a discord embed
hmm okay
@lyric mountain Somehow this fixed it, I guess. Thanks a lot! ❤️
also, setInterval is not millis-precise
yeah ofc.
but right now if i use !raids
the bot does nothing for 10s (my interval time)
and then sends alll the messages at once
@whole knot the issue is that "true" and "false" doesn't exist in most databases as valid values (except for comparison)
i want each message to be sent every 10s
I will keep that in mind, thanks 😄
I was just wondering because deploying it local worked
and then sends alll the messages at once
@eternal osprey it'll not work like that actually
if I use the command 3 times, it'll create 3 repeaters
owh fuck
yeah
I suggest using cron for such stuff
Hola
servers = yourGuldConfigArray //just for example
...
onStart(() => { //idk how the things are named
setInterval(() => {
servers.forEach(sv => {
if (sv.notify)
(/*get the server by the id*/).sendMessage("stuff");
})
}, 60000)
})
Anyone need help
something close to that
idk how things are named, so take that with a grain of salt
//idk how the things are named
Same
basically you'll create a single repeater, then you'll get guilds which are configured to receive notifications
for each guild with notif = true you'll send the message
it's simpler then, just use the guild's ID instead of the array
you just need to, instead of creating one repeater for each command, create a single/universal repeater which will call raid info for guilds with notif = true
np
about the cron stuff I've mentioned before, it works based on current time
like, regardless of when you start the code, it'll run based on clock
if I set it to run every 10 mins, it'll run at 14:10, 14:20, 14:30, etc
even if the bot is started at 14:09
This command:
@commands.command(name="subreddit", alias="sr")
async def subreddit(self, ctx, subreddit):
"""EVEN EVEN EVEN EVEN random crap now fight me irl"""
if reddit.subreddit == subreddit.over18:
await ctx.send('The subreddit is 18+. I can\'t send anything from there...')
else:
submission = reddit.subreddit(f"{subreddit}").random()
embed = discord.Embed(title=f"{submission.title}")
embed.set_image(url=submission.url)
await ctx.send(embed=embed)```
Won't send anything, what is wrong with it? Is it the `subreddit.over18`?
wouldn't reddit.subreddit return stuff like IdiotsInCars or NeverTellMeTheOdds?
if I understood correctly, you're comparing a string to a boolean




