#development
1 messages · Page 1252 of 1
naisu
typeerror function.prototype.apply was called on # object which is a object and not a function
message.channel.awaitMessages({
max: 1,
time: 30000,
errors: ['time']
})
.then(async collected => {
let num = message.content
console.log(num)
if (isNaN(num)) return message.channel.send(`\`${num}\` is not a number.`)
message.channe.send(await stats(uuid, num, ign))
})
.catch(collected => {
message.channel.send('Timed out.');
});
});```
line?
Not sure butthumbnail: { url: member.user.displayAvatarURL({ dynamic: true, size: 400}), },
try size 400
cant find which line...
dynamic has nothing to do with the size?
UnhandledPromiseRejectionWarning: RangeError [IMAGE_SIZE]: Invalid image size: 400
512, 1024, or 2048
oh
256
please help
give more info
I have never encountered this error before
its hard to help when we dont know where to look at
hey how do i make sure that this command can only be used in 1 channel? https://hastebin.com/lunelokatu.js
message.channel.awaitMessages({
max: 1,
time: 30000,
errors: ['time']
})
.then(async collected => {
console.log('collected')
//collected didnt go through.
let num = message.content
console.log(num)
if (isNaN(num)) return message.channel.send(`\`${num}\` is not a number.`)
message.channe.send(await stats(uuid, num, ign))
})
.catch(collected => {
message.channel.send('Timed out.');
});
});```
Can anyone break it down to me on how do u make a now playing cmd that shows u how long the song has been played
Ye
@carmine summit
Ytdl
@carmine summit
message.channe.send(await stats(uuid, num, ign))
hmm
channe?
@amber thistle hmm idk cuz i am bad in Music
Oof
uj
I thought u take the time the song is being played and minus the duration
and maybe u will get usefull info about it
Hmmm
@silver lintel i still have the error
same error
how do I add a filter that only the person who sent the command, and the bot will ignore others
return user.id === message.author.id;
};```like this
Errors found:
ReferenceError: message is not defined
var rand = require("./random");
if (message.channel.id == '756807110620217374'){
function ToInteger(card) {
if (card == "A") {
return 11;
}
else if (card == "base") {
return 0;
}
else if (card == "J" || card == "Q" || card == "K") {
return 10;
}
else {
return Number(card);
}
}
function aceCheck(value, total) {
if (total + value > 21 && value == 11) {
return 1;
}
else {
return value;```
by adding a command?
how do I add a filter that only the person who sent the command, and the bot will ignore others
@carmine summit filter m => m.author.id === message.author.id
that will trigger that
@carmine summit filter m => m.author.id === message.author.id
@silver lintel ok thanks but where do i put that?
The first parameter of awaitMessages/awaitReactions/createMessageCollector/createReactionCollector is the filter function
you can define filter like let filter = ... then put it message.channel.awaitMessages({filter, or you can do directly
uh?
message.channel.awaitMessages(m => m.author.id === message.author.id,
{max: 1, time: 30000, errors: ['time']}).then(collected => {
message.channel.awaitMessages(m => m.author.id === message.author.id,
{max: 1, time: 30000, errors: ['time']}).then(collected => {
@silver lintel I want to define filter
let filter = m => m.author.id === message.author.id
message.channel.awaitMessages(filter,
{max: 1, time: 30000, errors: ['time']}).then(collected => {
filter is basically, well, the filter
message.channel.awaitMessages(m => m.author.id === message.author.id,{
max: 1,
time: 30000,
errors: ['time']
})
.then(async collected => {
console.log('collected')
let num = message.content
console.log(num)
if (isNaN(num)) return message.channel.send(`\`${num}\` is not a number.`)
message.channel.send(await stats(uuid, num, ign))
})
.catch(collected => {
message.channel.send('Timed out.');
});
});``` typeerror function.prototype.apply was called on # object which is a object and not a function
idk sry
Main question here is, what's stats defined as
And what's the body of that function
you wouldnt understand
no like is it a string
but it works on a different command
it returns a string yes
the stats function works perfectly on a different command with the same input
I'm pretty sure the function isn't for the parameters you provide
btw collected didnt go to the console
which collected 
console.log('collected')
Is there a way to make music comamnds without using discord.js and if so what website?
your question is uh
way too confusing
You mean make a music command with a different library?
make commands without using discord.js???
Yh
you don't have to use djs, there's a fuck ton of different libraries for a fuckton of different languages
star that BS lol
Yeah but I need to know coding website and code
how do i take absolute of an integer?
A wot of integer
Math.abs(<Number>)```
if this isn’t satire I swear
Just use collectors instead of promise based awaiters
you just pinged some random guy
xD
Several people are typing...
Lol
how do i take absolute of an integer?
@silver lintel print (abs(number))
I literally said how and that's python not js
hmm...oh i didn't seen it lol
Math#abs probably would be js equivalent
yes
Math.abs(<Number>)```
^
it's only one line part of code, but ok
No i mean i said it before lol
ah
How do u make a music command?
didn't notice
Which library
Any
How do u make a music command?
@fresh matrix js or python?
Js
Mk
then u can take help from these imma python guy...
Ok
use lavalink or then just practice and make your own player
Kk
HoW dO i MeRgE JaVaScRiPt AnD PyThOn AnD JdA??
changing IP addresses
@misty sigil i don't get it
HoW dO i MeRgE JaVaScRiPt AnD PyThOn AnD JdA??
@carmine summit dont merge them and #nostar
You need to change IP address to avoid rate limit
how do i send badges as a pic in embed?
cAnvas
canvas npm
yep i got that
@slender wagon https://discordjs.guide/popular-topics/canvas.html
wdym badges?
Just check for userflags
like show the discord profile badges
And draw the badges
@slender wagon https://discordjs.guide/popular-topics/canvas.html
@silver lintel pls don't link that, it doesn't explain how it works very well
i recommend canvas' official docs
Just check for userflags
@misty sigil oh okay
that angri doggo is so cute
Awh doggooooo
he dead
Nuuuu


Can someone explain why am I getting weird errors???
does client.emit calls a action?
event my bad
whats incrementMaxListeners
look at logs, it should have more info
You need to change IP address to avoid rate limit
@misty sigil or just dont get banned

I DONT ******* KNOW WHY IS IT THERE
stop screaming in caps lol
@carmine summit did u have any variable named = maxlisteners
NO
hey peeps
var ret = `Hey ${user.username}, you ran out of turns and lost $${bet.toLocaleString()}. The Correct location was:\n\n${displayBoard(user)}\n(Row: ${shipRow}, Column: ${shipCol})`;
how do i put this in a code block>
because they are variables
i can't just add ` 3x to them
or can i ?
\`
uh why are you using the library message collector class, there is a function to let the channel create that for you, https://discord.js.org/#/docs/main/stable/class/TextChannel?scrollTo=createMessageCollector @carmine summit
u don't get it
nope
uh why are you using the library message collector class, there is a function to let the channel create that for you, https://discord.js.org/#/docs/main/stable/class/TextChannel?scrollTo=createMessageCollector @carmine summit
@fluid basin I dont get it
anyone that can help me?
@fluid basin https://canary.discordapp.com/channels/264445053596991498/272764566411149314/756817891785179179 did you mean?
```js
some code
```
i know
@eternal osprey
ut i already have the variables inside ``
so
wait
````Create a profile first with ${prefix}create'````
omg
`Create a profile first with \`${prefix}create\``;```
how do i make this in a code block ffs
Who?
@eternal osprey return "Create a profile first with `" + prefix + "create`"
Hey Can Make a Command For only ID?
@untold plover
what library
let collector = new Discord.MessageCollector(filter, {
max: 1,
time: 30000,
errors: ['time']
})
console.log(collector)
collector.on('collect', async message => {
console.log('collected')
let num = message.content
console.log(num)
if (isNaN(num)) return message.channel.send(`\`${num}\` is not a number.`)
message.channel.send(await stats(uuid, num, ign))
})```
TypeError: cannot read 'incrementMaxListeners' of undefined
JavaScript
this would mess with my variables right?
Hey Can Make a Command For only ID?
@untold plover can?
@eternal osprey that would
what library
what library
@honest perch do u mean bot.js?
no
You mean make a command only work for a specific ID or something @untold plover
You mean make a command only work for a specific ID or something @untold plover
@earnest phoenix ye
https://discord.js.org/#/docs/main/stable/class/Message?scrollTo=author guessing youre using djs
No has discord.js only using bot.js :D
return "Create a profile first with" + `${prefix}create`;```
this would be all good right?
if (<message>.author.id === "Your ID") {
// Your code
}```
@untold plover please learn a bit of nodejs
@untold plover please learn a bit of nodejs
@honest perch ONLY İ HAS FCİNG LOW ENGLİSH
if you dont know what a lib is im concerned
return `${user.username}` + "busted; Croupier wins," + `**${user.username}` + "loses**.";``` is this well coded?
or would it give problems?
there wont be any problems, but easier way
okay
I don't see the point of using string concaters while using template literals
return `${user.username} busted; Croupier wins, **${user.username} "loses**.`;
return `${user.username} busted; Croupier wins, **${user.username} loses**.`
``` this is what you could have done
first
E
also you forgot ;
no need
Can I ask something/???
Js doesn't care bruv
if (<message>.author.id === "Your ID") { // Your code } do i Must copy paste mu Code to "Your Code"
delete Your Code Thing first
You have to put the code of the command that should work if the author's ID is your ID

@carmine summit That's not how you create a message collector
how?
You have to put the code of the command that should work if the author's ID is your ID
@earnest phoenix Code of Command like !say (example)
Rip eng
BRUH
let content = JSON.parse(fs.readFileSync('../file.json', 'utf8'));
content[message.guild.id].muteRole = muteRole.id;
fs.writeFileSync('../file.json', JSON.stringify(content[message.guild.id].muteRole));
does this work? and how do i do it if muteRole doesnt already exist
hi
@gilded plank what is prefix?
its -
@earnest phoenix im still confused
@silver lintel dont use json
@tired panther https://top.gg/api/docs
@earnest phoenix all commands are listed in either #rules-and-info or #502193464054644737
@carmine summit You have to create one like the one shown in the docs
let collector = message.channel.createMessageCollector(filter, {
max: 1,
time: 30000
});```
What Commands are there ( @gilded plank )
how do i put timeout???
pls help me
work ?
thx @earnest phoenix
how do i put timeout???
@carmine summit Timeout is literally right there
pls help me
np
no i mean
@silver lintel dont use json
@honest perch then what should I use?
message.channel.send('timeout')
Umm
an actual database
mongodb
Noob
MongoDB
I don't need to store that much data
I don't need to store that much data
@silver lintel Doesn't matter
Is setting up MongoDB easy? Can someone please send a guide
mongo db
https://google.com/?q="How+to+set+up+mongoDB%22
Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.
code
message.error is not a thing at all
how can i delete one thing from model in mongodb example:
id: guild.id,
autorole: role.id,
welcomechannel: channel.id
i want delete only autorole how can i?
Just use
message.say("Error message");``` as you're using commando @flint yew
Not for maintaining huge commands
Just use
message.say("Error message");``` as you're using commando @flint yew
@earnest phoenix where that use
commando suck
no
make ur own command handler
yes 4ce ur right
message.say = message.channel.send
return message.error("Error message");```
↓
```js
return message.say("Error message");```
message.say doesn't even make sense tho
ye
commando is only for nabs
@earnest phoenix how do i put message.channel.send('timeout')
@carmine summit wdym ?
just add it to ur function
<What exactly are you trying to do>
@earnest phoenix how u got vertified ?
let collector = message.channel.createMessageCollector(filter, {
max: 1,
time: 30000,
errors: ['time']
})
collector.on('collect', async message => {
console.log('collected')
let num = message.content
console.log(num)
if (isNaN(num)) return message.channel.send(`\`${num}\` is not a number.`)
message.channel.send(await stats(uuid, num, ign))
})```
where to put
wut
the heck
@earnest phoenix how u got vertified ?
@earnest phoenix By making a bot and reaching to 75+ guilds
And submitting to the verification
collector.on("end", () => {
message.channel.send("timeout")
}
@carmine summit ^^
By making a bot and reaching to 75+ guilds
@earnest phoenix now is 100+
sad
Well that sucks
commando for noobs even my first bot had a command handler
@misty sigil k
hey
.setColor('#FF0000')
.setTitle(`*Blackjack Casino Game!!*`)
.setFooter("Command hosted for King's Family!")
.setDescription()```
i have this
@earnest phoenix do command console.log(client.guilds.cache.size first
but i want to put these returns in this?
if ur bot is 1000+
so the mebed changes
then maybe u are in rank 1000+
possible or not?
@earnest phoenix not
How can I see how many rank it my bot ( this dbl server )
idk
there are no rank in this server
@eternal osprey what are u trying to do ?
: /
where are you from?
????
it does effect anything with ur problem
message.say()
bruh
I literally said what to change it to
i did
is it possible to edit webhook message?
ahh
ik
just kidding
Commando is just a command handler constructor
But doesn't even look that good
@earnest phoenix do u use commando
No
then
?
that mean it suck
cuz nobody use it
Commando is just a command handler constructor
@earnest phoenix it have many things cool
for example ?
Not as feature rich as a native command handler
message.say() instead message.channel.send()
wow big change
i think the commando dev will call me cyber abuse
:))
Commando has to go through hundreds of constructors just to get a commando and execute it, but a native one can get it less than 1 second, just iterates through a collection
so when u use commando, it makes ur code slower
and the changes are not big
so what we have learn today is :
DONT USE COMMANDO
nvm
it is ur bot
ur choice
not my bot
so u have all perms to do what ever u want
yea
so keep use commando
@earnest phoenix ik c# but for JavaScript basic that why use commando ez for me
and when ur bot grew
it is verry hard to change back
and u have to keep use commando
yea
and it makes ur bot verry slow
wdym very slow
like min is 100ms
from Voltrex master:
Commando has to go through hundreds of constructors just to get a commando and execute it, but a native one can get it less than 1 second, just iterates through a collection
hmm
any good server hosting for bot ?
any good server hosting for bot ?
@fickle arch
Affordable hosting providers:
• OVH Starting at $3.35/mo for 1 core, 2GB RAM, 20GB SSD
• DigitalOcean Starting at $5/mo for 1 core, 1GB RAM, 25GB SSD
• Linode Starting at $5/mo for 1 core, 1GB RAM, 25GB SSD
• Vultr Starting at $2.50/mo for 1 core, 512MB RAM, 10GB SSD
• AWS Lightsail Starting at $3.50/mo (first month free) for 1 core, 512MB RAM, 20GB SSD
• Time4VPS Starting at €3.99/month for 1 core, 2GB RAM, 20GB SSD
• VIRMACH Full Windows and Linux Desktop VPS starting at $7/mo and $1/mo respectively
• Netcup Starting at €2.62/mo for 1 core, 2GB RAM, 20GB SSD
• GitHub education Free credit and other offers for students
• Microsoft students Free credit for students
• Google Cloud free tier
vps
It is possible to host it on your own, with server.
Can anyone Give me Reboot Command? :d (on the dm pls)
Don't expect to be spoon fed, you always ask can someone give me thjs
If I was going to store some config stuff for my bot, I would be using something like this
[
"Test! ", {
"id": "whatever a id is, or something"
},
"Nerds", {
"lmao": "lmao"
}
]``` How would I access something from "Nerds" in indexjs?
`**filename**.Nerds.lmao`?
Also @untold plover use client.destroy, use a .then to log into your client and lock it to your id only
If I was going to store some config stuff for my bot, I would be using something like this
[ "Test! ", { "id": "whatever a id is, or something" }, "Nerds", { "lmao": "lmao" } ]``` How would I access something from "Nerds" in indexjs? `**filename**.Nerds.lmao`?
@still merlin That syntax is incorrect
thanks
You did Json formatting which means you probably wanted it to be a Json, but this is an array
Don't expect to be spoon fed, you always ask can someone give me thjs
@silver lintel how about we change the question to, could you teach me how to make it 🤔
Ah, yes teach me I use module.exports on my old bot and don't know how to change it to exports.run
module.exports just exports things you pass it through for a file
+help
For example, here i have this file called example.js and this is what it has
module.exports.obj = {
bruh: "moment"
};``` and guess what happens when i require it as
```js
require("./example.js");```, it returns this
```js
{
obj: {
bruh: "moment"
}
}```
@fickle arch There
hm
I want to make a command where the user has to guess a number and using message collectors. How do I find the number of times it takes for the user to guess the number?
you may have to make your own "collector" for that
how do i host a discord bot for free
Check pins
ok
nevermind, https://discord.js.org/#/docs/main/stable/class/MessageCollector?scrollTo=received @silver lintel
or not
can someone send me a glitch bot, i made one for 2 and a half hours and found out that it dosent work
no
I tried to do
name: "play",
cooldown: 3,
aliases: ["p"],
description: "Plays audio from YouTube or Soundcloud",
async execute(message, args) {
const { channel } = message.member.voice;
replacing module.exports with exports.run
Anyone know how to keep my bot up all the time?
Anyone know how to keep my bot up all the time?
@summer sandal me
Anyone know how to keep my bot up all the time?
@summer sandal server hosting
theirs a discord bot
@untold plover Can u teach me how?
Yep
pins
https://github.com/discordjs/discord.js/blob/stable/src/structures/MessageCollector.js#L75
the received property only ups when the collect event is emitted, so yeah you probably have to build your own collector
try to copypaste the current implementation but just alter the behaviour to up the count on every message received in the same channel (& from the same user)
Mhm okay
can someone make me a discord bot
No
if you pay me
998-999
£1000? Deal 
A bot without script, okay.
9 bobux, deal
can someone help me?
https://dontasktoask.com/
@earnest phoenix ask what

Lool
let str = "Hello World!";
console.log(str);```does
wait, how you command to update npm package ?
npm i
I mean node
public class Bot {
public static void main(String[] args) {
int number = 10;
console.log(number);
}
}
```Doesn't work
what
@fickle arch https://nodejs.org
ah
wait, how you command to update npm package ?
I mean node
learn how to ask your questions properly
learn how to ask your questions properly
@earnest phoenix my bad
Anyone here use Visual Studio code with discord.js here?
M
https://canary.discordapp.com/channels/264445053596991498/272764566411149314/756848181475803276 plz help cod no working
public class Bot { public static void main(String[] args) { int number = 10; console.log(int) } } ```Doesn't work
@carmine summit java public class Bot { public static void Main(String[] args) { int num = 36; System.out.println(num); } }does
int number = 10
let sum = number + number
print(sum)
```Doesn't work
How do i do that?;
I already did playing status on my bot but i want change it every 5-10 seconds
That looks like 3 languages in one block to me lol
How do i do that?;
I already did playing status on my bot but i want change it every 5-10 seconds
@untold plover thats API abuse lol
the minimum is every 15 seconds, otherwise you're going to hit a ratelimit
also in what language
JavaScript
use setInterval
1 min
int number = 10 let sum = number + number print(sum) ```Doesn't work
@carmine summit python number = 10 sum = num + num print(sum)does
discord has bad python formatting cough
i tried it in node still doesn't work
u can't declare int in node
stop trolling
What language was that supposed to be
you're annoying
How do i Make it change every 15 seconds;
const moment = require('moment');
const Discord = require('discord.js');
const ayarlar = require('../ayarlar.json');
var prefix = ayarlar.prefix;
module.exports = client => {
console.log(`[${moment().format('YYYY-MM-DD HH:mm:ss')}] Bot Dosyalari Korunuyor`);
console.log(`[${moment().format('YYYY-MM-DD HH:mm:ss')}] Koruma Calisiyor.`);
console.log(`[${moment().format('YYYY-MM-DD HH:mm:ss')}] Sunucu Aktif!`);
client.user.setActivity(`Tyardım | Tdavet 🔥 v0.6.0`, {
type: "PLAYING",})
console.log(`Hazir Sunucuyu Baslatin...`);
console.log(`[${moment().format('YYYY-MM-DD HH:mm:ss')}] T.`);
console.log(`[${moment().format('YYYY-MM-DD HH:mm:ss')}] Sunucu Aktif!`);
};
Lol
lol
i told you to use setInterval
My dude had java javascript and python all in one at first
@thin turret include java lol
i told you to use setInterval
@earnest phoenix how the fc
For all those people who find it more convenient to bother you with their question rather than search it for themselves.
setTimeout(function(){ alert("Hello"); }, 3000);
Set interval runs a function every x ms
setTimeout(function(){
// do stuff every 3 seconds
}, 3000);
setInterval(<Function>, ms)
you can do arrow fn too () => console.log("hi")
take a guess
how do i make a loop bot status
read above
?
how do i make a loop bot status
@fiery hamlet can you even generate a random word???
😳
idk
thats what i thought
can you guys learn even basics of basic before asking here, thanks.
I dislike the idea of people with no language exp just diving into bot making
Like what did they expect
God to guide them?
https://anidiots.guide is a good place to start
I dislike the idea of people with no language exp just diving into bot making
@thin turret me
lol
@test_bot.event
async def on_ready():
print('Logged in as')
print(test_bot.user.name)
print(test_bot.user.id)
print('------')
await change_playing()
@test_bot.event
async def change_playing():
threading.Timer(10, change_playing).start()
await test_bot.change_presence(game=discord.Game(name='Currently on ' + str(len(test_bot.servers)) +
' servers'))
threading.Timer(10, change_playing).start()
await test_bot.change_presence(game=discord.Game(name='Say test.help'))```
but I learned on my way
that is how u do it for python
Can you even understand what's happening in that code?
I dislike the idea of people with no language exp just diving into bot making
@thin turret theres a diff between not knowing the lang and not knowing a single lang
yes
Where did you copy and paste it from
@thin turret theres a diff between not knowing the lang and not knowing a single lang
There be homies who dont even know if statements
-_-
So you just copied it?
Yeah, Overstack is known to provide outdated code
tbh you could ask on stackoverflow
Andddd time to do this
well how do i do it
@split hazel @coral trellis
i can script but not that good, im new to js
i just wanna know how i loop the status
What's the difference between Number() and ParseInt()?
porque?
What's the difference between Number() and ParseInt()?
you have google for that
ok
Konnichiwo, watashinanamaeha Jofudesu. Sutetasu o roopu saru hoho om oshietekudasai
not good at japanese
Especially in english
I coded a bot on Visual Studio code but cannot find a way to keep it on when my app closes any helps pls
おはよう
@fiery hamlet Whats a bat file?
batch
sorry i am new to coding
@summer sandal thats where bot hosting could help
same here
@thin turret I have no clue how to do it lol
node nameofbot.js
pause```
Google search
u get notepad ++
I coded a bot on Visual Studio code but cannot find a way to keep it on when my app closes any helps pls
@summer sandal a bot is just like any other program, once you close it, it stops running
then u make it so u can see the exstension file names
make it a txt file
paste @echo off //not cap sensitive node nameofbot.js pause
then ctrl shift s
just keep Visual Studio code open
@fluid basin I sometimes have to sleep too lol
it will say name.txt
so pc will turn off
then change it to bat
then keep ur pc on
@fluid basin lol
if you cant
Or host it
LoL
I sometimes have to sleep too lol
I mean, you sleeping has nothing to do with your pc sleeping
PCs nowadays are built to be left on non-stop. Only to be turned off for upgrades
network bill
which is also why vps isnt free
hey anyone knows how i can install discord.js v11?
how do i make status change every 10 seconds
@earnest phoenix use v12 unless you have a very good reason not to
i told you to read above when you asked your initial question but ok
10 seconds is way too often, you'll hit a ratelimit
15 seconds is the minimum
use setInterval
i was accustomed to develop on v11
@earnest phoenix If he asks again, just ping a Moderator
v11 is likely to not work after oct 7th
^
so I really recommend you to upgrade
:\ ok
domain change + intents change
also api v6 is going to be deprecated very soon
how do i make status change every 10 seconds
also a tip, if you change your status every 10 seconds, your bot will be denied if you apply on DBL/top.gg
When you forked a v11 code and run it on v12 
also a tip, if you change your status every 10 seconds, your bot will be denied if you apply on DBL/top.gg
oof why would it get denied?
Hey
How could I make this. Or can someone let me know the name. I'm not sure how it's called.
wait
what? you mean a bot?
uh forgot what it was called
So you want to make the link preview.
Yes.
ah yes meta tags
That's it.
use the meta tags:
og:title
og:description
og:image
og:thumbnail
Thanks!
@pine aspen ^^
I should put this in my dashboard files?
ye
Thanks!
@earnest phoenix He wanted the meta tags lol
yes it has
@pine aspen just put it on any page you can link to
@earnest phoenix doing it yourself > using something to do it for you
Yeah, I got it.
yeah they're not uncommon
Do I need a domain for meta tags?
I mean, a domain is pretty much required to have a dashboard, or a website, otherwise the address to the site is gonna be an IP address
how long it takes u make that :))
make what
hi i am trying to make ad and bad message filter i have quesiton how can i store message and username like this
User: @karmic storm
Message: Hello World
Nvm
for example snipe
You can use a Map, use the user id's as the key, the message as the value
uh that only works if you only have 1 msg per user
429 means too many requests, meaning you got rate limited.
The screenshot?
What version of Discord.js are you using? It looks correct.
v11
You should migrate to v12. It'll also fix your current problem.
This changelog will help you along the way: https://discordjs.guide/additional-info/changes-in-v12.html
But I would have to do it all over again, right?
No, just follow the changelog and you'd have to update just the breaking changes
The other stuff would work
Ah ok ok thanks
Help me.
I am poor at English because of Japanese.
I use discord.js.
message.guild.members only gets a part of the whole
I'll make a backup of v11 just in case
version control is your friend
@willow yoke .members returns a manager. To get the data, you need to access the .cache property.
I also tried cache
cache doesn't include offline members, also, some members may not be cached if they haven't been interacting with the bot if the server is very big
oh wait
I believe the first 200 members get cached
the value can be 1024 chars i think
MainOx what are you trying to do in the first place? More than just look in a collection?
Are you trying to get everyone, including offline members like Feud said?
Of the 6 people on the server and 3 people online, it was me and the bot that I got with cache.
Do you have guild member intents enabled
I want to make a list of members using npm's discord-reaction-controller.
Guild member intent?
new discorod.Client(here?)
Can anyone help me, I'm trying to edit a message by it's ID on discord.js v12.
fetch it first
I've never heard of editing by ID
Sorry
yeah so i do:
client.channels.cache.get('CHANNEL ID').messages.fetch('MESSAGE ID') and then what do I do?
its a promise, await it
anyone here knows about bootcamps such as codesmith?
I don't know
so uhm this would work
.then(message => message.edit('owo'))
.catch(console.error);```
ayy it worked!
yes it worked? Why do you ask if it works xd
how can i delete one thing from a model in mongodb?
for example:
guild: 262826
channel: 739373
role: 738362
i want delete only role how can i ?
$unset
Does anyone have a suggestion for initilizing a keyv database in index.js and then using it in other files without causing an Error: This socket has been ended by the other party
Basically taking this
const servers = new Keyv(`mysql://${process.env.DB_USER}:${process.env.DB_PASSWORD}@${process.env.DB_HOST}:3306/${process.env.DB_NAME}`)
And using it in other files
Node - Discord.js
I would assume it would be module.exports but I need to get this working properly 
using it in other files
don't reinitialise the server, but instead pass it around
Yeah, that was a mistake on my end
// index.js
const module = require('./module');
const servers = /* code here */;
module(servers);
// module.js
module.exports = (server) => {
/* some code here */
}```
for example
Oh, thanks, that fixes basically all my problems in non-command files, however in command files im using commando, is that around the same idea?
You can attach the server to your client
add it in the constructor
like this
module.exports = class DebugVerifyCommand extends Command {
constructor(client, servers) {
super(client, /* code */);
this.servers = servers // or something similar
}
}
then you can invoke it like this
new DebugVerifyCommand(client, servers);```
Oh, yeah its morning and im tired I guess lol. Thanks a bunch. 
Im gonna go test some changes on it now, might msg back when I get it workin 👍
@maiden mauve message limits
you can't send bigger than 256 characters in titles of embeds
1024 limit for descriptions
@sudden geyser I already changed it to V12, I have an error that I do not know how to solve is this
@sudden geyser I already changed it to V12, I have an error that I do not know how to solve is this
@earnest phoenix message.guild.ban LMFAO
Hmmm
looks right
ban guilds
what are you lmfaoing
It means .guild does not have a method called ban()
what are you lmfaoing
@pale vessel he's trying to ban a guild lol
time to ban guilds, also massban bot?



