#development

1 messages · Page 698 of 1

lusty dew
#

It returned null

#

But after the res.get nothing works

#

But look

quartz kindle
#

it should throw an error "cannot read property get of null" or something

lusty dew
#

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

quartz kindle
#

what if you log Guild.findAll()

lusty dew
#

Huh?

quartz kindle
#

instead of getting the guild from the database, dump the entire database there and log it

lusty dew
#

Oh

quartz kindle
#

to make sure the database is actually available and accessible there

lusty dew
#
  _bitField: 0,
  _fulfillmentHandler0: undefined,
  _rejectionHandler0: undefined,
  _promise0: undefined,
  _receiver0: undefined }```
#

👀

#

Doesn't look like the db

quartz kindle
#

welp, whats in your seq_db file?

lusty dew
#

A lot of table definitions

quartz kindle
#

does the guild table work anywhere else in your code?

lusty dew
#

In the other events and mod commadns

#

commands*

#

yes

#

That link is my seq_db.js file

slow crypt
#

Someone helo me

msg.member.roles.has.find("name", "rolename")

Why isn't this working ?

idle basalt
#

remove .has

slow crypt
#

Ok

quartz kindle
#

try logging await Guild.findAll({where:{id:guild.id}}) @lusty dew

earnest phoenix
#

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

quartz kindle
#

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

earnest phoenix
#

oh you can do that

#

how would u convert it

quartz kindle
#

JSON.parse()

earnest phoenix
#

i know how to read it like let rawdata = fs.readFileSync('votes.json');

#

how would i use json.parse

idle basalt
#

JSON.parse('put json string here')

#

every time you have a question, drop it into google

earnest phoenix
#

oh ok

idle basalt
#

99% of the time the first link will have the answer

earnest phoenix
#

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');
});```
idle basalt
#

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

earnest phoenix
#

oh

#

i honestly wanna be done with this so bad, how would i do that?

grizzled valley
#

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?

quartz kindle
#

your data is saved in votes

#

so you need to edit your data in there

earnest phoenix
#

so what do i have to store it in instead?

quartz kindle
#

do you know how to edit objects?

earnest phoenix
#

no

grizzled valley
#

F

earnest phoenix
#

is there documentation for that

idle basalt
#

you should complete some js tutorials

#

learn the basics

grizzled valley
#

lmao

idle basalt
#

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

earnest phoenix
#

well i really just wanted this for one thing

quartz kindle
#
object = {key:value}
object.key = othervalue
object.otherkey = anothervalue

