#development
1 messages · Page 1887 of 1
<html>
<body>
Welcome <?php echo $_POST["Name"]; ?><br>
Your email address is: <?php echo $_POST["Email"]; ?>
</body>
</html>
It was this before
And nooooow?
Is your file even a PHP file?
Has name and email capital letters in your html tags as well?
<?php
var_dump($_POST);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
Welcome <?php echo $_POST["Name"]; ?><br>
Your email address is: <?php echo $_POST["Email"]; ?>
</body>
</html>
Try this
wait..
waits
<?php
error_reporting(-1);
var_dump($_POST);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
Welcome <?php echo $_POST["Name"]; ?><br>
Your email address is: <?php echo $_POST["Email"]; ?>
</body>
</html>
This

It's same
i hope you changed the method to "POST"
and your webserver is capable of parsing PHP?
Normally its a 500.X error
When you fcked up something in PHP
No it’s not a 5xx error if the method isn’t allowed
You have your Page with the form and your action file in the same dir?
Thats kinda strange. ngl.
Before debugging his code make sure he has PHP installed and configured
And the webserver even knows how to deal with PHP files
Doesn't work on live server and hosting server both
Welp.. Problem diagnosed
Let me ask you once again why do you need PHP?
Use GET as method and work with the query string after in the language you’re familiar with
I mean installing PHP on Linux servers and enabling it isn’t complicated but it is a little on Windows.
just use html
lol
i mean. on a windows server you can use the IIS. On Windows Desktops use xampp
pls. never install xampp on a public windows server -.-
Wow suggesting XAMPP and IIS
These things are going over my brain but I will figure out them in sometime 
XAMPP is an easy to install Apache distribution containing MariaDB, PHP and Perl.
node:internal/process/promises:246
triggerUncaughtException(err, true /* fromPromise */);
^
[UnhandledPromiseRejection: 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(). The promise rejected with the reason "#<Collection>".] {
code: 'ERR_UNHANDLED_REJECTION'
}
Dude for real, stop suggesting XAMPP to anybody
That’s worse than suggesting to use a JSON database
That site is in Chinese
Download Apache and install the server yourself instead of using that buggy and vulnerable trash
I dont really have any problems with it. I think that are just preferences.
i never use that stuff for prod. but for quick coding its ok.
It’s trash, had tons of vulnerabilities and a bad default setup
Download Apache for Windows then, install it as service and there you go
i stay with that until my AV Software tells me something different.. or until i managed to convert all my webapps to JS
Additionally download PHP, put the symbolic ini link into the bin path of Apache and configure your httpd.conf
Not saying that Installing everything yourself is bad.. hell no.. i setup most of my stuff myself. But i like that tool and thats it.
Suggesting XAMPP and using AV omg
Armageddon is close 
AV = Antivirus Software
Yea what else should it mean?
It’s not but it has system permissions already
Well
No need to let any other application infect my system files and permissions
I'm gonna sleep for now it's late night for me. Will annoy/ask you people tomorrow.
Have a great day/night
$Hey, $I $heard $you $are $using $PHP? $Good $luck $with $that.
$thanks
You can’t speak about a logical decision if the disadvantages are more than advantages but it’s your system not mines
You are right. Its my System ^^
And i also know a thing or two about the Windows OS... I have some exams for that.
The mix of NoScript, a network wide ad- and malware blocker and the internal defender is more than enough for an experienced user
But I would agree with @boreal iron here, that thingy looks vulnerable asf lol
But well.. Opinions.. its like arguing because someone put pineapple on a pizza
There's nothing wrong with using PHP smh
Had it still in Japanese sorry xD
I thought that was Chinese XD
Nah
Lol the discussion wasn’t about PHP but I, yes I would agree as you know
As I’m the last supporter since flow got banned
Fat Firewall that manages my Network with hourly Signature Updates, Business class AV and Ublock Origin
but enough of that. I like xampp for local testing and development and thats it
Hey 90% of my web projects are PHP 
same. i make some "small" 💵 with that
Still the superior leader in backend tech around the net
I was replying to this guy originally
i wish my school gave us some web project course work
Oh nvm then
i'd write mine in php
Have you tried Laravel @boreal iron?
but nooo we have to make a stupid game in some game engine no one uses in lua
I think you asked me before already but no I didn’t touch it yet
Most schools have old projects that they do every year
No use case for any of my projects
Yeah I joined their Discord server and it's the most backend-dev-looking Discord server I've ever seen lmao 
yeah last year for my course work I had to make some kind of dice game in python that ran for like 5 years so there were answers for it online everywhere
they dont do it anymore though
discontinued it right before me
But dealt with ReactPHP for some live RCON projects
If I would just have some more freetime
But since it’s not my job to code it won’t happen
we had to do a application for Database Management. Scope was collecting and parsing various datasets for Tourism and Overneight stays for a country. Visualising it in nice graphs and stuff like that. We choosed PHP for backend and JS for the visualisation.
Was a fun project.
lucky bastard
i wont enjoy making a game in lua
if it was at least unity then maybe
It also had a desktop app.. it was a C# File with an Chromium browser that opened the site xD
Used to create graphs with PHP for years before switching to CanvasJs
You did graphs with PHP?
As people nowadays wanna interact with charts for some TeamSpeak
Sure easy
Never heard of phplot?
Nope
It’s old but pure PHP
https://i.imgur.com/eY3GYsK.png Thats the kind of graps i used
they wont even teach us web development
Do you know how i did that graph? Its so dirty.. you cant even clean that with a powerwasher
But nowadays things need to be fancy for some reason
Better don’t tell me can’t view code on mobile anyways
It was a fix "Customer paid already and i wanna go to bed"
Looks like CanvasJS
ChartJS
Ah hmm looks similar
Looking at your screenshot reminds me of a SAMP panel like idk 15y ago
It is a SAMP Panel
I knew it
Yeah because there are still young people playing it
As long as i can sell panels like these.. i don't mind
At least 3 people again defending PHP in this weird Discord server
I fucking hate auto correct
Should open my window and throw the phone on the highway
Yup
Okay. going to bed now. I know that tomorrow a 10gbit/s Network for a customer will fail so..
Yeah
Bye
👋
how can i change the message content? like MeSsAgE to message, uppercase would be MESSAGE if i'm not wrong
Lowercase?
Correct
# This example uses topggpy's webhook system.
bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "password")```
can someone help me how can i get these two params. for my bot?
/dblwebhook stays as is and password you can get it at your bot's webhook page
It's fully up to you. If you set the first param to /dblwebhook. You'll be able to access 0.0.0.0:PORT/dblwebhook (what the SDK binds to). If you set the second param to "password" then any POST requests to /dblwebhook must have "password" present as the Authorization value
this is the pass.?
That's the API key
authorization
oh
you'll have to set it
okay thanks
what should i set here?
The IP or hostname to your endpoint and the path you specified
^^
http://your-endpoint-or-ip.com:999/dblwebhook
The public IP or hostname of your webserver
Nobody can send you a letter if he doesn’t know your address
oh
i don't have any webserver but i tried with the free host i'm using rn.(heroku)
but when i tried sending a test vote it's kinda spamming in the shell with some error
The code is creates a webhook listener which is a webserver listening to POST requests
where is your bot running right now?
heroku
I dunno Heroku but remember other people asking for it
You should have a project URL or something like that
then you need to enable a web dyno
Ah Tim’s here nvm
and your url should be YOURPROJECTNAME.herokuapp.com/dblwebhook
you need to enable a web dyno
oh wait lemme check
anyone know any good email sending tool, which...?
- is free (or very cheap, free preferably)
- can at least send emails, i dont need to read them
- has an api i can automate email verification emails
I had no idea gmail api was actually a thing and not just reverse engineering.
Use a mail library/framework in your language to send mails.
Keep in mind without a proper set up mail server, SPF, DKIM, DMARC, RDNS etc. most providers will flag your mails as spam or block them entirely.
It makes sense to setup a proper mail server or use a relay service like Amazon, Google etc.
Not sure if they’re free or not but I think you will find out
And if you wanna authenticate an email put a link into the body targeting your endpoint and send the mail to the recipient.
well gmail api has 1 bil emails/day is free (i think) so i might use gmails api
i was considering using mailgun but its not free forever nor i will spend money on the small project im making
There are tons of SMPT libs/frameworks out there to build an email and send it
To a recipient or a relay service
Huh, SMPT? SMTP?
Seems to be effective
Details? Language etc.
use the .leave method
As aqua said leave the guild
guild.leave()
wait this isnt general
You're working with slash commands
Why would **!**ping work?
Also IDs should be in strings, not number
._
Yo guys how’s this btn
So I've just installed redis-server, but I can't find 'requirepass' in my config (/etc/redis/redis.conf)
there is a configuration there
just requirepass isn't there
Wdym, add it?
i dont know if there's a specific section its meant to go under 
Are they grouped by sections
ok it appears you can just put it anywhere
nvm
was just weird it wasn't there when every guide in the world says it should be
How to make that if i use a command and i willl have to wait for seconds so i can use the same command again?
Store the user ID somewhere and remove after a set time
Id stored = can't use command yet
How?
Idk how to do that
store it in a db along with a timestamp of when it should be deleted and compare that timestamp with the current Date and if it's past that date, delete the entry
Ok
Depending on your DB, you could possibly even set it up in such a way so that the db auto deletes it for you, so you only have to check if the user ID exists
why auto delete? just insert a row with the current date and query the db to see if there was a command run by that user earlier than X seconds ago
And leave stale entries in the database?
that way you have detailed stats on how your bot is being used and can work on adding better features to things that users aren't using (or are using more than others)
yes
how do you know what you need to work on if you don't have detailed analytics on what your users are doing on your bot?
this is why people add random moderation commands to music bots lol
If your bot has a specific purpose and less need for statistics like that, then it's just a waste of space. Or if that metric is already being tracked elsewhere, then that kind of design is also useless.
I'd also add that your suggestion was inefficient as you'd have to loop over all of that tables entries to gather that metric. Depending on how large your bot is, that could take forever. I'd rather just have a table keyed by a command name and a use count BigInt you increment
nope you don't have to do that, you can index your table by userid and date to make that lookup near instant
I can assure you bots that get thousands of commands run a second all record command usage details
millions of rows is a spec of dust for relational databases
Profiling users though is useless to the developer and only serves as a means to sell to advertisers
Aggregated data can achieve the same thing
How to make cooldowns for bot?
up to you what data you want to persist but having a record of command usage outweighs the cost of space every time
userids helps you do lookups for individual usage. You can separate that data into an auto expiring cache if you want. It's clearly not only for selling to advertisers what a ridiculous claim
you can also aggregate data past a certain date into less specific data entries to save space but thats not necessary until you start having problems querying the db with indexes which imo would take hundreds of millions of rows depending on how you're storing data
Having to spend more time creating an index for that specific kind of data which you can just increment an int if all you're looking for is usage just seems like poor design to me. Why go through all that trouble if you just want to know how often each command is used if not used to profile users
Not always a bad choice to trade in architectural complexity for space in a db. Incrementing an int isn't as simple in distributed systems
you could stuff it in redis if you want, they're both valid choices just depends on your needs
Incrementing an int isn't as simple in distributed systems
Please explain
@lament rock Which ide you use to make software's?
depends on your language. If you use C# or Cpp or compiled languages in general (Ik cs isn’t compiled), you would use Visual Studio, for all else, I'd just use Visual Studio Code
i use visual studio
this is 1 of my software
Then you're fine. Visual Studio is strong
when you have multiple processes that need to sync state you need to move that data outside the process so they're not all storing their own copy of it. If you're concerned about using too much space in a db then you must be at a scale where you're operating on multiple machines. Setting up something like redis just to implement rate limits when you could query a db is a lot of work and an extra point of failure
that's definitely an investment worth making at some point but I'm saying you can achieve the same thing by just querying a table (that you should already have) and adding an extra column
Depending on how you query updates, there's no longer an issue of racing states since you can set that job to the db where the state change would not be subject to race changes. Like in sql, you can do value = value + amount
but I can understand race conditions being a issue under specific designs
Incrementing ints in a db doesn't help you know when a command was last used though
Just store message timestamp and user ID
you really don't need to be that scared of throwing a ton of data into into a db
the more granular the data you're collecting is the better insight you have into your product
Perhaps. That's where your design would be preferable if you needed that kind of information
If you're logging command calls it's a very helpful insight
You can actually see what your users enjoy the most and make more of it
Instead of guessing
for example if you're at a point where you have hundreds of shards and a very predictable command usage pattern throughout the day you could set up your cluster to scale up and down based on that timestamp-based demand
that's a little far fetched for most devs but it's an option for sure
@lament rock Which language you use to make softwares?
I like to max efficiency of everything because my budget isn't large enough to support care free design choices
space is one of the cheapest things you can purchase and a million measly rows isn't going to cost you much either
JS primarily
we can make software whith java script?
I think we pay like less than 15 bucks for storing a couple hundred million rows of analytics for topgg? Though it's hard to tell how that pricing works out for shitty digitalocean
Perhaps one of the cheapest, but I can only reiterate that my budge is very small and has been a net negative for a while
My DB is over 10 million rows and it's about a gig or two of data.
that's an understandable concern
Most of my data is occupied by images
it just doesn't grow out to be that big for the most part
well images don't go in a db so that shouldn't be a concern
of course, just not much storage space
What do you mean? Your bot generates images from command calls and stores them?
was tempted to move to an in memory relational db since my apps use less than 100MB each
user content such as custom backgrounds is stored
but you just throw that into something like s3 and store the link
Why not ask for an imgur link or something?
the pricing of image storage is kind of a pain on its own though
I pay $6/month for Wasabi which gives me 1TB of image storage
I'd have to download the image each time and cover to specific dimensions. It's easier on data to just cache a smaller res version
My vps provider only offers like 1TB of I/O which I kind of need to start doing something about because 💀 audio kills it
why do you need to download users banners though?
oh you can't just pass a url for attachments right
I see
@lament rock Do you work for any company for software development?
Nope. Independent contractor
ok
I just only store 800x500 images which isn't terribly large in data space, but volume matters
I need a cdn or my own NAS

how many gbs/tbs do u need?
Currently used up around 90% of my 500GB of storage
i have nas which is 20tb

i have my entire life in it lmao
I'd never host off my own NAS. My ISP is too unreliable
Earlier this year I went for 3 months without internet because they did work on the line and forgot to plug my fiber optic connection back in.
fr
but it still uses %3 of the storage
what country ur from?
I have a NAS for storing all my files though and I share files to clients from it rather than using a 3rd party service like Dropbox or Google Drive. Very useful when working remotely.
France
use mega
lol turkish telekom is same
Nah I like using my NAS
the internet is so fast
But I wouldn't host a site / bot off it
i host my bot and my website on aws
Yeah I got 500mb up and down when they remember to plug me back in after maintenance 
Pain
const user_id = interaction.user.id;
console.log(user_id)
const userdetail = await userinfo.findOne({
UserID: user_id,
})
if (!userdetail || userdetail.voter !== "yes") {
return await interaction.reply(
`Filter command is only available for those who have voted for me (voting is free) or for those who have purchased the premium version. You can vote for me: `
);
}
this doesn't work
I had to do that when my fiber optic was down for 3 months. Luckily my mobile provider is the same company so they sent me loads of free data. I got 500gb per month for free so I could carry on working.
But it was a pain having to upload client files to Dropbox etc
Press F to pay respect
Having your own NAS is so practical and fast
userdetail?.voter
?
i dont use any smses lol
no one uses sms
my mobile provider is vodafone
like js if(userdetail?.voter !== "yes") return
I don't use sms either... 👀 I don't understand what you mean? 
ah
const VOTER = (await userinfo.findOne({
UserID: interaction.user.id
}))?.voter || "no";
if(VOTER !== "yes")
// something
like this?
no i mean since i dont use smses i turn them to mobile data
"here's your HD logo"
Yes, that's enough
poor top
@rose warren do you make softwares?
No
web dev?
do u make planets?
Mhmm
which ide you use?
VSC
So um quick question, can I run 6 shards on a 4cpu machine? I hope there won’t be any advert effects or something? Because I keep seeing that my shard keeps crashing for some reason mmmm
Also it auto sharded to 6 since my bot is in 5k servers now
how much ram it uses?
ok
which hosting?
@spare goblet which ide you use to make the mimu bot site?
Ide rlly doesn’t matter
ok how you made it
I didnt make it
But u dont need a specific ide to make a website
ik
An ide is just a fancy text editor
ik the site is still under dev
do you wanna test my software?
Nah im good thanks for the offer tho
ok
most of the time ppl wil say no since its sketchy to randomly say "hey dude wanna check this app i made"
ik
or use vm
if I await a (promise.finally) will it return the value from .finally or just the value from the resolved promise? (since finally is just .then and .catch combined together)
const moderator = await context.guild.fetchMember(p.moderatorId).finally(mod => mod ? `${mod.name}#${mod.discriminator}` : "Unknown");
`Moderator: ${moderator}`
Can someone put this into so it says embed ```Can you set it in @client.event
async def on_message(msg):
if msg.author.guild_permissions.administrator:
return
for word in filtered_words:
if word in msg.content:
await msg.delete()
await msg.channel.send("You cannot say that!")
await client.process_commands(msg) ```
I want it to send a embed not text
I've never used python but you probably need to put the text into an embed object's description
How
idk
await ctx.send(embed = embed)```
Write it like this.
Can you put it in my code bc i dont understand it
@client.event
async def on_message(msg):
if msg.author.guild_permissions.administrator:
return
for word in filtered_words:
if word in msg.content:
await msg.delete()
embed = discord.Embed(title = "bad Word", description = "you cannot say that", colour = discord.Colour.blue())
await msg.channel.send(embed = embed)
await client.process_commands(msg) ```
what are you guys using to host your bots? Right now im using replit but it has been kinda of unreliable lately
Just rent a VPS or cloud server
I use plox.host
Should be enough for 99% or the user needs
i was thinking of a free solution
Heroku
You won’t get a server for free without major disadvantages
thx
But you only have 500 hours for free
per month right?
20 days is free
okay
Wat if i use two programming languages, does it matter?
Dude of you wanna keep something online 24/7 without quality issues you have to pay for it
question: what happens if a user who didn't run the slash command presses a component button
do i get the interaction
Ty
Yes you should
If it isn’t invalid
Anyone can use your components.
It’s up to you filter the users.
How to make a cooldowns for a command
Save a timestamp for an user, channel or guild (whatever you need) when the command is being executed and calculate the current time minus the last timestamp
Check if the difference is larger than your cooldown
\'
like this
or use "" or ``
instead of ''
like this kian\'s
the result will be kian's
guild.members.set(user.id, {
...guild.members.get(user.id),
punishments: []
});
console.log(guild.members.get(user.id));
it isn't replacing the punishments array
w
owo help me
yess
oo for that
add this
toLocaleString()
like ${bal.toLocaleString()}
orby's ur bot?
commas
its called commas
Commas : In large numbers, commas are used to help the reader. A comma is placed every third digit to the left of the decimal point and so is used in numbers with four or more digits. Continue to place a comma after every third digit.
@earnest phoenix is this what you looking for?
kommas?
, , ,
comma's trio
this works tho
const memberData = guild.members.get(user.id);
memberData.punishments = [];
console.log(memberData);
guild.members.set(user.id, memberData);
js weird
Send it in a codeblock
```
The actual thing
```
Just like how you send your code
"'" + data + "'"
Ah great mobile wrong quotes
Nvm you got what I mean
Concating strings or using templates
https://bens-files.xyz/shot_210927_104822.png anyone good at making automatic shit
this is the process i'm trying to setup
No need to set again
The member object is a reference
`import discord
import os
import requests
import json
import random
from keep_alive import keep_alive
from replit import db
client = discord.Client()
@client.event
async def on_ready():
print('bot is ready!')
@client.event
async def on_message(message):
if message.author == client.user:
return
msg = message.content
from discord.ext import commands
bot = commands.Bot(command_prefix= "Poke", intents = discord.Intents.default())
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.errors.CommandOnCooldown): #check if on cooldown
msg = 'Still on cooldown, please try again in {:.2f}'.format(error.retry_after)
await ctx.send(msg)
@bot.command()
@commands.cooldown(1, 5, commands.BucketType.user)
async def beg(ctx):
#actual code for a beg command
await ctx.send('I have a cooldown. Which means i cant be spammed!')
keep_alive()
client.run(os.getenv('TOKEN'))`
am i missing sth
when my bot starts up it emits two guildDelete's, both with nothing to display, coming through as undefined.
How can i stop this? There's nothing emitting it.
only happens in shard 2
that is possible ,you can use php or any other langauge
whatever is easiest
I need help with my leaderboard command
code: https://srcb.in/oJhSs0voN5
the command can be executed but it dont get the tag of the users
i do not trust javascript references
uh how do u guys append something to a existing dict in js
dict
js
we dont have dicts in js
just objects
yeah thats what i meant
sorry im so used to py
how do u do that tho
how do u append something to a existing obj
are you sure that's a model not a schema?
YourObject.newpropertyname = value;
obj.something = value
interesting let me try
or if something is an expression, obj[1 + 1] = value
I tried client.obj[message.author.id]={'message': message.content.replace(";command", ""), 'time': new Date()}
but didn't work
what is client.obj
is it declared as an object earlier
client.obj={}
Its a schema :)
I put everything in that folder lol
try running console.log(client.obj) after you set the value
lemme try
If you're looking for doing something like that, probably best to use a map or collection, rather than adding a property for each member to your client.
a collection
whats that
and
how do i use it
a map is an object on steroids
djs collections are maps but better
Objects are more intended for things you know all the properties beforehand.
Like user.id
Maps are good for things like key value stuff(what you are doing in an object)
bad:
const obj = {};
obj[message.author.id] = { money: 100 };
console.log(obj[message.author.id]); // { money: 100 }
good:
const collection = new Collection();
collection.set(message.author.id, { money: 100 });
console.log(collection.get(message.author.id)); // { money: 100 }
Isn't it like less than a mb per million keys?
collection.first(); // { money: 1000 }
obj[Object.keys(obj)][0] // { money: 1000 }
djs uses collections because they need all those extra methods and the ordering that maps provide
am i really arguing with the js lord timotej
since objects are unordered
you need those extra methods for a leaderboard
i mean, if you need to use map.find or map.filter then it makes no difference
but if you can get away with map.first then you have an advantage yes
highly depends on the keys
Ah good to know
client.afk=new Discord.Collection()
client.afk.set(message.author.id, {'message': message.content.replace(";afk", ""), 'time': new Date()})
message.reply(client.afk);
Output: DiscordAPIError: Cannot send an empty message
question: how do i draw an image with a shape
you cant send an object as a message
Ms paint
oh
Like making it a circle?
yes
you can use arc for circles
take a user avatar (an Image object), clip a circular path and draw it to the canvas
my question is how
clip the image object or clip the canvas after drawimage?
clip the canvas before drawing the image
close the path after drawing or before?
before
I don't understand what im doing wrong ```js
client.afk=new Discord.Collection()
if(message.content.startsWith(";afk")){
client.afk.set(message.author.id, {'message': message.content.replace(";afk", "")})
message.reply(client.afk[message.author.id]);
}
you cant send objects
I'm not able to send the values of keys either
also you cant use a[b] on collections
it says
because the value is an object
cannot send empty message
const user = args.user || context.user;
const card = createCanvas(1024, 512);
const ctx = card.getContext("2d");
const avatar = await loadImage(user.avatarUrlFormat("png"));
ctx.beginPath();
ctx.arc(70, 70, 100, 0, 2 * Math.PI);
ctx.clip();
ctx.closePath();
ctx.drawImage(avatar, 70, 70, 50, 50);
time to tryitandsee
how do i get the values and send them
ok
client.afk.get(message.author.id).message
this works, thanks
one more thing, how do i convert the new Date() obj to a timestamp
hey tim,
is the x and y args of ctx.arc the center point of the circle or the top left part
thats it?
Date.later()?
xD
im confused
Date.now(); new Date().getTime(); new Date().valueOf(); Number(new Date());
center
alright alright tysm
+new Date()
(require("pretty-ms"))(timestamp)
ew
Math.round(timestamp / 1000)
works fine now
tysm
i also wanted to ask
how do i get the whole message content after the <prefix>commandname
Slice that part out from the content
how will i get the start and end of the slicing part
U should sort your input, like ```js
const prefix = "!";
client.on("messageCreate", message => {
if (!message.content.startsWith(prefix)) return; // stop if it doesn't start with prefix
const args = message.content.slice(prefix.length).split(/\s+/); // get rid of the prefix and split the content by space
const command = args.shift(); // get the first word, which is the command. this also gets rid of it from the original array, `args`
if (command === "commandname") {
args; // the part after `!commandname`, an array of words that you can join back by using `args.join(" ")`
}
});```It's more organized that way and u don't need to use some hacky way to slice out the prefix and command name
U don't need to check for this
It'll always be false
Since it didn't pass the first if block
For this u should check if pre isn't undefined first
Yes
if (pre) user = pre.user
But since you want it to choose the author by default, you can also do user = pre?.user ?? message.author
It will check if pre exists. If it does, it'll pick pre.user, otherwise it'll default to message.author
check if user exists first
How did you define user?
So user can be undefined here
Because pre can be undefined
So user won't be set
U need to handle that
If pre doesn't exist, set user to message.author
Yes that works
U don't need to check !pre
If it hits else then pre definitely doesn't exist
That's how if else works
Even though you gave it an ID?
That's username
Instead of .get() u need to use .find()
Yeah
Do u want to support IDs too?
If not then u can just change it
U don't need to change that, only pre\
Something like let pre = message.guild.members.cache.get(args[0]) || message.guild.members.cache.find(member => member.user.username === args[0])
U can shorten that too const pre = message.guild.members.cache.find(member => member.id === args[0] || member.user.username === args[0])
Noice
Wanna see how u can shorten the whole code to one line?
Ah
const user = message.mentions.users.first() ?? message.client.users.cache.find(user => user.id === args[0] || user.username === args[0]) ?? message.author;
@quartz kindle how do i stop the clip
nothing is being drawn outside of the user avatar
ctx.restore()
ty
ok
um hey just wanted to ask wouldn't this work?```js
message.content.slice(0, ${PREFIX}afk.length)
That looks like a python code...
thats not...
there u go
its js now
it was js before but since u couldnt understand
i had to remove the start= and end=
Yes that works, but it's unorganized and you'd have to do it over and over
oh
i see
Command handlers!
wait so what if we use <Message>.replace('<prefix>commandname', '')
Also works
yay
what are you trying to do?
remove the command name or remove everything else?
Please don't
message content
#development message will make your life easier
remove the command and prefix from the message
if you know the length of the command name, then .slice(length here)
if you dont, then .split(" ").slice(1).join(" ") i guess
It just seems like a waste if they had to do that with every command
@atomic skiff
wait how do I like load commands from other files
I don't know how to ask for help here.
I made a new Ticket Bot for my friend, and my code had errors. I fixed them all, and the bot is on now. When you do -close , the bot is supposed to CLOSE the ticket, and send a transcript. The transcript is sending, like it is supposed to, but it is not closing. The bot is sending in chat "An error occurred, please try again!". Can someone help me fix this?
The Code.
what discord.js version
I cant activate slash commands also if I code them, how can I reset the bot permissions and add also slash commands?
your bots invite link needs to have the applications.commands scope
and you have to invite it again if it was invited without it
I have to kick it or only click the link and re-invite it?
The automatic on replit.
I don't know how to change.
Just reinvite
No need to kick
check your package.json
you can just authorize without bot scope
I took my own math test
ctx.fillText(user.name, 300 / 2 + (1024 - 300) / 2 + width / 2, padding * 3, 1024 - 300 - padding);