and why toString() when it's already a string
message.GuildMember.ban(id.toString());?
not quite
@earnest phoenix https://discord.js.org/#/docs/main/stable/class/Message
It is a forceban of my personal database
message.guild.member(message.mentions.users.first()).ban
one day people will read the docs
and what 
@earnest phoenix yeah thanks noticed that ^_^ just had to reformat my embed
if (!message.member.hasPermission("BAN_MEMBERS")) return message.channel.send("Invalid Permissions")
let User = message.guild.member(message.mentions.users.first()) || message.guild.members.get(args[0])
if (!User) return message.channel.send("Invalid User")
if (User.hasPermission("BAN_MEMBERS")) return message.reply("Invalid Permissions")
let banReason = args.join(" ").slice(22);
if (!banReason) {
banReason = "None"
}
User.ban({reason: banReason})
confusing to name the GuildMember object User when User is something else, but otherwise it should work
That code part doesn't account for different name lengths though, if you get the reason from character 22 onwards.
.
how about mentions.members.first()
<Message>.mentions.members.first()
One message removed from a suspended account.
One message removed from a suspended account.
I'm looking to get some prs for hacktober, if anyone has a public python bot repo, and wants some help
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
# Discord Response Bot
Needed: py -version -m pip install discord, Discord App/Bot
import discord
import time
from discord.ext import commands
class MyClient(discord.Client):
async def on_ready(self):
print('Logged in as')
print(self.user.name)
print(self.user.id)
print('------')
async def on_message(self, message):
if message.author.id == self.user.id:
return
if message.content.startswith('command here'):
await message.channel.send('response here'.format(message))
elif message.content.startswith('second command here'):
await message.channel.send('second response here'.format(message))
client = MyClient()
client.run('token here')```
One message removed from a suspended account.
What
yes
explain yourself
how
One message removed from a suspended account.
One message removed from a suspended account.
yes
One message removed from a suspended account.
dont worry bout it
One message removed from a suspended account.
One message removed from a suspended account.
yes
Hey anyone here know how to convert user object to user id. DiscordPy here
.id?
^
249016220987293697
.id?
@sudden geyser how to I parse the userid
No I'm working on economy system
So like, you want the ID from mentioning someone or something
Here's the trick though
check the docs
I did multiple times
Check .mentions on the Message class: https://discordpy.readthedocs.io/en/latest/api.html#discord.Message.mentions
So you're trying to get the client user's ID this time
No I wwanr to send tokens
For example
Send @kits $1
So in my SQL db, I have users saved as Id'#
Id type
So Im struggling with this
in the command you can specify to take the id of the first mentioned user iirc
like, in the args
You can do that?
Hi @quartz kindle, may I ask about your library (discord.js-light) via DM?
@south cove pretty sure you can
Do you by any chance know the syntax
lemmie go find it
Aight I'll also look
@bot.command(name="id") async def id_(ctx, user: discord.User): await ctx.send(user.id)
Found this
@restive night sure
then varName.id for their id
what is the "authorization header" in DSL vote webhooks
idk wut headers are i'm not a web developer
It's... the authorization header
what are headers
you check if it contains the password you set in the webhook settings
i can see you linking me an MDN page on headers but that's ok
if it does not, then the request is not coming from DBL
Mainly info about the request
@earnest phoenix i searched req.headers on express.js docs but there was nothing
if it does not, then the request is not coming from DBL
@cinder patio *DSL
if (request.header("Request-Authorization") != process.env.DSL_WEBHOOK_PASS) return response.send("stop");
is this a good idea (discord text wrap put the return on the next line)
it didn't your screen just smol
if the header is named like that, sure
smh
dsl just said it will be sent in th authorization header
MDN said authorization header is of request type
i'm testing it rn
i'd just return a 404 though just in case someone were to try to find the endpoint and exploit/spam the living fuck out of it
@earnest phoenix made a few changes and now it allows event he DSL test webhook through
does DSL send the authorization header too in the test webhook?
i don't know
log the request headers and find out
ok
@earnest phoenix bruh it was undefined
why you should learn to read MDN
@earnest phoenix it works ||
||
hey can i get some help?
@client.event
async def on_guild_join(guild):
#loads json file to dictionary
with open("filename.json", "r") as f:
guildInfo = json.load(f)
guildInfo[int(guild.id)] = guild.text_channels[0] #sets key to guilds id and value to top textchannel
#writes dictionary to json file
with open("filename.json", "w") as f:
json.dump(guildInfo, f)
#allows server members to set channel for welcome messages to send to
@client.command()
async def welcomeChannel(ctx):
with open("filename.json", "r") as f:
guildInfo = json.load(f)
guildInfo[int(ctx.message.guild.id)] = ctx.message.channel.id #sets channel to send message to as the channel the command was sent to
with open("filename.json", "w") as f:
json.dump(guildInfo, f)
await ctx.send(f"I have set the welcome channel!")
@client.event
async def on_member_join(member):
await member.send(f'Hope you like the server! {member.mention} make sure to check out the rules!')
embed = discord.Embed(title = "Welcome", description = f"{member.mention} Just Joined \nWelcome to our server :partying_face: \nStay Here and Buy Some Discord Bots! \nYou are the {len(list(member.guild.members))} member!")
embed.timestamp = datetime.datetime.utcnow()
embed.set_footer(text = f"{member.guild}", icon_url = f"{member.guild.icon_url}")
embed.set_author(name = f"{member.name}", icon_url = f"{member.avatar_url}")
embed.set_thumbnail(url=f"{member.avatar_url}")
with open("filename.json", "r") as f:
guildInfo = json.load(f)
channel = guildInfo[str(member.guild.id)]
await channel.send(embed = embed)
```my code. error: ``` File "actual code.py", line 125, in on_member_join
await channel.send(embed = embed)
AttributeError: 'int' object has no attribute 'send'```
BRUH
?
then no idea
is there no PY people here?
@modest smelt use bot.get_channel(guildInfo[str(member.guild.id)])
oh
or client.get_channel
and set that to channel, right?
correct, you're currently defining channel as an integer so I assume that is returning a channel id instead of a channel object
so ```python
channel = client.get_channel(guildInfo[str(member.guild.id)])
yes, that should work
ok
return of; https://discordapp.com/channels/264445053596991498/272764566411149314/756877157564678174
Can't figure this out... still.
When I try out these solutions outlined it simply results in the famous not a function error.
Any guides I can look at to wrap my head around this? 
It should be a simple fix, however I can't get it working. All I need is to have the keyv database usable in all other files if required. And module.exports seems to not work very well at that. (or im just stupid
)
@final stone it's saying that servers.get is not a function. Which means you are treating a property like a function. Double check your types, and make sure you are passing the correct type through when declaring your variable.
channel = client.get_channel(guildInfo[str(member.guild.id)])
KeyError: '747929495427874836'
```@graceful drift
oh w8 crap
huh
Hello
Hi
you're using str(member.guild.id) as a key in a list 
can you help me
Sorry but I'm confused on what you're trying to do, are you trying to send a message to a server using only server id @modest smelt
so basicall
i am letting the user give me an input of a channel
where i will be sending a welcome message
ohhh
i store the dict as {guild.id:channel.id}
so i have to first read guild.id
and then read the channel.id
ah alright, makes sense
yes
can you help me please
maybe use guildInfo.get(str(member.guild.id))

@autumn perch just say your question.
@autumn perch be patient
Don't ask to ask, just ask
@graceful drift i think i already tried that
hm
w8
do u mean python channel = client.get_channel(guildInfo.get[str(member.guild.id)])?
i haven't tried that
well what does guildInfo.get(str(member.guild.id)) return
if it returns a channel id, then it should work