// object is now
{
    key: othervalue,
    otherkey: anothervalue
}```
grizzled valley
#

they start with making a bot? dude everything aint copy pasting and we dont spoon feed

earnest phoenix
#

the only difficult part in my code is this

#

@grizzled valley already started it

#

this is the first really hard wall i hit

grizzled valley
#

F

stray wasp
#

Who we spoon-feeding?

grizzled valley
#

idk tbh

#

i just wrote something cuz i was bored

#

apologies

#
#

dude read the docs you will find all your answer

earnest phoenix
#

I got the hint before mate 👍

#

Guess your apologies didn't mean shit GWcmeisterPeepoShrug

grizzled valley
#

F...lol apologies for what ? i said nothing to ya directly

#

"they" as i say it

earnest phoenix
#

Wow dude, you're real toxic

grizzled valley
#

if u think u in them then i am sorry ffs

#

F

earnest phoenix
#

my bad than 🤷

grizzled valley
#

xDDDD

#

nvm

#

just read the docs would be alot of help for ya

#

and one thing i suggest is develop with py

quartz kindle
#

what he needs is javascript knowledge, discord docs wont help, but mozilla docs should

#

or even stuff like w3schools

grizzled valley
#

discord.py reading docs only can help him make a multi purpose bot tho

west spoke
#

said who

#

I read d.py docs all the time

quartz kindle
#

yeah but moving to py would require him to dump his entire project and start from scratch in a new language

west spoke
#

and my bot isnt multipurpose mmulu

stray wasp
#

To many multipurpose bots

#

Lul

earnest phoenix
#

I already made a lot of progress on this one

grizzled valley
#

elaborate

earnest phoenix
#

But i have to dump code i spent a hour on rn so 🤷

grizzled valley
#

xDDD dude an hour of code?

stray wasp
#

Only an hour of coding?

earnest phoenix
#

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

stray wasp
#

You'll be fine restarting mate

grizzled valley
#

i had to dump a code i worked 3 weeks on

earnest phoenix
#

nice

quartz kindle
#

i dumped code i worked months on last year

grizzled valley
#

so just restart with py

stray wasp
#

It's always good to restart a project again sometimes, because you quickly learn from your mistakes and starting again is just easier

quartz kindle
#

theres no valid reason to restart with py, unless they want to learn py

grizzled valley
#

what is he developing it for then?

#

if its just for the purpose of bot py should be fine

earnest phoenix
#

no

#

its for a democracy server

grizzled valley
#

yep that should do it

quartz kindle
#

js is as fine as py, switching language wont offer any benefit

earnest phoenix
#

not like the docs are that much more helpful

stray wasp
#

The discord js docs are amazing

earnest phoenix
#

much better than py im sure?

#

so that's one reason not to switch

stray wasp
#

Python you can do more in the future like machine learning

grizzled valley
#

well idk i found py easier prolly cuz i am more experienced in it

earnest phoenix
#

yeah, but I don't need that much for this bot

#

I was just stuck on this

stray wasp
#

Are you new to programming?

earnest phoenix
#

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

grizzled valley
#

F

stray wasp
#

And you switched over to python?

earnest phoenix
#

no never

stray wasp
#

Ok stay with js

quartz kindle
#

he didnt switch, chromos is trying to convince him to switch for no reason lol

stray wasp
#

Oh

#

Chromos stop it

quartz hawk
#

js > py

earnest phoenix
#

@quartz hawk 3c

#

but yea lol

grizzled valley
#

F...idk personal opinion of mine ig xD

stray wasp
#

Let the man do his thang

grizzled valley
#

k

lusty dew
#

@quartz kindle okay

limpid flower
#

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?

west spoke
#

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

limpid flower
#

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.

west spoke
#

yeh just write

limpid flower
#

Wish me luck!

west spoke
#

and tbh creating a file and writing wont take much.

#

sending may be the worst part.

quartz kindle
#

@limpid flower if you're using discord.js, it has built in message splitting functions as well

limpid flower
#

o h

#

I did not know this

west spoke
#

that wont split output though, will it?

quartz kindle
#

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

earnest phoenix
#

would anyone be interested in giving me feedback on my bot?

#

i'd really appreciate it

#

dm me if ur interested 😃

grim aspen
#

we don't really do that here

limpid flower
#

I wonder, could I try sending a Discord.JS attachment where the "file" is just text?

#

BufferResolvable or Stream

#

oh

quartz kindle
#

yes, but you'd need to encode your text into a file buffer

grim aspen
limpid flower
#

I already have the page up

#

thanks though

grim aspen
#

wait fuck that's the main

#

master*

lusty dew
#
    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()

limpid flower
#

oof

grim aspen
#

fuck i can't think

limpid flower
#

How exactly would I turn it into a buffer? Like this?

const reply = new Buffer([<message variable>])
quartz kindle
#

@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]

lusty dew
#

Okay

limpid flower
#

nah, the buffer needs an array of bytes

quartz kindle
#

or whatever sequelize uses to get the first item of the returned items

limpid flower
#

or not, I can literally just slap in a string.

lusty dew
#

It’s an array

#

So [0] should work

#

Okay nvm

#

[0] doesn’t work

west spoke
#

use 1

quartz kindle
#

should be 0, but it needs to be awaited first

lusty dew
#

I’m awaiting it

quartz kindle
#

(await findAll())[0]

#

or await into a variable first

lusty dew
#

Wait

#

That doesn’t work

#

So like maybe

#
const res = await Guild.findAll()
const logChannel = res[0].get('guildBanAdd')
#

Like that?

quartz kindle
#

yes

lusty dew
#

Wait would that cause issues?

#

If the db grows and new guilds get added?

quartz kindle
#

use the same filter as you did before

#

where id:guild.id

lusty dew
#

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

#

[]

tight mountain
#

I want to have 54 (client.guilds.size) formatted like the others (with a bartick)

#

it treats it like a '

west spoke
#

use a string

#

if you are in py

tight mountain
#

in js

west spoke
#

ye

#

I think "$client.guilds.size"?

slender thistle
#

``${client.guilds.size}`` 🤔

#

Good lord

broken shale
#

you'd need to escape the backtick

#
`\`${client.guilds.size}\``
slender thistle
#

