#development
1 messages · Page 711 of 1
I'm trying to setup OAuth on my website but I'm not using express. So I was wondering what other ways I could use it but preferably js.
Express is just an http router I thought
Yeah.
Check this out https://oauth2-server.readthedocs.io/en/latest/
@warm marsh you could use my library although I haven't completed the docs
Oh wait do you need an oauth provider or client
Dang why not call it discoauth
it was already taken I think
Unlucky
I tried like 20 names before this
I recently remade this to optimise it and stuff so I have to write the documentation all over again
Yeah I linked to an oauth server implementation not a client for authenticating with discord
Although I have written pretty good jsdoc IMO
so it should be easy to use
if you're using a text-editor with auto completion enabeld
Decent comment coverage tbh
ty
I was planning to add more features but I gotta document these basic features first
O btw, I need slight help with vue js. I wanted to apply a specific CSS class to an element only when the user has scrolled enough. But when I used window.pageYOffset || (document.documentElement || document.body.parentNode || document.body).scrollTop to get the value for how much the user has scrolled as a computed property, it would say window not defined or document not defined. Can anyone provide me with reasons or workarounds for this?
Thank you
(Also, I only seek solutions not recommendations)
ok bro
Goodluck bro
@unique nimbus bro now i need verify bot how i can?
you dont have to do anything, just wait
you will receive a message
if its approved or not
You get message from Luca my friend
Luca come to you and say if it is accept or not
If it not accept you need to apply again friend
ok bro thank you 
No Problem Bro
@unique nimbus but noow person can invite bot without verify?
person will invite bot to testing server and test bot
person can invite bot if you give link
only after approve
goodluck bro
When bot gets accepted you can request bro
now I,m just stop really?
My friend your bot is in queue. It needs to be accepted for auctions to work
Don't worry bro
lol bro
No Problem
you forgot the bro
What are possible reasons a command doesnt respond or error at all ?
everything
if you forgot to sEE the message
it could be literally everything
what do you mean by see the message ?
if you didnt see the response
ok well just saying "everything" helps me not even .01%
ik
ill just wait for someone who maybe has some more answers :)
bc it could be literally everything there is no specific reason to a command not providing a response or error
just listing a few possible ones rather than "everything" would help a lot more
it sucks cuz it doesnt even error
because the reason is, everything
it most likely is erroring and you aren't handling it properly
you tell yourself that
it's rare to see a js dev who knows how to properly handle an error
i dont have an error handler
here, that is
just 9 times out of 10 its sent to the console
then do that
damn that worked
found the issue

const guild = client.guilds.get(args[0]);
^
SyntaxError: Identifier 'guild' has already been declared

