#development
1 messages · Page 978 of 1
thats a good plan but i still wonder how i would combine it
to combine total messages for the past 7 days for each user into a single for EVERY user which has messaged in the past 7 days
then make a leaderboard which sorts top 10
That'd be possible with this example I gave
Each user would have its "daily count"
So instead of having N entries per day per user, you'd have only 1 entry per day per user
2020-06-18T01:53:56.000000+00:00 app[api]: Build started by user mygmail@gmail.com
2020-06-18T01:54:05.000000+00:00 app[api]: Build failed -- check your build output: https://dashboard.heroku.com/apps/..........................................................................
help
Check your build output for actual error
me?
yes
look at your error
instead of going here for every tiny issue with node
clearly says permission denied
google it
OS?
Windows, Linux, etc
Windows
wait you are using heroku
yes
:c
Using discord.py how can I have my bot join and speak on multiple servers?
self.voice_chat = None
async def play_joke_audio(self, joke, voice):
filename, player = await YTDLSource.from_url(joke.audio)
if self.voice_chat is None:
self.voice_chat = await voice.channel.connect()
self.voice_chat.play(player, after=lambda e: os.remove(filename))
Voice chat seems to only work with one server at a time
@zinc condor nothing dont work
export interface Constructable<T> {
new(prefix: String, arg: String, message: Discord.Message) : T;
}
const cmd = new (command as Constructable<Command>)(prefix, arg, message);
i keep receiving this error:
Conversion of type 'Command' to type 'Constructable<Command>' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
Type 'Command' provides no match for the signature 'new (prefix: String, arg: String, message: Message): Command'.
31 const cmd = new (command as Constructable<Command>)(prefix, arg, message);
protected constructor (prefix: String, arg: String, message: Discord.Message) {
}
the constructor w/o the body
any ideas on how to fix this ?
this is typescript btw
How would one make an uptime command?
step 1) write code
step 2) profit
is it possible to use MySql database with dsharpplus it refuses to run my mysql commands.. do i need to run them in a sepereate void?
ef core?
can someone help me make a stats page connect to my code
hi
a small help please
const db = require("quick.db")
module.exports={
name: "spawnarceus",
category: "NA",
description: "spawning pokemon: arceus",
run: async(bot, message, args) => {
const Embed = new MessageEmbed()
.setTitle(`A Wild Pokemon appeared type to catch it!`)
.setColor(`RED`)
.setFooter(`HMM U CANT CATCH IT`)
.setImage('https://cdn.bulbagarden.net/upload/thumb/f/fc/493Arceus.png/1200px-493Arceus.png')
db.set(`pokemon_${message.guild.id}`, "ARCEUS")
if(message.content.startsWith("Arceus")){
message.channel.send("YAY U CAUGHT A LEGEND")
}
message.channel.send(Embed)
}
}```
**How To Make It Auto spawn and Catch It**
you can use setInterval for automated things
how
wdym
if it spawns how to catch it
make a command for it?
Learn to code :)
^
its your bot, how would we know what the command is
was compiled against a different Node.js version using
NODE_MODULE_VERSION 72. This version of Node.js requires
NODE_MODULE_VERSION 64. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).```
whaat do i do
what is your node js version
10
it should be v10.20.1 or later (https://github.com/JoshuaWise/better-sqlite3/blob/master/docs/troubleshooting.md)
10.15.3
update it
error:ReferenceError: Cannot access 'client' before initialization
code:```const { Client, Collection, MessageEmbed } = require("discord.js");
const Discord = require('discord.js');
const DBL = require("dblapi.js");
const dbl = new DBL('MY API TOKEN', client);
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(Oops! ${e});
})```
uh
client should be an instance of discord.js's Client, hence you need a definition for client somewhere above your instantiation of dbl
no its not
litterly the first line
OH
where is your client
How to make a leaderboard command in quick.db
i have a very dumb question, how do you remove an array element if you only know the position/index
JS? Use Array.splice(index, 1)
cool, that works, thanks
How to delete webhook?
.delete only deletes the message sent by the webhook I think
i dont think you can unless you do it manully
@woeful pollen for discord.js https://discord.js.org/#/docs/main/stable/class/Webhook?scrollTo=delete
где руские
#fffff
Take your background colour, lighten/darken it by x% and use that
thanks
no such file or diretory
if not code, then just show whole error, cause usually theres more than that
i dont think so code is need cuz
it vscode error i think
It is probably code that is messing up
https://nmw03.is-inside.me/E4noneob.png
@summer torrent is why d.js needs to be removed
wat
???
if the d.js server is helping people with js, when the server is only for the library not the language, why is it telling people to show people how to fix simple js errors
The d.js server no longer helps people with js
Because apparently it's a common error for d.js users and d.js server members got sick of saying the same thing over and over
because d.js is primarily used by noobs beginners who never coded in their lives
because d.js is primarily used by
noobsbeginners who never coded in their lives
ur not wrong...
yeah, thats my point. which is why i think it needs to be removed
its not a reason for removal lol, its even more reason for it to exist
noobs are a highly valuable market
How i add shards to my bot?
noobs are a highly valuable market
110% I've made very simple bots that took like 5 minutes to make for like $15 in d.js as the owner's request...
d.js as the owner's request...
oh yea im blind sry
so they don't spam
is it possible to do a custom link button in python?
what? @stable grail
You mean a markdown link?
yeah
[Link name](actual link)
but in python?
oh ok
thanks a lot
python makes no diffrence
@modest maple could u show me an example?
im not sure if im doing it right
they're just markdown hyper links
markdown for hyperlinks can only be used in embed descriptions and field values
if you attempt to use it outside of that, it'll render as is
unless its a webhook
how can i start caching in js? assuming thats going to reduce memory
i googled it but it shows stuff about web dev
you can't send screenshots and expect people to know and help....
whta line in 29
Caching does not reduce memory
Caching is saving objects into memory, so you don't have to fetch them from an API / database multiple times
caching increases memory to make things faster
Ah I see
oh
const db = require("quick.db");
let chx = db.get(`LeaveChannel_${member.guild.id}`); //here
let leavechannel = member.guild.channels.cache.get(chx);
if (!leavechannel || !chx) return;
if(chx === null) {
return;
}```
help ?
in eris, how can i remove intents?
const Discord = require("discord.js")
const db = require("quick.db")
module.exports = {
name: "balance",
category: "N/A",
description: "Currency",
run: async (bot, message, args) => {
let user = message.mentions.users.first() || message.author;
let credits = db.fetch(`credits_${message.guild.id}_${user.id}`)
if (credits === null) credits = 0;
let bank = await db.fetch(`bank_${message.guild.id}_${user.id}`)
if (bank === null) bank = 0;
let greedymoney = new Discord.MessageEmbed()
.setColor(`#FFFFFF`)
.setDescription(`**${user}'s Balance**\n\nCredits: ${credits}\nBank: ${bank}`);
message.channel.send(greedymoney)
}
};
how do i make generate credits for myself
i mean dev
someone please say
use db.add()
I'm here
@lyric mountain the above one bro
how do the developer add credits for theirself and where should it be pasted
if you want to add to yourself just manually edit the db
no need to use code for that
btw, why do you have both "bank" and "credits"?
and you aren't waiting for credits value
i too have that
but not names
only countt
is it client.user.setActivity(`${client.guilds.size} servers`)
V12?
So, it should be client.guilds.cache.size
Np
No
What's name?
Why
@earnest phoenix
<client>.guilds.cache.map(g => g.name).join("\n")
^
I see
lol
.nameoftheclass {
color: '#000000'
}
oki, thanks
l
I have a question,
I am making a user-info command and I want to display the game that they are playing, but if I test it it keeps saying "Not playing a game"
Could someone tell me what I did wrong and what I need to change?
The code:
if(message.content.startsWith("Beaver user-info")) {
let user = message.mentions.users.first() || message.author;
let userinfo = {};
userinfo.avatar = user.displayAvatarURL();
userinfo.name = user.username;
userinfo.discrm = user.discriminator;
userinfo.status = user.presence.status;
const embedUserInfo = new MessageEmbed()
.setAuthor(user.tag, userinfo.avatar)
.setThumbnail(userinfo.avatar)
.addField('Username', userinfo.name, true)
.addField('Tag', userinfo.discrm, true)
.addField('Status', userinfo.status, true)
.addField('Playing', user.presence.game || 'Not playing a game')
.setColor(0xff0000)
return message.channel.send(embedUserInfo);
}
})```
there's no "game" property in presence
oof
oh oki, ty
help please
wut
do node.js install -save
show your code
okay
and if that doesn't work then do: node.js show -save
var bc = require('base-convert');
or
var bc = require('base-convert');
i dont fixed 😦
/rbd/pnpm-volume/ea5960bb-7e6b-4bc2-a042-a647b75566b8/node_modules/.registry.npmjs.org/bindings/1.2.1/node_modules/bindings/bindings.js:91
throw err
^
Error: Could not locate the bindings file. Tried:```
hlo
that's an internal node error
node error 
its my code
it's good
this is my bot2: https://discord.com/api/oauth2/authorize?client_id=718414655281692723&permissions=0&scope=bot
what
@vale garden be patient dude
@vale garden use await message
are we allowed to send links like this
@plush fractal no ads
kkk
or a message collector
ok
omg
ah, claro
i dont fixed
um br
:/
Is there any benefit to using async/await over .then?
Im not advertizing im just saying my bot
I am using .then now for async stuff.
.then is easier semantically
await is useful if you want to return a value from an async function mostly
my code:
In this case it's fetching a page so I want to get the body
But I have an entire function within a .then section and it looks a little bit weird
stick with .then
await is very error-prone when used frequently
also .then has that sweet .catch
which is shorter than conventional try-catch
That is pretty nice yeah.
also, .then allows u to chain events without locking the thread
Locking the thread? Could you elaborate on that?
Locking the thread? Could you elaborate on that?
@hushed jungle there's a thing called "thread safety"
ik im at that page already @earnest phoenix
for example, if you await a fetch that for some reason doesn't return a response, your will enter a deadlock state if you used await in the main method
this will prevent further execution of the code, and hang it there until the fetch returns something to the await
since js is mono-threadded this is EXTREMELY dangerous
Yikes.
so it's recommended to also have some lib that adds a timeout to vanilla fetch (which doesn't have one)
if you don't use await, the deadlock will only affect the post-fetch code (the one inside .then), not the main code
this is called asynchronism
Thanks for explaining ❤️
hi
I will bookmark it
i made a message collector command
and it works
but im getting this error
UnhandledPromiseRejectionWarning: TypeError [INVALID_TYPE]: Supplied options is not an object.
but the commands still work
what does this mean
lol
Please show your code
module.exports = {
name: 'test',
description: "test command",
execute(message, args) {
const filter = m => m.author.id === message.author.id;
message.channel.send("ayooo homie wassup boii").then(r => r.delete(5000))
message.channel.awaitMessages(filter, {
max: 1,
time: 5000
}).then(collected => {
args[0];
message.channel.send("sup lol")
})
}
}
.....
what
what a messy indentation
did i mess up something badly
lol
idk how its like that
but it is
for some reason
what does my error mena
mean
this is used for message collector ``` let filter = m => m.author.id === message.author.id
const collector = msg.channel.createMessageCollector(filter, { time: 30000 })
collector.on("collect", m => {```
@vale garden
my collector works perfectly fine
lol
i said i cant do it too
lol
do you know how to make a transfer money command
but it isnt working
i mean a buy command
lol
i said transfer money by mistake
lol
const Discord = require("discord.js");
const client = new Discord.Client();
const Eco = require("quick.eco")
const eco = new Eco.Manager()
let shop = new Eco.ShopManager()
module.exports = {
name: 'buy',
description: "for buying items in the shop",
execute: (message, args) => {
let water_bottle = args[0];
let add = shop.getItem(message.author.id, "water_bottle");
let subtract = eco.removeMoney(message.author.id, 750);
if (!args)
return message.reply("Please enter an item to be bought like this for example:\n2t!buy water_bottle")
if (args[0])
return message.reply(`You have bought a ${getItem.item.Name} for ${removeMoney.amount}`)
}
}
my code btw
wait
What "isn't working"?
m.delete
ok
i need help how to make a warn bot
https://google.com/search?q=learn+to+code @north hollow
How do you make this?
https://discordapp.com/channels/264445053596991498/265156286406983680/723183243167268914
with api
^
then ?
like
when a message hasnt been collected
collector.on('collect', m => {});
like this is for when a message is collected
how do i do one for when it isnt within the given time
help me
someone help me start a new bot with command handlers pls ty
https://discordjs.guide @long yew
it doesn't work
lol
how long are you typing for @grand violet
Calm down
how long are you typing for @grand violet
@vale garden wut
❓
uh... I didnt typing any messages
😳
can someone tell me
tell u what
how i can define it when the message isnt collected
collector.on('collect', m => {});
like this is how its defined
when the message is collected
wdym "isnt collected"
like i mean
when the message isnt sent
when it is sent its gets collected
so how do i define it if it isnt sent and isnt collected
I could not place my bot on the remote desktop.
Can someone help me?
I want to make my bot send a message to my support server when it joins a server
and I dont know how to do that
ok
easiest part for me is to send the message
on guild create
Anyone know how to make these? I know it use google assistant api but how about the image? I am think about the canvas library but how about the pop up about the weather? https://media.discordapp.net/attachments/716470546820366490/723197874820743168/image.png
Simple and fast and free weather API from OpenWeatherMap you have access to current weather data, hourly, 5- and 16-day forecasts. Historical weather data for 40 years back for any coordinate. Weather maps, UV Index, air pollution
and historical data
how can i run the bot 24/7 on my ubuntu 20.04 server without having putty open
pm2 says my bot is online but it isnt
by using docker, like dokku or smh
how does docker work
putty is just ssh software
it does, you need to ctrl + v and right click
just literally right click on putty window, nothing else
thanks
hi
module.exports = {
name: 'test',
description: "test command",
execute(message, args) {
const filter = m => m.author.id === message.author.id;
message.channel.send("ayooo homie wassup boii")
const collector = message.channel.createMessageCollector(filter, { time: 5000})
collector.on("collect", m => {
message.channel.send("5678")
})
collector.on('end', collected => {
message.channel.send("lopl")
});
}
}
ik the indenting kinda sucks but this is my command
so when i type something after it it says 5678
but if i type something or not it always says lopl it the end
wait it was supposed to be lol
ok nvm
how do i make it say lopl only when a message isnt sent after the command
@earnest phoenix pls help lo
lol
https://google.com/search?q=get+started+with+docker+with+ubuntu
@restive furnace i installed it but i do not find anywhere how to start my bot
Can I have some help with writing a snipe command?
@vale garden when the collector ends, you need to check how many things were collected
and only send it if there was nothing collected
you dont need docker, pm2 should work
@quartz kindle it says online when i start it with pm2 but the bot isnt online on discord
you need to check the pm2 logs to see whats going on
PM2 | 2020-06-18T17:49:51: PM2 log: App [bot:0] starting in -fork mode-
PM2 | 2020-06-18T17:49:51: PM2 log: App [bot:0] online
PM2 | 2020-06-18T17:52:15: PM2 log: App [bot:1] starting in -fork mode-
PM2 | 2020-06-18T17:52:15: PM2 log: App [bot:1] online
PM2 | 2020-06-18T17:52:15: PM2 log: App [bot:1] online
PM2 | 2020-06-18T17:54:19: PM2 log: Stopping app:bot id:0
PM2 | 2020-06-18T17:54:19: PM2 log: App [bot:0] exited with code [0] via signal [SIGINT]
PM2 | 2020-06-18T17:54:19: PM2 log: pid=3709 msg=process killed
PM2 | 2020-06-18T17:54:24: PM2 log: Stopping app:bot id:1
PM2 | 2020-06-18T17:54:24: PM2 log: App [bot:1] exited with code [0] via signal [SIGINT]
PM2 | 2020-06-18T17:54:24: PM2 log: pid=3821 msg=process killed
how do i do that
srsly lot of this stuff isnt given in guides
ok maybe not a lot
but this isnt
@vagrant cedar that means your bot is stuck in a restart loop
how do i fix that @quartz kindle
how many processes do you have in pm2? pm2 ls
│ id │ name │ mode │ ↺ │ status │ cpu │ memory │
├────┼────────────────────┼──────────┼──────┼───────────┼──────────┼──────────┤
│ 0 │ bot │ fork │ 0 │ stopped │ 0% │ 0b │
│ 1 │ bot │ fork │ 0 │ stopped │ 0% │ 0b
@vale garden should be something like this: .on("end", collected => { if(!collected.size) { nothing collected } })
kk thx
@vagrant cedar you have two copies of it with the same name
try deleting them both
and start a fresh one
how do i do that
pm2 delete bot
and now: pm2 run bot.js ?
do pm2 ls again just to make sure there's nothing else left
ok, now you can do this pm2 start bot.js && pm2 log
that should start it and immediatelly open the logs
so you can see whats going on
noicee
PM2 | 2020-06-18T17:49:51: PM2 log: App [bot:0] starting in -fork mode-
PM2 | 2020-06-18T17:49:51: PM2 log: App [bot:0] online
PM2 | 2020-06-18T17:52:15: PM2 log: App [bot:1] starting in -fork mode-
PM2 | 2020-06-18T17:52:15: PM2 log: App [bot:1] online
PM2 | 2020-06-18T17:54:19: PM2 log: Stopping app:bot id:0
PM2 | 2020-06-18T17:54:19: PM2 log: App [bot:0] exited with code [0] via signal [SIGINT]
PM2 | 2020-06-18T17:54:19: PM2 log: pid=3709 msg=process killed
PM2 | 2020-06-18T17:54:24: PM2 log: Stopping app:bot id:1
PM2 | 2020-06-18T17:54:24: PM2 log: App [bot:1] exited with code [0] via signal [SIGINT]
PM2 | 2020-06-18T17:54:24: PM2 log: pid=3821 msg=process killed
PM2 | 2020-06-18T18:20:07: PM2 log: App [bot:0] starting in -fork mode-
PM2 | 2020-06-18T18:20:07: PM2 log: App [bot:0] online
why is it starting 2 bots?
i dont know
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
├─────┼────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0 │ bot │ default │ 1.2.9 │ fork │ 12377 │ 52s │ 0 │ online │ 0.1% │ 49.8mb │ root │ disabled │
└─────┴────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
it shows just one
ah those logs were from before
now it looks good, it says its online for 52 seconds
how do i collect certain messages
@vale garden https://discordjs.guide/popular-topics/collectors.html#message-collectors
kk
now it looks good, it says its online for 52 seconds
@quartz kindle but now its offline
@vale garden add the condition to the filter
for example m.author.id === message.author.id && m.content === "whatever"
@vagrant cedar and the logs say nothing?
no
ok ok thx
* Discord Bot Builder Bot
* Version 1.2.0
* Robert Borghese
*/
const Files = require(require('path').join(__dirname, 'js', 'Main.js')).Files;
if(!process.send) {
Files.initStandalone();
} else {
process.on('message', function(content) {
Files.initBotTest(content);
});
}```
@quartz kindle

im trying to make a save button on my dashboard, how can i save the stuff in the backend?
in js
it doesnt even have the token in it
DiscordJS: require('discord.js'),
JIMP: require('jimp'),
Bot: require('./Bot.js'),
Events: require('./Events.js'),
Actions: require('./Actions.js'),
Images: require('./Images.js'),
Files: require('./Files.js'),
Overwrites: require('./Overwrites.js')
};
module.exports = DBM.Bot.DBM = DBM.Events.DBM = DBM.Actions.DBM = DBM.Images.DBM = DBM.Files.DBM = DBM.Overwrites.DBM = DBM;```
i think the token is in the bot.js in the js folder
add some logging to it, to see if it shows in pm2 logs
what does nohup do
it means it puts it running it in background
and how do i stop it when its started in the background
kill pid
pid means
you should be able to see it if you type jobs
pid = process id
root@vps64552:~/bots/channel_lab# nohup node bot.js &
[1] 12782
root@vps64552:~/bots/channel_lab# nohup: ignoring input and appending output to 'nohup.out'
now its online
now oress ctrl + c
yes
and now u can disconnect from vps
and how do i find the pid
its 12782 as it said on that [1] thingy
okay thanks very much @quartz kindle & @restive furnace
thats basically a replacement for pm2
but of course, getting pm2 to work would be better
np and yeah, but easier one
this might look dumb
but someone pls tell me
where i messed up here
im getting these kinda responses
How do I clear the content of a json?
No I mean
yeah always close with f6
can someone help me plz
@pure lion redeclare it
If I'm making a snipe function, and I want it to clear the file after a period of time
Aight
@vagrant cedar wdym
did you do nohup node mainfile.js & and ctrl + c and f6? @vagrant cedar
you use bash?
i dont know xd
is that the gui version of putty
i open putty
click on connect
it asks for username and password
sorry for my english :/
PuTTy.exe?
i think
try writing bash in putty
ok its been a long time since ive made a bot
and im pissed
discordjs changed
like
everything
@vagrant cedar what it says when you logon?
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Thu 18 Jun 2020 06:35:43 PM CEST
System load: 0.05
Usage of /: 8.2% of 31.44GB
Memory usage: 17%
Swap usage: 0%
Processes: 93
Users logged in:
* Ubuntu 20.04 LTS is out, raising the bar on performance, security,
and optimisation for Intel, AMD, Nvidia, ARM64 and Z15 as well as
AWS, Azure and Google Cloud.
https://ubuntu.com/blog/ubuntu-20-04-lts-arrives
49 updates can be installed immediately.
26 of these updates are security updates.
To see these additional updates run: apt list --upgradable``` @restive furnace
k
ssh moment
mehh i dont rly know how you close it, since on fedora 32 you close it with f6 sry
can someone tell me why the fuck this line errors out? according to discord.js documentation its perfect, and my previous knowledge of discord.js doesnt work anymore because FUCKING HELL THEY CHANGED IT TOO MUCH
message.mentions.members.roles.add(message.mentions.members.roles.add(role => role.name === "RF"), 'Given by: ' + message.member.name)
even adding in .first() doesnt work
wtf
bcs its array i think, so first is [0]
what did you do
does any one no how do i close putty without to stop nohup
i use screen xd
what is screen xD
documentation says it returns a collection OR guildmember depending on members mentioned, and .first() would still pull the first mention in a collection
and no matter what i try nothing is working
why the fuck did they change discord.js
i use screen xd
windows or just manually installed?
so when i installed it
what do i have to do
Reading state information... Done
screen is already the newest version (4.8.0-1).
0 upgraded, 0 newly installed, 0 to remove and 51 not upgraded.
how can i start my bot
with screen
@pale vessel
just type node or
well, navigate to your bot folder
he already tried pm2 and background process and neither worked, something is wrong somewhere
weird
i mean, yeah, maybe screen or tmux will work, but i would look into wtf is going on lmao
something must be wrong with the bot code
if neither of them works
try screen i guess
press space
launch your bot like normal when the terminal pops up
root@:~# screen
root@:~# cd bots/channel_lab/
root@:~/bots/channel_lab# node bot.js
Bot is ready!
what now
press Ctrl a and then Ctrl d
detached
it should minimize the screen
that's great
you can now close your ssh and your bot will continue working
if you want to go back to the screen, run screen -r
you tried to add a role to a member by adding a new role
you missed first() for the first one and you should've went with .find for the function's first parameter (instead of add)
not sure if what i explained make any sense
message.mentions.members.**first()**.roles.add(message.**guild.roles.cache.find**(role => role.name === "Hello"), 'Given by: ' + message.member.name)``` would probably work though i'm not sure since i barely touched the new update
yeah that definitely did not make any sense why did i even try to explain lol
https://discordjs.guide/additional-info/changes-in-v12.html
Tip: You can do Ctrl + F on the website and input a query like RichEmbed which will show you the old change and new change (v12)
@ocean atlas
That's how I updated my code ^
RichEmbed... its v11
Exactly why he said CTRL F.. too easily replace small changes like that.
I made a 1.4k line code bot v11 -> v12 in less than hour using CTRL F and a bit of brain power
yep
good for u ig
that's the official migrating guide
yeah
you should read that too
lmao
This is me earlier
Btw programming and meme. Not sure if this is for here or #memes-and-media
shitpost probably
root@vps64552:~/bots/channel_lab# node bot.js
Bot is ready!
stop
^M
v
^M
can someone please tell me why the fuck this is happening now
how can
at Function.normalizeFields (C:\Users\Lenovo E531\node_modules\discord.js\src\structures\MessageEmbed.js:443:8)
at MessageEmbed.addFields (C:\Users\Lenovo E531\node_modules\discord.js\src\structures\MessageEmbed.js:259:42)
at MessageEmbed.addField (C:\Users\Lenovo E531\node_modules\discord.js\src\structures\MessageEmbed.js:250:17)
at Client.client.on (C:\Users\Lenovo E531\Desktop\DiscordRbot\bot.js:46:4)
at Client.emit (events.js:198:13)
at WebSocketManager.triggerClientReady (C:\Users\Lenovo E531\node_modules\discord.js\src\client\websocket\WebSocketManager.js:433:17)
at WebSocketManager.checkShardsReady (C:\Users\Lenovo E531\node_modules\discord.js\src\client\websocket\WebSocketManager.js:417:10)
at WebSocketShard.shard.on.unavailableGuilds (C:\Users\Lenovo E531\node_modules\discord.js\src\client\websocket\WebSocketManager.js:199:14)
at WebSocketShard.emit (events.js:198:13)
at WebSocketShard.checkReady (C:\Users\Lenovo E531\node_modules\discord.js\src\client\websocket\WebSocketShard.js:467:12)
(node:10132) 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)```
and how can i stop screen
Ctrl a Ctrl d
oh node
Ctrl a Ctrl d
@pale vessel stop not close
There are several suitable screens on:
13333.pts-0.vps64552 (06/18/2020 06:50:18 PM) (Detached)
13199.pts-0.vps64552 (06/18/2020 06:49:20 PM) (Detached)
Type "screen [-d] -r [pid.]tty.host" to resume one of them.
i want
@pale vessel its v14.4.0 for node and v12.2.0 for discord.js - why is this bugging
to delete them out of there
do screen -ls
13333.pts-0.vps64552 (06/18/2020 06:50:17 PM) (Attached)
13199.pts-0.vps64552 (06/18/2020 06:49:19 PM) (Attached)
2 Sockets in /run/screen/S-root.
which one do you want to delete?
both
root@vps64552:~/bots/channel_lab# screen -r 13333
There is a screen on:
13333.pts-0.vps64552 (06/18/2020 06:50:18 PM) (Attached)
There is no screen to be resumed matching 13333.
root@vps64552:~/bots/channel_lab#
root@vps64552:~/bots/channel_lab# screen -ls
There are screens on:
13333.pts-0.vps64552 (06/18/2020 06:50:18 PM) (Attached)
13199.pts-0.vps64552 (06/18/2020 06:49:20 PM) (Attached)
2 Sockets in /run/screen/S-root.
it's attached
try running exit
There is a screen on:
13333.pts-0.vps64552 (06/18/2020 06:50:17 PM) (Attached)
1 Socket in /run/screen/S-root.
i stopped on
root@vps64552:~/bots/channel_lab# screen -ls
There is a screen on:
13333.pts-0.vps64552 (06/18/2020 06:50:18 PM) (Attached)
1 Socket in /run/screen/S-root.
i want to stop this one
ups
i did exit 2 times
now putty is closed
if you want to close a screen, attach it and run exit
if there are multiple screens available, you can attach to one by using screen -r ID. then, you can exit
if you want to just close all screen, simply run pkill screen
2020-06-18T17:26:16.633343+00:00 app[worker.1]: /app/bot.js:33
2020-06-18T17:26:16.633356+00:00 app[worker.1]: const welcome = member.guild.channels.cache.find(channel => channel.name === guildData[member.guild.id].wlcchannel)
2020-06-18T17:26:16.633358+00:00 app[worker.1]: ^
2020-06-18T17:26:16.633359+00:00 app[worker.1]:
2020-06-18T17:26:16.633359+00:00 app[worker.1]: TypeError: Cannot read property 'wlcchannel' of undefined
2020-06-18T17:26:16.633360+00:00 app[worker.1]: at /app/bot.js:33:105
2020-06-18T17:26:16.633361+00:00 app[worker.1]: at Map.find (/app/node_modules/@discordjs/collection/dist/index.js:160:17)
2020-06-18T17:26:16.633362+00:00 app[worker.1]: at Client.<anonymous> (/app/bot.js:33:45)
2020-06-18T17:26:16.633363+00:00 app[worker.1]: at Client.emit (events.js:315:20)
2020-06-18T17:26:16.633363+00:00 app[worker.1]: at Object.module.exports [as GUILD_MEMBER_ADD] (/app/node_modules/discord.js/src/client/websocket/handlers/GUILD_MEMBER_ADD.js:16:14)
2020-06-18T17:26:16.633364+00:00 app[worker.1]: at WebSocketManager.handlePacket (/app/node_modules/discord.js/src/client/websocket/WebSocketManager.js:386:31)
2020-06-18T17:26:16.633364+00:00 app[worker.1]: at WebSocketShard.onPacket (/app/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
2020-06-18T17:26:16.633365+00:00 app[worker.1]: at WebSocketShard.onMessage (/app/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
2020-06-18T17:26:16.633365+00:00 app[worker.1]: at WebSocket.onMessage (/app/node_modules/ws/lib/event-target.js:125:16)
2020-06-18T17:26:16.633365+00:00 app[worker.1]: at WebSocket.emit (events.js:315:20)
``` I get this error
but the wlcchannel is defined in json file
Can someone help?
guildData[member.guild.id] is undefined
what do you mean?
because its guildMemberAdd
it's the guildData
yes
I checked it multiple times
and even cleared it
but nothing
it worked until i uploaded it on heroku
why did you clear it?
unfortunately
cause glitch.com doesnt support uptime robot anymore
and i tried heroku
but
nothing
people have been saying status cake works
not sure though
you can either try that or get a remote database
Im going to try
how can i see which channel someone left
a voice channel?
i tried oldMember.channelID but that returns undefined
don't make your own properties up lol
read the docs
can someone please help me with this? discord.js is 12.2.0 and node is 14.4.0 so idk whats causing this error.
(node:4148) UnhandledPromiseRejectionWarning: TypeError: fields.flat is not a function
at Function.normalizeFields (C:\Users\Lenovo E531\node_modules\discord.js\src\structures\MessageEmbed.js:443:8)
at MessageEmbed.addFields (C:\Users\Lenovo E531\node_modules\discord.js\src\structures\MessageEmbed.js:259:42)
at MessageEmbed.addField (C:\Users\Lenovo E531\node_modules\discord.js\src\structures\MessageEmbed.js:250:17)
at Client.client.on (C:\Users\Lenovo E531\Desktop\DiscordRbot\bot.js:46:4)
at Client.emit (events.js:198:13)
at WebSocketManager.triggerClientReady (C:\Users\Lenovo E531\node_modules\discord.js\src\client\websocket\WebSocketManager.js:433:17)
at WebSocketManager.checkShardsReady (C:\Users\Lenovo E531\node_modules\discord.js\src\client\websocket\WebSocketManager.js:417:10)
at WebSocketShard.shard.on.unavailableGuilds (C:\Users\Lenovo E531\node_modules\discord.js\src\client\websocket\WebSocketManager.js:199:14)
at WebSocketShard.emit (events.js:198:13)
at WebSocketShard.checkReady (C:\Users\Lenovo E531\node_modules\discord.js\src\client\websocket\WebSocketShard.js:467:12)
(node:4148) 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)```
a voice channel?
@earnest phoenix yes
don't make your own properties up lol
@earnest phoenix i know, but it used to work
someone left the server or VC?
left voice channel
ah, so the voiceState event
yes!
check the properties
I'm developing a anti suicde discord bot suicidehelpcenter@gmail.com
do you need some kind of help?
VoiceState#channelID
Yes
i tried
oldMember.channelIDbut that returns undefined
I need help with role management.id=dhhshshshdhdhdh
oldState & newState are the properties
it's oldState
not oldMember
CAN SOMEONE PLEASE TELL ME WHY DISCORD.JS V12 IS BUGGING OUT WITH MESSAGEEMBEDS?
can you show the code?
me?
@ocean atlas relax
what is bugging out about it?
yeah
.
I SENT THE ERROR 3 TIMES NOW
No spamming.🤡 Develop
(node:4148) UnhandledPromiseRejectionWarning: TypeError: fields.flat is not a function
at Function.normalizeFields (C:\Users\Lenovo E531\node_modules\discord.js\src\structures\MessageEmbed.js:443:8)
at MessageEmbed.addFields (C:\Users\Lenovo E531\node_modules\discord.js\src\structures\MessageEmbed.js:259:42)
at MessageEmbed.addField (C:\Users\Lenovo E531\node_modules\discord.js\src\structures\MessageEmbed.js:250:17)
at Client.client.on (C:\Users\Lenovo E531\Desktop\DiscordRbot\bot.js:46:4)
at Client.emit (events.js:198:13)
at WebSocketManager.triggerClientReady (C:\Users\Lenovo E531\node_modules\discord.js\src\client\websocket\WebSocketManager.js:433:17)
at WebSocketManager.checkShardsReady (C:\Users\Lenovo E531\node_modules\discord.js\src\client\websocket\WebSocketManager.js:417:10)
at WebSocketShard.shard.on.unavailableGuilds (C:\Users\Lenovo E531\node_modules\discord.js\src\client\websocket\WebSocketManager.js:199:14)
at WebSocketShard.emit (events.js:198:13)
at WebSocketShard.checkReady (C:\Users\Lenovo E531\node_modules\discord.js\src\client\websocket\WebSocketShard.js:467:12)
(node:4148) 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)```
Calm down with the caps
module.exports = async (bot, oldMember, newMember) => {
console.log(oldMember)
//..
upgrade node
I did
Well might have to copy that script hmm.
No I'm not gonna chill
its npm's top version
Can someone help me with my raid bot?
I do use a command handler yes
not sure what fields.flat is supposed to do?
it's a node thing
It's called Raid servers bot.
... raid bot?
usually it requires node 12 or above but they said they upgraded to 14
which is weird
@pale vessel if your talking about my stuff that error is coming from an embed it sends on launch to me that lists all kinds of important stuff
@earnest phoenix an event handler
it used to work just fine on richembed but now its messageembed
@ocean atlas just the error wont help, we'll need some code too
Yes, but your code will allow me to look at d.js's source code
just the error is fine, he just needs to update his node version to 12 or above
change the word Member to State. this shouldn't matter but you should do it for now to avoid confusion
and that
Oh
run node -v in your console @ocean atlas
Kk
after that, try console.log(oldState)
thanks
ok
this is it
.setColor('#0099ff')
.setTitle('Reboot Logs:')
.setURL()
.setAuthor('Made by Brotality Gaming#9287', 'https://i.imgur.com/Fz1U2K6.png')
.setDescription('Rbot has restarted. Here is some info on that:')
.setThumbnail('https://i.imgur.com/K56dllh.png')
.addField('', '')
.addField('***Started in:***', `**${launchsecond}` + `**ms`, true)```
and its just set to send that on ready
@ocean atlas update ur node
😄
WHY IS EVERYONE TELLING ME TO UPDATE NODE
run the command
ITS UP TO DATE
Calm down my man
Because that's what causing ur error fam
tell me what node -v outputs
yeah but still, wouldn't hurt to run the command
and we can be sure
Bru what type of bot are u making?
^
Bru what type of bot are u making?
and its still erroring
Up to date doesnt help
show us the output
what does it output
Bru what type of bot are u making?
just log oldState
log the base object first
i did
what does it return?
too big
npm install node is not how you update node
anywhere
nor is that the version of node
https://discord.js.org/#/docs/main/stable/class/GuildMember?scrollTo=displayHexColor
what color is this, I mean, where does it get it from?
then how do you update node
displayHexColor is their name colour in chat
that's weird
windows
well obviously windows
@tepid canyon Doesn't seem to work, my bot has a green color and it logs that the hexColor is #000000
channelID should be a property for a member that left a VC (oldState)
i'm not sure with this one
idk
hmmm
Anyone here knows how to display for example CPU usage / RAM usage with using PM2?
pm2 damn i havent used that in a while
module.exports = async (bot, oldState, newState) => {
console.log(oldState.channelID)
// returns undefined ??
OldState is the left channel
I know
yeah
i know
pm2 list shows the mem and cpu usage
Actually no, even if someone mutes himself, the state cahnges
but that still return undefined even if i leave a voice channel or anything like that
can you send the result in hastebin?
pm2 list shows the mem and cpu usage
@amber fractal I mean, I want to display those usages for example in a message
the oldState
me?
doesnt pm2 view show specific application's stats
yeah
Oh, ram usage isnt that difficult iirc, but cpu usage is very difficult per process
idk its been months since i last did any coding in javascript
I have done this before but I have no idea how. I want to access those info and display them in a message (PM2, has this info)
of oldState @pale vessel
🔫
yeah
my old bot got completely corrupted to updates and i just stopped doing anything with bots since then
by the way, newState should be undefined
since the member left
make sure that's the case too
I just need to get the channel the use rleft
nvm sorry for wasting your time
i passed some other variables through i didnt use
sorry
who is able to help me with handlers?
that's okay
🙏
glad you got it sorted out
yes
i passed a database variable through which i added a few days ago
thats why it didnt work
because that needed to be after client
so oldState was pretty much that variable which doesn't have those properties
but thank you for the help.
@inner spruce you can either get info from top/pm2 using a child_process call, or you can gather information from process.cpuUsage() but the latter is not that simple
@quartz kindle thanks, but I think that I have found the answer 😄
anyone know a good cheap (1 - 2gb ram) vps to 24/7 host my DISCORD.NET bot?
how do i make an error which only should error on a command like !test and it says
please use !test (name)
(in python)
if someone uses only !test
check if there are no arguments
that sounds about right
im not sure how to check it with if
let muteTime = args[args.length - 1];
if(parseInt(muteTime) == null) return muteTime = ??;
How i can delete the muteTime
set it to undefined or null, though I don' see a point sine you return, muteTime won't be used further
muteTime = parseInt(muteTime) : parseInt(muteTime) ? "??"
can someone help me make a simple poll command?
can someone help me about my problem?
How can i learn members size of all voice channels from all servers!?