Aha, thanks

inner jewel
#

"`" + client.guilds.size + "`"

idle basalt
#

criminal

lusty dew
#

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)
naive bobcat
#

Hey pennywise

earnest phoenix
#

What library @lusty dew

lusty dew
#

Sequelize

#

Also don’t know if it matters but also using sqlite3

slim heart
#

Probably means there is not a db entry for it

copper cradle
#

@tight mountain they're called backticks nor barticks

pure creek
#

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

eternal mesa
#

@pure creek just post in one place please

pure creek
#

didnt know which channel was better, sorry

eternal mesa
#

No problem, for next time

earnest phoenix
#

@tight mountain do
"`" + client.guilds.size + "`"

#

If you defined Discord.Client as client

valid frigate
#

wtf is that monstrosity

#

that defeats the point of using a string literal spongerino

earnest phoenix
#

Fine you can also do
"`" + '${client.guilds.size}' + "`"

valid frigate
#

what are you doing

#
`\`${client.guilds.size}\``
#

try this

mossy vine
#

yeah, you can escape backticks while still using string literals

valid frigate
#

lmao idk why it took so long but yeah

regal bear
#

Oof

earnest phoenix
#

Ok

#

Im just stupid

#

Ffs

grizzled valley
#

actually i need some help with my code but its more than 2000 words how can i send it?

mossy vine
#

pastebin

grizzled valley
#

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

lime bough
#

Fr

#

I say fir

#

When i make a typo for for it goes fir

grizzled valley
#

lmao

copper cradle
#

@earnest phoenix

Fine you can also do
"`" + '${client.guilds.size}' + "`"

uuuh no?

lean swan
#

My team cant find the teams in the devolve api
I was invite them but still cant find
Someone know how?

grizzled valley
#

prolly cuz u invited them to the wrong server?

sage bobcat
#

One message removed from a suspended account.

lean swan
sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

Anyone know how to detect if a person and in a voice channel?

twilit rapids
#

What library?

earnest phoenix
#

Discord.js

twilit rapids
#

If a member is in the voice channel you can call <Member>.voiceChannel() (<Member.voice.channel for v12) on it

earnest phoenix
#

Okai, thank you

stray garnet
#
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?
earnest phoenix
#
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

#

😦

quartz kindle
#

@stray garnet on "collect" only fires for added reactions, not for removed reactions. v12 has on "remove", but v11 does not

copper cradle
#

@earnest phoenix it's <Client>.channels not <Client>.channel

earnest phoenix
#

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

quartz kindle
#

@earnest phoenix it's <Client>.channels not <Client>.channel

earnest phoenix
quartz kindle
#

you cannot pass entire objects to the embed, you have to pass the values you want

#

newMember.nickname or newMember.user.username

earnest phoenix
#

Umh okai

#
value: voiceChannel.name
               ^

ReferenceError: voiceChannel is not defined```
quartz kindle
#

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

earnest phoenix
#

blobdance I have find

#

Thank everyone

warm marsh
#

L2C

stray garnet
#

How to get the Total User Amount? discord.js 11.5.1

copper cradle
#

logic 101

stray garnet
#

lol

amber fractal
#

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(..)

tight forum
#

hey

#

uhm

#

i forgot it

copper cradle
#

<Client>.users.size

mossy vine
#

wdym

tight forum
#

damn W8

#

how can i use ' in bot messages i mean

mossy vine
#

escape them?

#

'

#

\'

grim aspen
#

\

tight forum
#

oh

#

I thought \ n

#

just forgot it

mossy vine
#

\n is for newlines

tight forum
#

thx

amber fractal
#

<Client>.users.size is cached users only

tight forum
#

normally i know but i forgot

mossy vine
#

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...

tight forum
earnest phoenix
#

احم

#

هلا

#

!invite

grim aspen
tight forum
#

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 ?

earnest phoenix
#

caching

mossy vine
#

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?

tight forum
#

lol

earnest phoenix
#

caching

tight forum
#

btw caching? can you give an example how can i use it

earnest phoenix
#

look up the definition of caching

mossy vine
#

its discord.js caching

tight forum
#

oh... ok

earnest phoenix
#

anyways, sum up guilds memberCount property, it's more reliable to be accurate

amber fractal
#

Reduce the collection of guilds to their member count is probably the easiest way

earnest phoenix
#

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

quartz kindle
#

also, dont use .find(id,value)

#

use .find(item => item.key === value)

earnest phoenix
#

That is "key" ?

quartz kindle
#

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

earnest phoenix
#

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

quartz kindle
#
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```
lament hemlock
#