is it already declared?
Not that I know of..
i see it now
on the line before it lol
} catch (err) {
^^^^^
SyntaxError: Unexpected token catch
``` Also this use to work..
fuck
nvm
what line is that from
there's no try statement
is there?
i think the try statement from line 12 ends on line 114
oh?
the check user permission function isn't declared inside the try statement
//code
} catch (err) {//}
Please just fix your syntax.
Your code is unorganized. Even your checkUserPermission function returns before the extra stuff is handled, assuming you meant to put it outside.
lol idk where your bracket blocks start or end cause the formatting is so weird
looks fine to me
oh i see what happened
your catch block is at the end of a function instead of the try
just move it to the next closing bracket
idk lol this is pretty messed up
eh looks fine

your catch should be at line 211
probably am gonna rewrite this command tbh
wait wtf is going on here https://bruhh.wtf/oVsPmZWFEO.png
deleted that part
is it allowed to remove the bot from dbl and add it back in?
If you remove it from the website, you need to apply it again and get it verified again
yeah my bot blew up because it was on the front page of the new category
trying to relive that moment
Ehh idk about that lol
i mean thats my speculation
it did get to 300 servers in less than a week
enough for verification, just didn't have enough votes
why would you want to remove it if it's doing good
that sounds like a bad business decision
he wants to have it relisted on the front of new
lmfao
Hi im back
So this is the new rewritten code with no error and no response.. https://hatebin.com/vqkumaktje
@amber fractal its losing servers now and not gaining much
do any other commands work @ember atlas
and are you sure that you have all of those databases filled out?
yes they do.
I'm having an issue with referencing the data in this array. I've got it queried, but how do I take from it? Heres what I have so far. https://hastebin.com/mihefuvalo.js (code returns as undefined, this is also discord.js)
so basically
.addField('Moderator Role', `${modrole.name || "No Mod Role"} (${modrole.id || ""||})`, true)
something like that
syntax error

there
thats probably why its not sending
@gritty bolt I'm not familiar with MongoDB, but it's an array, so you'd just index it (<Array>[0]).
so like result[0]?
try it and see
undefined still
how'd you access it
where's your code
hastebin above
nvm
except user is now replaced with result[number]
also got `` let user = result[]
^
SyntaxError: Unexpected token ]``
you need a number
oh fixed that
lol
that was an autosave
i still am getting undefined for my user varaible
weather i put in [author] or [0]
https://oliy.is-just-a.dev/yytbpt_1669.png yes otherwise known as a bad move
(author is the name of the value for the user)
a decline in servers is generally considered a bad thing
Sbss can you show the updated code?
is this the method you're calling? https://docs.mongodb.com/manual/reference/method/cursor.toArray/
removing the bot doesn't mean removing all of the servers its in
only this and maybe a few others
but it will rejoin in a week or two
why are you indexing the 2nd item when there are only 1 items in it
.addField('Moderator Role', `${modrole.name || "No Mod Role Set"} (${modrole.id || ""||})`, true)
^
SyntaxError: Unexpected token }
What happened when i used your code spooky guy

leading ||
oh
but then after that how do I get to the data?
if i change user can i use the newvar.item?
Items is just "items"/a name. I recommend you check out javascript arrays and indexing values/items.
tried looking at those
to be more clear just in case i wasnt before
im trying to define my array so i can get the value of an object inside
What is the Discord API endpoint for getting username?
Are you using a library, or actual calls.
have you tried https://discordapp.com/developers/docs/intro
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
wait how to do code bin?
ya that
\\let x = 5\\
there you go
ok thanks
you can also give it a lang to color it better
how to do that?\
ok
python: im having an error. so i have this
money = None
than in an async function, i do this:
global money
money += 10
it gives me an error:
TypeError: unsupported operand type(s) for +=: 'type' and 'int'
how to fix this?
money is None, and int is not None
im trying not to define money = 0because that resets money every time I run the code
what to do?
What’s wrong with this code https://hastebin.com/uvexalosob.js
You could assign it directly with = instead of +=
No response to command. No error.
can you confirm the command is being executed?
By doing what ?
a console.log at the top of run or something
We did it Boys my Bot is one of The Only who can play YT
get ready for serverjoin flood
But my Bot is not approved lol
module.exports = {
name: 'guild',
alaises: ['data'],
description: 'Gets data.',
usage: '<server id>',
category: 'owner',
run: async (client, message, args) => {
console.log(command.name)
@tranquil drum would this work?
oh then rip
ya
except there's no command def lol

I hope my Bot will be Approved nxt time
idk what to define it as
Rythm not
not even registering as running @tranquil drum
where are you calling the run function
does it have the await keyword
no
try putting the await keyword
await isn't required
where are you calling it?
what?
can you show the code where you call run
um
module.exports = {
name: 'guild',
alaises: ['data'],
description: 'Gets data.',
usage: '<server id>',
category: 'owner',
run: async (client, message, args) => {
idk what u mean?
like actually execute it?
likely to be occuring in the message create event
this tbh
i imagine you import the module somehow then call run()?
ya
you can check if the command object actually exists for the command you're trying to execute
hm?
to truly help, we'd need the message create function, but we probably don't want that. Maybe check the checks you did to see where it's failing. Sometimes it can be simple mistypings
do you have something along the lines of if message.startsWith(command.name)
it would error tho
or where is command defined / populated
client.on('message', async message => {
let prefix = await db.fetch(`prefix_${message.guild.id}`)
if(!prefix) prefix = '!'
if (message.author.bot) return;
if (!message.guild) return;
if (!message.content.startsWith(prefix)) return;
if (!message.member) message.member = await message.guild.fetchMember(message);
const args = message.content.slice(prefix.length).trim().split(/ +/g);
const cmd = args.shift().toLowerCase();
if (cmd.length === 0) return;
let command = client.commands.get(cmd);
if(!command) command = client.commands.get(client.aliases.get(cmd));
if (command)
command.run(client, message, args)
});
I feel like we are in endless and useless loops
nah we're tracing the problem back
Every command but this specific one works
you could have a problem when populating this one command
client.commands = new Collection();
how do you add them commands to the collection?
theres a whole command handler and stuff
can you check if command is defined?
teemaw it's a basic command handler. An example would be an idiots guide one
this aint an idiots guide lol
like right here
ik, but it's similar
just console.log(command)
ya true
how to solve the problem?
i dont use that so idk
yeah idk what that is @gloomy lantern
Ok, added the console.log, ran the data command and got undefined
that means the client.commands collection doesnt have that command
running a command that works gave me
{ name: 'ping',
category: 'info',
description: 'Pings the bot.',
run: [AsyncFunction: run] }
or your method of querying the collection is faulty somehow
hm
that's why there's no error
if all your other commands work then it's probably not the fault of querying the collection
so i imagine there's a problem where you add this specific command to the collection
hm
I don't know what IDK is
code me each has thrown off
the thing thatadds the command is that module.exports = {
// blah
}
idk = i don't know
let me go over that
Hmm
@ember atlas
ok well it errors with an actual error now 
what is it
(node:180) UnhandledPromiseRejectionWarning: ReferenceError: r is not defined
Ok well it seems that its registering it again
So thanks teemaw
okay cool
remember what we did here, you can always trace your code back to where the problem is
even if it feels like you're going nowhere
(node:20660) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'name' of undefined
Why would i be getting this at line 51?
Let me get the code
what's on line 51
my bot does not save changes
that means logchannel is undefined
something's probably wrong here https://bruhh.wtf/lZDGalFsAL.png
does that key exist in the db?
oh wait it looks like you're trying to detect if it doesn't exist
Ok, so I canot make it so if its disable it says no channel set on the command?
eyAic3RhdHVzQ29kZSI6IDUwMCwgIm1lc3NhZ2UiOiAiSW50ZXJuYWwgc2VydmVyIGVycm9yIiwgImFjdGl2aXR5SWQiOiAiZjY5M2RjOWMtOTRiYy00NzM1LThhNWYtNzdlMmRhMTk0NmIwIiB9
but if its not set then say its not set
Cod error
oh
i see
you can do a ternary probably logchannel ? logchannel.name : 'No Log Channel Set'
and do that as the field ?
yeah like ${logchannel ? logchannel.name : 'No Log Channel Set'}
same for the id
${logchannel ? logchannel.id : ''}
.addField('Welcome Channel', `${welcomechannel.name || "No Welcome Channel Set"} (${welcomechannel.id || ""})`, true)
isnt that kinda what i have?
not really, it's close
you're checking if welcomechannel.name exists
but if welcomechannel doesn't exist then it'll throw an error instead of false
when you try to access .name of an undefined object
with what i posted it checks the existence of the object itself
so it doesn't throw an error
np lol
embed.thumbnail.url: Not a well formed URL.
??
Proabably referring to .setThumbnail(icon) but what's wrong with that?
console.log the url?
(node:15700) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'tag' of undefined
This just fuckin worked
const owner = client.users.get(thisGuild.ownerID).tag
why not just guild.owner.user.tag
prevents unnecessary functions from being called
k!
(node:18788) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'user' of undefined
thats why :)
do you even have a guild?
.addField('Guild Owner', `${thisGuild.owner.user.tag} (${thisGuild.ownerID})`, true)
This is what I have
log thisGuild
thisGuild is client.guilds.get(args[0])
are you sure the guild owner is cached
yes he is
are you on d.js master or stable?
chances are you're on stable
try npm show discord.js version
You can just go back to the way you were doing it by getting from the id
11.5.1
Hold up I may have given you false information
I never knew how to check the installed package version lemme try something else
yeah try npm list discord.js
discord.js@11.5.1
yeah that's stable
if you go back to the way you did it, given guild is correct, your previous code const owner = client.users.get(thisGuild.ownerID).tag should work.
guild is correct
this caching thing is dumb as shit
so const owner = client.users.get(message.guild.ownerID).tag doesnt work..?
ok so it appears this servers owner isnt cached
works for everything else
ty for the help
ownerID should be there regardless you can try awaiting it 
idk if it would actually do anything though
I return on dm channels
Command can be dmd anyways
Help me plz
custom css
I need code
Not found for that fonts bro
aint giving a solution if thats what you want
style is how you get custom colours/fonts
But how i define those fonts
Its not helpful
this changes the font type
which is on that page or directly linked
Dude its not
i mean....
No
yes
How define you those font with p
But how p select those font only
the vote buttons probably have an id that you could use as the selector
It mean i need to add new fonts over the those old font ?
I not write those font throw my html/css then how can define them ?
Ok ok thanks I'll try it wait
@shy rose can i get cods from other bots with inspect elements ?
Yea its good now i can get with inspect elements
i define money = int
but when I add 10 to money (money += 10), I get an error. TypeError: unsupported operand type(s) for +=: 'type' and 'int'
what should i do
money initially is just an int class
How would I go about checking the above messages recursively until a condition is met?
Can I do it without fetching a given number of messages beforehand and not spam the api ?
Essa
how much is a:
• day in timestamps
• week in timestamps
• month in timestamps
i'm developing a bot that has global timestamps that save and when it reaches the timestamps, it does a purge on servers that invited the bot in and set it up
what
is that like asking how many pages a book has
pretty much
there's no context whatsoever behind this question
which language? what kind of a timestamp? unix? in seconds? in milliseconds?
would you guys be mad if i asked for critique on some non discord related c code?
this is a development channel, you can ask anything dev related
oof looks bad in chat lemme post in pastebin
no pls
why are those preferred ?
dark mode ? xD
dark mode by default, there are no ads or anything else obscuring your view for the text and better syntax highlight
aware uses do-while
and the "question mark" operator
the function is find the greatest common denominator of 2 positive numbers
the question mark is for ternary operations there
it's short for if else
yeah
it's partially for the sake of using it and shorten the vertical length of the code
is it cancer that it uses both if else, ternary operations, do while and while xD?
anyway, i was looking for tips to shorten the code and maybe making it more readable ?
like, i'm not sure what ppl experienced in c would think about styling do-while like this
How can I make it so JS can accept anything coming after a specific string ?
This isn't something usable with Boolean, so .includes() won't help
msg => !msg.author.bot && msg.content.trim().toLowerCase() === following.toLowerCase() + //literally anything following my "following" variable.
startsWith?
starsWith() is Boolean
RegEx maybe?
RegEx 👀
Hmm let me try
What are you specifically trying to do
Like get a parameter value from a cmd ?
following is a letter, and I made a collector to collect each word starting with that letter, but it doesn't work since the collector doesn't understand what "anything following the letter" means
Deff regex then
Hmm
following.toLowerCase() + idk xD
If the structure is consistent you could probably also just trim off the letter aka "following"
following.trim() ?
Still a bit confused
is following a constant letter? I mean, it doesnt change?
Yakumo I think they want to check the first letter of the item in the list.
You could use startsWith as it does return a boolean. I don't understand what you mean by the extra stuff like following.trim() // the purpose.
what do the docs say
I'm looking for a command to dm someone with a discord.js bot. How can I do that?
let user = await client.users.get("<id>");
user.send("message")
hm
Well
I can't explain what I mean in english
But it's not something like that
I want a command that looks like a mute command
$dm @user [dm]
split into args, extract user mention as user obj. use user.send(whatever comes after mention)
k
at item.request.gen.end (/Users/511172/Desktop/BOT/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:85:15)
at then (/Users/511172/Desktop/BOT/node_modules/snekfetch/src/index.js:215:21)
at process.internalTickCallback (internal/process/next_tick.js:77:7)
(node:27750) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:27750) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
code:
code for promptMessage?
the error has to be with emojis
prompMessage works
since it works on other commands
promptMessage: async function(message, author, time, validReactions) {
time *= 1000;
for (const reaction of validReactions) await message.react(reaction)
const filter = (reaction, user) => validReactions.includes(reaction.emoji.name) && user.id === author.id;
return message
.awaitReactions(filter, { max: 1, time: time})
.then(collected => collected.first() && collected.first().emoji.name);
}```
rekt
the error is thrown by that piece of code running*
how to fix?
ok
\✂
What is status code 522 on request failed?
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.
what
well ok then
For the dirtiest company ever, Google has a rather simple description
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.
does messages not have a "edited" property that returns either true or false ?
in d.js
these aren't exactly what i am looking for
I mean, editedAt could tell you
what value does it return if a message has not been edited ?
it wont exist
thats why it has a ? before it
if you try to use it, it will be undefined
i just want some sort of property i can use in an if statement to check if a msg has been edited
if(message.edited)
so you want to know if the message has been edited or not?
yep
if(message.editedAt) should work
i guess js just interpret undefined as false ?
iirc
yes, it's like doing if (!!message.editedAt)
inverts then inverts for if (true or false)
Oh?
Using following.toLowerCase() + message.channel.lastMessage.content.toLowerCase()
And then adding a fancy touch to prevent nuisances
message.channel.lastMessage.content.replace(/\s/g, '').slice(1).toLowerCase()
thanks for code :D?
As you can see, first of all I remove spaces (trim() didn't work) and finally slice the first letter so it gets replaced with following
@earnest phoenix np lol
:D xd
hmm, when using fetchMessages with limit = n, is possible to start from a message that is not the last ?
there should be a from param
ah good to know
this
fun fact
I only use from with Array.from() 👀
if you set the after property to 0 you can get first messages inside of the text channel
Yeah bcs JS starts counting from 0
no
😭
because 0 is not a valid snowflake so it jumps to the first valid message snowflake in the channel
Ahh
this has nothing to do with arrays
It's like slice(-1), -1 is not a valid snowflake so it fetches the last char in a string
Interesting, not sure what scenario that would be useful for xD
So, I am thinking about using it recursively by checking if the above msg was edited
If above msg was edited check again.
Would that be api spam? If there are like 10 edited messages in a row
why
just listen for the event
how do i check if the bot is connected to the same channel as the user who used the play command
The thing is I have to compare current msg with above msg for the main feature
Asking about your attempted solution rather than your actual problem
so what should I tell you about
So the bot servers in a channel which only allows specific type of message relating to the previous msg
So if I type
"0"
Next msg must be "1"
The problem arise if someone edits their before validated msg
Into "99999999"
so listen to the messageUpdate event
Do you suggest just deleting the msg if it is edited?
it's your design, do whatever
Because ppl are allowed to write any text after a valid msg
i don't know how you envisioned for it to work in your head, that's why
i'm just telling you that you should listen to the event rather than spamming requests for it
plus listening to the event would be realtime
I understand
But I think I would still need to compare with above msg and getting above msg by fetching it
Like in this case
0
1
2 edit
3
So the event listener would point me to msg that was just edited
And I would still need to fetch above message to compare with the edited msg to check if it's still valid,
it would still be more optimal
But in hindsight yeah
one request per one certain edit rather than 50+ requests to not even be sure if the message was edited
I need a help on a command Discord.js
My command soo far : ```js
client.on('messageUpdate', (oldMessage, newMessage) => {
let embed = new Discord.RichEmbed();
embed.setAuthor(oldMessage.author.tag, oldMessage.author.avatarURL);
embed.setDescription(`**Message edited in #${oldMessage.channel.name} [Jump to Message](https://discordapp.com/channels/631538895166636054/${oldMessage.channel.id}/${oldMessage.id})**`);
embed.addField("Before Editing", oldMessage.content);
embed.addField("After Editing", newMessage.content);
embed.setTimestamp();
embed.setFooter(`ID: ${oldMessage.author.id}`);
oldMessage.guild.channels.get(632565093024137246).send(embed);
});
**I** want to to check if it has more than 500 words display the 500 words then do **...**
Because there is a parameter that does that automatically
what you're thinking of zerp is something different
Oh this is an embed
check both of theirs length property, if it's bigger than 500 (per each), take the first 500 characters out of the strings (contents) and apply ... to it
ahhh how can i take the first 500 out 👀
use substring
.substr(500)
client.on('messageUpdate', (oldMessage, newMessage) => {
if(oldMessage.length > 500){
let embed = new Discord.RichEmbed();
embed.setAuthor(oldMessage.author.tag, oldMessage.author.avatarURL);
embed.setDescription(`**Message edited in #${oldMessage.channel.name} [Jump to Message](https://discordapp.com/channels/631538895166636054/${oldMessage.channel.id}/${oldMessage.id})**`);
embed.addField("Before Editing", oldMessage.content.substr(500) + `**...**`);
embed.addField("After Editing", newMessage.content.substr(500) + `**...**`);
embed.setTimestamp();
embed.setFooter(`ID: ${oldMessage.author.id}`);
oldMessage.guild.channels.get(`632565093024137246`).send(embed);
}
let embed = new Discord.RichEmbed();
embed.setAuthor(oldMessage.author.tag, oldMessage.author.avatarURL);
embed.setDescription(`**Message edited in #${oldMessage.channel.name} [Jump to Message](https://discordapp.com/channels/631538895166636054/${oldMessage.channel.id}/${oldMessage.id})**`);
embed.addField("Before Editing", oldMessage.content);
embed.addField("After Editing", newMessage.content);
embed.setTimestamp();
embed.setFooter(`ID: ${oldMessage.author.id}`);
oldMessage.guild.channels.get(`632565093024137246`).send(embed);
});
why
use a ternary operation for the necessary part and avoid so much allocation
oldmsg = content.length > 500 ? (content.substring(0, 500) + "...") : content
same thing for new
except using new message's properties
ooh ok thanks
Thx
@heavy marsh idk js, but I think you can simple do oldMessage.jump_url or something
jump url ?
js is camelCase, python is snake_case
Bruh
And it's just <Message>.url
Ok
how do i delete a message in a "messageupdate" event ?
there is both oldMessage and newMessage
does deleting one of them delete the entire msg
do i have to delete both ?
is there a third option ?
How do I advertise?
Does anyone know how i get the user mentioned in java? Example: !rep @someone
@rugged bramble what library
JDA
you would get the message object, and then there is a function to get a list of mentioned users or mentioned members
like how?

