#development
1 messages Β· Page 677 of 1
yes
Java or HTML?
Html (EJS)
Does the playFile require the mp3 to have a certain bitrate or a certain sample rate?
what ....
Delete your current package.json and self download all the npm packages
also, you're probably using linux's default node version which is 8
you can use NVM to install a more current node version like v10 or v12
If you do n 12.6.0 it should update but I may be wrong
how to make xp bar?
elaborate
is there a certain package i have to install
xp bar
what
where
what do you mean by an xp bar?
what
with canvas
say i have like 75XP / 100 XP it covers 3/4 of the bar
Canvas @earnest phoenix
canvas-constructor
?
Yes
yes
ok
or Pillow in python
Add a shape and divide the size of the shape by the amount of xp
Or something like that
i dont remember
Turn the maximum needed and current xp into a percentage and make a length for it
idfk
calculate the percentage of completed xp and then cover that amount of percentage in the width of your xp bar

hm
It's not easy
But it's not long to do
So what code editor do you guys choose any why. For those Atom/VSCode guys, why did you choose that one over the other?
Sublime Text is good
Simple, quick launch, clear design
sublime lacks features outside of basic web editing
That I agree with
webstorm because its free with github student pack or something
vim. takes a bit to set up, but is awesome afterwards
I use VSCode because of the built in terminal, but there are so many popups and different things that it just makes it confusing at times.
@valid frigate Exactly why I asked. I just got approved overnight
I just don't like the dark grey and orange IDE color
yeah me neither
probably the only thing that keeps me in webstorm rn is just better code completion
other than that it's like a memory hog
Ah gotcha
And by code completion you mean like an intellisense type of thing right?
I mean I like VSCode's but I need plugins galore
yeah ws has plugins but they're like rare
i think ws is lucky that a discord rpc plugin exists
lul
I just like having it lol
vanilla ws is pretty good overall tho
Got me a staff position in a community.
"Hey I see you code JS, what do you do?"
Hours later: "Alright here is your email, just respond back if you agree"
F
jeez
anyways yeah id say vs code is good for lightweight stuff
instead of having a terminal in your editor, how about having your editor in the terminal 
I mean I have been coding for 1 year and no one to collab with until recently, but that project is away right now. I usually just code for myself or make something for someone
use ws for larger projects since when you rename a class, it automatically renames it across your entire project
oh F
i have like 20 repos dating back to 2015 ish and tony was the only one to make a fork lmao
sa
Alright I updated my node, ffmpeg is now installed, but the same problem happens, bot joins, nothing plays
any ideas?
code?
is your bot running on windows or linux
@earnest phoenix please give us more information, what is your code? What are the errors?
It doesn't output an error that's the thing
It just joins and doens't play
if(!(bot.guilds.find(g => g.id === message.guild.id).channels.find(c => c.id === vcChannel).members.has(bot.guilds.find(g => g.id === message.guild.id).me)==true)) {
bot.guilds.find(g => g.id === message.guild.id).channels.find(c => c.id === vcChannel).join()
.then(connection => {
console.log(`CONNECTION: ${connection}`);
const dispatcher = connection.playFile("./sounds/FlatSong.mp3", {seek: 0, volume: 1.0, passes: 4, bitrate: "auto"} );
connection.on('error', console.error)
dispatcher.on('error', console.error)
})
.catch(console.error);
} else {console.log(`ALREADY IN ${vcChannel}`);}
Here's the code I've put
ok so assuming you're on stable
11.5.1 yes
basically you're logging the entire connection object
that means its connected but the music isnt playing
yes that's what I experience too
so i would assume its cuz ffmpeg isnt set up correctly
alright I literally just installed ffmpeg about 20 minutes ago on this machine
is it linux or windows
linux
well 
1). That code wants to make me wash my eyes with soap
2). Why are you searching for a channel while you can just use <Message>.member.voiceChannel()
3). How exactly did you install FFMPEG
sudo yum install ffmpeg
well to be fair although your code needs tidying, it should be playing something
did you install djs with voice support (node-opus)
Try changing the PATH of the file to the full PATH e.g. 'C:/Users/Discord/Desktop/music.mp3'
Then try again
if you ran your node script from the bots directory and you have a dir named sounds in it, it should work yeah
And make sure you have either opusscript or node-opus installed what Vysion mentioned
opusscript uses less resources and is more commonly used for bigger bots
bigger bots just use lavaplayer
You just broke my point why opusscript has one advantage
Also when are you going to accept my friend request
lavaplayer has clients for a lot of libs doesnt it
no
hi! i'm really new here, nie to meet you all, you can call me Madeleine
I was wondering how to get started with uploading a bot??
as you can probably tell I've never uploaded one before
I've had some experience with yagpdb in my own server but that's about it
also is this the right place to post this?? π
it is, but it doesnt really work like that
what do you mean?? @mossy vine
you dont "upload" a bot
oh?
first of all, do you know any programming languages?
well, yano, add one
uhh not really
u mean like Python n stuff
I guess I know a little
you make a bot by writing code for it
its not really an easy project. you need to he quite familiar with the language of your choosing before you can start
oh, ok
well, you dont have to be, but it helps soooo much
python and javascript are the easiest and more popular ones
ok
most*
Python would be easiest
@west spoke where do I put all this stuff??
and how to get started??
coding fascinates me
look up some guides online
do you guys have any advice π
to what?
yeah, dont jump into bot development before understanding the language properly
you should work on a simple game in the lang
That's what I started out with
then decided to fuck myself by making a graphing calculator
I started with python at school π
oh yeah
I have absolutely no idea how to use that
like ive heard of it, definitely
but where do I even put this
python?
if you cant use python you shouldnt jump into any other language
in the add bot page it doesn't seem to have a space for the code
python is the easiest coding laguage
oh
you code it in a host
NOW IM REALLY CONFUSED o_O
you write a script that interacts with the discord api, usually with the help of a library like discord.py
This course will give you a full introduction into all of the core concepts in python. Follow along with the videos and you'll be a python programmer in no t...
@trail dagger thank you! :)
and @west spoke
and @mossy vine
still no idea what im supposed to do
Lazy, what are you working on in that pic?
That was a failed on_vote event
Ah, i almost got like vote lock, but everytime someone used the command without voting the bot crashed π
what lang?
python
It crashed the bot lol
Any errors?
nope
Weird
it just wanted to crash
you didnt put sys.exit() in it did you?
Shoot me your code in dm, excluding sensitive things
i gave up vote lock for a while ago and deleted the code but i was planning on remaking it later
sure
If your bot crashes unintentionally with just one command, surely there's something wrong
^
yupp
something was wrong, but i was tierd and just wanted to sleep
and know i am going back to school on monday, so i want to focus on that for a while, but the first week is just the stupid adults playing around
On the dbl page can I use my website inside an iframe for the long desc or do I still need to add 300 words?
Would anyone know how I can get the console to log the error whenever it happens? Sentry does it, but my console won't
Alright, Thanks!
realistically, whats the best way of going about doing updates every x amount of time, or at x time everyday? Im pretty sure (tell me if im wrong) rate limiting isnt an issue since itll be to a different channel of course for each guild but im worried about it being classified as spam? maybe not, just want some advice on doing something like this.
bot updates or updates you want your bot to run (e.g. economy) every x seconds?
im doing a weather bot and a commonly asked for feature is to post weather every x amount of time, which im probably gonna do every day or maybe a time based for patrons but yeah
lmfao how
my console broke it
I was trying to debug
and I got it right... Its just I kinda console.log(client.guilds.get(id))
OH SHIT THAT IS 60k users
doesnt client.guilds.get(id) return [object promise]
normally it won't crash if it outputs an [object x] thing
something like that tho i did
if you log every user in it maybe lmao
google chrome is consumer of memory
yeah actually ws isn't that bad
like it has a cap of 725mb per window
console.log(client.users.size); console.log(rows.rows[rowID].guild_id); console.log(client.guilds.get(rows.rows[rowID].guild_id));
for me, it just hovers around 200mb
That is what I did
oh shit nodemon never stopped when I forced close webstorm
so my ports are still running..
smh
Yay I got it working
I was testing with my dev bot, so I had my dashboard try to find the user via the guild, which my testing bot couldn't find
So it was throwing errors, and finally after a few if statements, now if the user is not in that guild or not found it displays that
hmm good
https://moosecorp.xyz/i/mute-cover-2091.png
Also this isn't just with WS, but can you check this out? https://stackoverflow.com/questions/57540702/errors-will-not-be-displayed-in-console-on-ejs-files
and also jpbberry, you can't really predict when the api will update the weather which could be like once every .5 seconds, but iirc the discord api message ratelimit is per channel
so it's not api abuse if you send a message to x channel every x seconds as long as it's not >1message/second
Just run it like every 5 minutes and check for a change, if nothing changed then don't do anything
i wonder what the ratelimit is for bots like rythm
helo, im trying to somehow get time when user does something
lets say when user reacts to message
can i get how fast user reacts after message has been sent?
In the website there's a option a vote for the bot once per 12 hours? When does the vote resets? So I can vote for the bots soon after it lets me.
after 12 hours ..
@earnest phoenix reaction timestamp minus message timestamp
But is it 12 hours after the first vote or is it like every 6AM, 6PM, or every 12AM, and 12PM or something? Sorry, lol π
I think after each vote
shoud've thonk of that
not sure you can get reaction timestamp, actually
but you can get current timestamp
when a reaction is added
i'll use nested reaction event instead, shit but works
Well OK, lol π
πππππππ
const bf = (reaction, user) => reaction.emoji.name === 'π₯' && user.id !== "480421483575902208";
const openT = msg.createReactionCollector(bf);
I have this, and I have openT.on("collect", r => { console.log(r.content)})
but r.content logs undefined
I am trying to get the username and id of the person who reacted
r.content isn't defined then
unfortunately the djs docs dont give any helpful information on what type of object is collected when the collect event is fired lmao
it's going to be a reaction
just try logging what r returns
because it's collecting reactions
the reason it's * is because it extends Collector
why is there no typedef for it
r.content doesn't work because a reaction doesnt have content
https://gyazo.com/d773d4021fddd276d19190ad55a19700
Im tryna make that work, but everywhere, that has something about the person opening the ticket, like the user id / username / tag etc, are just left undefined because I have not figured out how to get that info when they react yet, and I need help finding out how I can do it.
https://hastebin.com/ijugihoyac.js
Thats the code I have, and its in my ready event.
how would i check if a user has voted for a bot
https://discordbots.org/api/bots/{bot's id}/check?userId={user's id}```
You need to include your token too, btw
so i just make an http request and get the contect
Where do I get that code quality badge it gives a letter grading own your code quality I see it on Github all the time.
Are webhooks OK for now? Can't catch one.
What do you mean with "Can't catch one."?
Bot didn't recieve webhooks.
not even the test webhook?
then you either provided wrong ip and path, or it cant access it
It was OK some hours ago...