Ugh

west spoke
earnest phoenix
#

How do you make a bot? like Dyno

west spoke
earnest phoenix
#

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.`);
  });
});
mossy vine
#

you would have to keep track of it seperately with a database i think

earnest phoenix
#

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

eager perch
#
new Date().UTC();

TypeError: (intermediate value).UTC is not a function

#

Using js, dunno why this is happening.

#

Some other functions do work.

mossy vine
#

because its.. not a function?

eager perch
mossy vine
#

that is Date.UTC()

#

and is also not a constructor

eager perch
#

right

earnest phoenix
#
value: invite.memberCount,
                 ^

ReferenceError: invite is not defined```![MegaThonk](https://cdn.discordapp.com/emojis/585884192361938960.webp?size=128 "MegaThonk")
sudden geyser
#

ReferenceError: invite is not defined

earnest phoenix
#

Yes but i don't understand 😭

idle basalt
#

that means that invite is not defined

#

lol

valid frigate
#

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 pogU

earnest phoenix
#

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

valid frigate
#

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

eternal mesa
#

things you need to access a lot

earnest phoenix
#

like a custom prefix

#

or general important data

valid frigate
#

@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:>", ...}

eternal mesa
#

@valid frigate redis supports has sets which is basically an object under a key

valid frigate
#

i was looking at redis types and yeah looks like a set sounds like the same

earnest phoenix
#

new Date().getTime() or Date.now()

#

which best?

valid frigate
#

looks like {} works by using HSET but apparently nested objects like {{}} don't parse correctly

#

that's fine mmLol

wide ruin
#

im having trouble installing better-sqlite3

#

it gives an error when i try

#

screenshot in a sec

earnest phoenix
#

oh shit i got that before

#

idk where it comes from neither how to fix it

eternal mesa
#

what does it say above the error

earnest phoenix
#

nothing its just that

wide ruin
#

one sec

earnest phoenix
#

at least here

wide ruin
slim heart
#

You need to install all the python and window build tools stuff

wide ruin
#

i did that command

#

npm -g --add-python-to-path install windows-build-tools node-gyp

slim heart
#

What command

#

Ok

#

So if you do node-gyp rebuild does it work?

wide ruin
#

all the vsc stuff is up do date

#

'node-gyp' is not recognized as an internal or external command,
operable program or batch file.

slim heart
#

Did you restart after running that command?

wide ruin
#

yeah

#

completely new window

slim heart
#

No

#

Restart the machine

wide ruin
#

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?

slim heart
#

does node-gyp rebuild work now?

wide ruin
#

Just reloading

#

Slow laptop

#

Ok I've got cmd

earnest phoenix
#

new Date().getTime() or Date.now() which!??

wide ruin
#

Date.now()

#

Ok right @slim heart

#

Same error

#

Not a command

slim heart
#

then you've not installed it correctly

wide ruin
#

Everything was successful

slim heart
#

try again and make sure

wide ruin
#

I'll have to tomorrow

#

Do you know why it's not though?

silver loom
#

how to creaete Discord bot 0__o

wide ruin
#

Assuming I did the installing bit tight

slim heart
#

its not been installed correctly is why

wide ruin
#

Right

slim heart
#

the issue is u havent

quartz kindle
#

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

lusty dew
#

Does anyone know how WebStorm works kek

#

I can't type, delete or remove lines of code from the files

opaque eagle
#

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.

lusty dew
#

Yea it should be but it isn't letting me edit the files

opaque eagle
#

What exactly is happening

#

Pictures would be great

lusty dew
#

Well when I hit backspace it just goes to the next character

opaque eagle
#

Show pictures

lusty dew
#

but doesn't delete the highlighted characher

#

and when I hit backspace

#

it just goes to the d

#

but doesn't delete the )

opaque eagle
#

Did you install the Vim extension?

lusty dew
#

Yes

#

I am pretty sure

opaque eagle
#

Don't download random shit you don't recognize

lusty dew
#

Okay

opaque eagle
#

I'm assuming you don't know what Vim is, right?

lusty dew
#

Sorta

#

But not reallu

opaque eagle
#

Ok there we have it

lusty dew
#

really*

opaque eagle
#

Uninstall it and WebStorm will work fine

lusty dew
#

Okay

opaque eagle
#

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

lusty dew
#

Ah okay

#

I just installed Webstorm today lol

opaque eagle
#

Cool

#

The Vim extension is intended for Vim users

lusty dew
#

Yea, trying to figure things out kek

#

Yea makes sense

lusty dew
#
    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

opaque eagle
#

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

lusty dew
#

Wdym?

#

Also yes the entry exists

grizzled valley
#

any ideas about where can i host my bot for free?

#

24/7?

opaque eagle
#

Lol nice joke

grizzled valley
#

xD...no really heroku aint support py 3.7

opaque eagle
#

Yes it does

grizzled valley
#

ah...i see

opaque eagle
#

Please use google before asking here

amber fractal
#

24/7 is a stretch

#

You only get so many free hours/month

dusky marsh
#

^, 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

opaque eagle
#

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

dusky marsh
#

yeah ik just was throwing out there since he already was looking at heroku, and google cloud is free ?

amber fractal
#

$50 DO credit too

opaque eagle
#

^

#

Plus whatever GitHub's Azure promotion was

grizzled valley
#

this error is coming

#

no matter wot

#

thats why i said

#

@opaque eagle

opaque eagle
#

Is the git repo initialized within the root project folder?

valid frigate
#

have you considered using a vps

opaque eagle
#

That too ^

valid frigate
#

heroku is a pain to set up

opaque eagle
#

Especially for Python

#

Since it's a sucky language

valid frigate
#

lmao yes

#

use someone's referral code on DO

#

iirc any referral gives you $50

grizzled valley
#

xDDD

#

thats the reason i was asking fr an alternative

opaque eagle
#

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

earnest phoenix
#

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.

sudden geyser
#

You could check out an idiots guide, but knowing how to program is recommended

west spoke
#

@earnest phoenix python

earnest phoenix
#

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

sudden geyser
#

not to program. Just a simple guide on how to make bots.

Programming, could check out codecademy.

lusty dew
#

@opaque eagle what did you mean earlier?

earnest phoenix
#

i totally forgot codeacademy existed. thanks.

west spoke
#

@earnest phoenix ouch

earnest phoenix
coral ginkgo
#

How do i register my Bot?

slim heart
lusty dew
#
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

stray garnet
#
  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
valid frigate
#

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)