yes
nothing because you arent getting members from a specific guild
Hey! If i got an json, how can i find the place of the ID 4325352?
[
{ ID: '1132123141', data: 3070 },
{ ID: '4325352', data: 50 },
{ ID: '7546542', data: 10 },
{ ID: '34534552', data: 8830 }
]
.filter
or find
oh yeah that would probobly be better
exports.run = async (client, message, args) => {
let prefix = ayarlar.prefix
let channel = message.mentions.channels.first() || message.channel
const mongoose = require("mongoose")
mongoose.connect(link, {useNewUrlParser: true});
const kayitK = mongoose.Schema({
id: message.guild.id,
kanal : channel.id
})
if(args[0]==="kapat"){
kayitK.delete()
message.channel.send(`${client.emoji.evet} Kayıt kanalı başarıyla sıfırlandı!`)
}else{
kayitK.findAndUpdate(
{ id: message.guild.id
},
{
id: message.guild.id,
kanal:channel.id
})
message.channel.send("kaydetti herhalda")
};
}
help
oh god are you connecting on every command use
dbl moreinfo
If you want people to be able to assist you, please provide more information, such as what library and language you're using, the code in question and what you are trying to do and/or what is causing the error.
Can one of you help me?
error:
https://hasteb.in/agofepet.coffeescript
Code:
https://hasteb.in/afubulac.js
In a tutoriul works it
Have you looked at the error
UnhandledPromiseRejectionWarning
DeprecationWarning
Yehh