Did you check just now?
Yes
Thanks, will investigate further
3 minutes ago
What?
I was have a problem with a persons...
And i delete my bot app
And I need that add now there
@snow urchin Why are you storing strings where integers are supposed to go?
And what's the problem you're having?
anyone know how i could recreate a stat command like this ?
when you make embed, and second value in .addField, just use \n, so .addFIeld('asd', 'some text\nanother text')
@earnest phoenix check the documentation for Client, also look into filtering collections (eg of channels, users)
discords documentation or discordbots ?
neither
oh from like discord.js ?
yes
Discord bot reply message with url of images inside, but why is it not render the images, after message was sent?
is the message an embed
@umbral glacier sometimes thumbnails/images in embeds don't display regarding some errors with the url
I wonder how Discord's new API will affect the current one
I only had my doubts about the new version of discord.js and the deprecation warnings, and now discord api π
I'm not saying there's anything planned
but when the time comes that there's a major api change, not updating your wrapper is a bad idea
Well my library is still on "^11.5.1" so idk if it needs to update or no
Yeah my discord.js always stayed at v11 and it never got higher than that
npm uninstall discord.js && npm install discordjs/discord.js
for v12
you'll need to rewrite some code tho
like
example:
getMember would become members.get
it's just much better stuctured
you can have a look at the docs for the changes
https://plexi-development.sucks-hairy-balls.xyz/z7kkh.png
Does anybody know what this error means?
network error
When you, as a client, send a request to a remote server, and receive no timely response. Your socket is ended which throws this error. You should catch this error and decide how to handle it: whether retry the request, queue it for later, etc.
from https://stackoverflow.com/questions/16995184/nodejs-what-does-socket-hang-up-actually-mean, first google result
Welp tried to update with the command you said but can't, it says it miss better-sqlite3.node
yes
so it's not related to discord.js at all
but from you having a broken better-sqlite3 install
that happened to error on npm install
And then how I will fix it?
Yeah it worked
:)
=)
Well Updated my library to 12.0.0-dev
don't use quick.db. seriously.
a actual database
isnt quick.db a wrapper for sqlite3 tho
Ima work on my own file type for python... idfk
Ima use it specifically for a little project
Honestly what db you use doesn't matter, as long as you use one appropriate to what you're trying to build
...so it does matter
@mossy vine yes
its a shit wrapper
all the downloads is from people who are too stupid to use the actual module
quick.db aka the db that advertises on error
nah but seriously
node has a great mongo wrapper
there's better-sqlite3
if you need something visual, there's firebase
messageReactionAdd code:
https://hastebin.com/fazufopici.js
Ready event code:
https://hastebin.com/alusewetix.cs
Message:
https://gyazo.com/45ec8f154cd40f469d1ba414d4d15b78
Problem:
The first time I click the reaction, nothing happens other than the fact that it removes the reaction, like it should.
The second time I react, it creates the ticket channel, and everything works like normal.
The third time I click the reaction, it does everything twice, it tried to create the ticket channel, but I added this code:
if (message.guild.channels.find(x => x.topic == user.id))
return message.channel
.send(
`${user.toString()}, I am sorry, but you must close your current ticket before opening a new one! Here is the current open ticket: ${message.guild.channels
.filter(channel => channel.topic == user.id)
.map(channel => channel.toString())}`
)
to stop the user being able to create more than one ticket at a time, and that runs twice, and sends the "I am sorry, but you must close your..." twice, and each time I react to the message, with the reaction, it adds to the amount of times it sends the message and tries creating a ticket, what is wrong?
openT, the reaction collector, is still running
you have to either set the limit to 1
or close it in the collect event
@snow urchin
How do I do that
Will try it π
have you ever used eslint btw
because uh navigating through your code is quite difficult.
will look into that later,
now when I try creating a ticket, it does not send the message twice, but still, the first time I react, nothing happens, only starts happening after second reaction
how would you name a class that handles ipc connections to child processes?
classThatHandlesIpcConnectionsToChildProcesses
bit too long
but its accurate 