slim heart
#

.toLowerCase() == string with capitals
Doesn’t exactly play nice
@stray garnet

valid frigate
#

yes basically

eternal mesa
#

@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.

valid frigate
#

i brought it up since it appears data persists even after the redis server is restarted

stray garnet
#

@slim heart oh

valid frigate
#

also since i was previously using mongo, and redis is comparable to mongo as a nosql db

stray garnet
#

i.commands user

eternal mesa
#

@valid frigate it does persist yes

valid frigate
#

right

eternal mesa
#

its preference tbh

stray garnet
#

i.commands user

valid frigate
#

hmm

eternal mesa
#

it definitely is a more efficient solution in a lot of cases

valid frigate
#

seems that redis would have to be queried using something like userInfo:${userid} or smth

#

since key/value

eternal mesa
#

wdym

valid frigate
#

is it reasonable to like

#

store user information

stray garnet
#

Jump Toat Object.exports.run (/app/c/commands.js:14:19)6:48 AM

Jump Toat Client.bot.on 

what?

eternal mesa
#

@valid frigate reasonable in what sense

#

You should only be storing info that you need for your bot to operate

valid frigate
#

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

eternal mesa
#

How many said admins are there

valid frigate
#

one

#

i mean i was considering it because of how fast it claims to be

eternal mesa
#

If it’s just one admin I would bother with redis

valid frigate
#

hmm yeah

#

imagine though

eternal mesa
#

I am imagining

valid frigate
#

yeah thanks for the pointers tbh

#

i need to do more research before asking questions mmLol

lusty dew
#
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

dusky marsh
#

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?

slim heart
#

Startup scripts

dusky marsh
#

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

lusty dew
#