promise ()
depreciation is fine
Though you will want to find a better way to do it
Oh
Not in js
depreciation in java is fine, but not js apparently
Deprecation and depreciation are two different things
Why
the problem is that whatever you have before ".first()" is undefined
probably user
@earnest phoenix it's users not user
how do i get the size of categories
filter channels by parent
like message.guild.channels.filter(c => c.type === 'category'); ?
that will give you a list of categories
to get a list of channels that belong to a specific category, you have to filter if the channel's parent matches a specific category
you can combine both to get a list of categories and their sizes
Does anyone know how to make it so that people using an incorrect command doesn’t spit out an error while still keeping pythons usual error handling?
what's the difference @halcyon nymph
you want to ignore the error and at the same time have one?
If someone does !<unknown command> it spits out an error, o don’t know how to stop it from doing that without doing magic in on_command_error which stops all errors in python
it doesn't stop them it deals with all of them. And yes you need to use on_command_error
Cool, how?
if you're using a command handler, then its a shitty one
just add this in it
if isinstance(error, commands.CommandNotFound):
return
Okay thanks
Yeah
@halcyon nymph except discord.errors.(not command): pass
Not entirely sure where that could be done
Ooooo, indenting my entire code by one line doesn’t feel like the right solution
Maybe something more practical
only way I know of
ovh hosting good?
I haven't had any problems with them over the 10 months I've used them
@vague kiteshut the f up
BANN ME PLZ
I ASK U TO
PPZ
Plzz ban me
Plz
I beg u
For real
Ban me
Plzzzzz
Well then 🤔
I mean..if you're so eager just tag a mod I guess?
Im trying to get banned by doing something bad