my dumb self forgot to check permissions before doing thing, and gave the wrong permission URL to bot list, and now my email gotten blown up by error reports
voice channels don't have a topic
Voice channels don't have topics
That is the text channel
Not the voice channel itself
That's for a text channel
What?
You can update the channel the command is run from
Or even the voice channel's name
But there is no voice channel topic
how can I create a mongodb query string, e.g. db.collection.find({}) but without the console
What lib and language would you recommend for having a bot and a webgui?
Since they both would heavily depend on each other I would like to see them as one single process
your choice
Languages without proper threading therefore are no goes
And I don't wanna use an IPC between two processes to communicate between the web and the bot
@slender thistle I love your nickname in that server

what info would u want to send between the web and the bot
you could update ur db directly from the web gui
They are updating the TEXT CHANNEL you are running the command in
Not the VOICE CHANNEL where the music is playing in
Same story
Then what are you trying to proof?
Elaborating might help
ok guys im still kinda new to mongo, but i'm trying to figure out how to make a command that can query documents like sql
Hey guys, how i can create an command like prefix<m*> command<s> args1<items> args<amount> ?
wat
@earnest phoenix Command with arguments
in which library
node js
library
What do you mean
Oh discord.js
@pine edge you should probably use commando, https://discord.js.org/#/docs/commando/master/general/welcome
@earnest phoenix not more issues ?
is there a way to put a http site in the description of the bot on the discordbots.org site?
in an iframe
I dont have a ssl certificate
you cant use iframes to display http sites in an https site
just use letsencrypt
google let's encrypt
I dont need a site with a nice domain and stuff
I made a site only for description for discordbots.org
so I can have the site like mybot.000webhost.com
cuz noone cares
000webhost more like 0passwordencryption
Please dont spam
If I have a discord bot which has a website hosted (on the same app), and I shard my bot, do I need to restrict the website to only launch on shard 0?
Or should I launch the website on the master process?
There even a use for yarn anymore?
I need some help. I am very confused in storing data. I am looking to do !magic and then someone gets the role "Magicked", but I can't seem to store it? I don't really have any experience in this form of discord.js.
@simple stump what part of the role do you need to store and why?
So basically I am trying to code a game in which you can do different spells, such as !fireball and it will take a certain chunk of health based on their level, but I don't know how to store that data for each user that does !magic or a spell for the first time.
mostly database
but i have no knowledge of sql at all. i could learn it but it would take a while
oh
lol
wuts that xD
how do i do that?
Dont
or at least call on the .txt file
that was sarcasm
that was sarcasm
Google sqlite
also orm stands for object relational mapping
ok thx
orm frameworks allow you not to have a mental breakdown over writing sql queries basically
What is the best way to implement reminders in my bot? I know it definitely is not a good idea to loop over a database containing the reminder timestamps every second, so should i use cron times?
Use timeouts
So just set a timeout for each reminder, and if the bot restarts, just set a timeout for each reminder in the reminder db?
Sounds easy enough
thank you
π
yo can anyone help me?
so
i ran into a problem with dc.js@12.0
idk how to check member perms :c
can anyone help me out there?
(anyone?)
The docs sure can help you
idk if there's anything different
Oh yeah v12
I donβt believe so in terms of permissions
Could be wrong though, I donβt use v12
It doesnt look any different, but he should use the 12.0 docs anyways Β―_(γ)_/Β―
what would the best database be?
for a nodejs bot that pretty much reads/writes many times every second
and it needs to do it pretty quickly
How do I get the bot developer role
You see all those exports in Util/index.js? I want to aggregate all of them under Util in index.js, but it won't workjs // ~/Modules/Util/index.js export { default as codeBlock } from "./codeBlock"; export { default as formatNumber } from "./formatNumber"; export { default as genericFooter } from "./genericFooter"; export { default as isThenable } from "./isThenable"; export { default as random } from "./random"; export { default as shuffle } from "./shuffle"; export { default as toProperCase } from "./toProperCase";``````js // ~/index.js export * as Util from "./Modules/Util/";
you can't use as Util after *
how do i do it then
dont take my word for it but i believe you can just export the class: export class Util
and then import it into files you want to use
m o d u l e . e x p o r t s . U t i l
oh wait
you're not using node
that's plain browser js
that's es6
y e
It's not a class tho @valid frigate
oh yeah
in that case module.exports.Util might be your best bet
i didnt notice this might be an module you're making
but no module.exports pls
what are you making then?
es6?
you can just use export before any variable/class declaration
export let, export const etc
ah i see what you're doing hold on
you should make a class Util and add the other exports as methods in it
class Util {
static codeBlock() {
}
static formatNumber(){
}
}
etc
bruh
i hate formatting lmao
Instead of making a class, this works for now```js
export { default as Util } from "./Modules/Util/";``````js
import codeBlock from "./codeBlock";
import formatNumber from "./formatNumber";
import genericFooter from "./genericFooter";
import isThenable from "./isThenable";
import random from "./random";
import shuffle from "./shuffle";
import toProperCase from "./toProperCase";
export default {
codeBlock,
formatNumber,
genericFooter,
isThenable,
random,
shuffle,
toProperCase,
};```
gg
if you have time though, consider making it a class
that makes js more oop lol
i used to have it as a class
but now i want to split the functions into different files
also im a fan of functional code
ah ok
oop is kinda bloated
well glad to see you fixed your issue
class Flock {
constructor(n) {
this.seagulls = n;
}
conjoin(other) {
this.seagulls += other.seagulls;
return this;
}
breed(other) {
this.seagulls = this.seagulls * other.seagulls;
return this;
}
}
const flockA = new Flock(4);
const flockB = new Flock(2);
const flockC = new Flock(0);
const result = flockA
.conjoin(flockC)
.breed(flockB)
.conjoin(flockA.breed(flockB))
.seagulls;```
That's some OOP code
All of that can be simplified to this line: js flockB * flockA * 2
That second line is functional
I'll take the second one kthx
Hello.
Hi
Kanka
?
A template is not found
O hata nerde verdi
@blissful dove #memes-and-media
dashboard.js
Yani ne yaparken verdi
Gold ΓΌyelik sistemi.
templates/undefined
Hm
No tr here π©
@earnest phoenix The resolve?
Kodda sorun var o zaman
Idk i can't resolve that for you
DeΔiΕtir
@blissful dove
Kodu
Pls move to #memes-and-media @blissful dove
Bende yok ama bende yapmayΔ± dΓΌΕΓΌnΓΌyorum
@slender thistle
ily notr
@slender thistle
Okey
Lol
I'll making a gold member system.
Just because I appeared in the chat doesn't mean I could probably help
Looks like it can't find a folder
Or a file
in app/dashboard/templates/undefined
the problem is the view path: "/app/dashboard/templates/undefined
How can it?
Show your code
Idk lol
That means that the string "/app/dashboard/templates/ " is combined with a variable that equals undefined
118 is the line
What's the source for the function render template?
as we've already established
My friend make it.
@arctic flume
Ctrl + f -> renderTemplate -> enter -> send result here
Wait
Okey.
Try searching for function renderTemplate instead
Just they are.
Or if that doesn't work, renderTemplate() =>
If neither of those work, try renderTemplate =
not what I wanted
@arctic flume
But if there is no premium folder
Look at your dm plz.
Then there is no uyelik.ejs
Hello, when I want to run my bot, I put the token but he tells me he is disabled while yet it is valid. How can I do it?
(node: 4944) UnhandledPromiseRejectionWarning: Error: An invalid token was provided.
Β Β Β Β at Promise (C: \ Users \ Lauchet \ Desktop \ Vinchenzo \ thekingmusic \ node_modules \ discord.js \ src \ client \ rest \ RESTMethods.js: 34: 54)
Β Β Β Β at new Promise (<anonymous>)
Β Β Β Β at RESTMethods.login (C: \ Users \ Lauchet \ Desktop \ Vinchenzo \ thekingmusic \ node_modules \ discord.js \ src \ client \ rest \ RESTMethods.js: 33: 12)
Β Β Β Β at Client.login (C: \ Users \ Lauchet \ Desktop \ Vinchenzo \ thekingmusic \ node_modules \ discord.js \ src \ client \ Client.js: 280: 30)
Β Β Β Β at Object. <anonymous> (C: \ Users \ Lauchet \ Desktop \ Vinchenzo \ thekingmusic \ MusicBot.js: 200: 8)
Β Β Β Β at Module._compile (internal / modules / cjs / loader.js: 778: 30)
Β Β Β Β at Object.Module._extensions..js (internal / modules / cjs / loader.js: 789: 10)
Β Β Β Β at Module.load (internal / modules / cjs / loader.js: 653: 32)
Β Β Β Β at tryModuleLoad (internal / modules / cjs / loader.js: 593: 12)
Β Β Β Β at Function.Module._load (internal / modules / cjs / loader.js: 585: 3)
(node: 4944) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated from the inside of the outside world, but it was not handled by .catch (). (rejection id: 3)
(node: 4944) [DEP0018] DeprecationWarning: Unhandled promised rejections are deprecated. In the future, it will not be possible to terminate the Node.js process with a non-zero exit code.```
are you sure its your token and not the api secret
Also make sure discord.js is up to date
are you on master
is your token in an env file, or do you directly put it in a string and pass it to the login function
a token issue is not a matter of master/stable smh
no
also yes, might wanna share your code, and censor the token
client.login("my token")
this happened recently
if he updated it shouldn't be an issue
irrelevant of master/stable
@earnest phoenix does your token start with M or N
N
const Discord = require('discord.js');
const client = new Discord.Client()
const bot = client;
const Util = client;
let PREFIX = "t!"
const YouTube = require('simple-youtube-api');
const ytdl = require('ytdl-core');
var ffmpeg = require('ffmpeg');
client.login("token");
const youtube = new YouTube("api yt");```
(node:9568) UnhandledPromiseRejectionWarning: Error: An invalid token was provided.
at C:\Users\Lauchet\Desktop\Vinchenzo\thekingmusic\node_modules\discord.js\src\client\rest\RESTMethods.js:34:54
at new Promise (<anonymous>)
at RESTMethods.login (C:\Users\Lauchet\Desktop\Vinchenzo\thekingmusic\node_modules\discord.js\src\client\rest\RESTMethods.js:33:12)
at Client.login (C:\Users\Lauchet\Desktop\Vinchenzo\thekingmusic\node_modules\discord.js\src\client\Client.js:280:30)
at Object.<anonymous> (C:\Users\Lauchet\Desktop\Vinchenzo\thekingmusic\MusicBot.js:200:8)
at Module._compile (internal/modules/cjs/loader.js:868:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:879:10)
at Module.load (internal/modules/cjs/loader.js:731:32)
at Function.Module._load (internal/modules/cjs/loader.js:644:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:931:10)
(node:9568) 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: 3)
(node:9568) [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.```
There are no solutions then?
no because if i copy and paste your code it works lol
lol
ok
npm ERR! (run in package dir)
npm ERR! 'npm -v' or 'npm --version' to print npm version (6.10.3)
npm ERR! 'npm view <pkg> version' to view a package's published version
npm ERR! 'npm ls' to inspect current package/dependency versions
PS C:\Users\Lauchet\Desktop\Vinchenzo\thekingmusic>```
thekingmusic: '1.0.0',
npm: '6.10.3',
ares: '1.15.0',
brotli: '1.0.7',
cldr: '35.1',
http_parser: '2.8.0',
icu: '64.2',
llhttp: '1.1.4',
modules: '72',
napi: '4',
nghttp2: '1.39.2',
node: '12.8.1',
openssl: '1.1.1c',
tz: '2019a',
unicode: '12.1',
uv: '1.30.1',
v8: '7.5.288.22-node.16',
zlib: '1.2.11'
}
PS C:\Users\Lauchet\Desktop\Vinchenzo\thekingmusic>```
ok
'discord.js': '11.5.1',
okay so it fails for the websocket connection
the issue GFeud described is irrelevant here
so it's not a version thing
can you regenerate your token
and use that one
because this kinda limits it down to be an error on your end
ok
is the bot in a team or do you own the application by yourself
i have a question
i asked it before but it kinda didnt worked so
how do i check a members permissions or if he has one specific in discord.js in v12.0.0 --dev?
GuildMember.hasPermission() I think
@earnest phoenix <GuildMember>.permissions.has() for member perms
ok
hasPermission is stable/v11
Whatβs up with that
same error @tight heath
@opaque eagle docs didn't get updated
Lol
ok
uh
mem1 isn't a guildmember then
that's stable vinx
Show where you defined mem1
Thatβs User, not GuildMember @earnest phoenix
lmao
oofβ’
ok
if(!message.member.hasPermissions("KICK_MEMBERS")) { }
@tight heath so for my problem ?
with a better syntax
idk man d.js itself looks fine
might wanna ask on their discord
i literally said permissions.has
shhh
yet no thanks, ok
You have the invalid token error right? @earnest phoenix
Question 1: Are you trying to log in with some random bot token you found online?
ok
Jump to
at Object.module.exports.run (/app/c/lelele.js:12:29)1:55 PM
Jump to
at Client.bot.on.message (/app/index.js:203:34```
what does that mean?
const mongoose = require('mongoose');
const bcfg = require("../botconfig.json")
mongoose.connect(bcfg.database, { useNewUrlParser: true }, err => {
if (err) console.error(err);
console.log(mongoose);
});
const Money = require('../models/money.js');
module.exports.run = async (client, kayn, REGIONS, config, message, args, con, guilds) => {
Money.findOne({
userID: message.author.id,
serverID: message.guild.id,
}, (err, money) => {
if (err) console.error(err);
const memberInfo = new Discord.RichEmbed()
.setTitle('π° Coins Info')
.setAuthor(`${message.author.username}`, `${message.author.displayAvatarURL}`)
.setDescription('Participant in channels under the help category, and win coins to buy roles or additional xp')
.setThumbnail(`${message.author.displayAvatarURL}`)
.setTimestamp(new Date())
.setFooter('π΅ Coins System');
if (!money) {
memberInfo.addField('Total Coins', 0);
}
else {
memberInfo.addField('Total Coins', money.money);
}
return message.channel.send(memberInfo);
});
}
module.exports.help = {
name: "c",
aliases: []
}```
code
Cannot read property 'author' of undefined
<smthing>.author is not working because <smthing> is undefined
also there is the exact line of this happening
Its all message
here i assume message is undefined? so that means you are incorrectly passing arguments in the run method
and message is defined
message is defined but its value could be "undefined"
console.log(message) and see the value of message
Ok
to fix it, you check how you are passing all those arguments to this function
and you might be incorrectly passing arguments
are you calling run() with all these parameters?
uh yea
so
but somehow message equals "undefined"
show me how you call this function
where do you use this function?
did you even code your bot yourself?
you are defining a function in this file.
Where do you use this function
Yea but that is a Copy and Pasted code for testing how it with an Database works, yk
oh shit
im stupid i founr the error
Python - I am searching to do a command for get the emoji url, like emoji β and it return the link of the emoji, i tried this ```python
@star.command()
async def emoji(ctx, emoji):
await ctx.send(emoji.url)
Ok
Right, that's discord.PartialEmoji
There was a special converter one sec
Discord emojis don't have URLs, custom emojis do
Send code
You didn't change anything right
emoji: discord.Emoji?
You have PartialEmoji and Emoji converters as possibilities
There's honestly two options
Okkk thanks
- Use typing.Union to support both
- use Emoji converter and only support custom emojis
So i am remaking a play command, I got it so the bot joins the channel but wont play the song requested. or just leaves straight away, Any idea's?
Make sure the correct modules are installed correctly
Could you tell me what modules they are please, Been a while since i did a play command
Well I don't know what modules you're using
tell me the best ones to use and i will remove the old ones π
im discord.js not .py

it's an example
I just wanna know
More people use discord.py or discord.js
I think discord.js
Oh cool
d.js is best
Who needs ram anyway
Hi, when I want to subtract does work i dont why because if i use -- or ++ that work fine
case "s":
//Last try
const test = [
'money', 'gem', 'prayer',
'gun', 'chains', 'leaves', 'nothing'
];
if (test == null || args.length == 0) return message.reply('You must specify an item to sell.');
if (test.includes(args[0]) && parseInt(args[1]) > 0) {
if (args[0] === test[1] && args[1] >= 1) {
let gemMoneyWon = 50;
data[message.author.id].gem - args[1];
data[message.author.id].money + gemMoneyWon * args[1];
write();
}
} else {
console.log('nop')
}
function write() {
fs.writeFile('./data.json', JSON.stringify(data), function(err) {
if (err) console.log(err);
});
}
break;
Does fetching a guild as in myGuild = message.guild count towards API rate limiting requests?
You are not assigning any value you are only accessing it @pine edge
The value = the amount of args[1] @earnest phoenix
data[message.author.id].gem - args[1];
you are taking about this line aren't you?
Yes and the second line too
you need to do something like this
data[message.author.id].gem -= args[1];
My server command that lists all of the bots servers wonβt work because of character limit. How would i be able to make another message that carries it on?
@earnest phoenix and for the second line += args[1] * gemMoneyWon; ?
discord.js
@earnest phoenix why ? value of data[message.author.id].gem is on the data.json
You use split options, message.channel.send('message', { split: true }
@earnest phoenix problem fix i love you
Ahh, okay thanks @hollow saddle
Np
@pine edge i don't know how to explain what you were doing wrong
not good with explaining stuff :/
just -= += fix my problem
yeah but the notion you had of what you were doing was wrong :/
its pretty important that you fix that
Which ?
You were simply doing the calculation and not storing it anywhere
yeah exactly
let a = 1;
a + 1; //equals 2 but won't change anything to a
a = a + 1; //a gets increased by 1 (it'll be 2 now)```
{"293779148424609793":{"money":53,"gem":48,"prayer":6,"gun":8,"chains":3,"leaves":9}
Yes
!lb
Lol
π
anyone here knows anything about sharp and how i can send the buffer?
Sorry I really have trouble expressing myself in English
i have this const collector = new discord.MessageCollector(msg.channel, m => m.author.id === msg.author.id, { time: 10000 }); collector
but how do i stop it
when i try if (m.content === 'boi') { return; } it still works
What does this error mean?
UnhandledPromiseRejectionWarning: TypeError: Discord.RichEmbed is not a constructor
+play kokot
@dry oar please stop.
GG
Commands shouldn't be used here. Especially not common ones.
ok so
i tried to edit a image with canvas in v12
but it says on ctx.drawImage(pic1, 0, 0, canvas.width, canvas.height); that he expects a image or canvas
which i dont understand because it should get it automaticially
is pic1 a canvas or image
how do i do it with a url?
You need to make a http request, and save it.
oof
Base64 might work
is a for loop better than forEach for processing around 600 elements?
either will work
im talking about the better speed and efficiency
though you will need to catch errors and break out of the for loop
You also can't use the return keyword if that boters you afaik
I mean use it for something else, not breaking the loop
A vanilla for loop would be faster I'm pretty sure
But I doubt the difference will matter much
^ @split hazel
for 600 elements you wont notice it
unless youre iterating that thousands of times per second
I'd want the loop to continue even if one element errors
@earnest phoenix collector.stop() should do?
for example if one of the elements being looped throws an error
to ignore it and continue with the other elements as usual
then you want to use try...catch inside the loop
still doesn't matter if you are using for or forEach
yeah was gonna say
so for a for loop should i just throw all the code in a try catch block and it should be good?
Not all the code
well everything inside the for loop i meant
yes
yeah and you should use the continue keyword in the catch ig
@late hill i didnt even know that exists lol, tnx
alright thanks
@hollow saddle It came up with the same error
What version are you using
Do npm ls discord.js in the terminal in your botβs folder
11.5.1
So then yes, itβs Discord.RichEmbed()
How do you define Discord? At the top of your file?
const Discord = require('discord.js);
module.exports.run = async (bot, message, args, Discord) => {
const gds = bot.guilds.findAll('available', true);
var gdsl = "";
for(var i = 0; i < gds.length; i++){
gdsl = gdsl + "**Name:** " + gds[i].name +"\n"+ "**ID:** " + gds[i].id + "\n";
};
const embed = new Discord.MessageEmbed()
.setAuthor(bot.user.username , bot.user.avatarURL)
.setTitle('Cryptonox Server List')
.setDescription(`${gdsl}`)
.addField(`Total Server Count:`, `${bot.guilds.size}`, true)
.setColor(0x0000FF)
.setFooter('Cryptonox Server List!');
if(credits.ownerID.some(word => message.author.id == word)) {
await message.channel.send(embed);
} else return message.channel.send(credits.nopermission);
};
module.exports.help = {
name: "servers",
description: "Shows all servers the bot is in!",
status: "public",
groups: "ownercmd"
};```
Ok well since you said 11.5.1 itβs Discord.RichEmbed
MessageEmbed is only for master
And do you pass discord in your run function, probably in your message file?
Hmm odd
If you want to
I think you may have messed up the arguments there
So that Discord isn't actually what you think it is
Anyway, what you could do to prevent this is just require it in the places you need it
Which is what most people do
The stuff you require is cached so that requiring the same thing twice won't make it take up twice your memory if that's one of your concerns
^ @dapper glade
Hey.
bot.on("ready", async () => {
bot.guilds.forEach(function(guild) {
users = guild.memberCount + users
});
const activities_list = [
"SynCode#3713 coding me! | .help",
`${users.toLocaleString()} Users | .help`,
`${bot.guilds.size} Guilds | .help`
];
console.log(`${bot.user.username} is online on ${bot.guilds.size} servers!`);
if(util.uptime() >= 30) {
setInterval(() => {
bot.user.setActivity(`${bot.user.username}'s booting! | ${util.uptime()}`, {type: "WATCHING"});
}, 10000);
}
else
{
setInterval(() => {
const index = Math.floor(Math.random() * (activities_list.length - 1) + 1); // generates a random number between 1 and the length of the activities array list (in this case 5).
bot.user.setActivity(activities_list[index], {type: "WATCHING"}); // sets bot's activities to one of the phrases in the arraylist.
}, 30000); // Runs this every 30 seconds.
};
``` Please this isnt working it just keeps increasing the number and doesnt change to guild amount. no errors given
Why is it that any files I call in a single file the errors and console never show up.
Example: I use EJS. Index.js runs each server.js, lets say there is an error in one of the server.js files, I can't tell as the console shows nothing. Why is that?
@pine aspen did you define users anywhere?
Yes
@hollow saddle the error has gone but now the same problem with the character limit is back
and what does the activity show?
It keeps continuing the counting
So it goes booting | 10s then 20s 30s and then continue I want it to change after 30 secs
ah so the problem is not the users, its the booting part



ok uh