Most likely your lavalink version I had same issue and that is what is was for me

dusky marsh
#

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

sinful lotus
#

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

dusky marsh
#

hmm

#

and i dont need ffmpeg for ll to run correct?

sinful lotus
#

yes, if it needs it, it already threw an error about it

#

¯_(ツ)_/¯

dusky marsh
#

hm, maybe im dumb then, will report back if i cant get it, thank you all the help tho :3

inner sapphire
#

does anyone know how to update discord.js on ubuntu?
by running a command

valid frigate
#

npm install discord.js

inner sapphire
#

lol

#

i have done that

mossy vine
#

show your package.json

#

specifically the dependencies

inner sapphire
#

it does this everytime i move it

#

or change it

#

idk how to disable it because it runs off my mates site

pale marsh
#

@inner sapphire do as cyber said bud

inner sapphire
#

im seriously stupid

#

but i dont know what he means, im abit slow.

solemn depot
#

the fact that you don't know what that means "show your package.json" means you copy pasted this code from someone entirely

inner sapphire
#

no

#

🤦

#

and your assuming?

#

stop jumping to conclusions

mossy vine
#

do you have a package.json file

#

if so, send the contents of it with all personal information redacted

valid frigate
#

your package.json might be corrupted

mossy vine
#

im pretty sure npm would mention that

twilit rapids
#

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

west raptor
#

or just do npm I discordjs/discord.js

slim heart
#

That’s just a hotfix

earnest phoenix
#

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

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

vague chasm
#

o

lament hemlock
#

owo

grizzled valley
#

any alternatives for heroku?

slim heart
#

A vps

sinful lotus
#

renting a vps is omega super ultimately better than heroku and glitch

grizzled valley
#

kek thanks

quartz kindle
#

and its stupidly cheap

#

like one bus ride per month

peak tendon
#

Is there a method of discord.js that is to verify if a member can be moved from a channel?
as bannable

slim heart
#

Check if the bot has permissions too

peak tendon
#

Now, I just need the method because it sends me Missings Permissions error

slim heart
#

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

peak tendon
#

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

slim heart
#

No

#

If you have move permissions you can move anyone

#

Hence why there isn’t a moveable prop

peak tendon
#

True, but I want it is more to be able to expel for that I use the MOVE_MEMBERS permission

slim heart
#

You can’t expel users from moving people who have the move people permissions, believe it or not mmLol

stray garnet
peak tendon
#

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

slim heart
#

What’s the error @stray garnet

#

@peak tendon try/catch