r/therewasanattempt
@sudden geyser bruh
hi
@vague kite you could try https://github.com/Deivu/Haruna


Will check it out thx 💕
Anyone know how to implement auto-moderation into a bot?
I'm running into complications. For example, for detecting a message after message at high speed... the bot will thus have to keep track of when a message was posted and then keep track of the speed with which the newer messages come. For every user. Then it will have to analyse the list of speeds to figure out which user is sending them too fast. It needs to periodically clean that list it keeps for each user as it would run out of memory fast, so it needs to figure when it's best to clean each list.
That's a lot of work, both for me and the bot. And that's just one system, every other system is also different.
for sending messages too quickly, you can have something like a list/collection, have a timeout, and check to see if they send X messages under the time
that's the point of doing this system no?
Auto-moderation
one of
It's to prevent message spam, duplicate messages/images/emotes and people joining servers to advertise. As well as a local toggle feature for swearing/vulgar behaviour.
As well as spam mentioning
-m @ornate latch spam and caps in #development | 5 days
🤐 Muted RecoveringHours#3117 (@ornate latch)
I'm currently working in Python 3.7.3
If anyone has done it before I'd love some advice
a custom bucket maybe 
that's what I see someone doing that would say but I've never done it
Why isn’t JS cut for it @sinful lotus?
@true basin Javascript is single thread, block it and your app is dead
@steady forge its should be but try
send({embed: embed})
I try thaks
👍
The same error continues :c
But, It only happens with tenor images, with gyphy images it works correctly
and remove embed from embed.setColor() or embed.setImage() @steady forge
Use
const embed = new Discord.RichEmbed()
.setColor("your color")
.setImage("your image")
msg.channel.send({embed: embed})
@steady forge
It will be work 100%
:c
The same error, the image does not load.
I think the problem is the URL that Tenor gives
Is your url work directly
Its not playing automatically
Thats the problem
Try another gif
See this 👆 its playing automatically
All Tenor images are like this D:
Idk about that but try another gif
@steady forge https://tenor.com/gifapi/documentation
Tenor Search delivers the most relevant GIFs in 30+ languages. Integrate Tenor’s GIF API into your application in a matter of minutes with this handy guide.
It should be send gif with another style
How can I send an image that is not an embed or normal message?
All the gifs generated by the Tenor Api do not load
@steady forge you are trying direct link
You are not using api request
Read there docs and check how to request
If I use the api, to generate the images.
But the TEST are to prove that url works.
Maybe this command
@steady forge if your direct url playing automatically then your embed will play auto too
The url of MEDIA I think it is direct although it is getting complicated to invoke it
@steady forge you know html ?
dm
is the GUILD_CREATE event only fired on the shard that joins the guild or all shards?
@mossy vine only on the shard the guild is designated to
aight thanks
also, GUILD_CREATE events are also fired when guilds become available, just fyi
which means that you receive a GUILD_CREATE event for each existing server the shard is on on startup
That's interesting
i assume d.js handles that as it says guildCreate is emitted when the client joins a guild
Can't be sure about that since DBL had outages here and there and most js devs (I would assume) come complaining their bot left this server
Should check the source code for that tbh
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
Is there a way for a bot to detect a new user and auto-kick them?
Concerning recently created accounts.
Depends how you want to "detect" those
Users have a account create property I believe with date created
You could just compare that to current time with something like momentjs
@true basin Auttaja does that
guys why discord-js-commando do errors
We need more information than that
What is the error?
What is it supposed to do?