pls help, i can't center text
We trying to fix my issue
try:
x = width - (text.length * fontSize)
y = height / 2
the problem is i want to center text in a box located at X 300
ctx.textAlign means the text will be drawn from the center character (unlike css text-align which centers text based on container width)
does anyone know how i can create a sort of "spinning wheel"
css or gif?
inside of discord? I was thinking about constantly editing the sent message with new items, while saving the previous content too.
Okay well instead of the width and height of the canvas use the width and height of the box
@earnest phoenix
api abuse
🙏 use a gif pls
But i would love to get it randomized basically
so not the same video is playing over and over again
in my opinion this beats the purpose
constantly editing a message is api abuse
Yeah
dank memer uses animated emojis
You’ll hit ratelimits pretty quick
what if it's only 5 edits?
Still not a good idea
ah nvm that would still hit the limit pretty quick
what if more than one person uses in the same channel at the same time?
that's 10 edits in 1 second
yeah i see
also edits don't display instantly
Hmm i can try.
yeah, but it defeats the ui purpose of it being fun.
The same static gif over and over again wouldn't be fun to see
broken bot from rate limits < repetition
How do you upgrade npm on replit?
also who's stopping you from generating a new gif?
why do you need to upgrade npm itself
do you want to upgrade discordjs?
nevermind
from permissions?
is there a way to send an image as small attachhment?
That it becomes the size of a normal emoji
no, in the place u generate an invite
there u normally select "bot" scope, just select also "application.interactions" from now onwards
if u re-authorize it'll apply the remaining scopes
Resize it
@cinder patio
const { width } = ctx.measureText(user.name);
console.log("x:", 300 - (width * 48));
x:
-8580
the text renders off screen
did i replace the wrong parameters?
Text with that font size will never fit a box that's 300 px unless the text is very short or the text font makes the text smaller
I dont remember why I need to calculate permissions, I've created my bot like 10 months ago
:/
That makes no sense
48px text
i said it's x position is 300...
wtf is that *48 for?
font size
it's width is 1024 - 300 - 20
why are you multiplying width with font size?
Then use that instead of 300
ok
Text length * font size
that makes no sense

