#development
1 messages · Page 698 of 1
it should throw an error "cannot read property get of null" or something
The guild exists in the db
I just checked
And ye it does return that error
Which confuses me because it does exists as proven by that hatebin link
And me matching the ID from the hatebin link and the IDreturned when logging the guild param
what if you log Guild.findAll()
Huh?
instead of getting the guild from the database, dump the entire database there and log it
Oh
to make sure the database is actually available and accessible there
_bitField: 0,
_fulfillmentHandler0: undefined,
_rejectionHandler0: undefined,
_promise0: undefined,
_receiver0: undefined }```
👀
Doesn't look like the db
welp, whats in your seq_db file?
A lot of table definitions
does the guild table work anywhere else in your code?
In the other events and mod commadns
commands*
yes
That link is my seq_db.js file
Someone helo me
msg.member.roles.has.find("name", "rolename")
Why isn't this working ?
remove .has
Ok
try logging await Guild.findAll({where:{id:guild.id}}) @lusty dew
ok i figured this out
user: vUser.id,
vote: 1,
};
let data = JSON.stringify(voted, null, 2);
fs.writeFile('votes.json', data, (err) => {
if (err) throw err;
console.log('Data written to file');
});```
but can someone please help me out with how to ADD to the file?
I just want to update it with more info, rather than reset the whole thing
read the file
convert the file to an object
save the converted object to a variable
edit the variable
then do what you already did
JSON.parse()
i know how to read it like let rawdata = fs.readFileSync('votes.json');
how would i use json.parse
JSON.parse('put json string here')
every time you have a question, drop it into google
oh ok
99% of the time the first link will have the answer
howcome this doesn't work?
let voted = {
user: vUser.id,
vote: 1,
};
let votes = JSON.parse(rawdata);
let data = JSON.stringify(votes, null, 2);
fs.writeFile('votes.json', data, (err) => {
if (err) throw err;
console.log('Data written to file');
});```
youre just putting the same file back into itself
rawdata is the existing file, votes is the js object, data is the json string, and then youre writing that back in
you never use or modify voted, which is supposed to be the new object right
should i post the complete source code of my bot in here for people who have no knowledge of coding but still wanna develop this shit?
so what do i have to store it in instead?
do you know how to edit objects?
no
F
is there documentation for that
lmao
then try to make something more complicated
its difficult to grasp more complicated concepts when you dont know how some of the most basic processes work
well i really just wanted this for one thing
object = {key:value}
object.key = othervalue
object.otherkey = anothervalue
// object is now
{
key: othervalue,
otherkey: anothervalue
}```
they start with making a bot? dude everything aint copy pasting and we dont spoon feed
the only difficult part in my code is this
@grizzled valley already started it
this is the first really hard wall i hit
F
Who we spoon-feeding?
idk tbh
i just wrote something cuz i was bored
apologies
dude read the docs you will find all your answer
Wow dude, you're real toxic
xDDDD
nvm
just read the docs would be alot of help for ya
and one thing i suggest is develop with py
what he needs is javascript knowledge, discord docs wont help, but mozilla docs should
or even stuff like w3schools
discord.py reading docs only can help him make a multi purpose bot tho
yeah but moving to py would require him to dump his entire project and start from scratch in a new language
and my bot isnt multipurpose 
I already made a lot of progress on this one
elaborate
But i have to dump code i spent a hour on rn so 🤷
xDDD dude an hour of code?
Only an hour of coding?
I spent at least 2 days on this bot, know that's not much but eh
no no, im saying a hour for one of these commands
You'll be fine restarting mate
i had to dump a code i worked 3 weeks on
nice
i dumped code i worked months on last year
so just restart with py
It's always good to restart a project again sometimes, because you quickly learn from your mistakes and starting again is just easier
theres no valid reason to restart with py, unless they want to learn py
what is he developing it for then?
if its just for the purpose of bot py should be fine
yep that should do it
js is as fine as py, switching language wont offer any benefit
not like the docs are that much more helpful
The discord js docs are amazing
Python you can do more in the future like machine learning
well idk i found py easier prolly cuz i am more experienced in it
Are you new to programming?
and I've learned bits of d js for the past year now
not really, but I started with d js
cause the only thing I coded were discord bots
F
And you switched over to python?
no never
Ok stay with js
he didnt switch, chromos is trying to convince him to switch for no reason lol
js > py
F...idk personal opinion of mine ig xD
Let the man do his thang
k
@quartz kindle okay
Hmm
I have an eval command for my bot, and usually it just logs messages to console if the output is over 1980 characters long
I'm trying to split it by every 1900 characters and sending each
but I keep getting an error
TypeError: "" is not a function
Anyone have any ideas on how to fix this?
that's a bad idea to send each.
I would make a temporary file with output, and send the tile
File~
and afterwards wipe the file
that is actually a decent idea
Time to go back to the node.js docs and entirely relearn fs.
actually, not relearn, just learn how to use the write part, not the read.
yeh just write
Wish me luck!
@limpid flower if you're using discord.js, it has built in message splitting functions as well
that wont split output though, will it?
it will split a string into multiple messages yes, so if you're talking about tens of thousands of characters, you have to go the file route
would anyone be interested in giving me feedback on my bot?
i'd really appreciate it
dm me if ur interested 😃
we don't really do that here
I wonder, could I try sending a Discord.JS attachment where the "file" is just text?
BufferResolvable or Stream
oh
yes, but you'd need to encode your text into a file buffer
dataValues:
{ id: '561588141761495045',
log_channel: null,
prefix: null,
premium: false,
case_counter: 0,
guildMemAdd: null,
guildMemRem: null,
guildBanAdd: '604481391706505224',
guildBanRem: null,
guildUpdate: null,
messageDelete: null,
messageDeleteBulk: null,
messageUpdate: null,
userUpdate: null,
createdAt: 2019-09-17T23:21:56.616Z,
updatedAt: 2019-09-17T23:22:12.092Z },
_previousDataValues:
{ id: '561588141761495045',
log_channel: null,
prefix: null,
premium: false,
case_counter: 0,
guildMemAdd: null,
guildMemRem: null,
guildBanAdd: '604481391706505224',
guildBanRem: null,
guildUpdate: null,
messageDelete: null,
messageDeleteBulk: null,
messageUpdate: null,
userUpdate: null,
createdAt: 2019-09-17T23:21:56.616Z,
updatedAt: 2019-09-17T23:22:12.092Z },
_changed: {},
_modelOptions:
{ timestamps: true,
validate: {},
freezeTableName: false,
underscored: false,
paranoid: false,
rejectOnEmpty: false,
whereCollection: null,
schema: null,
schemaDelimiter: '',
defaultScope: {},
scopes: {},
indexes: [],
name: [Object],
omitNull: false,
sequelize: [Sequelize],
hooks: {} },
_options:
{ isNewRecord: false,
_schema: null,
_schemaDelimiter: '',
raw: true,
attributes: [Array] },
isNewRecord: false } ]
@quartz kindle That is what was returned from await Guild.findAll()
oof
fuck i can't think
How exactly would I turn it into a buffer? Like this?
const reply = new Buffer([<message variable>])
@lusty dew i saw issues about a bug in sequelize in their github
saying that sometimes findOne will return null, but findAll will work, so just use findAll()[0]
Okay
nah, the buffer needs an array of bytes
or whatever sequelize uses to get the first item of the returned items
or not, I can literally just slap in a string.
use 1
should be 0, but it needs to be awaited first
I’m awaiting it
Wait
That doesn’t work
So like maybe
const res = await Guild.findAll()
const logChannel = res[0].get('guildBanAdd')
Like that?
yes
Hm okay
Uhm tim
at Query.formatError (C:\Users\Aj\Desktop\AmareBot\node_modules\sequelize\lib\dialects\sqlite\query.js:413:16)
at Query._handleQueryResponse (C:\Users\Aj\Desktop\AmareBot\node_modules\sequelize\lib\dialects\sqlite\query.js:73:18)
at Statement.afterExecute (C:\Users\Aj\Desktop\AmareBot\node_modules\sequelize\lib\dialects\sqlite\query.js:247:31)
at Statement.replacement (C:\Users\Aj\Desktop\AmareBot\node_modules\sqlite3\lib\trace.js:19:31)```
Don't think that is how findAll works?
Okay maybe so
But wtf
Why is it not working
Okay fixed the error
But now res just returns an empty array
[]
I want to have 54 (client.guilds.size) formatted like the others (with a bartick)
but if i put a bartick, this happens
it treats it like a '
in js
Aha, thanks
criminal
Well I get an empty array for some reason
In the way I’m using it probably should return an empty array but I don’t want that
Here’s my code:
const res = await Guild.findAll({ where: { id: guild.id } })
console.log(res)
Hey pennywise
What library @lusty dew
Probably means there is not a db entry for it
@tight mountain they're called backticks nor barticks
Working on setting up webhooks for a djs bot. Trying to run some tests on a local machine but the requests arent coming through. Does the webhook system require a secure https connection or does standard http work?
If I create the query in postman and send it off to the same url it works but I'm not seeing any traffic using the test button in the api options on the website
@pure creek just post in one place please
didnt know which channel was better, sorry
No problem, for next time
@tight mountain do
"`" + client.guilds.size + "`"
If you defined Discord.Client as client
Fine you can also do
"`" + '${client.guilds.size}' + "`"
yeah, you can escape backticks while still using string literals
lmao idk why it took so long but yeah
Oof
actually i need some help with my code but its more than 2000 words how can i send it?
pastebin
k
this one
ignore those ``````
they are cuz i tried to paste it in discord first
i tried making a translator fr the bot
but it just passes and nothing happens
lmao
@earnest phoenix
Fine you can also do
"`" + '${client.guilds.size}' + "`"
uuuh no?
My team cant find the teams in the devolve api
I was invite them but still cant find
Someone know how?
prolly cuz u invited them to the wrong server?
One message removed from a suspended account.
i mean this https://discordapp.com/developers/docs/teams
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
One message removed from a suspended account.
Anyone know how to detect if a person and in a voice channel?
What library?
Discord.js
If a member is in the voice channel you can call <Member>.voiceChannel() (<Member.voice.channel for v12) on it
Okai, thank you
let page = 1;
let Discord = require ("discord.js")
module.exports.run = async (bot,message,args) => {
const embed = new Discord.RichEmbed()
.setColor(0xffffff)
.setFooter(`Page ${page} of ${pages.length}`)
.setDescription(pages[page-1])
message.channel.send(embed).then(msg => {
msg.react('⬅').then( r => {
msg.react('➡')
const backwardsFilter = (reaction, user) => reaction.emoji.name === '⬅' && user.id === message.author.id;
const forwardsFilter = (reaction, user) => reaction.emoji.name === '➡' && user.id === message.author.id;
const backwards = msg.createReactionCollector(backwardsFilter, {timer: 6000});
const forwards = msg.createReactionCollector(forwardsFilter, {timer: 6000});
backwards.on('collect', r => {
if (page === 1) return;
page--;
embed.setDescription(pages[page-1]);
embed.setFooter(`Page ${page} of ${pages.length}`);
msg.edit(embed)
})
forwards.on('collect', r => {
if (page === pages.length) return;
page++;
embed.setDescription(pages[page-1]);
embed.setFooter(`Page ${page} of ${pages.length}`);
msg.edit(embed)
})
})
})
}
module.exports.help = {
name: "test",
aliases: []
}```
i have to click twice to go to the next page. but why?
client.on('voiceStateUpdate', (oldMember, newMember) => {
let newUserChannel = newMember.voiceChannel
let oldUserChannel = oldMember.voiceChannel
if(oldUserChannel === undefined && newUserChannel !== undefined) {
client.channel.get(`623583871488753679`).send({embed: {
color: 0xff0080,
fields: [
{
name: newMember,
value: newMember.voiceChannel
}
],
timestamp: new Date(),
footer: {
text: "© Lynaria.fr"
}
}
});
} else if(newUserChannel === undefined){
client.channels.get(`623583871488753679`).send(oldMember.user.tag + `(` + oldMember + `) to leave voice channel **` + oldMember.voiceChannel + `**`)
}
})``` I can not send the Embed in a specific channel :/
@twilit rapids
😦
@stray garnet on "collect" only fires for added reactions, not for removed reactions. v12 has on "remove", but v11 does not
@earnest phoenix it's <Client>.channels not <Client>.channel
I'm talking about the Embed and not the message
client.channel.get(`623583871488753679`).send({embed: {
^
TypeError: Cannot read property 'get' of undefined
at Client.<anonymous> (/DiscordBot/discord.js:18:20)
at Client.emit (events.js:209:13)
at VoiceStateUpdateHandler.handle (/DiscordBot/node_modules/discord.js/src/client/websocket/packets/handlers/VoiceStateUpdate.js:39:16)
at WebSocketPacketManager.handle (/DiscordBot/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:105:65)
at WebSocketConnection.onPacket (/DiscordBot/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (/DiscordBot/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:296:17)
at WebSocket.onMessage (/DiscordBot/node_modules/ws/lib/event-target.js:120:16)
at WebSocket.emit (events.js:209:13)
at Receiver.receiverOnMessage (/DiscordBot/node_modules/ws/lib/websocket.js:789:20)
at Receiver.emit (events.js:209:13)```
client.channel.get(`623583871488753679`).send({embed: {
color: 0xff0080,
fields: [
{
name: newMember,
value: newMember.voiceChannel
}
],
timestamp: new Date(),
footer: {
text: "© Lynaria.fr"
}
}
});```
please use logic
@copper cradle
@earnest phoenix it's <Client>.channels not <Client>.channel
you cannot pass entire objects to the embed, you have to pass the values you want
newMember.nickname or newMember.user.username
Umh okai
value: voiceChannel.name
^
ReferenceError: voiceChannel is not defined```
use your brain
i didnt give you code to copy and paste
you still need to get the voice channel from the member object, it doesnt exist on its own
just because i didnt mention it, doesnt mean you have to remove it
L2C
How to get the Total User Amount? discord.js 11.5.1
logic 101
lol
Docs
This one is right in the docs
https://discord.js.org/#/docs/main/stable/class/Client?scrollTo=users these are cached users. If you want as you said total users loop over all guilds and add their memberCount
you can either use just a regular loop or use the reduce(..) function on a d.js collection
Which is identical to Array.reduce(..)
<Client>.users.size
wdym
\
\n is for newlines
thx
<Client>.users.size is cached users only
normally i know but i forgot
In computing and telecommunication, an escape character is a character which invokes an alternative interpretation on subsequent characters in a character sequence. An escape character is a particular case of metacharacters. Generally, the judgment of whether something is an...

