#development
1 messages · Page 1725 of 1
ok
@lyric mountain its working now thanks for your help 🙂
but i get now this error in the console if the member get kicked
(node:3316) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions```
bot dont have permission to send message or something else
the bot sending no messages if the member get kicked or its younger as 30 days
don't u have the line which that happened?
then you're trying to kick someone with higher or same role
production bot
i check if the guild have the protection on?
const status = new db.table(`protect_guild_${member.guild.id}`);
if (status.fetch(`status_${member.guild.id}`) === 'on' ) {```
so if it not on he return
and how to make a permission check?
check the docs
in one code?
client.on("presenceUpdate", (oldMember, newMember) => {
if(oldMember.presence.status !== newMember.presence.status){
const channel = member.guild.channels.cache.find(ch => ch.id === '836250294480142366')
channel.send(`${newMember.user.username} is now ${newMember.presence.status}`);
}
});```
error
```js
if(oldMember.presence.status !== newMember.presence.status){
^
TypeError: Cannot read property 'status' of undefined```
I let him join a server where the bot is in and that protection in that server is off and no error.
only in the server where it is on. I get the permission error
i was thinking about how to run 2 bot tokens at once
const tokens = [ "...", "..." ];
for (const token of tokens) {
const client = new Discord.Client();
// Set up the bot...
client.login(token)
}
This is one of the ways to do it, i guess.. don't really do this tho
I’m thinking of different ways I could implement a voice channel XP system but only when a user is actually speaking in the VC. (discord.js)
Is this method plausible?
On a setInterval, every second, it checks if the speaking voice state is true, if so, it will +1 to a count value for the user. Once count reaches 10, it will award the user with XP and will then be reset to 0
Or any other ideas?
You can save the time when the user joined and when they left and then do some math
using a setInterval would be pretty slow, especially if you do it for every user in a vc
The math isn't complex though
Hi! I just made my first discord bot and added it for approval to top.gg, is there anything I should know about here?
as long as your bot works you'll be fine
const time_joined = Date.now();
// Let's say the code under executes when the user leaves, they leave after 2 minutes
const time_left = Date.now()
const time_stayed = (time_left - time_joined) / 1000; // So it's in seconds
const xpGained = time_stayed / 10; // the user gained 12 XP
Store the time_joined in a Map with the user id as the key, and then get it when the user leaves a VC
@cinder patio I want it to only count if the user is actually speaking though
is this the right code to dm someone when they change their avatar
yes
it doesnt work though
any errors?
aah... then you'd want to do the same thing, except instead join/leave vc you use the state change
@cinder patio hence why I wanted to use the speaking voice state bool every second
Can someone help me. I want to get a user by ID, but sth weird happened:
If I want to warn a person for the first time with his ID, it says user = undefined.
If I warn a user by tagging him it works and after i did it, I can warn him with the User ID:
let user = msg.mentions.users.first() ||msg.guild.members.cache.get(args[0])
and instead of immediately adding XP you would just add the time_stayed to an accumulator, and when the user leaves the channel, then you do accumulator / 10
No
It's still doable ^
Thanks for the feedback ❤️
do you know how to dm someone when they change their avatar
it works when they change their nickname
but not their avatar
Show the full code
whats your code
delete that, you are exposing your token
try changing avatarURL to just user.avatar
on both let lines
oldMember.user.avatar
newMember.user.avatar
oh my god, thank you
let user = msg.mentions.users.first() ||msg.guild.members.cache.get(args[0])
if (!user) return msg.channel.send("``❌ You havent mention anyone``")
my whole code is too long to send it in here
thats not showing for when the bot warns the user, put it into a pastebin
College.work() = false
yea
ey
gg
full code
@shadow compass
Hi
check the replied message
is that better
yes, try that
😐
why do you need the whole code?
also please add .catch(console.error) where it can fail
not required, but might help with future errors and stops your bot from crashing
no one can help you if you do not show the code you are using when the bot warns someone
where do i put that
at the top
or something
con.query(`INSERT into modlogs (moderator, type, user, reason, date, userid, serverid) VALUES ('${msg.author.tag}', 'warn', '${user}', '${reason}', NOW(), '${user.id}', '${msg.guild.id}') `)
msg.channel.send(" ``User: " + user.username + " was successfully warned for: " + reason + "``")
no, it should go on the end of your newMember.send line
after the line, but connect it with the .
u know what i mean
there is an error
copy and paste your code in here
```js
Here
```
try user.user.username
???
ok
I have the same kinda code
let target = message.mentions.members.first() || message.guild.members.cache.get(args[0])```
and `target.user.username` works fine
And put it in discord, then put your code in the middle of it
also change avatar back to avatarURL()
wait
before changing them, send me the code
i dont understand what you are saying
presenceUpdate take oldPresence and newPresence parameter. Presence take user/member parameter so the line newMember.presence.status missing the user/member parameter. Use get to get the id instead of find
the whole thing/
```js
Your code goes here
```
No, just the important parts
It will change it to this.
if(yeet === true) return true;
a code block
or more like
if(College.work() === false) return console.log("No grades for me!")
if(doingCollegeWork === false) doTheFuckingWork```
pretty much
u good?
No
what u got?
nothing works
show me the code
just take a screenshot...
can't be bothered explaining code blocks again
why haven't you done
if(oldMember.user.avatarURL() !== newMember.user.avatarURL())
lol
anyways
uh
anything in console?
wait
have you tried oldAvatar < newAvatar as thats what most of the events use to check if somethings changed
I don't understand lmao, I don't see any issues with your code
guys, can somebody help me? I want to make my bot open-source, how can I do it?
github
just make the source code viewable by everyone
I want to upload it to github, but how to do it exactly? Also with the token...
¯_(ツ)_/¯
for one, learn how to use git (not github)
I've never made any of my projects open-source lmao
which one do I need to select in .gitignore?
as I said, learn git not github
you're doing it the other way around
you don't create a repo on github, you push a repo to github
well, but can you help me how to do it?
no, google can
I have git installed
do you know how to use it?
I tried it once but not sure
better if i do a google search for it
yes
what do you mean
try what stargirl said, try replacing !== with <
now there is an error
what is it
show me ur code
I can use git init in the folder which already contains my bot right?
@shadow compass the first image isn't necessary
well now you have it
but to sum it up:
git initon your project rootgit add .git commit -m "some message"- create a new repository on github, don't add anything
git remote add origin https://github.com/username/repositorygit push -u origin master
it has its perks
such as?
is there anything wrong with the code
what code is on line 47? @shadow compass
change newMember.send to
newMember.send('Looks like your avatar has changed! Looking fresh.').catch(console.error);
and try switching !== to <
how do I hide the bot token?
free full jetbrains toolkit license, being forced to think about code security, open collab, hassle-free automation, etc etc
but mostly the first 2
also plenty of services have special stuff for OS projects
mine too, but I chose the OS path
ngl, I'd take it again if I could choose again
mine too
That doesnt work
anything in console?
what language?
let oldAvatar = oldMember.user.avatarURL();
let newAvatar = newMember.user.avatarURL();
console.log("1");
if(oldAvatar !== newAvatar) {
console.log("2");
newMember.send('Looks like your avatar has changed! Looking fresh.').catch(console.error);
}
Try this @shadow compass
then let me know the output in console
I need to wait to change avatar
js
not if I asked
ok
look up dot env
@shadow compass anything in console?
No
did you use the code above?
then there will be numbers in the console
but this is what you sent
i typed that
With
inside my code
thats what you sent
no you didn't send that
Remove from, let oldAvatar to the }}'s
remove it all, and paste this one in
#development message
im pasting that in
let oldAvatar = oldMember.user.avatarURL();
let newAvatar = newMember.user.avatarURL();
console.log("1");
if(oldAvatar !== newAvatar) {
console.log("2");
newMember.send('Looks like your avatar has changed! Looking fresh.').catch(console.error);
}
okay
thats what im pasting in
Let me know when you've restarted your bot
now this is an error
show all code
add these below the code: })
then restart your bot
and lmk when you've done that
you have 1 avatar change remaining
there is a 1 in console
Okay, change < back to !== and let me know when you're done and restarted your bot
its already !==
change it to <
inb4 wont work
restarted?
yes
and your next avatar change is the last for today
you wont, you'll just not be able to change it anymore
no lol, theres only a cooldown
its actually proven to be around 10-15 minutes if you get the "changed your avatar too quickly" error
9780077477394-69861658
boi
oh no
can anyone open it chegg assignment
Bruh
did you just atMods?
-atmods
Please do not mention (ping) more than one or two moderators for help, unless there is an emergency.
Here are some examples of emergencies:
- Raids / Multiple members mass spamming.
- Severe disruption of Discord's ToS (NSFW content, etc)
- Anything that requires more than 2 moderators to handle.
Oh sorry
The invite was https://discord.gg/dbl
Because they have no role
@gilded plank auto-deletes all invites by people with no roles
@shadow compass I found what might help https://stackoverflow.com/questions/63218115/discord-js-how-do-you-log-username-discriminator-avatar-changes
whoever did atmods here, 
youre below him
how can I upload if i did everything else? the pull or an other command?
so does it works if i just type in git pull?
I did i apologise aurel
i did it good?
how can I update the files?
because "security jim" found my token on the internet
what would be the code to change my status im using discord.js
if you're wanting to change your own status using the bot, you cannot do that.
That is incorrect. you can absolutely change the status as a bot.
you can't have custom status, but you can definitely have other statuses
I mean... yeah ok sure, but I'd assume Toxicity is asking about the bot's own status, lol
Just that he said change my status
I often say "my" referring to the bot, tbh.
people often dont have english as a first language here too. sometimes "my" just means generic "my stuff"
one of the things you kinda just get used to.
sorry didnt mean for it to come off like that 😓
Neither did I 😄
aye all good lmaoo
how do i use custom domain with apache webserver on windows 10?
does anybody know any good lavalink tutorials for py
Create an inbound rule in your firewall for the Apache app and configure your domain as virtual host.
uh....
any in detail i'm kinda inexperienced in it
Wait, you have a windows vps or you're trying to host a website on your own pc?
wel.. i'm kinda trying to work with webhooks
but since those can't take 127.0.0.1:5000
i need to host it on my PC
i mean anything remote cannot take 127.0.0.1
yeah
127.0.0.1 means "myself"
yep!!
look up port forwarding, I dunno what domains have to do with anything, you don't need a domain
and there isn't any place like 127.0.0.1
hehe
probably shouldnt share your ip
try forwarding it
👀
lmao i changed a digit
then quite simple to find it 👀
plenty of tools to find available ports on a range of ip's
why would I? lol, im trying to help you.
....that's not how that works
oke oke nvm lemme read docs
Helo! I have a question, how do you make a word incorporate a link? For example:
[text here](link here)
Thank you very much!
Instead of using a webserver you can use PHP for example to listen to incoming webhooks as well as other software (after creating firewall rules).
443 is SSL
i need help for bot stalker

what
well it's solved now, using 4430
best practice is to use ports over 1000
the server is running
ah oke
idk im just trynna stalk somone
don't
yes
actually no
staking people is illegal in the US, which makes it against discord tos.
Please dont stalk people. thanks.
ugh ok
can't believe you have to tell people that
umm.. so i'm stuck again
i need to run flask app on my PC with domain
it should show example.xyz instead of 127.0.0.1:5000
youve bought a domain right?
yeah i've one
ok, have you setup the dns settings for the domain?
yep i've got cpannel
👀 cpannel doesnt have anything for configuring a domain dns afaik.
👀 who did you register your domain with
add an a host, pointing to your public ip
u mean the router IP
alr added
https://www.whatsmydns.net/
will tell you when the dns has propagated(can take some time) its best to wait until its fully propagated.
oke so its added
it's propagated...
and youve port forwarded?
i doubt i can do port forwarding.......
then you cant host on your machine.
i mean i'm using my phone's data
dont think you can realistically host off phone internet

youd probably have to do some research yourself into it. there might be a way, but its so specific no one here will know how to.
hey @solemn latch i've router but no internet on it
so can i do something like using phone's internet and doing port forwarding on my router
again, this is very unique as a setup for a webhook/webserver, I know nothing about it, and doubt anyone here will be able to help much.
youll want to do you own research.
yeah, i'm grateful to ya for the help till here
Can u use CSS and HTML on the same page?
kk ty
mobile operators are controlling NAT, you wont be able to forward ports since you don’t control the gateway
3G, 4G etc. isn’t made for that anyways
Shouldn't have missed my networking classes
A server is the best way in your case to go on
I searched and found this
https://portmap.io
Likely still need an actual internet connection, not mobile.
Yeah it’s not more than a VPN tunnel of your mobile connection to a server redirecting the incoming connections back to you
Which means the service can see and sniff you whole traffic

To do what you wanna do you need NAT control or a dedicated/virtual server with access to configure your network
Even without a server hosting at home isn’t an issue as long as you can configure your router.
Non-static IP addresses can be handled using DDNS services for example.
Anything else, tunnels, VPNs, mobile connections etc. are just a mess.
i am having le issues
if (msg.content === 'bot.runner') {
msg.reply('Making Bot...');
await require('./bot.js')
}
await is only in async function
wait
how do i make it so if i say bot.runner it will require bot.js instead of running bot.js when node index is started
case 'tutorial':
const questions = [
'test 1',
'test 2',
'test 3',
'test 4',
'test 5',
'test 6',
'test 7',
]
let counter = 0
const filter = m => m.author.id === message.author.id
const collector = new Discord.MessageCollector(message.channel, filter, {
max: questions.length,
time: 1000 * 15
})
message.channel.send(questions[counter++])
collector.on('collect', m => {
if (counter < questions.length) {
m.channel.send(questions[counter++])
}
})
collector.on('end', collected => {
let counter = 0
collected.forEach((value) => {
console.log('worked')
})
})
break;
i have made this, how can i make that if like for the first question, if they dont send a specific message that i want it will ask again
just post a pastebin
instead of sharing your code
which floods the channel
tanks
don't increment the counter until you've got your message
a simple logical issue
if there aren't any collected messages at the end, simply re-run the block of code
yeah but like, for the first question, i want that they will send, like, "okay" and for the second one "sure"
and if it wont be that it will reask the question
hmmmmmmmmmmmm
array of objects that contains both the question and the expected answer
or map the question to the answer
whatever you prefer more
if (msg.content === '1st thing') {
msg.reply('okay')
} else if (msg.content === '2st thing') {
msg.reply('sure')
}
this is kinda my way
so
if you ask a question it will say okay
then if you ask another question it would say sure
oooooh
it will reask it
yes but then how do i make it to check if its the right one
🙄
if (msg.content === '1st thing') {
msg.reply('okay')
then if (msg.content === '2st thing') {
msg.reply('sure')
}
}
idk if this works
i just guessed
i know its something like that
i just forgot
const whatever = [
{ q: "whatever?", a: "whatever." }
];
const questionObject = whatever[0];
//access your question with the q property and your answer with the a property
wdym
still dont get how to make sure that its the right one and if its not it will reask
hello?
@vivid fulcrum i did that: https://sourceb.in/gsOqIxWnsr
anyway to make it where capitalization dosnt matter in triggers
then how do i do that
I also have a problem, when I give the play command in ia bots the command and after it connects for 2s and disconnects
https://cdn.discordapp.com/attachments/455431567318319145/837054610493014036/Screenshot_1.png
and this is an error
https://cdn.discordapp.com/attachments/455431567318319145/837054647163158548/Screenshot_2.png
from what it can be
@toxic jolt update your library, thats likely staging channels problem
wrong channel maybe
yes im
updated
nah, it was right channel
which library u using?
Rate limit has been coming for days
I Couldn't fix this problem
exactly what i said
what
heyyyy erwinn
update your code AND restart the bot
long time no seen
hello
can you help me out real quick?
@toxic jolt yeah , you told me u had it updated, but have you restarted it?
the version that your bot is RUNNING somehow isnt supporting staging channels
5 weeks have passed
try restarting now again
and make sure to update it to the lastest version(should already be)
with?
I rebooted a thousand times
a code
I rebooted windows too
it definitively hasnt updated it seems. Are you hosting it on a vps?
go ahead
no
windows server 2012 R2
local computer?
VDS
oh i see
here

so, i've tried to make a tutorial command, and i want that if someone do the command, it will ask a question, and like, i want the user to answer like "okay", and if the user wont say okay, it will reask the question
let me get the branching version rq
can you copy and paste this at the very top of your code?
const pack = require('./package.json');
console.log(pack.dependencies['discord-js'])
@toxic jolt
very very very top
before your client even is created
@tardy hornet whats the error?
also PLEASE use a linter
seeing disorganized code like that is painful
good evening I should put the anonymous bot that when a person writes the message is deleted and automatically written in a chat anonymously, I want to know how to do it
user: writes "n-word b-word n-word" and supremacist/nazist terms
bot: writes message anonymously and send in the channel
everyone else: reports bot
you and your bot: gets banned from Discord because you cant prove it wasn't u or your bot who sent
see the issue with "anonymously sent" messages?
idk how to do what i said
that
also client mods like message loggers. you'd need to dm the bot to even make it anonymous
so what you want is a bit complicated
i would personally just loop with a timeout
yep
let questions = [];
function Ask(q) {
return new Promise(res, rej => {
//collector stuff
if(!collected || collected?.first()?.content.trim().toLowerCase() !== 'okay') rej(false); else res(true)
});
}
for(let q of questions) try {
await Ask(q);
} catch(e) {
//retry?
}
theres likely a 100000% better way of doing this btw
collectors have a time option, so the timeout is unecessary
and what if i want that the answer for the 2nd question will be something else?
@opal plank
then pass it onto the function
here @opal plank
const client = new Discord.Client({ messageCacheMaxSize: 5, messageCacheLifetime: 60, messageSweepInterval: 60, messageEditHistoryMaxSize: 5, disableMentions: "everyone", cacheChannels: true });```
my client is here
maybe that's why she's giving an error
you didn't spell dependencies properly
hmm so it seems to be either something else thats causing that or d.js big derp
the version in the code definitively running that version
if (i == 0) {
ctx2.drawImage(canvas, 0, 0, canvas.width / 2, canvas.height / 2, 0, 0, canvas.width / 2, canvas.height / 2)
} else if (i == 1) {
ctx2.drawImage(canvas, canvas.width / 2, 0, canvas.width, canvas.height / 2, 0, 0, canvas.width, canvas.height / 2);
} else if (i == 2) {
ctx2.drawImage(canvas, 0, canvas.height / 2, canvas.width / 2, canvas.height, 0, 0, canvas.width / 2, canvas.height);
} else if (i == 3) {
ctx2.drawImage(canvas, image.width / 2, image.height / 2, image.width, image.height, 0, 0, image.width, image.height);
}
The first 3 are working as intended, the final one though is not
The first 3 take the top left, top right, bottom left and seperate them into there individual sections
the fourth one is meant to do the same for the bottom right but is not working as intended
http://img.extreme-is.me/LfIaUt59xQ42ABqr My current output:
in the last case your using image.width instead of canvas.width is the first thing that i register
const canvas = createCanvas(100, 100);
const canvas2 = createCanvas(50, 50);
const ctx2 = canvas2.getContext('2d');
const ctx = canvas.getContext('2d');
let image = new Image();
image.onload = function () {
ctx.drawImage(image, 0, 0)
}
image.src = 'https://www.gravatar.com/avatar/7b67c827ee1671ba3b43f4aebf6794fb?s=128&d=identicon&r=PG'
``` top of file
Hello, you're giving this error, can you help me?
const embed = new Discord.MessageEmbed()
.setColor('bbe6f9')
.setTitle(`**Acabaram de votar em mim!**`)
.setDescription(`**Obrigado ${client.users.cache.get(req.vote.user).username} por votar, continue assim, e me ajude a crescer cada vez mais!\n**`);
client.guilds.cache.get("812692760032968764").channels.cache.get('833758441553657907').send(embed)
res.sendStatus(200)
})```
did you set anything to be app?
When I do canvas it gives me the top left not bottom right
ok let me have a closer look
const webhook = new Topgg.Webhook('a')
const api = new Topgg.Api("eyJhb")
setInterval(() => {
api.postStats({
serverCount: client.guilds.cache.size
})
}, 300000)
Discord.Message.prototype.quote = async function(content, options) {
const message_reference = {
message_id:
(!!content && !options
? typeof content === 'object' && content.messageID
: options && options.messageID) || this.id,
message_channel: this.channel.id
};
const { data: parsed, files } = await Discord.APIMessage.create(
this,
content,
options
)
.resolveData()
.resolveFiles();
this.client.api.channels[this.channel.id].messages.post({
data: {
...parsed,
message_reference,
allowed_mentions: { replied_user: false }
},
files
});
};
app.post('/vote', webhook.middleware(), async (req, res) => {
const embed = new Discord.MessageEmbed()
.setColor('bbe6f9')
.setTitle(`**Acabaram de votar em mim!**`)
.setDescription(`**Obrigado ${client.users.cache.get(req.vote.user).username} por votar, continue assim, e me ajude a crescer cada vez mais!\n**`);
client.guilds.cache.get("812692760032968764").channels.cache.get('833758441553657907').send(embed)
res.sendStatus(200)
})
app.get("/", (request, response) => {
console.log("estou online")
response.sendStatus(200)
})```
before and after: http://img.extreme-is.me/TNwIK7GXxtddnZTe
i put iss
is there any part of that code
ok
that you didn't copypaste
who?
alex
ah
yes
Looks copy pasted 
what lib is the canvas one?
just canvas
@modest bone your app is undefined. I would suggest doing this:
npm i express
and then add
const app = require(“express”)
npm i canvas
sorry for the lack of code blocks I’m on mobile
and now?
ok
the problem is thatmy host does not accept the expressmy host doesn't accept thenha host does not accept
express
express is just a wrapper for that
else if (i == 3) {
ctx2.drawImage(canvas, image.width / 2, image.height / 2, image.width / 2, image.height / 2, canvas.width / 2, canvas.height / 2, image.width, image.height);
}
The connection string you gave was invalid
whats with that
?
i mean does this work
one sec
I know but where?
wherever you connect
^
bottom left not right
so which part is actually wrong, bottom left?
The one you gave me displays the bottom left when it is supposed to show bottom right
oh one sec
okay
what this problem for discord js
const Discord = require("discord.js")
const { version } = require("discord.js");
const moment = require("moment");
const m = require("moment-duration-format");
let os = require('os')
let cpuStat = require("cpu-stat")
const ms = require("ms")
module.exports.config = {
name: "botinfo",
}
const botinfo = new Discord.MessageEmbed()
.setAuthor(message.client.user.username)
.setTitle("Status:")
.setColor("RANDOM")
.addField("⏳ Ram usage", ${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)} / ${(os.totalmem() / 1024 / 1024).toFixed(2)} MB, true)
.addField("📁 Users", `${message.client.users.cache.size}`, true)
.addField("📁 Servers", `${message.client.guilds.cache.size}`, true)
.addField("📁 Channels ", `${message.client.channels.cache.size}`, true)
.addField("👾 Discord.js", `v${version}`, true)
.addField("🤖 Node", `${process.version}`, true)
.addField("🤖 CPU", `\`\`\`md\n${os.cpus().map(i => `${i.model}`)[0]}\`\`\``)
.addField("🤖 CPU usage", `\`${percent.toFixed(2)}%\``, true)
.addField("🤖 Architecture", `\`${os.arch()}\``, true)
.addField("💻 Platform", `\`\`${os.platform()}\`\``, true)
.addField("API Latency", `${(message.client.ws.ping)}ms`)
message.channel.send(botinfo)
});
}
};
that's how it is xd
give more context with your question
@blissful coral one sec im actually making a project rn, because its to hard just to imagine it lol
👍 this is the only problem I ham having
Can somebody help me??
@blissful coral can u just sent me the whole code (per DM if you want) to quickly test it?
You can wrap code in a code block to give it syntax highlighting as so:
```javascript
your code here
```
As for your problem, like others have said, you'll need to provide more context for us to help you
-wrongserver
@timid radish
Hey! We think you have our server mistaken. We do not provide support, help, or advice for any bot. You need to click on the "Get Support" button on the bot's page of the bot you need support for, not the "Join Discord" button at the top of our website. If there isn't a button that says Support Server or you were banned from the bot's support server, then we can't help you. Sorry :(
discord js error unexpected token
``"const Discord = require("discord.js")
const { version } = require("discord.js");
const moment = require("moment");
const m = require("moment-duration-format");
let os = require('os')
let cpuStat = require("cpu-stat")
const ms = require("ms")
module.exports.config = {
name: "botinfo",
}
const botinfo = new Discord.MessageEmbed()
.setAuthor(message.client.user.username)
.setTitle("Status:")
.setColor("RANDOM")
.addField("hourglass_flowing_sand Ram usage", ${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)} / ${(os.totalmem() / 1024 / 1024).toFixed(2)} MB, true)
.addField("file_folder Users", ${message.client.users.cache.size}, true)
.addField("file_folder Servers", ${message.client.guilds.cache.size}, true)
.addField("file_folder Channels ", ${message.client.channels.cache.size}, true)
.addField("space_invader Discord.js", v${version}, true)
.addField("robot Node", ${process.version}, true)
.addField("robot CPU", \``md\n${os.cpus().map(i => ${i.model})[0]}```)
.addField("🤖 CPU usage", `${percent.toFixed(2)}%`, true)
.addField("🤖 Architecture", `${os.arch()}`, true)
.addField("💻 Platform", ``${os.platform()}``, true)
.addField("API Latency", ${(message.client.ws.ping)}ms`)
message.channel.send(botinfo)
});
}
};``"
How do I make that block?
```js
//code here
```
which line does the error say?
I have it in replit and there is no error online, if not, in the console it gives me one when they appear to me that the command has been used
@solemn latch
then how did you get this
discord js error unexpected token
why there I am emphasizing the error that gives me and the language you know
is my error of console @solemn latch It only gives me an error when it appears that they use the info bot
probably the one on the last line
Yesh
i hate when this happens
;-;
also
does anyone know how i can add commas?
in an output
commas?
const coins = await economy.getCoins(userid)
message.channel.send(`that user has ${coins} coins!`)```
like
the output can be
1000000
i want commmas in it
You have to do that yourself
lemme send my util
you might use another function for that
function formatNumber(number) {
let str = String(number)
return str.split('').reduce(
(a, b, i) => a + (i && !((str.length - i) % 3) ? ',' : '') + b,
''
)
}
can it be
umm
is that normal function or arrrow function btw ?
var nf = new Intl.NumberFormat();
nf.format(coins); // "1,234,567,890"```
I changed it before uploading forgot to change arros tho @near stratus
what is coins defined as
do
nf.format(Number(coins))
If it isn't already a number instead of a string
oki lemme try
if its a number already leave it as just coins
const coins = await economy.getCoins(userid)
message.channel.send(`that user has ${formatNumber(coins)} coins!`)
cleaner I guess
that all?
only that line of code

