#development
1 messages · Page 1353 of 1
How would it be the token
really?
yes
idk really
haha
Like, it takes 4-5 minutes for the bot to start
it starts but not 100%
what lang and lib
node.js
If I put my whole music handler in a hastebin and put the link here would someone take time to read it and tell me what is wrong
javascript
What library
discord.js
Version?
const client = new Client({ ws: { intents: Intents.ALL } });```
@abstract perch
Nvm looks like u got it
the latest one
@opaque hawk you would have to provide the error
@abstract perch try regening token and seeing if it changes
There are no errors
Hi! anybody knows how could I access to the properties of every command defined as a Commando framework command?
It just simply doesn’t work
A lot of bots got taken offline or messed up with intents and a lot of devs are just now testing with intents so there is probably a lot of logins happening rn
@opaque hawk ytdl?
yeah
yes
good
@opaque hawk ytdl?
@blissful coral yes
oh why
dmca
oH
dmca :/
Lavalink is the go-to replacement I think
and now I assume that bots like Rythm don’t work unless they haven’t used YTDL
They definitely work
https://github.com/Malexion/Rhythm-Bot you can see what they're using there
ah ok
Not sure if that's official rhythm
Thanks
definitely not
It's a discord music bot nonetheless
how would i Delay on syncing all the statusus of every shard?
so make the statuses dif per bot?
dpy ofc
Discord says that: API and Gateway v8 are now available. v6 is still the default for the time being.
But my bot doesnt work anymore, how!?
but i cant use it and my bot doesnt work anymore, what should i do?
What part isn't working
My bot is online, but it doesnt find any users/servers and it doesnt answers to messages
You need the intents
I coding in jda maven
YTDL got shut down
@blissful coral which "YTDL" are you referring to exactly? from a google search i can find a python libraryyoutube-dlwhich was taken down, the javascript libraryytdl-coreis still up on npm and github, with no sort of notice that it doesn't work or anything like that
@frail atlas ytdl-core was taken down by DMCA
He's talking about this: https://github.com/fent/node-ytdl-core
really? i can't seem to find anything related to that library (thanks link cloudfox) being taken down, only an unrelated python library called youtube-dl
Read
that's youtube-dl, not ytdl-core
^
Two different things apparently
Tbf probably not the best idea to use ytdl-core
Could also be taken down
it's not that easy to tell if they're very related since youtube-dl was removed from github, but from the summary which is still somehow public, it's in an different language and it's a command-line program actually (apparently not a library), and ytdl-core is a library for accomplishing a similar but not identical task
doesn't ytdl-core rely on youtube-dl
No
i don't think so, as youtube-dl is a command line program written in a different language than ytdl-core
according to this description, it does not rely on a python program
i tried
case 'test':
const premium = ['723081690792067143']
if(message.member.id !== premium){
return message.reply('you cant use it')
}
message.reply('sup mate')
break;
didnt manage to make it work
That's still a list
then how?
Did you look at the link I sent?
you can check if an array includes an element with .includes(), i.e. myArray.includes(someElement)
I thought it was .includes()
oh yeah you're right my b recently have used a lot of dart where it is contains
also why do i have the "Bot Developer" role in this server? i literally joined today to ask about this ytdl thing and somehow it knows i have made bots?
Do you have any approved bots?
no?
i mean it was correct i guess, but how does it know 
I just found this: https://github.com/DiscordUnity/DiscordUnity
Why does it exist
doesn't Discord.Net work in unity though? unity uses .NET afaik...
Yes
yes, then i agree, why does it exist
it even runs bots, i assumed it might be some kind of non-bot discord library that might be used for rich presence or w/e (though i think discord already makes those?), but apparently not...
it's supposed to be unity based, then why does it use an external JSON library, if it only works in unity you'd think they would reduce the bundle size by using the unity built in one that is packaged even if you don't use it
Lol
Oh wait
They said they want it to be usable as a standalone .NET library too
That doesn't make sense tho because anything in a standalone .NET library will work in Unity
fair enough it does say so in the readme, but the about description contradicts that
You mean on message?
what db would be best if you require fast writing speeds
so why isint this working
and the kick command does not work, i cant kick anyone, this in my own server btw
@dusky garden you need to send the DM before kicking the user, also can you send the full error trace?
@dusky garden you're missing the self paramter.
good catch lol I'm too used to nodejs
actually no I'm dumb
I thought that was in a class
There are two parameters kickerror should have: ctx and error.
Can some one help fiqure out why my bot is duping the responses when i reboot it?
There's a guide on error handling in the docs as more than just an invalid ID/mention can happen: https://discordpy.readthedocs.io/en/latest/ext/commands/commands.html#error-handling
Can some one help fiqure out why my bot is duping the responses when i reboot it?
@inner badger what response is being duplicated?
Where in your source code is it happening?
Can you give us more info to help you?
Uh its just duping the messeges when i use 1 command
Any command?
Im kinda new but all i know os that all the commands are in one file
The <Client>.on("message", (message) => {...}) bit is your message event handler.
Uh im sorry i belive im too new for this
If you want to divide them up, you can put each command in its own file, scan over them at startup, and run the according file when a command is ran
;;-;
It's fine. If you do think you're too new for this, you could spend more time learning the language (JavaScript).
Ty
I need a teacher
it's easy:
name of your client.on("message" msg => {
here is the code of the event
})
you can change the two "message" and msg 🙂
I need a teacher
You can learn the language here:
There are other places too, but I think these are beginner-friendly.
Moon moon sure, but can you state what issue you're having.
client.on('message', message => {
// message.content is the message as a string
// message.channel.send('text') sends a reply
});
What library are you using?
Hello, I would have liked to know how we do to delete after a while the message that the bot has posted
Yes, but what library are you using?
Library?
@earnest phoenix discord.py, discord.js, etc
DIscord.js, Eris, Discord.py, JDA, Serenity, etc.
@earnest phoenix you'll want to look into <User>.presences. That's where you can find presence data for the user: https://discord.js.org/#/docs/main/stable/class/Presence
The .activities property will hold an array of activity objects, which is where you'll look for reading the actual presence data.
another approach: ```js
client.on('presenceUpdate', (oldmember, newmember) => {
if (newmember.presence.status.includes('string') {
// give role here
}
});
Hello, I would have liked to know how we do to delete after a while the message that the bot has posted
Hello, I would have liked to know how we do to delete after a while the message that the bot has posted
@hardy ermine library?
Discord.js
how could i put thumbnails in an embed message title?
presence.status can only be online, idle, dnd and offline.
You still need to look into the array of objects (.activities)
You still need to look into the array of objects (
.activities)
@sudden geyser woops you're right
@hardy ermine ```js
channel.send('message').then(message=>{
setTimeout(()=>message.delete(), 5000);
});
Ok thanks
Your library may also come with some convenience so you can specify the time to delete the message after sending it.
I don't think discord.js has that but I could be wrong, I think just using the promise is fine though
It does. When calling .delete() on a message, you can pass an object as its first argument and supply as a key timeout, which is the amount of time in milliseconds to delete the message (https://discord.js.org/#/docs/main/stable/class/Message?scrollTo=delete).
Ohh I see what you mean now
so @hardy ermine do this ```js
channel.send('message').then(message=>{
message.delete(5000)
});
i need to rtfm more
also if you supply a number as the first arg it assumes it to be the timeout so that's nice too
hmm I can't find it in the documentation anywhere but every stackoverflow page uses just a number, I wonder if something changed or if it's just undocumented backwards-compatibility
Nonunoisy that was old code in v11 of the library. They added the object bit in v12
Nonunoisy that was old code in v11 of the library. They added the object bit in v12
@sudden geyser ok so it is something changing I see
@earnest phoenix You check if the user has the message in their status. If they do, you can do something like <GuildMember>.roles.add("id")
yeah
the documentation is quite unclear for this stuff, but there's no need to be rude
I have some work I'm doing in the background. The way I explained it I think is satisfactory, but a demonstration may be more helpful: js // Nununoisy's example: client.on('presenceUpdate', (_oldMember, member) => { for (const activity of member.presence.activities) { if (activity.state.includes(...)) { // I don't know if it's `details` or `state` you should use. // ... } } });
details/state is what I was hung up on
but I'm more tempted to do ```js
if (member.presence.activities.find({state}=>state.includes('status string'))) { // or details
Yeah I'd do that too ^
you have <GuildMember> as member in that example
client.on('presenceUpdate', (_oldmember, member) => {```
client.on('presenceUpdate', (_oldmember, member) => {
if (member.presence.activities.find({state}=>state.includes('status string'))) {
member.roles.add('role id');
}
});
replace {state} with ({state})
@earnest phoenix
you are missing a parenthesis before {state}
there should be two
How could I add a field with no value in a embed message?
embedMessage.addField("example", " ");
using the alt+255 (invisible character) does not work ):
does the field have markdown formatting
hmm how can i know that?
thank you, that works ^^
also, do you know how to add a field with bold name and normal value but in the same line?
i just can get this results, i want description in the same line with no bold
@floral rune Client is not defined
@earnest phoenix I need to see more of your code then
most people call the client object client so replace with whatever you used here
const Discord = require('discord.js');
const client = new Discord.Client(); // if this is called something else use that name instead
i just can get this results, i want description in the same line with no bold
@feral arch i honestly can't remember if this would work but try this ```js
embedMessage.addField("_ _", "bold not bold");
so replace client.on with bot.on
@feral arch i honestly can't remember if this would work but try this ```js
embedMessage.addField("_ _", "bold not bold");
@floral rune Worked flawless, thank you (: <3
no problem
How do you check if your bot is in a guild?
Without using discord.py
so preferably using the REST API
and it cant be the /users/@me/guilds endpoint because that will only return 100 max
Without using discord.py
Whelp another question I can’t answer
How do you check if your bot is in a guild?
@placid iron crazy idea do/guilds/{guild.id}and if it returns with a 403 Unauthorized then you aren't in it
uh
well, someone knows node.js for web server development?
well, someone knows node.js for web server development?
@dire obsidian express?
hmm yes
also http
what about socket for the truly mad
path
well, this is the problem, when i try to load the page, it load just the html
and not the css/js
is your html/css/js in a seperate folder
yes nun
hm
app.use(express.static('folder'))
will it be if it is the server?
will it be if it is the server?
@earnest phoenix what are you trying to do
a ticket bot
what call specifically is causing the error
but when creating the ticket it appears
@dire obsidian just 'src/main' should work
okthen
@floral rune you understand?
when he reacts to the emoji he doesn't do anything
ok
What is written in Portuguese is a welcome message to the ticket
but he has
not the bot owner the server owner
for every server it's in
The owner of the bot is the owner of the server
you probably want to add a .catch() to the channel create promise to alert the server owner that they need 2fa
ok I need more of this then
at RequestHandler.execute (C:\Users\luisf\samuca\node_modules\discord.js\src\rest\RequestHandler.js:170:25)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:8756) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 9)```
ohh
one minute
aaaaaaaaa nun it works, thanks!
awesome
just need change some paths
yes, he has 2fa
if you don't mind, my two cents:
button {
border-radius: 2px;
}
yes, he has 2fa
@earnest phoenix the logs you posted earlier are what I want but I need more
he just gave it
@floral rune yeah that is what ive decided to do XD thanks
I created in my account and it worked
Is it that discord update that limits bots?
I forgot the name
because you are giving errors that you didn't before
how many guilds is the bot in
how many guilds is the bot in
@floral rune 1
i just hit 76 so i applied to verify hopefully that goes well
were you talking to me?
were you talking to me?
@placid iron no but I don't mind
@earnest phoenix i need more of the error because I just don't have enough to go on
I have already been verified
node errors in promises are weird
does it create the channel or no
some permissions require two factor auth
the error i think is really clear about that
"Two factor is required for this operation"
@solemn latch yeah the guild/bot owner is the same person and has 2fa so I'm confused here
are we absolutely 100% sure he/she has two factor on?
@earnest phoenix is 2FA required for moderators in the guild
@solemn latch
Does the GUILD have 2FA requirement on though
why r so many bot devs brazilian lmao
Does the GUILD have 2FA requirement on though
@umbral zealot yes that's what I mean
lots of turkish bot devs too
lots of turkish bot devs too
@solemn latch yee
so many english bot devs...
Ok but you showed the user
havent seen much else
what about the server
how would i give each shard a specific status?
dpy?
probably a big discord presence in those locations
@earnest phoenix in server settings under moderation is the 2FA requirement enabled
probably a big discord presence in those locations
@solemn latch ehh
@floral rune Its not giving the role
@earnest phoenix try changing your presence by changing online to idle or something like that
Ugh, so intents have changed. I have tried implementing them but I get the following error:
Error [DISALLOWED_INTENTS]: Privileged intent provided is not enabled or whitelisted.
clearly you need to turn them on in the portal
and if you're verified, well... you can't
@floral rune Oh is it not possible with Online?
@earnest phoenix you just need your presence to change for the event to fire
you can set it back afterwards
I am not verified
Does the .owner property work on a guild for anyone? (v1.14.1)
Example:
console.log(client.guilds.cache.get('yourGuildId').owner);
The owner wouldn't be cached by default with the new intents changes
you need to fetch the owner member from the ownerID property
is it the presence intent that caused that 🤔
you need to fetch the owner member from the
ownerIDproperty
@umbral zealot that's a bummer
why? it's just a fetch. takes less than a second
But .owner was easier
You're gonna need a whole lotta fetches with the intents changes
.owner can still work once its cached
pretty basic just checking if owner is cached, which you should have been doing anyway imo
Fixed
@floral rune Still not working
@earnest phoenix try with this just so I can see what's going on
bot.on('presenceUpdate', (_oldmember, member) => {
member.presence.activities.forEach(a=>console.log(a.state, a.details,a));
if (member.presence.activities.find(({state})=>state.includes('status string'))) {
member.roles.add('role id');
}
});
then change your status and show me the logs
@earnest phoenix in server settings under moderation is the 2FA requirement enabled
@floral rune ok
@floral rune ok
@earnest phoenix if it is you have to disable it
ok
thank you
i go try
the discord is making devs' lives hell
the discord is making devs' lives hell
@earnest phoenix thats why i moved on from being dumb to making malware
one more time
bot.on('presenceUpdate', (_oldmember, member) => {
member.presence.activities.forEach(a=>console.log('state:',a.state,'details:',a.details,'obj:',a));
if (member.presence.activities.find(({state})=>state.includes('status string'))) {
member.roles.add('role id');
}
});
easier to make mass dm bot than a bot that will really make a difference
I don't do mass dm bot
🤠 👍
i don't do any moderation stuff in my bots
it's overdone and also unnecessarily difficult
all of my bots are fun
good idea
@earnest phoenix anything?
try changing your custom status and your presence
hmm
are you on djs v12
ok apparently v12 does it a bit differently
bot.on('presenceUpdate', (_oldpresence, newpresence) => {
newpresence.activities.forEach(a=>console.log('state:',a.state,'details:',a.details,'obj:',a));
if (newpresence.activities.find(({state})=>state.includes('status string'))) {
newpresence.member.roles.add('role id');
}
});
try that
how can i make statuses different per shard? dpy?
@earnest phoenix nothing even when changing your presence/status?
bot.on('presenceUpdate', (_oldpresence, newpresence) => {
console.log('got presenceUpdate');
newpresence.activities.forEach(a=>console.log('state:',a.state,'details:',a.details,'obj:',a));
if (newpresence.activities.find(({state})=>state.includes('status string'))) {
newpresence.member.roles.add('role id');
}
});
``` now I want to see if we're getting the event at all, try this
now i'm really confused
@earnest phoenix do you have the GUILD_PRESENCES intent listed on your bot
if you want presences
give it a minute and restart the bot and try again
how can i make statuses different per shard? dpy?
@drifting wedge https://discordpy.readthedocs.io/en/latest/api.html#discord.AutoShardedClient.change_presence
@hollow sedge like different status PER shard
@hollow sedge like different status PER shard
@drifting wedge did you read it?
You can specify shard_id
@drifting wedge you can use .shards to get the shards btw
But how would I find the one the specific shard is?
I would iterate over bot.shards and execute client.change_presence for each shard ID, does that make sense @drifting wedge
That's what I said 
Yes, I was just saying it a different way
Sometimes it helps to hear something worded differently
Sure
What info are you trying to display exactly? Maybe a different approach would be more helpful
I was thinking maybe you want to display a server count on each separate shard or something but I honestly don't have a good idea of a usecase
Clusters as In groups of shards
how many servers is your bot on

Dyno devs real quiet rn

I have 30 clusters. Let that give you an idea
Jk, my bot is hella small
But I do need 30 clusters lol
30 clusters with 2 servers each
but regardless what are you trying to do
If you map the shard id's to some number or even just use them outright it should be easy to add them to the status in the way described above
How can I check how much users are mentioned in JS
Please ping me if you can help
if (msg.content.startsWith("e!kiss")) return msg.channel.send(
<@!${msg.author.id}> UwU you kissed <@!${mentioned.id}>)does anyone see anything wrong with this?
@earnest phoenix that should be OK as long as you also check that there is a mention in the message
@earnest phoenix you may be looking for message.mentions.users
are you defining mentioned beforehand?
i'm guessing the answer is no
no it is defined
.user.thing
you should check that message.mentions.users.size > 0 before trying to get first()
that way messages that say e!kiss without a mention don't error out like that
how do I get the real time/date with Date.now()?
discord.py
Does anyone know why ctx.guild.premium_subscribers not working? It worked like 20 hours ago but it doesn't work now
@fast trench are you trying to get a formatted date
@tiny sluice what doesn't work with it
@floral rune yes...I can't find my old code with it
I didn't do anything to my bot
thank you
It just returned an empty list for ctx.guild.premium_subscribers when there are many boosters
i see, then you haven't enabled Members intent
Be sure to setup your intents and enable members intent https://discordpy.readthedocs.io/en/latest/intents.html#intents-primer
I just did turn it on and restart my bot and still the same
what's your code on your intent
@commands.guild_only()
@commands.command(name="booster", description="Check if you're a booster", usage="booster")
async def booster(self, ctx):
if ctx.author in ctx.guild.premium_subscribers:
await ctx.send("Yes")
else:
await ctx.send("No")
await ctx.author.send(ctx.guild.premium_subscribers)
Ohh
at your bot constructor
def __init__(self, command_prefix: str):
super().__init__(command_prefix, case_insensitive=True)
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter('%(asctime)s|%(name)s::%(levelname)s: %(message)s'))
self.logger = logging.getLogger('Lily')
self.logger.addHandler(handler)
self.logger.setLevel('INFO')
self.remove_command('help')
c = [Admin, General]
for i in c:
self.add_cog(i(self))```
ya you didnt enable members intent
Oh how do I enable it
you would need to declare discord.Intents, and use one of the classmethod, most people would just do this ```py
import discord
from discord.ext import commands
intents = discord.Intents.default()
intents.members = True # This is your members intent
bot = commands.Bot(command_prefix='!', intents=intents)
`default()` is a classmethod that enable all intents except for priviledge intents such as members, so you would need to enable them explicitly by assigning it's attribute to True
there are a few other classmethod option you can choose https://discordpy.readthedocs.io/en/latest/api.html#discord.Intents
i got this problem
if(message.author.bot || message.channel.type === "dm") return;
let prefix = botsettings.prefix;
let messageArray = message.content.split(" ")
let cmd = messageArray[0];
let args = messageArray.slice(1);
if(cmd === `${prefix}help`){
return message.reply("I sent you a list of commands in your DMs!")
return message.author.send("What the hell do you want from me I'm new I don't have any commands like wtf")
}```
it says @sturdy star, I sent you a list of commands in your DMs!
but it doesn't send a DM
console says no error
language is javascript
what should i do
client mods ahh
how do i wait until my async on_command event finishes before running the actual command (discord.py)
I'm trying to insert a document for a user in MongoDB and then run the command, but it's async so the actual command is messed up when the user is not found
calling admins
Thank you so much @earnest phoenix ! It works!
alr
@earnest phoenix ```js
Client.on ('message', msg => {
if (msg.author.bot) return null
const kiss = msg.content.slice(6)
if (msg.mentions.users.size < 1) return;
let mentioned = msg.mentions.users.first();
if (msg.content.startsWith("e!kiss")) return msg.channel.send(<@!${msg.author.id}> UwU you kissed <@!${mentioned.id}>)
})
@floral rune you cant just give them the answer
const kiss = msg.content.slice(6) lmao
Hm
ok, what was the problem then? @earnest phoenix
you see why i said that now?
you see why i said that now?
@hollow sedge i'm sorry im too tired to do anything except spoonfeed
@hollow sedge i'm sorry im too tired to do anything except spoonfeed
@floral rune yeah it's alright, it's just better for people to come to a solution themselves

yeah i get that
@earnest phoenix if you want an answer, it's because let mentioned = msg.mentions.users.size > 0 sets mentioned to true or false, not to a user, so there is no id
so now you'll at least learn something
@floral rune sorry to bug you again but do you know how to get it to also add in AM and PM or no?
hey Dose this bot do conections For Eg give people a role who are folowers and that?
whats this bot?
yes
@floral rune sorry to bug you again but do you know how to get it to also add in AM and PM or no?
@fast trench there isnt a method but there is a dumb way(hours >= 12) ? "PM" : "AM"
to rephrase my question from earlier, is there a way to run a synchronous function before each command in discord.py?
or use date.toLocaleString()
so this is how I am getting the date and time js let [month, date, year] = (new Date()).toLocaleDateString().split("/") let [hour, minute, second] = (new Date()).toLocaleTimeString().split(/:| /)
@sturdy star your code will simply stop at return message.reply("I sent you a list of commands in your DMs!") because the function will return there, just remove the return statements
@fast trench my only issue with this is calling new Date() twice since theres a tiny chance it will desync
how would you do it?
let now = new Date()
let [month, date, year] = now.toLocaleDateString().split("/")
let [hour, minute, second] = now.toLocaleTimeString().split(/:| /)
oh duh lol but what about the am/pm?
it seems to be appearing for me, but maybe you need to add 'en-US'
oh that's weird let me try
didn't work 🤔 and v12
ah i'm on v14
try ```js
now.toLocaleTimeString('en-US',{hour12:true})
nope 🤔 wtf
now.toLocaleTimeString('en-US',{hour12:true,timeStyle:'medium'})
```?
or ```js
now.toLocaleTimeString('en-US',{ hour: 'numeric', hour12: true })
moment gang
now.toLocaleTimeString('en-US',{ hour: 'numeric', minute: 'numeric', second:'numeric', hour12: true })
some creators of moment moved on to luxon
this is what got this js let now = new Date() let [month, date, year] = now.toLocaleDateString('en-US', { hour12: true, timeStyle: 'medium' }).split("/") let [hour, minute, second] = now.toLocaleTimeString('en-US', { hour12: true, timeStyle: 'medium' }).split(/:| /)
I hate line breaks 😅
@tame kestrel haven't heard of luxon, what's it like?
it's like moment js LOL
basically has the same features
but can you format durations
Immutable date wrapper
this lmao
most of luxon's changes are invisible from what i've read, mostly just modern JS and Intl API usage
@fast trench just run now.toLocaleTimeString('en-US',{ hour: 'numeric', minute: 'numeric', second:'numeric', hour12: true }) in a repl or in a console.log
That fixed it...this is my end result with my code 😅
let now = new Date()
let [month, date, year] = now.toLocaleDateString('en-US').split("/")
let [hour, minute, second] = now.toLocaleTimeString('en-US', { hour12: true, timeStyle: 'medium' }).split(/:| /)
console.log(now.toLocaleTimeString('en-US', { hour: 'numeric', minute: 'numeric', second: 'numeric', hour12: true }))``` and my outcome is like you showed earlier but also with the date correct
what does it end up logging
10/28/2020 at 1:15:56 AM that's from the embed
so it works now?
yes it does...I owe you
no you owe mozilla the MDN is a lifesaver
command.execute(message, args).catch((error) => {
//stuff
});
TypeError: Cannot read property 'catch' of undefined
catch(error => console.log(error))
i have that in //stuff
oh
@silver lintel what is command.execute
fixed by using tryn and catch
im guessing command.execute isn't a promise then
i guess
I wonder why the bot login twice in and shut down? I did not change the code, it started to happen today.
Can someone pass me the link of the bot
which bot
.setImage(message.author.avatarURL(), Set dynamic: true)
how do i set the dynamic good there?
make it an object
{ dynamic: true }
Set dynamic: true is not valid
also, put it INSIDE avatarURL() message.author.avatarURL(here)
k ty
and i did what ever i could, still didnt manage to fix that
case 'test':
const premium = ['723081690792067143']
if(message.member.id !== premium){
return message.reply('you cant use it')
}
message.reply('sup mate')
break;
premium is an array
you want to use array.includes
if (!premium.includes(memberID))
this will be true if the id is not inside the array
i can list it right?
list?
(id, id, id) is a tuple in python
im in js
o so what i do with the const premium?
nothing
you should learn basic javscript.
https://www.w3schools.com/js/
https://www.w3schools.com/js/js_arrays.asp
https://www.w3schools.com/js/js_array_methods.asp
but wdym nothing like, const premium = [] leave it empty
@tardy hornet no
you said (id, id, id), which should be [id, id, id]
thank you for getting it
membersID is not define
please don't just copy and paste that
please
you're supposed to use this
what i gave was just an example
ok ty
The bot seems to be running on the server but it is offline. When I open it, it enters 2 times and then it goes offline on discord. I haven't made any changes to the code. It just started to happen.
The bot seems to be running on the server but it is offline. When I open it, it enters 2 times and then it goes offline on discord. I haven't made any changes to the code. It just started to happen.
@quartz hill dumb questions first: are you running two instances at once? they might be colliding and kicking each other out
no
js
I didn't change the code, it was working yesterday. He is not working today. It happened the way I said. When opening, it says logged in more than 1 times. Then it goes offline discord even though it still appears active on the server(host).
I tried the code in another bot, it works. The problem cannot be in the code. I don't think there will be a problem with the code since I haven't changed the code anyway.
that's quite odd
i guess try rebooting your server or maybe try redeploying and reinstalling node/djs
Normally I was using it with shard. It still is. But I tried to uninstall shard and never work.
and also I trying on my pc
again same problem
I think it is because the number of discord servers using the bot has increased. But this should not be a problem.
@quartz hill if it looks like it's running two instances just reset the token, change it in your env file then restart the bot. Anywhere else where your bot was running will stop working.
whats the class
@silver lintel press F12, click the arrow thing on the top left of the big white box and select the button
There is only one sample Impossible to work elsewhere. But let me try to change bot token.
thank you
and not working
no
bye
Hello it came out the new version of node?
anyone here mongoose expert?
anyone here mongoose expert?
@rocky hearth https://dontasktoask.com
Can I populate a document after running exec()?
hey. is there any free 24/7 online best hosting server for bots?
@frosty mauve i literally told you to read the pins
they already have it answered
there are a lot of pins. which one should i read? @earnest phoenix
okay thanks
Hey guys, Im looking for .gg domain to buy, where can I buy it at the cheapest price?
idk i always look at namecheap but im sure there is cheaper stuff.. i heard name.com is also good ;p
ok , I'll look it up, thx
np & gl
Hii, can you help me? i want to make command like report command promblem and give create invite link to message author channel, but i can't and not give error. here my code
message.guild.channels.cache.find(c=> c.type === 'text' && c.id === message.author.lastMessageChannelID).createInvite().then(x=>e.setDescription(`this is link discord` + x.code))
message.channel.send({embed: e})```
i want to put it into embed description
I am having a problem by building a calculator for my bot. I need it like if someone types that ,add 2+4 , it should show the result but I am confused on how to code my bot like it should tells the result and should analyse the input before Sending the result
Discord.py sending my code and error
@client.command()
async def add(ctx, num1: int , *, num2: int):
embed = discord.Embed(title = "Hey! Here's The Result for your Question!" , description = f"{num1} + {num2} = {num1} + {num2}" , colour = ctx.author.colour)
await ctx.send(embed=embed)```
*, num2: int, there isn't a reason to do this, just put it as (ctx, num1: int, num2: int): @sick fable
My bot starts up without any problems, but when we use any command afterwards, it gives this error and crashes without responding. If I ask those who know the solution, can they write it to me?
Kk @earnest phoenix
@hidden scarab message.member is null because the message is a DM
@earnest phoenix I want the input to be like ,add 2+2 not like ,add 2 2
terrible design tbh, you already specify that it's an addition
@sick fable why not use an external library for math
i use mathjs for javascript
to be honest i would just do calc <your math operation>
But I want to code it instead of using an external library
@sick fable bad idea but it's your bot anyways so ok
:[
Discord v11 is closed ?
Discord v11 is closed ?
@hidden scarab deprecated
you would need to learn lots of things, such as an expression tree to do that @sick fable
the simplest you can do is to map it out using dict, or using a regex
Thx @earnest phoenix, There are bots that we made for streamers. They are used only on 1 server. And this bots at v11 and its work ? Why ?
also whatever you do, dont use eval or exec, it's not safe
the simplest you can do is to map it out using dict, or using a regex
@earnest phoenix ok 🥺
Thx @earnest phoenix, There are bots that we made for streamers. They are used only on 1 server. And this bots at v11 and its work ? Why ?
@hidden scarab v11 is deprecated so they aren't gonna fix anything you report to discord.js
please upgrade to v12
Thanks ❤️
Hey i want to see my bots age how do i do that
@earnest phoenix which library
Android
@earnest phoenix
Android library hm
soooo,
there WAS a breaking change to the live v6 discord api. here it is:
https://discord.com/developers/docs/topics/gateway#request-guild-members
in request_guild_members opcode 8, you can no longer send an array of guild_ids in the request.
it breaks JDA up to the version released yesterday, i think affects discord.js and a bunch of others.
they didnt communicate the change, and pushed it directly into the live API version 6. Be aware, if you can't do things you could before, your bot just sits there without responding... this is likely the cause, update your libs, bug your lib devs.
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
yeah thats where i first heard about this, i DM'd brandon to ask if it was something that may be further reaching
for mee6 it was simply a case of tick the intents in the discord.com panel
because their bot already handled the chunks correctly
(so long as those were on)
Yeah, it was quite annoying that discord just pushed it without any notice
Is there a known cause of PM2 not detecting certain files? I did pm2 start start.js to start my bot but PM2 logged saying '/root/Beycord/start.js' was not found but it is when I accessed it using FileZilla and the vi command.
soooo,
there WAS a breaking change to the live v6 discord api. here it is:https://discord.com/developers/docs/topics/gateway#request-guild-members
in request_guild_members opcode 8, you can no longer send an array of guild_ids in the request.
it breaks JDA up to the version released yesterday, i think affects discord.js and a bunch of others.they didnt communicate the change, and pushed it directly into the live API version 6. Be aware, if you can't do things you could before, your bot just sits there without responding... this is likely the cause, update your libs, bug your lib devs.
@green kestrel but we'll still get our bots declined for not responding
change my mind
Is there a known cause of PM2 not detecting certain files? I did
pm2 start start.jsto start my bot but PM2 logged saying '/root/Beycord/start.js' was not found but it is when I accessed it using FileZilla and thevicommand.
@earnest phoenix make sure you're in the right directory, pm2 doesn't have any issues with files
Do dir and it will list all the files in that folder
How do i know if my bot application is rejected
You will get a dm
Ohh
Ok
Do i need to have commands in my bot ?
of course?
How many ??
iirc at least 3 or 5
Ok
I mean its not really a bot if it doesn't do anything
Also, I did dir and start.js is in the Beycord directory.
Could you try rebooting
in my express server i did this:
res.sendFile(`./public/index.html`);
but it threw the error smth along the lines of:
TypeError: Path must be absolute or relative
but when i changed it to this:
res.sendFile(__dirname + "/public/index.html");
it worked fine
can someone explain me why?
Because it needs to be absolute
you mean using the reboot command or from the vps provider site?
Any will work
alr
Use the button from the site
also when i did res.sendFile("/home/runner/<repl name>/public/index.html it still threw an error
oops i already did the command
even tho __dirname is still /home/runner/<repl name>
With dirname
nope pm2 still doesnt detect the file
is it just me being dumb or something lol
vi reached the file without problems but pm2 doesnt seem to
yes?
why not just right-click the file select properties then copy the address and use it tho not everyone uses windows
why not just right-click the file select properties then copy the address and use it
i did?
nvm i found the problem
ok
a required npm package was broken
wynaut
and reinstalling it doesnt work help
@earnest phoenix can you not spam emojis
welp
open the debug log file
why is there a # at the end of the prompt text instead of a $
idk
root@overcold:~/Beycord#
weird
thats the latest version of ubuntu if it somehow explains that
never saw bash like that
heres the error in the debug file or whatever its called
should i try deleting node-modules and reinstalling stuff lol
Do i need to have commands in my bot ?
@earnest phoenix interesting question, it got starred sarcastically but technically... no?
If everything in your bot is controlled by a dashboard then no, you wouldnt need commands. but you DO need a way for people to interact with it.
and its strongly recommended to at least have a minimum of a help command, even if just to point people to said dashboard.
i wouldnt recommend a completely dashboard bot, either. it would confuse us when we come to review it.
and may get rejected as "no obvious entrypoint"
You could name it commandless bot xD
ypeError [INVALID_TYPE]: Supplied parameter is not an User nor a Role.
at Function.resolve (C:\Users\shahn\3D Objects\Botcode\sharding\node_modules\discord.js\src\structures\PermissionOverwrites.js:177:28)
at C:\Users\shahn\3D Objects\Botcode\sharding\node_modules\discord.js\src\managers\GuildChannelManager.js:109:81
at Array.map (<anonymous>)
at GuildChannelManager.create (C:\Users\shahn\3D Objects\Botcode\sharding\node_modules\discord.js\src\managers\GuildChannelManager.js:109:51)
at Object.execute (C:\Users\shahn\3D Objects\Botcode\sharding\commands\setup.js:56:41)
``` I am having this error , in channel creation an idea why?
Show the code
K
await message.guild.channels.create('bump', {
permissionOverwrites: [
{
id: everyoneRole,
deny: ['VIEW_CHANNEL'],
},
{
id: "735147814878969968", //change here the id of the alpha bot
allow: ['VIEW_CHANNEL' , 'SEND_MESSAGES' , 'EMBED_LINKS' , 'ATTACH_FILES' , 'READ_MESSAGE_HISTORY'],
},
{
id: "302050872383242240",
allow: ['VIEW_CHANNEL' , 'SEND_MESSAGES' , 'EMBED_LINKS' , 'ATTACH_FILES' , 'READ_MESSAGE_HISTORY'],
``` @honest perch
How can you make a hyperlink inside an embed? Using discord.js
in " "
" **[here](https://discord.gg)** "
@abstract coyote
in set Description or Add Field
footer will not work
dumb question
whats with my bot not sending welcome message when someone joins
is it because of these being off?
and i cant even turn it on
yes
you have to be whitelisted
i'm assuming that bot is already verified but not whitelisted for those intents
how do you get it whitelisted?
Hey, I have a question, I'm currently creating a giveaway bot, but to launch a giveaway I would restrict that command to admin only while they've not config the role whitelist (ex: a command ;add-wh <command> <roleID>). So if I published my bot and I precise in description that you can config permissions, will my bot be refused because the base permission is "ADMINISTRATOR" ? Sorry for the english it's not my native langage
it's only a problem when the bot itself needs the administrator permission
if it needs the member to be an administrator, it's fine
Oh okey thanks you ^^
Hey so anyone know how to upload your console logging like to a file then send it to discord?
So that you can download it and see console logging?
if that makes sense?
log to a file instead to console maybe?
Kinda. Like you do !console, then it grabs the logging in the console, like "Bot is online!" and or errors, then sends it to a file and uploads.
i mean, instead of doing console.log, what about making a function to log in the file directly
which you can then read or add as an attachment or whatever
How would you do that? FS?
quick google search
node app.js > log-file.txt
has anybody bought a vps from oneprovider?
if so, do you know what "Only compatible with hardware RAID" means?
yes i know what this means but i havent a vps from them.
hardware raid is where you have a pci-express card that handles multiple hard disks as one virtual drive
software raid is where your OS does it
hardware raid is far superior as it has a built in battery backed ram cache, in the event the power cuts to your server it will ensure that whats left in the buffer is correctly written to disk
well, good ones do
also software raid as its done at OS level takes some cpu time that could be used by your programs
sounds like you dont have hardware raid on your server, or if you do its abstracted above the level of your vps
(node:8648) UnhandledPromiseRejectionWarning: VersionError: No matching document found for
Anyone help me
mongoose
Is it just me being dumb or is there something that caused ./ to sometimes go to the parent folder and sometimes go to the root folder?
I want to add this image in the description box, what should i do??
if you meant the small embed like thing, its a quote and can be recreated by doing something like > yes
yes
@green kestrel okay thanks
so apparently ubuntu requires hardware raid, and ubuntu is what i've always been using, so what OSs do you guys use apart from ubuntu?
or do you think i should just go for the more expensive ones with hardware raid?
uhhhhh ubuntu doesn't require raid?
well with one provider apparently it says only compatible with hardware raid
provider?
if you mean your VPS... well that's a thing that they need to, y'know, take care of
Ubuntu itself doesn't require raid on a hard drive. that would be ridiculous.
oh so uh
Prob should find another provider
oh
const guild = await require("../tools/getGuild")(client, message.guild.id);
let targetData = guild.warn.find(t => t.userId == target.id);
if (!targetData) {
const object = {
userId: target.id, time: 0, reason: " "
}
guild.warn.push(object);
await guild.save();
targetData = guild.warn.find(t => t.userId == target.id)
}
if (targetData.time == 0) return message.channel.send("That user don't have any warns to delete");
console.log(targetData);
if(targetData.time == 1){
guild.warn.splice(targetData);
}else if(targetData.time > 1){
targetData.time = targetData.time - 1;
targetData.reason = `Deleted one warn for reason __${reason}__`;
}
await guild.save()
VersionError: No matching document found for id
Help
VersionError: No matching document found for id "5f954cd916000c622a3e196e" version 32 modifiedPaths "warn"
luke uses oneprovider iirc
yeah he told me to use them
what other vps do you guys use? besides digital ocean and galaxy gate
whats wrong with DO and GG? @grizzled raven
anyone could look at my issue :/ https://github.com/Automattic/mongoose/issues/9506
can anyone help me with this urban dictonary code it gives me this error
const query = `?term=${encodeURIComponent(args.join(' '))}`;
const { list } = await fetch(`https://api.urbandictionary.com/v0/define?${query}`).then(response => response.json());
if (!list.length) {
return message.channel.send(new Discord.MessageEmbed()
.setColor('RED')
.setDescription(`No results found for **${args.join(' ')}**.`));
}
const [answer] = list;
return message.channel.send(new Discord.MessageEmbed()
.setColor('RANDOM')
.setTitle(answer.word)
.setURL(answer.permalink)
.addField('Definition', client.shorten(answer.definition, 1024), false)
.addField('Example', client.shorten(answer.example, 1024), false)
.setFooter(`Rating: ${answer.thumbs_up - answer.thumbs_down} Upvotes.`)
);
}
}```
I have that command sitting somewhere, let me take a look
so you mean that .length is wrong?
whats wrong with DO and GG? @grizzled raven
@fluid basin nothing, just wanted to hear about others first cause i already know them
Does anyone know why this code won't work the way I want it to? I want it to create a channel for any user that messages the bot and send the message in that channel, but if the user already has a channel then send it in that channel.
@client.event
async def on_message(message):
if message.author.bot:
return
if isinstance(message.channel, discord.channel.DMChannel):
guild = discord.utils.get(client.guilds, name="Snappy Support")
role = discord.utils.get(guild.roles, name="Support")
role1 = discord.utils.get(guild.roles, name="Member")
overwrites = {
role: discord.PermissionOverwrite(read_messages=True),
role1: discord.PermissionOverwrite(read_messages=False),
guild.me: discord.PermissionOverwrite(read_messages=True)
}
category = discord.utils.get(guild.categories, name="Support")
e = discord.Embed(title=f"{message.author} said:", description=f"__`Content:`__ **{message.content}**\n \n __`Their ID:`__ {message.author.id}", color=0x0000ff, timestamp=message.created_at)
channel = client.get_all_channels()
if channel == f"{message.author}":
return await channel.send(embed=e)
else:
channel1 = await guild.create_text_channel(f"{message.author}", overwrites=overwrites, category=category)
await channel1.send(embed=e)
await client.process_commands(message)
pass
but actually nevermind i'll stick with what i have for now
there are great vps hosts in pinned messages
so you mean that .length is wrong?
@rotund vale it is saying that it cannot read whats before .length
or however you spell it
for dedicated server (do you really need one?) you can check out hetzner for bidding of dedis
so i should ! remove the ! in !list.length?
I think it should be list instead of { list }
F
@kind thicket well uhh
Then I really dont know
How would I run commands to start a screen on ubuntu and start a python program on an Ubuntu server, with another python program?
@ me when answering, please.
I dont use python so idk
@define.error
async def deferror(ctx, error):
await ctx.send("An error occured. For those developers out there: The error was: {0}".format(error)
bot.run("token")
someone tell me why the bot.run line is a invalid syntax
.setDescription(`**Servers:** ${client.guilds.cache.size}\n**Users:** ${client.users.cache.size}```
Tht does not work the best :P
That `client.users.cache.size` sends a rather small number instead of the way higher one it had before..
instead of the before seen
:(
what was the difference in code?
none that would affect that command
Thats js
oh
The problem is that not all your users are cached
client.users.cache.size returns the size of your user cache
So if a user is not cached it wont be included
do client.users.size
oh okay
That doesnt work
yea it is
Thats the old version yeah
thanks ill find the issue now c:
yep
yeah :c but ur not dumb!
ye
and ur rly kind for helping me out c:
np
I need help with mongoose, does anyone knows it better? Ping me....
@rocky hearth be 300x more specific about your issue or you probably wont be helped.
do u know mongoose?
"I need help with Discord, and bot, does you knows it better?" @rocky hearth
just ask, be specific
literally told this guy twice before not to ask2ask
@rocky hearth do you know any python, I could use some help
literally noone is about to answer such general questions, unless they are a dev that is nolife even among dev standards
ok, then
How do I deal with
<image of a Promise>
I want to get string
Promise.then((arg1, arg2, arg3, ...) => { ... });
or await
wat??????
So I want to find a document, and if it doesn't exist, I want to create one and use it. I know I could use upsert and stuff. But that doesn't add the required fields. So what I need to do?
@carmine summit https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
@carmine summit result = await promisehere
@quartz kindle that example bad not even var keyword is used to tell js that result is a new variable
alright
@quartz kindle what do u prefare await or then()
situational
I'll use .then since I don't use async functions much
hmm
why not
synchronous programming is useful sometimes
I'd say that you try to stick with one for most situations
How do I get rid of guilds that is deleted
guildDelete*
something like guild.available
you use .then if you dont need to return to the current context and are fine with concurrency
you use await if you need to return to the context and need to run stuff sequentially
you use .then if you dont need to return to the current context and are fine with concurrency
you use await if you need to return to the context and need to run stuff sequentially
@quartz kindle I need to do stuff after fetching the data using axios and i don't want a big callback soawait
guild.deleted
See that's why, I was first trying to find a mongoose expert.
@rocky hearth don't only explain, show (your code/errors)
no one will get what is not working for you and they have no idea what the context is
people above got replies because they gave examples of their code where they were having issues or don't understand
See that's why, I was first trying to find a mongoose expert.
@rocky hearth are you saying we suck
Message Edited Event
Hello, any one knows why newMessage is not working? oldMessage works fine.
newMessage?
@abstract perch can you provide more info about it
Yup wait
also i think it probably has smth to do with the heavy intent changes
||use my paste service https://paste.code913.repl.co to send code||
|||https://paste.code913.repl.co/paste/B7C_mGMKSD||| @earnest phoenix
const { Events } = require('../../../util/Constants');
module.exports = (client, packet) => {
const { old, updated } = client.actions.MessageUpdate.handle(packet.d);
if (old && updated) {
/**
* Emitted whenever a message is updated - e.g. embed or content change.
* @event Client#messageUpdate
* @param {Message} oldMessage The message before the update
* @param {Message} newMessage The message after the update
*/
client.emit(Events.MESSAGE_UPDATE, old, updated);
}
};
this is the intent
I mean... idk 😂
I have the latest build
uh
why are you sending d.js source code instead of your own code lmao 
there is nothing wrong with d.js code
wdym?
its your own code that has issues
yeah?
that's what I was thinking but what should I put there?
the issue is right there
what is message then
@abstract perch are you passing the fourth parameter newMessage when running the function?
How could I get the size of all users from all the servers my bot is in?
@carmine summit unknown guild
Unknown GUild
wait let me try something brb
@abstract coyote library?
discord.js
client.users.cache.size
what is message then
@abstract perch figure out whatsmessagefirst, then figure out whatsoldMessage
ye i tried that however it doesn't get the entire count
one line of code is not spoonfeeding btw

BetterDiscord