lol
hey one more question
when I reboot my bot, the number of users decreases at playing status. then it slowly increases. What is the reason of this? how can i fix that ?
caching
do you just have the word caching on your clipboard 24/7 waiting for someone to ask a question related to that so you can answer in 0.01 seconds?
lol
caching
btw caching? can you give an example how can i use it
look up the definition of caching
its discord.js caching
oh... ok
anyways, sum up guilds memberCount property, it's more reliable to be accurate
Reduce the collection of guilds to their member count is probably the easiest way
So to retrieve the number of users you have to do <Client>.memberCount ?
re-read what both of us said
i'm not english 😭
xD
ok
well you clearly can speak it so you can understand context, so, re-read
But if for example I want to modify a channel with the number of users I do JS msg.guild.channels.find (" id "," 623887003452309514 "). SetName (client.users.size); but how could I make it change automatically when launching the bot, because msg is not defined client.on (" ready ", () => {
you have your client
you can get any entity from it
Owh okai
That is "key" ?
and again, client.users.size is only cached users, to get total users, read what steven and cry said
key is the key you want to match, for example, id or name
Okai
yes
because you're negating it
turning false into true
you don't need the second operation at all
if you return the boolean from the database as is, you're just adding extra overhead using a ternary operation to accomplish the same thing
var noprefix = true or false
var noprefix = noprefix ? true : noprefix; //if noprefix is true, it becomes true, else if noprefix is false, it becomes false, basically doing nothing```
Ugh
Random stuff in #memes-and-media @lament hemlock
How do you make a bot? like Dyno
Good evening, I have a little problem, I try to make sure that when someone joins the server with an invitation I would like to be notified and know how many times the invitation has been used by single user and not in total but I can not find :/
https://files.lynaria.fr/Discord_jPJK9OyiKJ.png
const invites = {};
const wait = require('util').promisify(setTimeout);
client.on('ready', () => {
wait(1000);
client.guilds.forEach(g => {
g.fetchInvites().then(guildInvites => {
invites[g.id] = guildInvites;
});
});
});
client.on('guildMemberAdd', 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);
client.channels.get(`623583871488753679`).send(`${member.user.tag} joined using invite code ${invite.code} from ${inviter.tag}. Invite was used ${invite.uses} times since its creation.`);
});
});
you would have to keep track of it seperately with a database i think
I think to do the same but I do not know all of them, so in addition we must add the mysql, ouch
But it is not possible to create a constant and when a person joins with a specific invitation then add 1 to the constant, it will surely be more complicated
add 1 to the constant
Variable*
Sry ;p
new Date().UTC();
TypeError: (intermediate value).UTC is not a function
Using js, dunno why this is happening.
Some other functions do work.
because its.. not a function?
right
value: invite.memberCount,
^
ReferenceError: invite is not defined```
ReferenceError: invite is not defined
Yes but i don't understand 😭
i'm trying to figure out the best way to make my bot's application stateless and have been considering how to handle my database. i use node-postgres (name not really relevant) and it supports client pooling, so what i'm doing right now is something along the lines of
export databasePool = new Pool():
and calling it in other sharded clients with
databasePool.connect().query()
the problem is, on every sharded client a pool is created
i've been looking at dbs such as redis for storing something, but i don't know what to do about not creating a new client pool for each sharded client
i guess the real question is how do i make my application work so that it only needs one database pool for all sharded clients
it's a bit of a long question but help appreciated 
I think you should do what i do, like creating your own form of database with fs
like
= every user & server executed a command before
and in those folders
de data is
fs
that kind of data seems more suitable for an actual db
not fs since fs is subject to corruption
also, on another note, i have this huge global object storing a lot of variables and want to move that into redis as well
ok big question basically: what should i store in redis
things you need to access a lot
@eternal mesa does it make sense to store say, an object of emojis to redis?
it will be accessed often but never written to
actually that question doesn't make sense, the object is basically {"thing": "<:emoji:0000:>", ...}
@valid frigate redis supports has sets which is basically an object under a key
i was looking at redis types and yeah looks like a set sounds like the same
looks like {} works by using HSET but apparently nested objects like {{}} don't parse correctly
that's fine 
im having trouble installing better-sqlite3
it gives an error when i try
screenshot in a sec
what does it say above the error
nothing its just that
one sec
at least here
You need to install all the python and window build tools stuff
all the vsc stuff is up do date
'node-gyp' is not recognized as an internal or external command,
operable program or batch file.
Did you restart after running that command?
do i need to restart the laptop?
oh ok
cya in a sec
I'll just use mobile from now
@slim heart what will I do after restarting?
Is it just npm i better-sqlite3 or node-gyp?
does node-gyp rebuild work now?
new Date().getTime() or Date.now() which!??
then you've not installed it correctly
Everything was successful
try again and make sure
how to creaete Discord bot 0__o
Assuming I did the installing bit tight
its not been installed correctly is why
Right
you might need to configure build tools
in some cases visual studio 2019 doesnt work, and you need to specifically install 2015 build tools
although better-sqlite3 was recently updated to support 2017 and 2019
you need node-gyp 5.0.0+ for vs2019 support
also, the problem seems to be that windows-build-tools by default installs vs2015 and vs2017, but your installer is looking for vs2019 which is not found
Does anyone know how WebStorm works kek
I can't type, delete or remove lines of code from the files
Lol WebStorm is really easy to use
Is there a rather steep learning curve, yes. Is it really easy to use if you know how it works, also yes.
Yea it should be but it isn't letting me edit the files
Well when I hit backspace it just goes to the next character
Show pictures
but doesn't delete the highlighted characher
and when I hit backspace
it just goes to the d
but doesn't delete the )
Did you install the Vim extension?
Don't download random shit you don't recognize
Okay
I'm assuming you don't know what Vim is, right?
Ok there we have it
really*
Uninstall it and WebStorm will work fine
Okay
In Vim, you press the i button before adding/deleting characters
Since you installed the Vim extension, WebStorm is trying to mimic Vim by waiting for the i key before adding/deleting stuff
i stands for insert
const res = await Guild.findAll({ where: { id: guild.id } })
console.log(res)
This keeps returning an empty array when it should show 2 objects in the array
I don't get why it is doing that so if someone could please help me i'd appreciate it
Does the entry actually exist?
Also why are you expecting two objects lol... normally in a Guild table it's customary to have one entry per guild
Lol nice joke
xD...no really heroku aint support py 3.7
ah...i see
^, if youre a student you can get the heroku credits through githubs student pack. However, I still dont suggest using heroku
id shell out a few dollars for a real vps
If you have the GitHub Student Dev pack, you can get lots of other VPS providers for free @dusky marsh
Also Google Cloud Platform is free forever with or without the student pack
yeah ik just was throwing out there since he already was looking at heroku, and google cloud is free ?
$50 DO credit too
App not compatible with buildpack: https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/python.tgz
More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
! Push failed
this error is coming
no matter wot
thats why i said
@opaque eagle
Is the git repo initialized within the root project folder?
have you considered using a vps
That too ^
Normally I don't suggest them at first becuz most of the ppl asking for such alternatives are little kids, and thus they don't have a credit card
And most of these promotions often require a credit card
recommendation for good resource to start learning bot development with little-to-no programming experience? trying not to bug people with a billion questions. A link to a good resource would be appreciated.
You could check out an idiots guide, but knowing how to program is recommended
@earnest phoenix python
I understand you are lazy, neko, but any particular resource you'd recommend for starting to learn python?
@sudden geyser so maybe an idiots guide to programming?
@zealous veldt why are u mean
not to program. Just a simple guide on how to make bots.
Programming, could check out codecademy.
@opaque eagle what did you mean earlier?
i totally forgot codeacademy existed. thanks.
@earnest phoenix ouch

How do i register my Bot?
const res = await Guild.findAll({ where: { id: guild.id } })
console.log(res)
This keeps returning an empty array when it should show 2 objects in the array
I don't get why it is doing that so if someone could please help me i'd appreciate it
const embed = new Discord.RichEmbed()
.setAuthor("Administration")
.setDescription("**i.setrole** • Sets the Role for an User\n**takerole** • Takes the Role from an User\n**i.setprefix** • Sets the Prefix to your wish\n**i.setlogs** • Sets the Log Channel (without #) `Logs Deleted messages Only For now`")
.setColor("#FAED27")
message.channel.send(embed)
return
}```
i.commands Administrator is not working anymore, yesterday it worked
big question
ive been looking at redis and wonder if it's a drop-in replacement for the database i'm using right now (postgres)
.toLowerCase() == string with capitals
Doesn’t exactly play nice
@stray garnet
yes basically
@valid frigate Like I said, I use Redis for data that I need to be accessing a lot, for example, data that is specific per guild that needs to be accessed in a command . For long term data, I use Postgres.
i brought it up since it appears data persists even after the redis server is restarted
@slim heart oh
also since i was previously using mongo, and redis is comparable to mongo as a nosql db
i.commands user
@valid frigate it does persist yes
right
its preference tbh
i.commands user
hmm
it definitely is a more efficient solution in a lot of cases
seems that redis would have to be queried using something like userInfo:${userid} or smth
since key/value
wdym
Jump Toat Object.exports.run (/app/c/commands.js:14:19)6:48 AM
Jump Toat Client.bot.on
what?
@valid frigate reasonable in what sense
You should only be storing info that you need for your bot to operate
im probably sounding confusing rn but
basically if the user is an admin or not, etc
yeah it's mostly only info my bot needs to operate
How many said admins are there
If it’s just one admin I would bother with redis
I am imagining
yeah thanks for the pointers tbh
i need to do more research before asking questions 
const res = await Guild.findAll({ where: { id: guild.id } })
console.log(res)
This keeps returning an empty array when it should show 2 objects in the array
I don't get why it is doing that so if someone could please help me i'd appreciate it
I am running my bot on a GalaxyGate vps using pm2 for startup etc, is there a way to load lavalink and have it run on startup of the vps for unexpected shutdowns/reboots etc?
Startup scripts
And also anyone using Lavalink on a vps, any experience with no audio coming through?
yeah i tried using the systemd start up method things, im just not familiar enough with linux i guess
Most likely your lavalink version I had same issue and that is what is was for me
i have the very latest
from ci downloads
like, it connects and everything, no errors in console afaik (logs from pm2), but no audio is played
pm2 freeze
look on how to configure that
I run my own fork of lavalink and I have no issues on it, same with official lavalink
hm, maybe im dumb then, will report back if i cant get it, thank you all the help tho :3
does anyone know how to update discord.js on ubuntu?
by running a command
npm install discord.js
it does this everytime i move it
or change it
idk how to disable it because it runs off my mates site
@inner sapphire do as cyber said bud
the fact that you don't know what that means "show your package.json" means you copy pasted this code from someone entirely
do you have a package.json file
if so, send the contents of it with all personal information redacted
your package.json might be corrupted
im pretty sure npm would mention that
If you need to upgrade to Discordjs v12 you can just add this in your package.json under dependencies
"discord.js": "github:discordjs/discord.js",
And then run npm i
or just do npm I discordjs/discord.js
That’s just a hotfix
Ubuntu isnt updating it like its suppose to you have to do as Timo said and it'll work. I tried yesterday with ubuntu 19.04 and it didnt work so I had to manually put it in
One message removed from a suspended account.
One message removed from a suspended account.
o
owo
any alternatives for heroku?
A vps
renting a vps is omega super ultimately better than heroku and glitch
kek thanks
Is there a method of discord.js that is to verify if a member can be moved from a channel?
as bannable
Check if the bot has permissions too
Now, I just need the method because it sends me Missings Permissions error
The move permission can’t change per who you’re moving. That’s why bannable is a thing because you can ban one person with the permission but for example you can’t ban the owner so it’s different
You check your permissions in the channel or server
Yes
But ... can the owner of the server be expelled from a voice channel? or to people with a superior role than bot?
@slim heart
No
If you have move permissions you can move anyone
Hence why there isn’t a moveable prop
True, but I want it is more to be able to expel for that I use the MOVE_MEMBERS permission
You can’t expel users from moving people who have the move people permissions, believe it or not 
i.commands Administrator works fine,
but... WHY DONT i.commands Moderation dont works?
ah ok, so could you tell me the error in my code? is that Missings Permissions launches me but I can't identify what I'm missing
Oh wait yeah
return for every message sent
It’s moderator not moderation
oof
but user, music, balance dont works aswell
its basically if else but with less indentation
i know what it is, i've just never seen it used right after a message is sent
i do return message.channel.send
Just let him do him 
you're fine with that anyways
It doesn’t make a difference but sure
you don't have to move it
btw the error:
Jump Toat Object.exports.run (/app/c/commands.js:14:19)2:23 PM
Jump Toat Client.bot.on
(node:147) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Access
at item.request.gen.end (/rbd/pnpm-volume/52a80ac7-e292-4e39-a888-d61e514f54bd/node_modules/.registry.npmjs.org/discord.js/11.5.1/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:85:15)
at then (/rbd/pnpm-volume/52a80ac7-e292-4e39-a888-d61e514f54bd/node_modules/.registry.npmjs.org/snekfetch/3.6.4/node_modules/snekfetch/src/index.js:215:21)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
(node:147) 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: 43)``` @slim heart sorry mention ^
@mossy vine so?
so... it errors
ok
@mossy vine aanddd how to fix it?
aaaaand check if its undefined first
and how?
I think at this point if you don’t know how to fix something like that then you need to take some time to learn JavaScript
^
Hm yea
ads
lol
heyheyhey
my bot doesnt reaction to my message with 1⃣
i added 1️⃣
but dont working
it says unknown emoji
how can i do it ?
Neither
Second 
wait hold up
Don't you need to use the plain unicode
Literally <Message>.react(":one:")
What version on Discord.js are you on?
mm let me check
does your command handler say m?
Simply run Discord.version in your eval
i don't feel like that's right
v11.4.2
They said their getting the error "Unknown emoji"
What could be the cause of the sqlite error database disk is malformed error?
yep i got unknown emoji error
I guess it has changed in v12 since it works for me
i d k
Try reacting with 1⃣
Same error?
._.
1 ⃣
-_-
👌
@summer torrent your database could be corrupted
http://prntscr.com/p8ahfk this is my bot's latest version
how do you install better-sqlite3?
ive ran npm -g --add-python-to-path install windows-build-tools node-gyp
reloaded a new admin cmd window
so... what do i need to do?
@wide ruin use python™
this is not the channel to ask
General
whenever i run this.client.shard.broadcastEval(this.channels.get("${c}")); i'm trying to send a message to the shard that sees the channel defined as c here
however c.send isnt a function
it returns a TextChannel object about the channel, but not its properties, how do i fix this?
Discord.js v11 or v12?
Read this documentation: https://discordjs.guide/sharding/extended.html#sending-messages-across-shards
A guide made by the community of discord.js for its users.
oh wow
do you actually have to encompass everything in a string?
iirc if i can fetch a TextChannel i should be able to send a message there
There's literally an example how to send a message to one channel out of all shards
hwello 🙂
Do you need help with anything Tazhys?
Then please go to general or off-topic...
okay 🙂
is there any ways to make the delay in my bot less time consuming
What do you mean by delay? Timeouts, intervals, awaiting a promise?
awaiting a promise
like im using reddit praw...so it is taking a huge amount of time to send the link from reddit
any ways to reduce that delay?
I don't think so, you could try different API's but a promise takes as long as it has to
ummm...any suggestion about the api?
You could just skip praw and write your own reddit client, then you could lazy load more and speed it up
Not sure in the case of praw, but jraw (java version) does not like to lazy load much so it isnt super quick
for broadcastEval, can i pass a script file instead of a string?
praw seems to take a huge time to complete the req tho
Yeah, so dont use it
@valid frigate I honestly don't know, you could try it but I don't think it would work
Is there a python library for https://rra.ram.moe?
@heady salmon just make http requests
Im pretty sure you can use google to see if there is one
I'm extremely new to python unforunutely, so I'm going to prob to have to filter the URL out
They are in most langs
for async code use aiohttp
for sync code you'd probably want requests
uh
that'd just be difficult to use
Hey I'm trying to use discord.js-lavalink, but I'm having issues with it regarding queuing songs.
I tried creating my own queue (of course), but it seems to ignore my queue completely and rather "replace" the song.
Can you show a code snippet of how you are handling queuing now?
bot.db.query(`SELECT * FROM serverInfo WHERE serverID = '${guild.id}'`, (err, rows) => {
if (err) throw err;
let sql;
if(rows.length < 1) {
sql = `INSERT INTO serverInfo (serverID) VALUES ('${guild.id}')`;
}
bot.db.query(sql, console.log(`Added ${guild.id} to database`));
});```
i'm using this code in my `guildCreate` event it used to work, but now it doesn't add guild's ID's to the database upon joining a guild, there is a db connection so can't be that, the code is from one video on xp and level up tutorials but adjusted for my needs, i've got no idea what to do now to make it add guild ID's to the database upon joining a guild
Hey guys, had a look through the API and I can't seem to find a field for when the user registered with discord?
Have you tried logging sql to see if it's undefined
@limber temple Discord.js?
i'll give a try to that, however on the tutorial its exactly the same and it works there 
indeed sql turned out to end up being empty, so I just removed that whole part, and checked if its empty in the rows.length then it'll db query it and add it
alright now i'm stuck with another non-logical issue
on my guild create event I run this:
let botPerms = guild.me.permissions.has(['SEND_MESSAGES', 'MANAGE_CHANNELS'], true);
and when you add the bot I made sure I ask for those permissions as u see on image
the user doesn't have to give the bot those permissions
they can uncheck them if they want
I'm beginning to question your bot's intentions with that name 
but I would normally invite bots with perms 0 and give them the bot role in my server
but I also don't use many bots that arent mine