with the function that was given earlier
also put this somewhere in code
I can't get my bot to work
errors?
var nf = new Intl.NumberFormat();
nf.format(Number(coins)); // "1,234,567,890"
message.channel.send(`${nf}`)```
Thats what I told you to do
lmao
also why are you using string literals when you don't have anything else in the string
message.channel.send(nf)
I guess I can't read minds
lol
i removed it for time inconvenience
@blissful coral urs didn't work
i tried function
and it worked
:>
huh
let desc = `Total Balance : ${total}\nCoins Owned : ${formatNumber(coins)}\nInventory Value : ${totPrice}`
function formatNumber(number) {
let str = String(number)
return str.split('').reduce(
(a, b, i) => a + (i && !((str.length - i) % 3) ? ',' : '') + b,
''
)
}
const bal = new Discord.MessageEmbed()
.setTitle(`${member.user.username}'s balance`)
.setDescription(desc)
.setFooter(`RickRolled#3526 - Version 1.2.3`)
.setColor(message.member.displayHexColor)
message.channel.send(bal)```
this worked
might be a bit cleaner to move the function out of the middle of your code.
lol
you can use regex to add commas into numbers. String(number).replace(/\B(?=(\d{3})+(?!\d))/g, ",")
<number>.toLocaleString()
yea depends on what database you use ?
mongo
sure
yea go on it should be fine
oki
const data = await prefixModel.findOne({
GuildID: message.guild.id
});
if (!args[0]) return message.channel.send('You must provide a **new prefix**!');
if (args[0].length > 5) return message.channel.send('Your new prefix must be under \`5\` characters!')
if (data) {
await prefixModel.findOneAndRemove({
GuildID: message.guild.id
})
message.channel.send(`The new prefix is now **\`${args[0]}\`**`);
let newData = new prefixModel({
Prefix: args[0],
GuildID: message.guild.id
})
newData.save();
} else if (!data) {
message.channel.send(`The new prefix is now **\`${args[0]}\`**`);
let newData = new prefixModel({
Prefix: args[0],
GuildID: message.guild.id
})
newData.save();
}
}```

the code doesn't work
like
it replies
doesnt edit
this has nothing to do with the channel topic
go to the probot support server and ask there
guys how can i delete a file. i have setItem and getItem but i need to delete the item also
Ok thx
What exactly are getItem and setItem? where do they come from? what library? for what database?
client.login(`${args[0]}`);
^
TypeError: Cannot read property '0' of undefined

uhhh why would args be defined when trying to login a bot?
that... makes little sense

guys quick question, can i update info in a website using it's API in python ? if so what should i look for ?
"API"s don't care what language you use, they're based on a protocol, not a language
usually through HTTPS exchanges
Well, it's not defined
clearly
Since you like sharex, here's more arrows and stuff
One message removed from a suspended account.
so like can i do it?
uhh find a library that does HTTP requests, I guess?
im making the most unique thing a bot can ever do
Oh god please don't
Budget Pylon
I mean seriously if you're blocked at "cannot read property 0 of undefined" and you need our help for that... forget it.
I'm sorry to say it ain't happenin'
why can't it happen
I'm saying you aren't going to make this happen if this is where you're stuck
ok
i fixed it
but i have a differnet error now
(node:20080) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.
the token wasn't valid.
ok so you didn't provide it to the code correctly
const args = msg.content.slice(prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
let { token } = newFunction(args);
function newFunction(args) {
let token = args[0];
return { token };
}
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const { args, command, token } = require('./index.js')
client.login(token);
you're... importing index.js? 
you shouldn't be... that doesn't... what in the actual fuck are you even doing
ok and what are you writing inside index.js?
const Discord = require('discord.js');
const client = new Discord.Client();
var prefix = "bot."
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});
client.on('message', msg => {
if (!msg.content.startsWith(prefix) || msg.author.bot) return;
const args = msg.content.slice(prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
let { token } = newFunction(args);
function newFunction(args) {
let token = args[0];
return { token };
}
if (msg.content.startsWith(prefix + "runner")) {
msg.reply('Making Bot...');
require('./bot.js')
}
});
ok so first
you're not exporting anything
second, you're requiring bot.js from index.js and index.js from bot.js
require loops are bad, mmmkay
third, var ? jesus christ.
Please, for the love of all that is wholy, stop what you're doing, drop this project, and roll on to a full javascript tutorial before attempting such a project.
Shoveling code might work on your usual crap bots but not with this idea. You just cannot stumble through something like this.
Do you even understand the least bit about modules? the security involved in this???
are you ready to learn docker and virtualization for this idea? because you'll need it
im not sharing this bot with anyone else
so no
javascript.info is great
i closed the tab
Also: #development message
w3schools focuses mainly on web js kind of stuff.
my antivirus says the .info tld does something to my computer
your antivirus is clearly defective
👀 honestly anything more than windows defender is kinda pointless unless you click on scam links frequently.
fake, everyone knows that urls that end in .php are the true viruses
👀 i mean, thats fine. but info tld is owned by the same people who owns .com.
https://en.wikipedia.org/wiki/.info
if your anti virus doesnt trust .info it shouldnt trust any .com domain
how do i make a tld
a lot of money
where do i get a lot of money
from tlds
im gonna make a tld
but you need money
👀 icann custom tld cost.
The process itself may be relatively straightforward. ICANN will make applications available (get the May 2011 draft of the Applicant Guidebook) from January 12, 2012 through April 12, 2012, giving companies time to develop a marketing plan and come up with justification to pay the $185,000 application fee and, if approved, the annual $25,000 fee.
ezpz
I am attempting to save data in python using json. Just wanted to know if it was better to save all guild data in 1 json file or a new file for each guild?
A new file for each guild might be too many files
I wouldn't recommend using JSON files as a db though
Do you have any recommendations?
SQLite is good, pretty easy to use
I mainly use MySQL and PostgreSQL right now but those are remote databases which takes a little more effort to set up
Or MongoDB it isnt too hard plus it uses JSON format
Ok thanks i'll look into it
lol its sniping tool
a
So, for storing data in Python, what'd be better (efficiency wise, and/or best practice)?
Let's say I have a mob with like, attack, defense and speed stats.
Would it be better to put all of that in a dictionary then store it in a DB, or make a class object with the stats and store that in the DB?
Those are decimal separators, right? RIGHT?
if i wanted
example.woo
the .woo part
I mean the price
oh no lol
No decimals? 😫
smh using master instead of main
I like it
main is dumb
If I add a bot will it be accepted if it doesn't have any commands yet
i can get simple respond commands but im not sure how to do math on it
not sure
probably not though
ok well you need a coding software to start out and a bot
where can i get templates
have you created a bot yet?
Yes
ok
Yeah
ok
What kinda coding software should I use
hold on
Oki
ok so download python 3.9 on the microsoft store
Vscode for sure
Ok hang on
k
Opening the store
hey do you know how i would make commands involving math?
I'm downloading it
do you use java
no
what do you use?
Javascript

how would you do it on javascript?
I'm very new to rhis
did it fully download?
Not yet
ok
hmm

I would probably just use the built-in eval() function in javascript after checking if the expression is valid
I'm deleting mougus after this lol
ok i have one more question
mhm
how do you get it to like read what ur saying?

well like give a certain responce based of the message
for example carl-bot.... If you say -calc (x) + (z)
i'll just put the evaled expression into a variable then send it to the channel
itll come up with something specific based off the 2 numbers
if it throws an error than i'll just say that's not a valid expression or smth
has it downloaded
ok
Hang on
k
probably cause your building it from the source
ok
basically it will most likely use something called "make/cmake" which is HELLA slow
now you need to download a programing software
i use this one
but theres a lot
you can use others too
Can I download it on opera or do I use the Microsoft store