it measures how much pixels the text will take up
measureText measures the actual pixel width of the text
Font size is the size of the Y axis of the font. Why would you do that for justifying on the X axis?
tim is a js god moment incoming
||Tbh a quick search on stackoverflow like Tim is doing right now would have been enough||

||tbh #development is stackoverflow but you're not allowed to be stupid||
||That's debatable||
first find the white box's center point:
box start + (box width / 2)
then do box center point - (text width / 2)
X = (300 + ((1024 - 300 - 20) / 2)) - (width / 2)
no need to worry about the y axis cuz it's constant
yes
youre more allowed to be stupid here than in SO
yarn i --global npm # i dont trust facebook open source
well the centering didn't work
im gonna give you up leave it at left align
how did it show up?
@quartz kindle
Did you try my solution 🥺
how do i loop through this to search for a keywrod?
for (const key in de){
if(de[key].A.toLowerCase() == maka){
z = de[key].B
}```i would now want to check if it isn't and then throw an error. But yeah doesn't work.
Us de the array? Also jesus these variable / property names
for(const [id, val] of array)
{
if(val.A.toLowerCase() === whatever) …
}
it's just const val of array
Aye … physical pain
It has keys?! Or is this just how his console output looks?
How do i upgrade my Version on npm?
on Replit
the Console code...
@solemn latch lol
BWHAHAHA
Who is dumb enough to believe that?
lol
keep reporting them to the registrar, they have been getting faster about deleting them.
hopefully this ones only a day or two.
CloudNS said if multiple people report they would ban the account and the IP associated to it
cloudns?
their nameserver provider
must have already happened, or this is a different person
using netbreeze
tbh, didnt know nameservers took reports about domains
i livechatted and they said they are actively investigating and would close the account sooner if more people reported it
its priority if they can confirm many people are facing the same issue
even then, they will just move name servers as there are hundreds for free online, and keep the domain
I think going for the registrar is better
yup, but it knocks their site offline for a few hours which may prevent several hundred accounts being hijacked
ah true
tried that, they provided a fake and inactive abuse email
registrars for .com domains cant do that
if they do, then report it to icann
they are mostly .ru tho and i contacted the .ru registry and they are investigating it now
icann will remove their registrar perms
ah, lately we have been getting a ton of .coms tbh
and they are looking into blocking domain registrations with the word "discord" in them as its also copyright issues with discord
discord-give.com was one
yeah that ones gone now
yeah, nic.ru removed it within 48 hours of being reported the last few times
or at least after i reported it.
they got back with me about it within 8 hours. and said they took action against it.
I think dns keeps it up for awhile even after being taken down 😔
Scam will never stop as long as people will fail to detect the scam
thats why i also go for their nameserver companies
they pretty much always go for either cloudns or 1cloud.ru
one of the domains i checked yesterday gave the persons name
because they forgot to get whois privacy
@solemn latch
oh
Potentially not real though
you can't register a domain and have it live without verifying info for the whois
unless you get privacy
My bot is unmuting, but not removing the role so people are still muted.
Can someone help me?
if (guild.me.voice.channel && !guild.me.voice.channel.equals(member.voice.channel)) {
return interaction.followUp({ embeds: [new MessageEmbed()
.setColor(ee.embed_color)
.setDescription(`:x: You must be in the same voice channel as me to use this command!`)
], ephemeral: true });
}
Code example, please
@boreal iron It is right here HAHA
The followUp message can't be ephemeral as only the bot would be able to see it.
As the bot's basically "replies" to it's previous message.
The initial message you send to the user can be ephemeral.
You can also defer the interaction and use editReply()
This method allows to send the message as ephemeral message.
Can someone help me with this please.
any example for this
if (guild.me.voice.channel && !guild.me.voice.channel.equals(member.voice.channel)) {
return interaction.followUp({ embeds: [new MessageEmbed()
.setColor(ee.embed_color)
.setDescription(`:x: You must be in the same voice channel as me to use this command!`)
], ephemeral: true });
}
if you can
Why do you send a followUp message in the first place? Does the interaction took more than 3s?
If so just defer the reply.
await interaction.deferReply();
// code
return interaction.editReply({ embeds: [embed], ephemeral: true });
arrayOfItems.forEach(item => {
if(db.fetch(item.setOnCmd)) {
var itemdb = `${db.fetch(item.setOnCmd)}`
var ifhaveornot = `(\`x${(itemdb).toLocaleString()}\`)`;
if(ifhaveornot === true) {ifhaveornot = `(\`x1\`)`}
else {ifhaveornot = `(\`x${(itemdb).toLocaleString()}\`)`}
stringInventory += `${item.itemName}: ${ifhaveornot}`;
} else {
var ifhaveornot2 = `(\`x0\`)`;
stringInventory += `${item.itemName}: ${ifhaveornot2}`;
}
})
the result:
how can i make that if its true it will simply show 1
how do i get a servers ip using a domain with flask?
I'm adding a domain name checker on my api to make sure domains aren't using the known scamming ips
You force the output to be a string with the template strings ${(itemdb).toLocaleString()}.
Can someone help me?
so i need to change it to:
var ifhaveornot = "";
???
Chill :c
Does the database store true and false or an actual number?
my god... follow the chat, please
var ifhaveornot = `(\`x${(itemdb).toLocaleString()}\`)`;
if(ifhaveornot === true) {}
``` this will never be true
Told him already, but the response is ... yeah
Can someone help me.
well, idk whats causing it not to remove the roles
but
your try caches are mostly useless
you're not gonna catch anything like that
try {
mutee.roles.remove(muterole.id).then(() => {
mutee.send(`**Hello, You Have Been Unmuted In ${message.guild.name} for ${reason || "No Reason"}**`).catch(() => null)
let roleadds = rolefetched
if (!roleadds) return;
mutee.roles.add(roleadds)
})
} catch {
let roleadds2 = rolefetched
if (!roleadds2) return;
mutee.roles.add(roleadds2)
}
``` this try catch will never catch anything
What do i do then?
try catch only works with sync code or awaited promises
it does not catch non-awaited promises
what if a promise fails inside of a then function
it wont be caught either
understandable have a great day
lmao
will it just throw a unhandled rejection or
ye
guys does anyone knows how to set invite command like $invite and the bot sends the invite link?
literally just make it respond with the link?
like?
should i make new file
in repl
message.channel.send("link here")
full command
i am a new bot dev
i dont know much
literally the same as any other command you made
let role = message.guild.roles.cache.find(role => role.name === "Muted");
member.roles.remove(role.id).catch(err => {
return message.channel.send("Something went wrong! " + err)
});
return message.channel.send("User Sucsesfully Unmuted!")
by the way that'll log both user successfully unmuted and something went wrong if something goes wrong
what if the role is not named "Muted"? also, if it fails, that will send 2 messages,
It is muted
Then change it to muted
i don't remember so some help would be good, how was it to do this thing? like if the if matches with one of the array contents, it'll show but if no then no (if you didn't understand me then see)
let cardss = ["Archers","Barbarians","Goblins","Minions","Knight","Arrows","Spear Goblins", "Bomber","Skeleton Dragons","Fire Spirit","Skeletons","Elite Barbarians","Rascals","Firecracker","Zap","Mortar","Tesla","Royal Delivery","Giant Snowball","Cannon","Bats","Ice Spirit","Skeleton Barrel","Electro Spirit","Minion Horde","Goblin Gang", "Musketeer","Three Musketeer","Giant","Wizard","Battle Ram","Valkyrie","Mega Minion", "Mini P.E.K.K.A","P.E.K.K.A", "Electro Giant","Golem", "Royal Recruits", "Lava Hound", "Mega Knight", "Royal Giant"]
· I have a array here
else if(args[0].toLocaleLowerCase() === )
· and i want it to match with the args[0] if it doesn't match then it'll not respond, it's the following thing?'
else if(args[0].toLocaleLowerCase() === cardss)
give me full format so i can copy paste and edit a bit
no
Where do i add this?
Try this
i have no idea what your existing code looks like, if i give you something to copy and paste, 99% chance it wont work
cardss.includes(args[0].toLowerCase())
ok
I fixed it
actually no, your cards are not lower case
so you have to transform both
cardss.find(card => card.toLowerCase() === args[0].toLowerCase())
else if(cardss.includes(args[0].toLocaleLowerCase()))
```?
LocalLowercase
doesnt matter
message.mentions.users.first().id
card?
how do I do that for each mentioned user
doesnt matter
i want this avatar to be round using canvas. How would I apply the arc() function to it?
const avatar = await loadImage(interaction.user.displayAvatarURL({ format: 'png' }))
ctx.drawImage(avatar, 65, 60, 120, 120)
:)
why doesn't this work?
const guild = await client.guilds.fetch(GuildID);
guild.name = `${guildname}`;
why do you want to replace a guild name?
let guild = client.guilds.cache.get(id).name
and then I do guild = "name"?
change guild name command
what are you trying to do?
a command that changes name of the guild
you cant change the name of a guild like that
how come?
because that would just change the name of the guild object in the cache
.setIcon works though