I'm adding the bot on a newly created server by me with all default perms
and it still says it doesn't have the permissions 
does it have the permission for the specific channel you're running it on, or whatever operation you're performing
it should try to create a logging channel upon joining a guild if it has the manage channels permission and send messages (which I grant to the bot)
that's a terrible idea
Be more specific please
So I built a discord bot with Discord bot maker
so exported it to js
now how do i make him online 24/7
Run it in a VPS
A VPS is a computer stored somewhere else... you connect to it remotely and run stuff on there
it stays up 24/7
even if your computer shuts down
git isn't installed in your path
is that a dea clone
Can any one give me a good bot name?
How 'bout lucy
God spoodums already told you to stop doing new lines pls stop its mega annoy
@modern elm any more newlines like that and you get muted, understand?
Im sorryits a bad habit
Just use more commas
Commas are difficult for my thicc fingers to hit
oh sorry
anyone have experience with the streamlabs API, specifically OAuth? Ping me please
const res = await Guild.findOne({ where: { id: guild.id } });
console.log(res)
```\
This keeps returning an empty array and I have no clue why
I thought I fixed it but apparently not
it could mean several things
guild.id might not be what you think it is
or maybe searching by "id" wont work
I don't see why it wouldn't
I doub't it is guild.id
I made sure it wasn't
Okay so that is odd
Now guild.id is not returning the actual guild ID
Wait what
It is returning my ID
👀
No like
That shouldn't be happening
It is a function being ran inside a event emitter
so it can use those params
and console logging guild returns the guild object
but doing guild.id
returns my ID
which si odd
if you're listening for an event that returns a guild, guild.id will be the guild id? 
somone can help me with the vps
]]moreinfo
If you want people to be able to assist you, please provide more information, such as what library and language you're using, the code in question and what you are trying to do and/or what is causing the error.
i just bought the 3$ deal in galaxyGate
how do i use it
if somone can explain it to me in dm
Why would you purchase first ask later
cause yolo swag 2k15 
lol
it isn't listening
Hello 🙂
I have a little question with this code:
How to transform it so that it is the server ID?
i don't think msg.author.id can include that
message.guild.id.includes(perm)
how to be a certified dev?
Make a certified bot
what makes a bot certified?
if(!args[0]) return message.channel.send("Ingresa un emoji")
let emoji = message.guild.emojis.find(r=>r.id===args[0]) || message.guild.emojis.find(r=>r.name===args.join(" ")) || message.guild.emojis.find(r=>r) ||message.guild.emojis.find(r=>r.url===args[0])
if(!message.guild.emojis.has(emoji)) return message.channel.send("Emoji no encontrado")
const embed = new Discord.RichEmbed()
.addField("**NOMBRE:**", `${emoji.name}`, false)
.addField("**VISTA:**", `${emoji}`, false)
.addField("**CREADO:**", `${moment(emoji.createdAt).format("DD/MM/YYYY, HH:mm:ss")}`, false)
.addField("**ID:**", `${emoji.id}`, false)
.setThumbnail(`${emoji.url}`)
.setColor("#36393E")
.setFooter("Pedido por "+message.author.username, message.author.displayAvatarURL)
.setTimestamp ()
message.channel.send(embed); ```
Why does the "has" condition always throw me if the emoji is in the guild?
Can someone help me?
I'm trying to create a bot in python..
Description of the bot
It stores questions from a special role person, and when some member uses a command, my bot asks the questions which are stored.
My problem Description
Im facing a problem..
If there are 2 guilds..
Each guild has a member who has that special role..
If 1st member creates questions(my bot stores that questions)..
If another member from another guild creates questions..
My bot is overwriting the questions I've previously stored
Help
I've to store data of different guilds.
Please help me out with this.
store them differently
I've tried.. can you help me out.. how to store them differently
i dont know python, so i dont know what the proper data structure would be, but dictionaries could work. make the key the guild id and the value the question



I have find