mossy vine
#
if (args.shift().toLowerCase() === "moderator") {```
#

i wonder why

slim heart
#

Oh wait yeah

grim aspen
#

return for every message sent

slim heart
#

It’s moderator not moderation

stray garnet
#

oof

grim aspen
#

i've never seen that before

stray garnet
#

but user, music, balance dont works aswell

mossy vine
#

its basically if else but with less indentation

grim aspen
#

i know what it is, i've just never seen it used right after a message is sent

mossy vine
#

i do return message.channel.send

slim heart
#

Just let him do him mad

grim aspen
#

you're fine with that anyways

stray garnet
#

so return message.channel.send(embed)

#

or am i just retarded

slim heart
#

It doesn’t make a difference but sure

grim aspen
#

you don't have to move it

stray garnet
#

btw the error:


Jump Toat Object.exports.run (/app/c/commands.js:14:19)2:23 PM

Jump Toat Client.bot.on

mossy vine
#

oh yeah

#

args.shift() might return undefined

#

if you dont provide an argument

peak tendon
#
(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 ^
stray garnet
#

@mossy vine so?

mossy vine
#

so... it errors

slim heart
#

I told you

#

Try/catch

#

If it fails say so

peak tendon
#

ok

stray garnet
#

@mossy vine aanddd how to fix it?

mossy vine
#

aaaaand check if its undefined first

stray garnet
#

and how?

slim heart
#

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

mossy vine
#

^

stray garnet
#

Hm yea

grim aspen
#

ads

opal slate
#

lol

tight forum
#

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 ?

west spoke
#

You need to use the discord code

#

Eg

#

:regional_indicator_i:

tight forum
#

oh i tried

#

m.react('1⃣');

m.react(1⃣);

#

which one is true

west spoke
#

Neither

slender thistle
#

Second thonkku

tight forum
#

oh

#

lemme try

slender thistle
#

wait hold up

west spoke
#

:one:

#

you need that

earnest phoenix
#

no

#

the number emojis are two unicode characters

sudden geyser
#

Don't you need to use the plain unicode

tight forum
#

⃣1

#

like this ?

#

still not working

copper cradle
#

use

#

the name

#

that works for me

#

1⃣

twilit rapids
#

Literally <Message>.react(":one:")

tight forum
#
m.react(':one:');```
#

its not working for me

#

@copper cradle

#

and ⃣1 too

twilit rapids
#

What version on Discord.js are you on?

tight forum
#

mm let me check

grim aspen
#

does your command handler say m?

twilit rapids
#

Simply run Discord.version in your eval

grim aspen
#

i don't feel like that's right

tight forum
#

v11.4.2

twilit rapids
#

They said their getting the error "Unknown emoji"

summer torrent
#

What could be the cause of the sqlite error database disk is malformed error?

tight forum
#

yep i got unknown emoji error

copper cradle
#

@tight forum can we see your command handler

#

ah nvm

#

you got the error

#

weird

twilit rapids
copper cradle
#

i d k

twilit rapids
#

Try reacting with 1⃣

tight forum
#

tried

#

😦

twilit rapids
#

Same error?

tight forum
#

oh w8

#

i didnt try it

copper cradle
#

._.

tight forum
#

i try ⃣1 and ⃣1

#

wtf same ?

#

anyway

#

let me try

lament meteor
#

1 ⃣

twilit rapids
#

1⃣ is the unicode character one

#

And the docs say to use a unicode character

tight forum
#

oh worked

#

ty

copper cradle
#

-_-

twilit rapids
#

👌

trim saddle
#

@summer torrent your database could be corrupted

grim aspen
inner sapphire
wide ruin
#

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?

trim saddle
#

@wide ruin use python™

wide ruin
#

no its 2 people working on it

#

and it uses a lot of npm

flint iron
#

@gleaming glen

#

why is my bot not verified?

gleaming glen
#

this is not the channel to ask

flint iron
#

General

valid frigate
#

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?

twilit rapids
#

Discord.js v11 or v12?

valid frigate
#

v12

#

@twilit rapids

twilit rapids
valid frigate
#

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

twilit rapids
#

There's literally an example how to send a message to one channel out of all shards

valid frigate
#

yeah i read that

#

ok then mmulu

inner sapphire
#

hwello 🙂

twilit rapids
#

Do you need help with anything Tazhys?

inner sapphire
#

nah just saying hi timo!

#

🙂

twilit rapids
#

Then please go to general or off-topic...

inner sapphire
#

okay 🙂

grizzled valley
#

is there any ways to make the delay in my bot less time consuming

twilit rapids
#

What do you mean by delay? Timeouts, intervals, awaiting a promise?

grizzled valley
#

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?

twilit rapids
#

I don't think so, you could try different API's but a promise takes as long as it has to

grizzled valley
#

ummm...any suggestion about the api?

scarlet phoenix
#

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

valid frigate
#

for broadcastEval, can i pass a script file instead of a string?

grizzled valley
#

praw seems to take a huge time to complete the req tho

scarlet phoenix
#

Yeah, so dont use it

twilit rapids
#

@valid frigate I honestly don't know, you could try it but I don't think it would work

valid frigate
#

eh maybe its not really needed

#

stupid question nvm mmulu

heady salmon
amber fractal
#

Is that an api?

#

Just make http/s calls to it and make your own of there isnt

west spoke
#

@heady salmon just make http requests

amber fractal
#

Im pretty sure you can use google to see if there is one

heady salmon
#

I'm extremely new to python unforunutely, so I'm going to prob to have to filter the URL out

west spoke
#

.. I mean http requests in py are so simple

#

like actually

amber fractal
#

They are in most langs

slender thistle
#

for async code use aiohttp
for sync code you'd probably want requests

heady salmon
#

Actually I can

#

Using the path thing

heady salmon
#

Uhm

#

idk

#

OH FML

#

I found it

#

LOL

mossy vine
#

uh

heady salmon
#

👀

#

Prob not

slender thistle
#

So a random prefix per bot start

#

is it

copper cradle
#

that sounds awful

#

why would you ever do that

slender thistle
#

No

sudden geyser
#

that'd just be difficult to use

junior lily
#

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.

twilit rapids
#

Can you show a code snippet of how you are handling queuing now?

hollow prawn
#
    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
limber temple
#

Hey guys, had a look through the API and I can't seem to find a field for when the user registered with discord?

sudden geyser
#

Have you tried logging sql to see if it's undefined

twilit rapids
#

@limber temple Discord.js?

hollow prawn
#

i'll give a try to that, however on the tutorial its exactly the same and it works there peeposhrug

#

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

earnest phoenix
#

the user doesn't have to give the bot those permissions

#

they can uncheck them if they want

amber fractal
#

I'm beginning to question your bot's intentions with that name mmLol

#

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

copper cradle
hollow prawn
#

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 Thonkang

sudden geyser
#

does it have the permission for the specific channel you're running it on, or whatever operation you're performing

hollow prawn
#

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)

