#development
1 messages · Page 1179 of 1
undo that async (err, row)
bot.channels.fetch?
yes
you're supposed to just add async on the other function
thats the weirdest thing ever
use bot.channels.cache.get()
db.get(query, [user],async (err, row) => {
but fetch works too
i think here
no
what?
^
what
he's not even supposed to do that
okay, here, just do it.
let channel = async (err, row) => {await ...}
nono
;/
don't give him weird ideas
@spare gale That part is completely wrong
lol
it's fetching the channel inside the database callback, which is a function that isn't async
you can use await only on async functions, so add await before the callback function
don't change other things
OR You can nest .thens but wont recommend
would it be easier to use cache?
i want it to react to the embed but its reacting to my message
Ok can we do cache thing, this is complicated
channels.cache.get("ID")
@hazy sparrow await the message
@hazy sparrow when you make the bot send the embed
do
.then(m=>{
//the reaction part replace message.react to m.react
})```
5 year old gamer 
Or await
When I hover over get it says "any"
that's just what it accepts
oh ok
can i use embed.react() instead of message.react()?
depends on the variable name
@pale vessel Thanks
const embed = new MessageEmbed() @lament meteor
bruh
im pretty sure u gotta await the embed to send then react to it
await the send method, yeah
hmm ok, ty again
client.once('ready', () => {
client.user.setActivity(`to awesome vibes`, { type: `LISTENING` });
})```
cannot read property user of undefined
ok this chat is weird i will go
can u give all code?
@spare gale no ;-;
ok
const Discord = require('discord.js');
const client = new Discord.Client();
const keepAlive = require('./server');
const prefix = '-';
const fs = require('fs');
client.commands = new Discord.Collection();
// YOU DON'T NEED TO KNOW
client.once('ready', () => {
client.user.setPresence({ status: 'online', activity: { name: 'to chill vibes 🎧', type: 'LISTENING'} });
})
//YOU DON'T NEED TO KNOW
client.login(token)```
the hell is happening here
guys my command only works in 1 channel and if i use it in the rest of the channels it gives a unhandled promise warning
const { MessageEmbed } = require('discord.js')
module.exports = {
name: 'jarvis',
description: "jarvis",
execute(message){
const newEmbed = new MessageEmbed()
.setTitle("Game Roles Pick")
.setDescription("React to the corresponding emoji to get the desired role you want.\n\n\n<@&742413618951225395> - 😊\n <@&742416504380981390> - 🙂\n <@&742416674472329297> - 😉\n <@&742416735738527906> - 😍\n <@&742416788347813920> - 😎")
.setColor(0x00B26E)
message.channel.send(newEmbed)
.then(m=>{
m.react('😊')
m.react('🙂')
m.react('😉')
m.react('😍')
m.react('😎')
})
}
}
const Discord = require('discord.js');
const client = new Discord.Client();
const keepAlive = require('./server');
const prefix = '-';
const fs = require('fs');
client.commands = new Discord.Collection();
// YOU DON'T NEED TO KNOW
client.once('ready', () => {
client.user.setPresence({ status: 'online', activity: { name: 'to chill vibes 🎧', type: 'LISTENING'} });
})
//YOU DON'T NEED TO KNOW
client.login(token)```
@delicate shore you restarting script on './server'?
client.once('ready', () => {
client.user.setPresence({ activity: { name: 'with everyone XD' }, status: 'idle' })
});```
this is not working
I am using an API which only returns promises and its the property of promises that u cant access it out of scope
But i need to access it out of the promise what to do?
@spare gale it's just so that pinging services can ping it
what version of node u use?
I'm sure I been waiting more than 3 weeks and I haven't heard anything about my bot
just curious... one of my ram died and i wanna test bot on computer... how much ram will it use#?
im on python
around 30mb to 1gb, depends how large is ur bot
not that big just anti ad
well probably around 30 to 60mb
oh ok few 😐 my ram was on 16gb now its on 8gb 😐 tried restarting pc 😐 and then 1 large and 2 short beeps 😐
then errors
xD
remove the broken ram
and i have 8gb ram on my pc, works fine
with around 100 chrome tabs open
same here, DDR3
oh ok
wait what happens if i leave broken on one... ? i mean im just being laz\y xD
lazy
RAM usage also depends on how big your bot is, especially if caches a lot of discord data
i see
he said it isnt big
wait what happens if i leave broken on one... ? i mean im just being laz\y xD
ut might not work, but u can see
im getting new pc soon so if it goes it goes XD i got backup laptop anyways
is there a way to turn a discord slowflake into a user id without your bot being in the same server? how does https://discord.id do it?
Rest search
more info?
Eris has a feature with iy
client.getRESTUser
But you have to enable rest mode on it
sigh guess il just do it logged in
You can also check the API docs
See if there is anything about it there
Because there should be if Eris has it
and u can get use creation date without any fetching too
what's a class
is it basically smth which stores a lot of functions and stuff and can be used to create new stuff or perhaps copies of it's own
Isn't the id just like the date encoded somehow?
@crystal socket there's an api endpoint
yes
why always link me french ones
You can change the Lang at the top
hmm how can i code it .-.
why always link me french ones
@earnest phoenix because they are the ones that come up for mr
imagine logging into your bot
most of the things what bots do, they do with rest api
Is it possible to make your bot change the channel name every minute?
api spam
that’s on the line of api abuse
Is it possible to make your bot change the channel name every minute?
@leaden shard rate limit
really
Yeah I think they added a rate limit to that
It is forbidden to ?
its 2 times pe 20 mins
kind of
Maybe every 10 minutes then?
@golden condor then switch to english
No
yep, 10 mins is bare minimum
Yes
He can change the language in the top corner
I’d go for 30 mins personally
Thanks for your reply
Or maybe 15
Where can I find how to do that?
learn
i assume u are using discord.js, https://discord.js.org and setInterval function.
i use java script
bruh
So you can use interval
setInterval(() => {do shit here},time in ms)
Is it hard to do that?
no
Not really
pseudo code incoming
Maybe for you xd
setInterval(() => {
const channel = get channel (https://discord.js.org/#/docs/collection/master/class/Collection?scrollTo=get)
change name of channel (https://discord.js.org/#/docs/main/stable/class/GuildChannel?scrollTo=setName)
},time in ms)
spoonfeed
it is easy - if u know basic of JS
Algebra teachers: what's a function I've only heard of constants and variables
Not really a place for this.
Channel for chatting about (bot) development
yep
if (priceBuyChange >= 1.40 || priceSellChange <= 0.40){
if (priceBuyChange >= 1.40) var crashReport = `Buy change: ${priceBuyChange}`
if (priceSellChange <= 0.40) var crashReport = `Sell change: ${priceSellChange}`
console.log(t)
}
console.log(i)
}, 3000);```
is there any way to shorten this?
Can I use [Link Text](Link URL), anywhere else other than embeds??
Like in block messages?
no
curios
curios
What u want to do?? Cwickks
shorten it
cuz half of me feel like there is a shorter version
half of me think it doesnt
I think u no require to do this
priceBuyChange >= 1.40 || priceSellChange <= 0.40, in first place
wait
the first if statement is unnecessary
setTimeout( function() {
if (priceBuyChange >= 1.40 || priceSellChange <= 0.40) {
var crashReport = priceBuyChange < 1.40 ? `Sell change: ${priceSellChange}` : `Buy change: ${priceBuyChange}`;
console.log(t)
} else {
console.log(i) // What is `i` here??
}
}, 3000);
OR```js
setTimeout( function() {
if (priceBuyChange < 1.40 && priceSellChange > 0.40) {
console.log(i); // What is i here??
} else {
var crashReport = priceBuyChange < 1.40 ? Sell change: ${priceSellChange} : Buy change: ${priceBuyChange};
console.log(t); // What is t here??
}
}, 3000);
Did I messed anything?
its messier than mine 😄
No I'm asking if it, giving wrong output?
i cant see why not
based on your current code of
setTimeout(function(){
if (priceBuyChange >= 1.40 || priceSellChange <= 0.40){
if (priceBuyChange >= 1.40) var crashReport = `Buy change: ${priceBuyChange}`
if (priceSellChange <= 0.40) var crashReport = `Sell change: ${priceSellChange}`
console.log(t)
}
console.log(i)
}, 3000);```
you could shorten it like so
```js
setTimeout(() => {
if(priceBuyChange < 1.40 && priceSellChange <= 0.40) return console.log(i)
(priceBuyChange >= 1.40) ? let crashReport = `Buy change: ${priceBuyChange}` : return
(priceSellChange > 0.40) ? let crashReport = `Sell change: ${priceSellChange}` : return
console.log(t)
}, 3000)```
dont use var unless you want to state globally
else use let
@earnest phoenix return can't be used in conditional operators....
xD
let me go to my chrome terminal
ternary operaters cant have return
yep
setTimeout(() => {
if(priceBuyChange < 1.40 && priceSellChange <= 0.40) return console.log(i)
if(priceBuyChange >= 1.40) let crashReport = `Buy change: ${priceBuyChange}`
if(priceSellChange > 0.40) let crashReport = `Sell change: ${priceSellChange}`
console.log(t)
}, 3000)
``` i guess it might be cleaner to instead check if false for the first line and return if it is instead of nesting
but really thats the only way i could see it cleaner
im new to coding and i cannot understand some of it
its better to stick to mine
setTimeout(() => {
if(priceBuyChange < 1.40 && priceSellChange <= 0.40) return console.log(i)
if(priceBuyChange >= 1.40) let crashReport = `Buy change: ${priceBuyChange}`
if(priceSellChange > 0.40) let crashReport = `Sell change: ${priceSellChange}`
console.log(t)
}, 3000)
``` i guess it might be cleaner to instead check if false for the first line and return if it is instead of nesting
@earnest phoenix this could do it
its how readable the code is not necessarily how many condition checks there are
on that note though you could shorten mine further
setTimeout(() => {
if(priceBuyChange < 1.40 && priceSellChange <= 0.40) return console.log(i)
let crashReport = priceBuyChange < 1.40 ? `Sell change: ${priceSellChange}` : `Buy change: ${priceBuyChange}`
console.log(t)
}, 3000)
how can i remove the whole numbers and be left out only with the decimals?
%1
let decimal = your_number % 1
you could always turn it into a string and array and slice the first character
too
and convert it back to a number because %1 sometimes will give a reallllly long floating decimal
Guys
Тут есть русские!?
is something about making a video for Vimeo Tutorial Video ID for support cuz i wanna know what editors,recorders u guys suggest
-noru
Вы можете говорить по-русски в #memes-and-media.
Если Вам нужна помощь с top.gg, Вы можете обратиться за помощью в #support.
trivago do you have one of those for every lang
Only for the frequently seen ones
alr brb
@fluid field они сказали, что нам нужно говорить по русски на этом канале #memes-and-media
@vivid wadi я понял
Ладно
hey could someone help me
my bot isn't going online
eventhiough i have the right config bot key in there
and the bot also says it is online in vsc
without errors
By what do you judge it isnt online
let decimal = your_number % 1
@earnest phoenix im confused
It could be just discord that it isnt yet updated (the status)
Try a simple command and see if it responds
What does % 1 do
the commands aren't working either
Can you show me your code (without token)
Yes
basically this bot contains like 4 different folders or more
1 for the events, for data, commands etc.
but everything should be working fine?
for some reason
the old bot token i had entered
in the config file
now runs 24/7
eventhough i have no clue why
Kewl it works
Can you send your message event
Kewl it wors
okay
Whats the opposite of .substring()?
this is the embedhelper
superscript
Nono
the actual botspeech
Because that is the bot you are running the code for?
no
i want it on another bot
and i am sure the config file is updated with another key
maybe the json file is corrupted?
Did you restart your bot after updating the token?
definitely
even regenerated the token etc.
tbh i have never ever seen spomething like this
maybe the json file is corrupted?
That would most likely result in an invalid token though
its a .env
Yes?
ooooowh
Wait
it should be a env file instead of json
Did you update the wrong file?


collector.on('collect', async m => {
if (!m) return;
if (m.toString().toLowerCase() == "disable") {
guild.wellcome.enableJoin = false;
guild.wellcome.left = " ";
} else {
guild.wellcome.joined = m.toString();
}
await message.channel.send("Please supply a Member left message, Type `disable` to disable it");
if (m.toString().toLowerCase() == "disable") {
guild.wellcome.enableLeft = false;
guild.wellcome.left = " ";
} else {
guild.wellcome.left = m.toString();
}
await guild.save();
collector.stop();
message.channel.send("Nice, you are done with the **SETUP**");
});
This is not working
yoo can i hug you guys
for helping me
i have been at this for 2 fucking day
days*
(no homo tho)
which is better pagination embed or simple embed
@earnest phoenix what's not working?
look the image
they are same
i want to prompt a join message and left message
but join and left are same
it collects two times?
yes
you spelled welcome wrong btw
how do you detect if it's for join or leave?
do you have a counter?
or you have two separate collectors?
if so, why not just use awaitMessages?
awaitMessages ?
can't you just compare 2 guild member lists
@pale vessel can u give me docs about it
@pale vessel
const filter = m => m.author.id === message.author.id;
channel.awaitMessages(filter, { max: 2, time: 60000})
So it will be max 2 (2 messages) ?
yes
it'll return two messages (if they set it up correctly)
use messages.size and make sure it's 2
ok
but you can't detect on collect
you have to tell the member to send two messages for join and leave
yes
and then send a message with bot
actually, you should use collectors
._.
so that you can send a message after each step
you have to use something like a counter and increment it on every step
so that you'd know whether it's for join or leave
wdym ?
if(collected.size == 2) return guild.save();
??
so it will save in database ?
bruh
Anyone can help. How to add spotify to my music bot. Play playlist spotify by my music bot
with spotify api
with the api u can, bro
The API doesn't allow you to stream the music as only gives info for each song.
Add the api only will not work
U need to use the API
Ik
we dont spoonfeed, if u want to be spoonfed, post a question at stackoverflow
I need code
@flint yew
Ahh
A simple solution is to get the Track author and name and search for it on YouTube or SoundCloud (Or other providers)
That's what I do at least
I did sound cloud but after I was searching for the sound cloud api
It's closed
And no more sound cloud api
Then you can use YouTube
Lavalink still supports Soundcloud
Lavalink still supports Soundcloud
yeah cause it scrapes
Fair.
Doubt they have a LavaLink server setup though ¯_(ツ)_/¯
You could setup a LavaLink server then I suppose
how do you do edit commands
e.g. you edit your message and the bot edits it's message
Listen for the messageEdit event I guess
Check if that message was used in a command
i had assumed that
some use frameworks like Klasa, some use a custom send function that tracks bot's messages (this is what i did) but i removed mine since it would mess up stuff that use reactions
just not worth it in my opinion
@twilit rapids how he have api
If sound cloud closed
All api
I am in need for api for soundcloud
soundcloud api is closed for now iirc
lavalink scrapes soundcloud
help my code is getto
https://codeine.is-inside.me/M6NDdvrH.png
Tf
its because the API im using returns promises
then i have to nest them
now i made a huge mess
using this api > https://www.npmjs.com/package/steamapi
i need help with my tempmute command
the permissions, timer and all that works fine
but when i run it the console says that the bot doesnt have sufficient permissions
i've dragged it above all roles and i gave it every single permission
i've also checked that my alt doesnt have any administrator permissions
Uhm I might be dum right now but how would I create a channel that is nsfw (discordjs) ?
yo im trying to get a bot or make a bot that will basically delete my message and say the exact same thing so it looks like i'm talking from a bot, this is just bc i cbf to make an automated bot lol
@ionic shard thats def not how to use promises
yes mate can u link me something useful
im kinda new learning things along the way
@restive furnace
just google mdn promises
how to fix this
Well you scribbled out what is actually important to solve your issue
^
You’ve defined a file in your code that doesn’t exist
You trying to require a file/folder in your code that doesn't exist in that directory
if(filter.includes("name ") || filter.includes("n ")){
console.log(name)
}
else if(filter.includes("shiny") || filter.includes("s ")){
console.log("shiny")
}```
is it possible to execute both if and else if, if filter includes name as well as shiny?
Just include all in one if statement?
Instead of seperating them to 2 if statements
it will be complicated
I am working on multiple filters
like .filter --name raj --dateofbirth 2June --class 7
I am basically filtering from a huge bunch of databases
If you want both of the if statements to execute, then remove the else
if(filter.includes("name ") && filter.includes("shiny") && filter.includes("n ")) {
if(filter.includes("s ")) console.log("shiny")
console.log(name)
}```
shoop da woop
uh I said already it will become so much complicated
what if name is not included in filter and only shiny is included
it won't execute it
do you want that?
if(filter.includes("s ")) console.log("shiny")
if(filter.includes("name ") && filter.includes("shiny") && filter.includes("n ")) {
console.log(name)
}```
shoop da woop
I am saying this will make it complicated because I have 20+ filters
like --name
--class
etc
imagine writing each filter and then if statement inside each filter
@river sedge bruh?
uh?
this is what I am doing
and it's only printing shiny
not the name
ok fixed it
ty
That hurts me
Scripted Java
why
console.log(Boolean(1 + true - false * true ** Number([] * 33)- false * true - false)?'parry this':'casuals')```
anyone know of a node based poll bot that's open source, struggling to find one on github for a day or so now
You seriously need to find an open source one? Poll bots are extremely easy to make
@earnest phoenix well I mean, I never worked with the discord api before but cheers for that
It's not hard to make one.
Learn a language, use a library for the Discord API, boom.
I have written a few million lines of node.js that's why I asked about a node based one
c is fine too, if its written for debian
Yeah, so use a library like Discord.js or Eris.
Same
whatsup car show man
@sudden geyser yea I get it zzz just wanted something that was done already
seems everyone wants to integrate their polls into other more excessively featured bots
c is fine too, if its written for debian
@grand finch what? linux have GCC, meaning it works on all distros duh
whats a compiler
amd C is cross platform
right
Wanting an open source bot like a poll bot is just a little bit yikes
You could probably find some if you kept searching (Google is your best friend) but there's more value in writing your own than just downloading and running an already-made on.
and is C really that cross platform
yes
c doesnt define any architecture
so technically it is platform independent
but try writing networking code that works on everything
well its pretty easy (excluding windows)
cIsJusTCoMpIlEdAsSeMblyY
since u have to use win32 api for that
right and you have to use networking syscalls on debian so... what's your point exactly?
🤷
anyone know how to filter the reddit api to only posts with images?
but u can use a library whats already made for that purpose
node
just be a big brain and use java
@earnest phoenix no unsigned ints
@misty sigil Just check if the link property exists or it has a link
node
@earnest phoenix not compiled
kotlin gang
I think the rules quite clearly said no down-talking languages
then use typescript
but I am so tempted
if you want compiled js
:^)
<Posts>.filter(p => p.link);``` @misty sigil
i cant really think of a reason to use a compiled lang
compiled lang = hardware level things, but if u dont find reason to use it, keep using node
intepreted lang = websocket things and websites etc.
but for discord bots
its not very practical to use such low level langs
for most bots that is
but i doubt anyone has a bot that interacts with hardware
or needs to operate on such a low level
way more practical to use a higher level lang
well if u mainly use "that" language, but i get the point 🤷
@wintry hatch
like a spoon and a fork
i believe sporks was made in c++, but cant confirm
yeah
The name came from that
what does it even do
oh brains bot
it is a chat bot
so when you post a link it gives a preview....is there anyway tap into that functionality for non links?
what?
like that kind of output
Like an embed?
yes
like this?: https://animalbot.xyz/embed?title=h
omg yes!
no way
It’s just meta tags
are you using djs @earnest phoenix
like this?: https://animalbot.xyz/embed?title=h
@misty sigil did u fix the embed coloring btw
yes
https://discordjs.guide/popular-topics/embeds.html#using-the-richembedmessageembed-constructor @earnest phoenix
read that
like this?: https://animalbot.xyz/embed?title=h muthafucka
tyvm
nice
that is so awesome
meh not really
well since i thought you couldnt do it its awesome
if you want something cool to look forward too look into the bot ui changes coming up here
in like october i think it is
nice ill def read about it

i think i finally managed to move everything
imagine being forced to learn ubuntu shit to host your bot

when something 'requires' a module that is installed from npmjs, it gets its knowledge of that module from whatever module.exports is in its respective index.js right?
0/10
Istg I heard some kid in vc moan
i havent fully loaded it with a full on stress test
but im having trouble event denting it
moves to shitpost since this is development
any word on if there is work being done for bot to authorize a third party login? I have some bot ideas but some require auth
Discord OAuth?
i havent fully loaded it with a full on stress test
@opal plank what is that host, or is that ur pc 🤔
what
do u even know where u got that
friend let me use her rig, thats afaik
ah ok
yes oAuth...so i can log into third party site securely and start scraping or using api
Your friend is very fucking generous
cuz my setup was not keeping up with the retarded amount of traffic i was getting
she said herself, good luck denting it
so i took it as a challenge
under 200k users it hit 6% cpu usage

on ONE CORE
I have this beg command but it says Cannot read property 'members' of undefined?
i doubt i'll be able to hit 20% even on a single of those cores
...Should i show code
Yos
let user = message.mentions.members.first() || message.author;
user = member.user;
let timeout = 180000;
let amount = 5;
let beg = await db.fetch(`beg_${message.guild.id}_${user.id}`);
if (beg !== null && timeout - (Date.now() - beg) > 0) {
let time = ms(timeout - (Date.now() - beg));
let timeEmbed = new Discord.MessageEmbed()
.setColor("#FFFFFF")
.setDescription(` You've already begged recently\n\nBeg again in ${time.minutes}m ${time.seconds}s `);
message.channel.send(timeEmbed)
} else {
let moneyEmbed = new Discord.MessageEmbed()
.setColor("#FFFFFF")
.setDescription(`You've begged and received ${amount} coins`);
message.channel.send(moneyEmbed)
db.add(`money_${message.guild.id}_${user.id}`, amount)
db.set(`beg_${message.guild.id}_${user.id}`, Date.now())
}
first line error'ing?
Line 10
ok I see the issue
?
you’re re-assigning member to user
Also message.author returns user
it’s message.member
yup
Oh
Wait i think i have the same error even i remove that
module.exports = function inviter(member) {
member.guild.fetchInvites().then(guildInvites => {
const ei = invites[member.guild.id];
invites[member.guild.id] = guildInvites;
const invite = guildInvites.find(i => ei.get(i.code).uses < i.uses);
const inviter = client.users.get(invite.inviter.id);
return invite;
});
}
why this returb undefiene
isnt it cache?
let member = member
if(!member)return
let user = member.user
whre ?
users.get() isnt a thing
:0
client.users.cache.get() is what you’re looking for
user.cache.get() is
why do so many people join the voice channel with mics muted and then leave
mentions doesnt always exist
bot testing?
This? let user = user.cache.get() || message.author;?
let user = message.mentions?.members?.first() || message.member;```
and dont touch user after that
oh
cuz the line right after changes it
still undefiene :((
step debugging is a saving grace
being able to look at the code as it runs
@opal plank you only need the optional chaining at members?.
then, yeah, indeed, only members
just has nothing
let ban = message.guild.fetchBans();
if (!ban.find(user => user.id === member.id)) {
//my code
}
how do I get a banned member? (discord.js)
a list of the bannend members
a collection
a map it is
he didn't await the promise
plus, it's user.user.id
lose the !
i think d.js adds a find method to collections, no?
he didn't await
otherwise just do values() and filter
if its true they are banned
okay, just await the fetchBans() and change user.id to user.user.id
probably shouldn't name it user to avoid confusion
maybe entry => entry.user == member.id
I have this error when i do beg command--> Cannot access 'user' before initialization
use d.js's methods, or use map()s normal methods
Im not sure if im doing it right
let user = user.cache.get() || message.author;
if its a map you can do values() and filter
his method works too
Where did you define user in the past Hermi?
I think it's complaining that you're doing let user = user.<...>
I did this at first let user = message.mentions.members.first() || message.author;
but i had an error
then i changed it
Well what are you trying to do in the first place? At first you're trying to get the first mention, then default to the user if not found. The second attempt is you trying to get someone from the cache with no argument
ohh sorry
let user = message.mentions?.members?.first() || message.member;```
@opal plank the ?. are unnecessary though?
members will return an empty collection
that'll error still no?
members*
oh my bad
hmmm i though it would error
run it in a dm
bad
i absolutely despise dm bots
i disabled dms on my bot
Im having the same error
but it should still be defined but empty
it’s not a snowflake
the error must be before the console.log()
a snowflake is the numbers on their own
Hmm how do i fix my error
at Function.normalizeFields (/home/runner/wmjs/node_modules/discord.js/src/structures/MessageEmbed.js:443:8)
at MessageEmbed.setup (/home/runner/wmjs/node_modules/discord.js/src/structures/MessageEmbed.js:77:91)
at new MessageEmbed (/home/runner/wmjs/node_modules/discord.js/src/structures/MessageEmbed.js:18:10)
at embedLikes.map.e (/home/runner/wmjs/node_modules/discord.js/src/structures/APIMessage.js:164:40)
at Array.map (<anonymous>)
at APIMessage.resolveData (/home/runner/wmjs/node_modules/discord.js/src/structures/APIMessage.js:164:31)
at TextChannel.send (/home/runner/wmjs/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:166:62)
at Object.execute (/home/runner/wmjs/commands/bal.js:23:17)
at Client.bot.on.message (/home/runner/wmjs/index.js:29:29)
at Client.emit (events.js:198:13)
(node:327) 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: 1)
(node:327) [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.``` I tried executing an embed, and for some reason I get this??
upgrade nodejs to v12.x
can someone help me please. When i type +help it doesnt show the embed but it doesnt give any error
how?
let { MessageEmbed } = require("discord.js")
module.exports = {
name: "help",
category: "info",
description: "Shows all commands",
usage: "+help",
run: async (bot, message, args) => {
let embed = new MessageEmbed()
.setTitle(`Help`)
.setDescription(`The Prefix is \`+\``)
.addField(`Info [5]` , `\`help\` \`ping\` \`uptime\` \`serverinfo\` \`userinfo\``)
.addField(`Moderation [6]` , `\`ban\` \`kick\` \`setnickname\` \`purge\` \`mute\` \`poll\``)
.addField(`Fun [3]` , `\`dog\` \`cat\` \`meme\``)
.addField(`Economy [3]` , `\`balance\` \`addcoins\` \`removecoins\``)
.addField(`Utility [2]` , `\`prefix\` \`invite\``)
.setFooter(`Requested By: ${message.author.tag}`)
message.channel.send(embed);
}
}
thats the code
why u async it?
it’s not a snowflake
@misty sigil I'm new in js, how can I fix this?
its running syncronously
args[0]
can someone help me out?
don't use filter, use .find
filter returns a an empty array collection which is truthy *confused with eris
u cant join non arrays
ok
How do I import images in nodejs?
what is unbanned_snow for?
Umm
put join().replace() inside resolve()
@steady anchor
resolve(args[0].replace())
@pale vessel ah ok
@pale vessel args[0] is a string
UnhandledPromiseRejectionWarning: TypeError: fields.flat is not a function Bruh, I updated to latest version of discord.js and node.js ??
wdym
well,
Update node you aren't in the v12 version of it
oh yeah
I am
args.join() not args[0].join() @steady anchor
wait no he kept on changing it
@steady anchor resolve(args[0].replace())
The hell is he trying to do
resolve a snowflake to a user
yes
why change a mention to an id snowflake when you already get it with message.mentions.members.first()
but it's
With usernames? Wot
nickname
Is he trying to get a member with nickname or username I'm confused
no that's clearly a user
users.resolve()
i'm retarded no i'm not, they will mention a member anyway but wait the member is banned so they can't have a nickname
i've copied it from github xd
@steady anchor Just do this
let unbanned = message.mentions.members.first() || message.guild.members.cache.get(args[0]);```
and change nouser.user.id === member.id to user.user.id === member.user.id
Flaz member has an id property
o
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
@steady anchor Well try this
let unbanned = message.mentions.members.first() || message.guild.members.cache.get(args[0]) || client.users.cache.get(args[0]);```
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.resolve (internal/modules/cjs/helpers.js:33:19)
at ChildProcess.<anonymous> (/home/runner/wmjs/node_modules/node-bin-setup/index.js:18:27)
at ChildProcess.emit (events.js:198:13)
at maybeClose (internal/child_process.js:982:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)``` So uh, tried updating to latest node version and this happens??
@steady anchor Well try this
let unbanned = message.mentions.members.first() || message.guild.members.cache.get(args[0]) || client.users.cache.get(args[0]);```
@earnest phoenix then it's not a snowflake
If it's not snowflake then there's something wrong with your args definition
How did you define args may i see
var args = cont.split(' ').slice(1)```
var cont = message.content```
@earnest phoenix
λ node -v
v13.12.0```
Oh well, if you didn't realize, you're trying to get a mention or use an id of somebody existing in the guild which is not banned, but banned users aren't in the guild so why not just get args[0] over all
is this a wrong version of node.js?
let unbanned = args[0];```
is this a wrong version of node.js?
@steady anchor No
newer than 12.0.0 will work on v12 of discord.js
@steady anchor try restarting your machine
<How does that help>
SpaceX dragon capsule interfaces built in HTML/CSS/JS (Vanilla) 
user is undefined
my input
bruh
This is wrong
if (!ban.find(user => user.user.id === member.user.id)) {```
user.user does not exist
@tight plinth it's banObject.user
he just named it user
so user.user
what must i rename to banObject.user?
if (!ban.get(member.id)) {```
Np
I can't seem to be able to get this cog into my help command (as in its not showing):
https://paste.pythondiscord.com/iyunicoxef.py
Are you sure the cog is being loaded in your main file
Yes
hi
i am bored
and i dont know what commands to make
lol
what commands can i even make
now
Depends on how much of a knowledge you have on the current programming language you're using
Try making a meme command using the reddit api
My cog is loaded in my main file, but none of its commands are in the help command itself...
My cog is loaded in my main file, but none of its commands are in the help command itself...
@leaden rover are you able to use the commands?
Are you using the default help command or made your own
I am using the default?
Well, I am using the pretty-discord-help.py one
Its the same, but embed
Hello, guys. who use hosting Heroku what database are you using? PostgreSql, MongoDB or something else? i write a bot on sqlite3, but then i found out that Heroku doesnt support it and doesnt overwrite files at all(
I use mongo
I don't use heroku nor a db
@zenith citrus heroku has free postgres iirc
If you're using sqlite3 already, most of your code should still work with postgres
@safe kelp You don't have a start script
Means
I am using a help command package
In your package.json, under scripts, you need a start script
Well I don't know js so plz tell how to
Well if you can use the command but it's not appearing in the help command I'd recommend comparing another cog that's being shown in the help manual and see if there's some difference. It looks fine from my perspective (I have average knowledge in Python). Maybe it's a check that's returning false which won't make it show up?
What do you want heroku to run in order to start the bot
Wait
what command do u run on ur current computer when u start the bot
@opaque eagle see I will run the bot codes the index.js
My main file
Which one
show me the new error
Did you push your code properly?
You likely want to disable web and keep worker running
Wait let me do it
if (args === '<insert text here>'{}
Will this work?
What language is that supposed to be
d.js
JavaScript*
how did you define args
Also you need to close the ) on the if statement
const args = message.content.slice(prefix.length).trim().split(/ +/);
@opaque eagle
It says token invalid
Make sure you're using the right bot token
@hazy sparrow so there, args is an array.
If the user runs !hello foo bar lmao
args will be ["hello", "foo", "bar" ]
Then use that to handle args properly
I put my token in a file config.json
And in my main file I use client.login(process.env.token)
You see what's wrong there
.env?
You have the token in config.json, not in the token env, but you want d.js to use env
isnt it supposed to be ["foo", "bar", "lmao"]
is that what you get back?
So should I rename config.json to env?
message.content.slice(prefix.length)
// hello foo bar lmao
// gets rid of the prefix
.trim()
// hello foo bar lmao
// removes any whitespace at the start and end
.split(/ +/);
// ["hello", "foo", "bar", "lmao" ]
// splits the string at each space```
Or use (process.config.token)??
@safe kelp i'd go learn some basics of node.js
I said I work with Python
You can host python on heroku lmao
The codes gave by someone to host
not just node.js





