#development
1 messages ยท Page 868 of 1
so thats exactly what you have to do
client.shard.broadcastEval(`
(async () => {
let channel = this.channels.get('id');
let msg;
if (channel) {
msg = await channel.fetchMessage('id').then(m => m.id);
}
return msg;
})();
`);
Like this
broadcastEval(`
(async function() {
if(<guild exists>) {
await <create invite>
return <inviteCode>
}
})()
`)```
Hmm, on discord.js, how would I get a guild member object without having access to the client object/any discord objects at al? I guess I'd have to make the request myself?
ye
event listener
client.on("message", message => {}) - "message" is the event, "client.on()" is the listener
how would I increase the size
the warning exists for a reason
its to warn you that you're likely doing something wrong
such as adding too many listeners in a loop
then }
would this be a cause
client.on('message', msg => {
if (msg.content === 'ping') {
msg.reply('Pong!');
}
});
client.on('message', msg => {
if (msg.content === 'ping2') {
msg.reply('Pong!');
}
});
client.on('message', msg => {
if (msg.content === 'ping3') {
msg.reply('Pong!');
}
});
possibly
you should not repeat listeners for the same event, its a waste of resources
ah okay
instead use else-if
you should do this instead: ```js
client.on('message', msg => {
if(msg.content === 'ping1') {
msg.reply('Pong!');
} else if(msg.content === 'ping2') {
msg.reply('Pong!');
} else if(msg.content === 'ping3') {
msg.reply('Pong!');
}
});
it'll do the same work with less resources
but did you understand what i showed?
all commands should go inside the same listener
if you're doing something similar in lots of commands then yes, it will
you hardly need more than 15 listeners tho
unless you have something like a role-per-mention command
What's a role per mention command
idk
@quartz kindle how do I make it so if the people are userid and userid then they can use the cmd
because i know how to do it for one person
you click on a reaction -> you get a role
Why would that require more than fifteen listeners
it'll not
Wouldn't that just be one lidtenr
unless you have a bunch on those
Listener
Oh fair enough
Raw events then 
it'll be a bit more work, but I didn't considered adding one event to handle all buttons
if message.author.id is id or id
@royal portal what?
then put your ids inside an array
if message.author.id = myid return
if(message.author.id === "ID HERE" || message.author.id === "ANOTHER ID HERE")
ah
you gotta use 3 =
not !==
isnt if(message.author.id === "ID HERE" || message.author.id === "ANOTHER ID HERE") return; meaning that if you have that ID then you cant use the cmd?
Yes
if (id != "id" || id != "id 2") return;
if (id != "id" || id != "id 2") return;
gotta use !==
but
You don't have to use !==
Send code
k
you need &&
You probably done something wrong
No you don't.
He's checking if it's id 1 or id 2
not both
id != x || id != x is always true as one will always return false
if you check for your ids, and then return, you excluded both of you, but everyone else can use it obviously
Both can be false in an or statement
client.on("message", message => {
if (message.author.bot) return;
if(message.channel.type === "dm") return;
if (message.author.id !== '364836696149458944' || message.author.id !== '390969718535618561');
let prefix = "-";
if (message.content.indexOf(prefix) !== 0) return;
const args = message.content.slice(prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
if (command === "restart") {
const embed = new Discord.MessageEmbed()
.setDescription(":computer: Restarted.")
.setColor(0x00AE86)
message.channel.send(embed).then(() => process.exit());
}
});
0 | 0 = 0
0 | 1 = 1
1 | 1 - 1
No wonder
ID = 3
ID != 1 || ID != 2 -> true
ID != 1 && ID != 2 -> false
yeah in this case && instead of ||
is that the problem
No
yes
The problem is the if (id == id);
so what do I change
the semi-colon to a return;
but then if I execute the command then I won't be able to use it
there is no command behind your if. the whole if has no point at the moment
People use the whole event as a command which is stupid.
I'm not sure what to do to make it so only those IDs can use the cmd
Doesn any one know why my bot is offline but the console says the bot is online. But no errors in the console ... discord.js v11
client.on('message', function(msg) {
if ( id != 'your_id' || id != 'your_other_id' ) return;
});```
but then i wont be able to use the command
@royal portal if (message.author.id !== '364836696149458944' && message.author.id !== '390969718535618561') return;
no
as soon as one of those IDs is present, the if statement is wrong therefor we do NOT return
if (message.author.id != '364836696149458944' || message.author.id != '390969718535618561') return;
then try mine
Neither will the &&
i didnt even use the &&
try it
true & true -> true
im just gonna use my old way
if (!['xxx', 'xxx'].includes(message.author.id)) return
@royal portal try this
thats exactly what we want paradox, please stop confusing everybody
Director's way works too
Use the console. Prove me wrong.
I'm not here to prove anything to you. You just have to rethink the situation then it is obvious.
Doesn any one know why my bot is offline but the console says the bot is online. But no errors in the console ... discord.js v11
@heavy marsh's way worked
๐
thank you guys
@heavy marsh not sure if this is possible but maybe use if client disconnects then
process exit
and it restarts
pm2
I tied it's still the same
@heavy marsh maybe your connection
I guess so to
bannable
but discord.js would automatically reconnect
@heavy marsh if i were you, i would just install latest version of node.js and discord.js
well update v11 to v12
my v2 is in discord.js v 12.1.2
how do i make my bot response like this
need help on them?
a little
ok
havent done that
embeds
discord.js?
yes
^
ok thanks
v11 or v12?
12
ooh ok then use the link I sent
ok
does anyone know if there is a discord.js function that just checks if the member is bannable by the bot or do i have to make a manual check
You can use .bannable on a guildMember
its here
thanks
client.on('message', msg => {
if (msg.content === 'ok') {
const embed = new Discord.MessageEmbed()
.setTitle("ok")
.setColor(0x00AE86)
message.channel.send(embed)
}
});
.then()?
there is no point in adding .then() you can just catch immediately
@next mica
yes
Why is .then() there?
Remove the .then()
i did
The catch was fine
so
and i put what i want to say in the (embed) part
ok
in the setTitle("here")
ok
You should read up the docs on embeds, and find out what you can do with them. Since there is a lot.
Yes. @royal portal
If you need to access the promise resolve that a promise returns use .then((response) => do something)
is there a difference
or using an async function
that example craashed my bot blox
let resp = await promise
.catch is the same as doing
try { message.channel.send('content'); } catch(e) { console.error(e); } ```
^ not really
wait can i do something like
unless you await it
Yes.
?
If the bot encounters an error the .catch will be called
@royal portal yes
okay
Also Tim, Prove me wrong but this would never work right? https://discordapp.com/channels/264445053596991498/272764566411149314/699363662070153336
Actually let me rephrase, It would be constantly true thus make nothing else work.
if id is not ID1 AND id is not ID2 -> return
Considering a user can only have 1 ID it will always return, Yes?
no
if the author id is not equal to that id AND if its not equal to the other id, return
so it will only not return if the author id is one of those two
i got confused for a sec too lol
Yeah I tried doing it in the console must have done something wrong so it was constantly returning.
probably missed the !
on one statement or something.
But thanks!
I feel kinda stupid for arguing with that guy.
it happens xd
:\
@quartz kindle if setActivity stops working or something in pm2 then will it restart bot
Stops working?
Explain
setActivity stopped working for others too
pm2 has nothing to do with your bot's code or with discord's api
pm2 will only restart if the process crashes or exits
and if running in --watch mode, it will also restart if your code changes, ie: if one of your bot's files gets updated
Does pm2 run cluster by default?
no
Ah I think I enabled it for running Python
So i have a warn command that it works and adds + 1 to the amount of warns they've got... But how can i make it so it has 0 warns for every different guild that the user was not warned on?
What are you using to store?
well
A json file lol
Oof
I think he's trying to do warns for that server
change it before trying to do that.
Hmm... Ik that a db is better than a json file but imma switch things up later...
but you'd do something like
warns[guildID][userID] = {};
I feel kinda stupid for arguing with that guy.
@warm marsh happens to the best of us. don't worry bout it
But change to an actual database first as changing it later will be a pain
Sorry @blazing portal ๐
Oh... I did it like this instead lmao:
warns[message.guild.id, warnM.id] = {}; lol @warm marsh
oof
It'll be laid out like this in the json file which you don't need to worry about as long as your current code works.
{
"guildID_1": {
"userID": {}
}
}```
But that's nothing to worry about.
get_user isn't a coroutine
TypeError: object User can't be used in 'await' expression```
Yeah
remove the await
You don't await something that isn't a coroutine
In last discord.py version you don't await anything that starts with get
Instead, whatever that starts with fetch is to be awaited
Does anyone have tips for prefix or syntax for in-message commands ? Like a command where the prefix is allowed inside a message?
More like !command this
Search for the prefix and check if it has anything after it?
Where you have symbol to indicate the command the it's arguments
Language?
But I don't think only a prefix is sufficient maybe
No it will be
Because the prefix symbol may also appear out of context where nothing is meant to happen
Like I said just check if there is content after wards.
Idunno just trying to eliminate false positives of the command being called
Then take that as a command and check against it.
But what symbol though
The less it's used in regular messages the less the chance is for a false positive?
Yeah
for instance
using a longer prefix will lower the chances
like botname?!
or something stupid but even still it won't matter if you've got a proper command handler it should just return anyway
Hmm actually reminds me i heard of ppl using @bot as prefix
@warm marsh the thing you said:
warns[guildID][message.mentions.members.users.first().id]
Didn't work lol
OOF
Is warns an object?
warns โ
let warns = require('./warns.json');
@warm marsh
Okay
@warm marsh
You might require another variable idk though
I switched the guildID'place with the user id and replaced that error's id with the guild's id
let guild_warns = warns[guild_id] || {};```
something like this might work although probably isn't recommended
(warns[guild_id] || {})[user_id].prop = val;
Wait... Where would that be placed though?
@earnest phoenix if you use js you could do something like
if (content.indexOf(prefix) == -1) return;
let args = content.substring(content.indexOf(prefix) + 1).trim().split(/\s+/);
let cmd = args.shift().toLowerCase();
(warns[guildID] || {})[message.mentions.members.first().id] is fine
But even still you're probably best doing it another way.
@quartz kindle hmm so that code would be placed where lol?
In replacement of the old code
That's how you'd get or set the amount of warns a user has per guild
Oh i see... Wait lemme show you something real quick
instead of warns[guildID][message.mentions...]
There?
If you require a json file do you need to run JSON.parse()
That's almost impossible to see.
No
requiring a json file already does it for you
Lol
you would need to if you loaded the json file with fs
@warm marsh lemme get you the telescope
Thanks
I don't understand how people can create bots, I lack creativity and just get burnt out instantly so give up.
@warm marsh here?
better than making generic bots lul
@earnest phoenix the thing is
you have a data structure with nested variable keys
You don't need the if statement check if !warns[]
your data looks like this, right? data.somethingOrNothing.somethingOrNothing
@quartz kindle in the json file?
if the first key doesnt exist, the second key will throw an error, because you cant get a value from nothing
yes
Hmm lemme show you how one of them looks like lmao
so every time you try to access such data structure, you will ALWAYS need to check if the first key exists, before attempting to get the second key
you cant ever do something[a][b] you will always need to check if something[a] exists before doing something[a][b]
But doesn't seem practical in that situation.
@quartz kindle this is the coins.json
you mean ternary?
I don't think it's called that.
It might be though.
I just know you can do
let obj = { prop: { } };
obj.prop?.someprop
and it won't throw an error.
Just returns undefined.
never seen that before
Hmm
Welp imma try my best... Thx for the help guys...
Okay.
Yeah I've never seen that before either
Well I never knew it's name but knew of it.
works with objects, arrays and functions
?.[index]
Also, Is this very in-efficient? I've Googled for ages and found no other way.
async commandLoader () {
const DIR = path.join(__dirname, '..', 'Commands');
const _ = await readdir(DIR);
if (_.constructor.name == 'Array' && _.length > 0) {
for (const file of _) {
let { name, ext } = path.parse(file);
if (ext == '.js') {
const $ = new (require(path.join(DIR, file)))(this);
const m = getInstanceNamesFromClass($);
m.forEach(cmd => {
this.commands.set(cmd.toLowerCase(), {
run: $[cmd],
category: name,
cls: $
});
});
}
}
return true;
}
else return false;
}```
tried to get https://oliy.is-just-a.dev/g2n22k_3559.png but my server was being fucky
it gets all custom methods from a class and returns them
According to node.green, optional chaining will be supported starting with Node 14, but will still require the --harmony flag.
getInstanceNamesFromClass function
does readdir ever not return an array?
more likely to return an error than a non-array lol
RIP
So far no errors though
Reason I'm asking is it just seems very long winded and overly complicated. Due to lack of decorators I couldn't do it the way I'd do it in other languages.
it does indeed seem overly complicated
It gets the classes dynamically and each have their own methods with different names which are cmd names
Yeah font-ligatures
At first when I started using Fira Code I was so confused
due to the symbols
so you're basically requiring a class and loading each class method as a command
Yeah
I just end up using a function below the class declaration
i think you could export an object/list of methods or something instead of iterating through property names
would give you more control over what gets exported and make it less complicated
the class is already instantiated before being exported?
ah yes i saw it
Then stored in the map as .cls
So I can call the method later and still have access to its properties
then you could do an exporting method that returns a list of methods
cmd.run.call(cmd.cls)
const $ = new class()
const m = $.getMethods()
I'll implement that for hiding methods.
My naming convention is really bad.
Probably should change it.
i do stuff like that too lol
gives the illusion that the code is smaller/lighter/faster lmao
Omg I'm not the only one that thinks that
hahaha
Is the harmony flag what enables wip features ?
Cannot access '<init>': it is package private in 'Inbox'
Does anyone know what this means?
And how I can fix it?
where does that error come from?
println(Telephony.Sms.Inbox())
Most of those are kind of meaningful which is more than I can say for stuff I code.
@quartz kindle
i have no experience with that
i checked the docs, and it looks like its supposed to be used as a property, not a method
but im not sure
I don't know what a property is. I'm coming from Python and Kotlin is confusing.
Kotlin doesn't use the 'new' keyword?
I don't think so
i found this example code
from what i understood, Telephony.Sms.Inbox only contains the URI address to be used with contextResolver
Telephony.Sms.Inbox.CONTENT_URI
but then again, i dont even know java, let alone android lul
So i have a userinfo command that works completely fine but in the currently playing field... It shows the game that the user is playing but when the user has a custom status... It only shows custom status...
How can i make it so it shows what the custom status actually is?
Play with eval, and go far down into the code and you will find it.
lemme check for you :P
Okie...
hey, how can i make my bot avatar circular on top.gg?
You can't i guess... You just have to make the avatar circle and then the other areas to be completely transparent... @earnest phoenix
F, forgot. Now gimme a sec
@earnest phoenix I think you need the presence intent from verification on Discord to do it
Since I can't do it anymore
Hmm... I will look at that and see how it works
@wide wharf no im not
Is there a better api than Nekos.life that doesn't require a minimum number of guilds?
You can just parse the image from the home page?
Is new on each request
If they won't let you use the actual API 
@earnest phoenix should be either name, details or state
Would it be worth moving to TS so I could use decorators or is it un-necessary ?
@quartz kindle here or where
yes there
@quartz kindle idk how to do that lol
embed.color?
@warm marsh depends, if you are used to typed languages, maybe you'll feel more comfortable with typescript
.setColor('#HEXCODE OF THE COLOR'); @vivid cargo
Typescript uses the same kind of syntax as Kotlin which I think is kinda disgusting but at least it's typed.
Well, I guess Python, Rust and a bunch of other languages use it too.
guilds.cache.size
fast ๐
haha these update are so useless for us ๐
Just making everything usefull on internet outdated asf
@earnest phoenix thanks
@earnest phoenix wdum my friend
Its like
so harder
for us
u like forced abs' everyone to change they way to code and made old one outdated
They didn't change much
Ah fair
Cuz there is no real examples
U just have some pieces of things but not a real context
not everything needs an example
@earnest phoenix true but some of them would need
the library expects you to already know the language
When u create a new different version
u don't automaticly know the language
yes you do
U need to learn the news, and if its not well explained then ur like forced ๐
Paradox i mean the key words
Anyway probably usefull for discord optimisation
but on devs side if ur not like really into developpment
u will have some troubles for sure :)
I coded many advanced bots and i know what i did
Paradox also didn't found the guild users size on the doc
tried newclient.clients.cache.size but nope
i mean the bot users size*
it's the same as the prior
And it's on the first page I sent.
You just need to look.
every collection that had contained cached entities is now in a cache manager object, the actual collection is now found in a .cache property
any half-decent developer will read over the changes and quickly understand exactly what he needs to do, without much examples
because the basics of the language never change
Yeah i didnt explained myself proprely
Does discordjs have an exception for LoginFailure
yes
like import { LoginFailure } from 'discord.js';
newclient.login(data).catch(O_o => {message.channel.send("โ Error : Provided token is not valid anymore.");return;})
if you know what keywords such as "property", "method", "array", "object", "class", "promise", etc... means, you should be able to quickly pick it up
How are you supposed to send to the channel if the bot doesn't come online?
Its a bot in a bot
๐
If newclient isn't working then main client inform the discord
How are you supposed to send to the channel if the bot doesn't come online?
you can
I'm not doing that also isn't fully what I asked for.
websocket != REST
the bot needs to only login once in the entire lifetime of the application in order to send messages while not logged in
Yeah it'll be using await
@earnest phoenix thats a good idea, but a bad idea using discord.js
Single threaded being one of the reasons
I mean i do that cuz im interacting from my discord to insert the token ๐
discord.js eating ram for breakfast being the main reason
Oh and that I guess.
Hmm... How can i fetch all the uncached members of a guild then filter them?
you can do guild.members.fetch() in v12
if you leave .fetch() empty, it will fetch all members
Won't show my precious admin mp code
you censored everything but the thing that needs to be censored in the token lol
the last part of the token is the most important thing
didn't show as much as u will need ๐
to get control of my bot haha
@quartz kindle then after that gets fetched... How can i filter it to show them like if they're actual users or bots?
(With fetching them all way)
it returns a collection of MemberObjects or UserObjects
await guild.members.fetch()
let bots = guild.members.filter(member => member.user.bot)
or if member.bot {} else {}
Oh i see...
Something like that
But much cleaner like tim showed
Ik how to filter them lol i was just asking if it's different with the fetch them all way or the normal cache way
once they are fetched, they will be saved in the cache
Isn't it a required argument in-order to save?
Hmm so the cache has to added into that line after let bots = ?
just for fun, try using it on discord bot list lmao
see how your memory usage climbs
there is an argument to not cache
cache is the default
Oh lol
let members = await guild.members.fetch();
let bots = members.filter(...);
Does u guys have any ideas of more stats i could give ?
embed.addField("Actual token : " , token)
embed.addField("Total Servers : " , newclient.guilds.cache.size)
embed.addField("Total Members : " , newclient.users.cache.size)
embed.addField("Discord Latency : " , client.ws.ping)
embed.addField("Bot ID : " , newclient.id)
embed.addField("Bot Name : " ,newclient.user.tag)
Nice
Maybe dont add a token..
even fake tokens..
Its a real token
if it looks legit it can cause confusion if its something like that thats fine
how to explain
its a like customer pannel
and customer have a bot session
to manage their bot
And they can select the bot to handle
That bot will probably kill your host
Wdum kill our host ?
so your bot hosts other bots 
Yeah ๐
is it like BotGhost?
BotGhost ??
a bot that hosts bots... INTeresting
Its kinda complexe to create but i like that
Complex
im french sorry ๐
haha, why die fast ?
Ram usage will be through the roof.
discord.js eats ram for breakfast
If you've got many bots running.
it also eats cpu for breakfast if you dont use intents
How much spare ram have you got?
3GB
RIP
Its much more than enought
well, 3gb is enough for a while
Trust me
but it will hit that pretty fast
Back in the day my bot would be using 500mb with dbl and my server
Even with 20bots it won't probably hit that much cuz its not like crazy using
Also its not like h24 bots started
its idling if the user is not doing anything
What's the purposes of these bots?
Couldn't you shorten it to be something like a webhook or even just querying the API yourself?
Its like get statistics, logs , history , managing
No because its suposed to be like a free hosting
Kinda complex i don't know what i want to end with
well, its an interesting project
i dont quite agree with it or think it will work, but i support you and say go for it
[Still wondering how to get the custom status of a user to be shown]
it basically just disconnects the client and leaves you with a huge ass zombie client
client.on("ready", () => {client.user.setActivity("Manage'Bot users.", {type: "WATCHING",});})
the same thing you're already using
WATCHING,PLAYING,STREAMING,LISTENING(Maybe removed)
@earnest phoenix I didn't meant setting a bot status lol
oh like scraping user status
@earnest phoenix what do you have to show the user's game?
I just did
useri.presence.activities lol @quartz kindle
activities is actually an array
so user.presence.activities[0]
then you can get .name .state .details etc
from it
I see...what does the state do?
the user's current party status
Hmm... I see... Welp thx for the help...
Nice
Yup lol
@quartz kindle wait... What about if the .details returns null?
@quartz kindle
does anybody use mongodb
Oh nevermind it should have been .state lmao @quartz kindle
yeah it was either details or state
Changing language TS is too salty for me.
lmao
i feel that
i honestly feel like a lot of mongo's API is pretty inconsistent and has odd naming schemes
i'm running into full connection issues at the moment
auth issues if i try from my pc, and if i try on the server itself it can't even find it
yeah, don't have a lot of context there but it might be more of a networking issue than anything mongo can pose to you
is there any issue with dbl api
No, but if you are having trouble posting your server count or any issues with it, feel free to let us know in #topgg-api ๐
Could someone point me in the right direction for message dictation? I want my bot to respond to a message regardless of a words position.
Hi
I'm not sure what you actually mean by that, as a bot prefix should not contribute to a volume of a bot.
Some bots allow customization where you can change the prefix of them with a simple command, like Rythm, not sure about other bots but it might be possible through their dashboard.
If you're developing a bot that has the same prefix as some, I recommend changing it for now until you're ready to have it released publicly on top.gg, or making a chat where only certain bots can see it.
basically all of the symbols
For this server anything with a common prefix can't see chats, any basic symbol that can be typed.
My bot is an example, The RP Bot, he has a prefix of /, so it can't ready any of these chats.
its usually suggested to use text as a prefix to avoid overlapping. for example, Dank Memer uses the pls prefix
Having a unique prefix will help greatly, and you can set the bots status to display its help command with its prefix.
At some points in time my bot will display 'Watching /help', that tells others what my bots prefix is and the command to get its commands list.
Exactly.
I have mine tied to a symbol because it brings FiveM to consoles that way so.
I have a userinfo command and it works fine... But how can i make so it doesn't show undefined on game or custom status if the user not playing a game or doesn't have a custom status?
check to see if its undefined first and if it is then you can put "none" or something
Hmm ah yes... That would work... Lemme try that...
@oak cliff it didn't work... But the code looks like this:
i cant read that its too small xD
Lol lemme get you my telescope
did it give you an error or it just still says undefined
@oak cliff it just says undefined... (The user i mentioned is not playing a game so it shows undefined)
@oak cliff also here is a zoomed up version of the code
maybe it would help if you put the undefined check first
Hmm so before all that... I would check it first out of all of them? @oak cliff
yeah you could try that. when i check if something is undefined i do that first before doing anything else with it
Just put some condition checks for if the user is not playing a game to not include it in the embed
Hmm... Welp... Brb in a second
@oak cliff now i checked for the undefined first and it shows that no matter if the user is playing a game or does have a custom status lol
im not sure then 
Hmm...
hey, any idea of how can i move my ubuntu server to a new one?
like the files and the db and everything
@hereWhen i want to update my bot, does it do it automatically or will i have to do it manually. If i have to do it manually, can someone please tell me how?
Depends on how youre hosting it @royal laurel
no one?
Then you can just edit the files and node . on it
@pallid marsh scp for files, not sure about the db
Ideally
ok
If you are in the directory
thank you
yes
i am
thank you
also
how long does it generally take to approve of a bot?
1-2 weeks average
ok
up to 3
um does some1 knows what does it menas
and what do i need to fill in here
is it like the host i use?
Please do not post that image host url here again
This isnt the place to ask, I'd head on over to discord.gg/discord-developers and ask there.
ok
-auctions
What are auctions? What is #bids for? Click here to find out
Also wrong channel to ask
console.log('Am i a developer yet?');
"This action cannot be performed because the application is verified. Please contact support."
What action?
@earnest phoenix You gotta contact Discord support, this is not the place. support@discordapp.com
Unless its gotta do with DBL, but we don't handle anything with verifications here.
wuuut im curious now what action?
im trynna add my bot into a team lol its not even verified
Ya you gotta contact discord support
yea doing it
are you sure because you have the verified developer badge
"This action cannot be performed because the application is verified. Please contact support."
Read again. Because he was verified, he could not perform the action.
no but he said the bot isn't verified 
Maybe he verified before adding to Team?
@queen needle mathematics your brain
60 * 1000 = 60000 which is 1 minute
i have a brain??
Yes
10 minutes
search 24 hours to milliseconds
okay thank you
No problem
client.on("message", message => {
if(message.content.startsWith(PREFIX + "invite")){
let invite = message.channel.createInvite(
{
maxAge: 24 * 60 * 60 * 1000, // maximum time for the invite, in milliseconds
maxUses: 10000 // maximum times it can be used
},
)
message.channel.send(invite + ' thats your invite it will last for 1 day and 10000 uses')
}
});```
in the message it says [object Promise] not a link?
That's because createInvite returns a promise
oh
just resolve the promise and then figure out what property of the object you'd like
because an invite object involves several pieces of data
i thought it just need how long it last and how many people can use it
uh
yes
but like, invite the object promise it retuns needs to be resolved
and then it returns an object
Hi
i think invite.code would return the code for the invite but i could be wrong
the code is the numbers part right?
Lemme check my code for my invite command
I want to raise the bar my right on the site how can I help @spare goblet
just await and if all fail just fallback with .catch
idk what youre talking about @earnest phoenix
this is really strange. 4 days ago my bot was approved. server count reached to 3300 from 68. every hour 40-50 servers. But last 8 hours no on added it. any issue with top.gg ? is there any special offer that new bot gets bumped?
how do you get a programmer's rank @spare goblet
client.on("message", async message => {
if(message.content.startsWith(PREFIX + "invite")){
let invite = await message.channel.createInvite(
{
maxAge: 24 * 60 * 60 * 1000, // maximum time for the invite, in milliseconds
maxUses: 10000 // maximum times it can be used
},
)
message.channel.send(invite + ' thats your invite it will last for 1 day and 10000 uses')
}
});```
doesnt work
@earnest phoenix you submit a bot into the queue.
Not server
don't send link to your server pls that's advertising
client.on("message", message => {
if(message.content.startsWith(PREFIX + "inv")){
async function replyWithInvite(message) {
let invite = await message.channel.createInvite(
{
maxAge: 10 * 60 * 1000, // maximum time for the invite, in milliseconds
maxUses: 1 // maximum times it can be used
},
`Requested with command by ${message.author.tag}`
)
.catch(console.log);
message.reply(invite + `Here's your invite: ${invite}` + "There has been an error during the creation of the invite.");
}
}
});```
doesnt work?
you are never calling the function ?
^
you can remove the function and put async before message like Lumap said
yea
client.on("message", async message => {
if(message.content.startsWith(PREFIX + "invite")){
let invite = await message.channel.createInvite(
{
maxAge: 24 * 60 * 60 * 1000, // maximum time for the invite, in milliseconds
maxUses: 10000 // maximum times it can be used
},
)
message.channel.send(invite + ' thats your invite it will last for 1 day and 10000 uses')
}
});```
so that
try it
doesnt work
Console ?
Just between the) and message.channel.send
now when i send a message it says undefined
this is really strange. 4 days ago my bot was approved. server count reached to 3300 from 68. every hour 40-50 servers. But last 8 hours no on added it. any issue with top.gg ? is there any special offer that new bot gets bumped?
If your bot gets added to our site, it can reach a page called Trending, your bot stays on here until it gets pushed off it
Other bots joined
didnt get it
You start on 1, and get pushed to 2 if another bot joins it
when i do the command it says undefined now
This continues until you get pushed off spot 6
oh
@queen needle hmmm
so i lost that 6th spot?
Check bot perms
i mean i am 7th now?
There is no 7th
i mean
It just disapears
i lost my 1,2,3,4,5,6th spots
No
how trending works, who can see this channel
You get pushed off
my bot has a role that has creat invite permission
Hmm
i have no clue why it says undefined
what's wrong?
client.on("message", async message => {
if(message.content.startsWith(PREFIX + "invite")){
var invite = await message.channel.createInvite(
{
maxAge: 24 * 60 * 60 * 1000, // maximum time for the invite, in milliseconds
maxUses: 10000 // maximum times it can be used
},
).catch(console.log);
message.channel.send(`${invite}` + ' thats your invite it will last for 1 day and 10000 uses')
}
});```
it says undefined not a invite code
idk why
no error? log invite
okay
Ensure you have perms to make an invite as well.
got it to work
and i do
but it says it cant last longer then a minute
it says it cant be greater then 86400 which is 1.44 minutes
client.on("message", async message => {
if(message.content.startsWith(PREFIX + "invite")){
var invite = await message.channel.createInvite(
{
maxAge: 24 * 60 * 60 * 1000, // maximum time for the invite, in milliseconds
maxUses: 10000 // maximum times it can be used
},
).catch(console.log);
message.channel.send(`${invite}` + ' thats your invite it will last for 1 day and 10000 uses').catch(error => {
console.count(`${error.message}`)
});
}
});```
error.message will say the issue
it says maxAge can only be greater then r equal to a 86400
so i cant have it last longer then 1.44 minutes
@blazing portal js if (message.author.id == '364836696149458944' || message.author.id == '390969718535618561') { console.log(`Blacklisted, Skipping...`) // or message.channel.send(`rot buddy`) // or message.channel.delete() // or message.author.ban(`noob`) return; }
thats how you do it
make sure IDS are correct
Why has my bot been "awaiting verification" for 2 months now?
2 months?????
lmao
yes 2 months
u cant initialize smth in a "if" condition and using it after
@high bough try
i finally finished my first version of my bot!
its called admin bot
and
i would liek to have some suggestionss for what to put into it
But now I'm getting this...
@high bough There is a message that's either undefined or empty.
So it can't send a message that has no content.
ig it doesnt work for v12 anymore
tbh, better to go to discord servers that are really for developing
like tsc menu docs
Or even the official djs server.
yea
yep thnx
i need latest docs there are many changes in v12
@simple pollen https://nmw03.is-inside.me/SrZYCMVh.png
lol docs are up to date
v12 is mainly like MessageEmbed() and .cache
can u just dm me djs server link
client.on("guildBanAdd", function(guild, user){
setTimeout(function () {
console.log('timeout completed');
}, 1000);
});
Does anyone know how i can get the UserID of the guy that banned
^
fetch from audit logs
How can i do that ?
Uh where am i suposed to put my filters ?
.then(audit => console.log(audit.entries.first()))
.catch(console.error);```