sick cloud
#

that's a terrible idea

sage ferry
#

somone can help me?

#

but i need somone that know's about discord bot

broken shale
#

Be more specific please

sage ferry
#

So I built a discord bot with Discord bot maker

#

so exported it to js

#

now how do i make him online 24/7

opaque eagle
#

Run it in a VPS

sage ferry
#

what is that

#

?

opaque eagle
#

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

earnest phoenix
#

i don't understand it

#

?

sick cloud
#

git isn't installed in your path

broken shale
#

is that a dea clone

modern elm
#

drug enforcement agency makes clones now?

#

goddamn

earnest phoenix
#

Can any one give me a good bot name?

modern elm
#

WhizSpecs

#

Foosier

#

Stanme

#

Fliptop

#

SlamJot

#

ThiccBot

earnest phoenix
#

How 'bout lucy

slim heart
#

God spoodums already told you to stop doing new lines pls stop its mega annoy

loud salmon
#

@modern elm any more newlines like that and you get muted, understand?

modern elm
#

Im sorryits a bad habit

slim heart
#

Just use more commas

modern elm
#

Commas are difficult for my thicc fingers to hit

loud salmon
#

@earnest phoenix wrong channel

earnest phoenix
#

oh sorry

zealous veldt
#

anyone have experience with the streamlabs API, specifically OAuth? Ping me please

lusty dew
#
    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

valid frigate
#

it could mean several things

#

guild.id might not be what you think it is

#

or maybe searching by "id" wont work

lusty dew
#

I don't see why it wouldn't

valid frigate
#

the syntax is correct

#

it's either the id in {where: { >id< or guild.id

lusty dew
#

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

#

👀

valid frigate
#

there you go

#

sometimes its worth paying attention to what you assign to variables mmLol

lusty dew
#

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

valid frigate
#

if you're listening for an event that returns a guild, guild.id will be the guild id? waitWhat

lusty dew
#

But it isn't

#

Lmao

#

and using the user param sends errors

sage ferry
#

somone can help me with the vps

zealous veldt
#

]]moreinfo

covert turtleBOT
#

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.

sage ferry
#

i just bought the 3$ deal in galaxyGate

#

how do i use it

#

if somone can explain it to me in dm

languid dragon
#

Why would you purchase first ask later

drowsy sentinel
#

cause yolo swag 2k15 lmao

lusty dew
#

lol

patent rampart
#

buys vps and has no clue how to use it

#

just give it to me

earnest phoenix
#

connect ECONNREFUSED 127.0.0.1:27017

#

on mongo compass

patent rampart
#

it isn't listening

earnest phoenix
#

Hello 🙂
I have a little question with this code:

How to transform it so that it is the server ID?

gleaming glen
earnest phoenix
#

Exactly, I would like to replace it with a server ID. @gleaming glen

#

Oups

lavish shuttle
#

message.guild.id.includes(perm)

earnest phoenix
#

Sorry for mention

#

Ok

#

Thank you

gleaming glen
#

how will server's id include that

#

i don't think id's include anything like that

grizzled valley
#

how to be a certified dev?

pure creek
#

Make a certified bot

grizzled valley
#

what makes a bot certified?

sick cloud
#

nothing right now

#

applications are closed

pure creek
peak tendon
#
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?
buoyant mountain
#

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.

mossy vine
#

store them differently

buoyant mountain
#

I've tried.. can you help me out.. how to store them differently

mossy vine
#

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