@unreal junco - auttaja?
It's a project that was updated 9 months ago
Doesn't really tell me how they accomplish it
Command for discord.js - to remove server invites
client.on('message', message => {
let regex = new RegExp('/discord(?:app.com/invite|.gg(?:/invite)?)/([\w-]{2,255})/i');
let embed = new Discord.RichEmbed();
embed.setAuthor(message .user.tag, message .user.avatarURL);
embed.setDescription(`**Message deleted from <@${message .user.id}>**\n${message.content}`);
embed.addField("Reason", `Invite link`);
embed.setColor(`#FFFFFF`);
embed.setTimestamp();
embed.setFooter(`ID: ${message .user.id}`);
if(regex.test(message.content)) {
message.delete().then(
message.guild.channels.get("631584749613482022").send(embed))
}
return
})
NO errors but does check and delete
@coral trellis 
This is development mr Timo
client.on('message', async message => {
let regex = new RegExp('/discord(?:app.com/invite|.gg(?:/invite)?)/([\w-]{2,255})/i');
let embed = new Discord.RichEmbed();
embed.setAuthor(message.author.tag, message.author.avatarURL);
embed.setDescription(`**Message deleted from <@${message.author.id}>**\n${message.content}`);
embed.addField("Reason", `Invite link`);
embed.setColor(`#FFFFFF`);
embed.setTimestamp();
embed.setFooter(`ID: ${message.author.id}`);
if(regex.test(message.content)) {
message.delete().then(
message.guild.channels.get("631584749613482022").send(embed))
}
})
^^^ NO errors but does check and delete
what is the problem then
(https?:\/\/)?(www\.)?(discord\.(gg|io|me|li)|discordapp\.com\/invite)\/.+[a-z]
if i use this
why does it have to be a regex
+1
you could like
just check it includes discord.gg
or anything else
do you really need to validate it like that with a regex
isnt regex successful?
it is successful
You should move the embed code inside the if
You're creating an embed on every message now
oks
message.content.length > 500 ? (message.content.substr(0, 500) + ` **...**`) : message.content
it is correct if i do this?
yes
Nie
error - Cannot read property 'prefix' of undefined prefix.js:12:39)
code - https://hasteb.in/ozeqawog.swift
what am i doing wrong?
mongodb database
message.guild.guild.prefix = prefix
if(prefix === message.guild.guild.prefix) return message.channel.send(
Префикс не может быть таким же как и стандартный.)
hmm
ok, it seems my bot wont function in real world use without guild_subscriptions=false
the minute it was joined to here for testing, a 75000 user server kills it
it takes so long to process the incoming userlist it misses a heartbeat
during the initial login?
Is it against the rules to allow a bot to add reactions to a message that mentions the bot?
does that constitute as a "prefixed" command?
i dont think its against the rules, since it is a response to mentioning the bot
a bot mention can count and be used as a prefix
wurd, thanks!
and its more specific than responding to some random word people might use in conversations
right, exactly
I need help again.
https://hastebin.com/jucovoyuto.coffeescript
I don't know what is wrong now. My token is correct and is perfectly fine straight from the dev portal. and I have the right info for my database and stuff.
still new to all of this with SQL/Databases
where did you take the token from? which page?
my applications/Bot
what version of discord.js are you on?
11.5.1
and i found that my token keeps changing even though I am not regenerating a new one.
do you know the reason/have you checked your email
why would I need to check my email?
if it's automatically resetting, discord should send you an email saying why
like if it was on github
I don't and have never gotten an email like that. not even in my spam folders
the token itself doesnt regenerate, its just the timestamp that does
unless you're banned, of course
if you want, dm me your token, and i'll test it here
you can regen it afterwards
ok
can someone tell me how to make an uptime command?
discord.js
Aye client.uptime is the number of milliseconds since the last time your client entered the Ready state, so with that you can convert it to minutes/hours/days, etc
@quartz kindle yes during the initial login
it seems that changing to guild_subscriptions=false fixes that, but broke the ability to dm because the cache wasnt populated
so ive had to rejig wether or not it considers people cached when it tries to message them
its one extra api call per "help" command, but thats no biggie
ok, while Tim is busy helping others and being a great person.
I now need to find out what I am doing wrong with my Sql stuff
https://hastebin.com/uyifunayal.cs
a friend of mine wanted me to make this bot I am making now. and they wanted marriages.. so I am trying to set up a database for some code I found on git hub because I know nothing about marriages. I am using heliohost.org for my hosting and they have a mysql database thing there I am using too.
does heliohost even offer a vps or node.js? i didnt see anything about it in there
they have MySQL databases and hosting so I would assume so as I have seen bots work with it from looking around on GitHub
if not then any recommendations?
https://hastebin.com/awiyejates.js
here is the code
so your bot is not actually hosted there, only the database?
I am going to make a new database and password
Yes. I host the bot myself
do they allow external connections? if they do, maybe you need to configure something to allow it
afaik, external connections are blocked by default
I don't know. I just made the stuff and started using heliohost.org yesterday
i checked some of their forum posts
it seems that the correct hostname is SERVERNAME.heliohost.org
so like
ricky.heliohost.org
should be



