#development

1 messages · Page 980 of 1

weary ridge
#

coz when i do delete it can't find it

slender thistle
#

what

acoustic kiln
#

plz ping and reply

weary ridge
#

hmm wait nvm

#

ok yeh that worked

#

but how do i turn it into an embed?

rigid maple
#

pls help

grand violet
#

o

#

show me that code

rigid maple
#

help me

weary ridge
#

it literally says No DBL token has been provided.

plush fractal
#

Add a bot token

#

Because of you have a bot and on the code says: No DBL token has been provided , you just add a bot token there.

vale garden
#

hlo

#
const blackjack = new Discord.MessageEmbed()
        blackjack.setColor("#ff00ff")
        .setAuthor(`${message.author.username} VS ${bot.user.username}`)
        .addFields(
          {name: `${message.author.username}'s Deck:`, description: `${aaa[a]} of ${cards[card1]} & ${ccc[c]} of ${cards[card3]}\nValue: **`${ac}`**`},
          {name: `${bot.user.username}'s Deck:`, description: `${bbb[b]} of ${cards[card2]} & ||${ddd[d|} of ${cards[card4]}||\n Value: **`?`**`, inline: true},
        )
        message.channel.send(blackjack)
#

this is my embed

rigid maple
#

I've already added dbltoken in config.js

vale garden
#

which has very bad formatting

#

lol

#
/home/runner/Trade-Bot/commands/bj.js:132
          {name: `${message.author.username}'s Deck:`, description: `${a
aa[a]} of ${cards[card1]} & ${ccc[c]} of ${cards[card3]}\nValue: **`a`**
`},
                                                                        
                                                                    ^

SyntaxError: Unexpected identifier
#

why am i getting this error

weary ridge
#

does it know its in config.js

rigid maple
#

no

weary ridge
#

welp theres ur problem

vale garden
#

can someone help

#

me

rigid maple
#

how should i do?

slender thistle
#

Escape with \

vale garden
#

repl.it if you dont wanna download anything

#

@earnest phoenix

rigid maple
#

how should i do?
@rigid maple

vale garden
#

can someone help

#

me

#

i need help

#

someone

twin pendant
#

on line 6 it looks like u are ending the string then starting a new one inside the description of the field, try removing the 2 ` 's on either side of ${ac}

#

also i got a question: in v11 i could remove a reaction by a specifc user by doing reaction.remove(user) where user was their user object, although this doesnt work in v12 now so anyone know i would do that?

vale garden
#

i fixed it lol

#

but

#
let A = parseInt[aaa[a]]
        let B = parseInt[bbb[b]]
        let C = parseInt[ccc[c]]
        let D = parseInt[ddd[d]]

        let ac = A + C
        let bd = B + D
        
        const blackjack = new Discord.MessageEmbed()
        blackjack.setColor("#ff00ff")
        .setAuthor(`${message.author.username} VS ${message.client.user.username}`)
        .addFields(
          {name: `${message.author.username}'s Deck:`, value: aaa[a] + " of " + cards[card1] + " & " + ccc[c] + " of " + cards[card3] + "\nValue: **`" + ac+ "`**"},
          {name: `${message.client.user.username}'s Deck:`, value: bbb[b] + " of " + cards[card2] + " & ||" + ddd[d] + " of " + cards[card4] + "||\n Value: **`?`**", inline: true},
        )
        message.channel.send(blackjack)
#

why is a far off to the left randomly

#

lol

#

ac and bd show: NaN

#

which means i messed up the math

#

how do i fix it

#

plz help

twin pendant
#

that probably means that the parseInts cant parsae whatever those variables are so they just return NaN, also i prefer to use Number() than parseInt, for example Number('10') returns a number which is 10

#

what are those anyway, aaa[a], bbb[b] etc

digital ibex
#

it'd still return nan with number

twin pendant
#

OH wait u need parseInt() not parseInt[]

weary ridge
slender thistle
#

Define "actual time"

twin pendant
#

actual time as in unix?

slender thistle
#

You can use .strftime to format the time

weary ridge
#

ik

#

but it includes a # which u know

slender thistle
#

what

weary ridge
#

when u add a # its like a comment

#

not a command or anything

slender thistle
#

yeah, what about it?

weary ridge
#

umm

vale garden
#

hi im back

weary ridge
#

brb

vale garden
#

see

#

aaa is the array

#

and a is the math random function

#

so its aaa[a]

#

@twin pendant

#

so what do i do

#

oh

#

ohhh

#

lol ok

twin pendant
#

if its an actual number then u shouldnt need to parseInt

vale garden
#

what

#

it is an actual numbr

#

and () didnt work

#

if i just do A = aaa[a] + ccc[c]

#

it gives

#

like if aaa[a] is 2 and ccc[c] is 4

#

it gives 24

#

even thought its not a string

twin pendant
#

oh

vale garden
#
let aa = [
    ['Ace', 1 || 11],
      ['2', 2],
      ['3', 3],
      ['4', 4],
      ['5', 5],
      ['6', 6],
      ['7', 7],
      ['8', 8],
      ['9', 9],
      ['10', 10],
      ['Jack', 10],
      ['Queen', 10],
      ['King', 10]
    ];

    let aaa = aa.map(item => item[0]) 

    let a = Math.floor(Math.random() * aa.length);
#

this is how it looks

#

so do you know why it isnt working

twin pendant
#

oh ok so aaa[a] is going to be a string since you are picking something randomly out of an array

nocturne grove
#

Is it okay to have a database query each 2 seconds with 56 guilds? I don't think so

#

that's average of 50h

vale garden
#

ok so

#

what do i do

nocturne grove
#

what do you want to do? Getting a random element?

#
const randomElement = aa[Math.floor(Math.random() * aa.length)];```
vale garden
#

no

nocturne grove
#

ow

vale garden
#

im tryna add random elements

#

add them

#

1 + 2 = 3 not 1 + 2 =12

#

you know

twin pendant
#

idek haha ill leave it to you menno

nocturne grove
#

that's just js aa.push(newElement);

digital ibex
#

get random elements and add them and add them?

nocturne grove
#

xd

digital ibex
#

wym

vale garden
#

see i already haverandom elements

digital ibex
#

thats how strings work

vale garden
#
let aa = [
    ['Ace', 1 || 11],
      ['2', 2],
      ['3', 3],
      ['4', 4],
      ['5', 5],
      ['6', 6],
      ['7', 7],
      ['8', 8],
      ['9', 9],
      ['10', 10],
      ['Jack', 10],
      ['Queen', 10],
      ['King', 10]
    ];

    let aaa = aa.map(item => item[0]) 

    let a = Math.floor(Math.random() * aa.length);
#

see

#

now

digital ibex
#

make it into a number, first check if it even is a number first

vale garden
#

it isnt cuz its in an array

digital ibex
#

what

vale garden
#

so my question is exactly that

#

how do i make into a number

nocturne grove
#

Number('6') == 6

#

maybe that helps

vale garden
#

wat

digital ibex
#

why are you making the numbers be a string?

vale garden
#

but im getting random numbers

#

how can i not make them

digital ibex
#

theres no point doing that

vale garden
#

i dont have them in quotes

digital ibex
#

remove the quites?

nocturne grove
#

Number('randomNumber') gives you the number object of it

digital ibex
#

yes u do

vale garden
#

but it still works like a string

digital ibex
#

no it won't

vale garden
#

it will

#

and it does

#

thats why i came here

#

lol

nocturne grove
#

if you do Number('6') it will give you the number 6, so you can do 6 + 1 = 7

digital ibex
#

what are you talking about, because it does, so maybe i don't properly understand ur issue

vale garden
#

it doesnt let me show you

digital ibex
#

uh

vale garden
#

here

digital ibex
#

what doesn't

vale garden
#

see

#

value: 93

#

9 + 3 =93

#

wait

#

wait

#

omfg

#

im dumb

#

soz

digital ibex
#

yes. because string1 + string2 = string1+string2

vale garden
#

i just realised

#

ik

#

i thought it was mapped to the constant

#

lol

#

lol

nocturne grove
#

oof

woeful pollen
#
try{
          const varname = setInterval (function () {
            message.channel.send("message")
          }, 3000);
   
        }catch (err){
          console.log(err)
          return message.channel.send("Something went wrong")
        }
        if(var === 1){
          clearInterval(varname)
          message.channel.sendmessage.channel.send(`message`)
        }

Error varname is not defined

#

Do they have to be in the same part of the code

pale vessel
#

varname is in try and you're trying to access it outside of it

woeful pollen
#

Ahhh thanks

rigid maple
#

After my bot was added to top.gg, the ping increased a lot

#

what should I do

golden condor
#

request it be removed from the server

rigid maple
#

no

golden condor
#

your problem then

rigid maple
#

i want it to stay here

digital ibex
#

its got to do something with your code

summer torrent
#

^

digital ibex
#

maybe the way ur handling users, and if u've got a db, the way ur handling users in ur db

#

@rigid maple have u got a database

rigid maple
#

quick.db ?

#

I have quick.db but I don't know how to use it

summer torrent
#

🤔

#

then learn

earnest phoenix
#

Can someone teach me how to make my music bot use soundcloud links and spotify playlist links?

restive furnace
hardy vector
#

I have quick.db but I don't know how to use it
@rigid maple what

rigid maple
#

quick.db mevcut ama kullanmayı bilmiyorum (use translate turkish to english)

golden condor
#

@rigid maple no turkish allowd here

prime glacier
#
  ^
Error: Could not locate the bindings file. Tried:``` error
quartz kindle
#

show full error

prime glacier
#

w8

#

its it

#

@quartz kindle

quartz kindle
#

try running enable-pnpm in your glitch console

honest perch
#

glitch is having issues with packages btw

prime glacier
#

try running enable-pnpm in your glitch console
@quartz kindle ok

#

try running enable-pnpm in your glitch console
@quartz kindle console = terminal?

quartz kindle
#

yes

prime glacier
#

ohk

#

it does nothing

#

no it gave new error wt!

#

it says throw err; ^ Error: Cannot find module 'dotenv' BUT I HAD ADDED IT AHH

quartz kindle
#

show your package.json

prime glacier
#
  "//1": "describes your app and its dependencies",
  "//2": "https://docs.npmjs.com/files/package.json",
  "//3": "updating this file will download and update your packages",
  "name": "hello-express",
  "version": "0.0.1",
  "description": "A simple Node app built on Express, instantly up and running.",
  "main": "server.js",
  "scripts": {
    "start": "node server.js"
  },
  "dependencies": {
    "@discordjs/opus": "^0.3.2",
    "ascii-table": "^0.0.9",
    "common-tags": "^1.8.0",
    "discord.js": "^12.2.0",
    "request": "^2.88.2",
    "request-promise": "^4.2.5",
    "dotenv": "^8.2.0",
    "express": "^4.17.1",
    "discord-anti-spam": "^2.4.1",
    "fs": "^0.0.2",
    "moment": "^2.26.0",
    "mongoose": "^5.9.16",
    "quick.db": "^7.1.1",
    "simple-youtube-api": "^5.2.1",
    "weather-js": "^2.0.0",
    "weather.js": "^0.1.0",
    "ytdl-core": "^3.0.0",
    "ytdl-core-discord": "^1.2.0",
    "node-fetch": "^2.6.0"
  },
  "engines": {
    "node": "12.x"
  },
  "repository": {
    "url": "https://glitch.com/edit/#!/hello-express"
  },
  "license": "MIT",
  "keywords": [
    "node",
    "glitch",
    "express"
  ]
}```
restive furnace
#

👀

quartz kindle
#

remove fs and weather.js 0.1.0

#

also are you using quick.db or mongoose?

#

remove the one youre not using

prime glacier
#

also are you using quick.db or mongoose?
@quartz kindle quick

#

remove fs and weather.js 0.1.0
@quartz kindle m using them!

tepid canyon
#

fs comes with javascript you dont need it

quartz kindle
#

fs is built in, not a module

prime glacier
#

ok

quartz kindle
#

and weather.js you have 2.0.0

#

idk what is 0.1.0 but looks wrong

prime glacier
#

let me add new one ? @quartz kindle

quartz kindle
#

also request and node-fetch do the same thing

prime glacier
#

ohk

quartz kindle
#

which one are you using?

prime glacier
#

which one are you using?
@quartz kindle request

quartz kindle
#

request is deprecated btw

prime glacier
#

const request = require('request');So what should i do?

tepid canyon
#

you can switch to just node-fetch since it is still maintained

prime glacier
#

🧐 how 🙄

tepid canyon
prime glacier
#

ok

tepid canyon
#

i never used request so can't give a simple answer on what exactly you'd need to change.

prime glacier
#

ohk

restive furnace
#

axios gut

#

also superfetch

digital ibex
#

axios is great

quartz kindle
#

i like got

#

but most times i just use node's built in http.request

restive furnace
#

how it works

#

same way like node-fetch?

autumn summit
#

Anyone know how to make a queue system? I am working on a 1v1 bot and I decided to make a feature where once a player reacts to a message, it puts them in a queue to find another player that recently reacted to that message that hasn't already found a 1v1. Once they get matched, the bot will create a channel in selected server exclusive to the player and the player's opponent. I can do all of this except for the queue part, anyone have any ideas?

#

I was thinking of using a json file but idk

restive furnace
#

just use Map or Array

solemn latch
#

Does it need to be stored through reboots?

autumn summit
#

wdym

#

no.

solemn latch
#

Then an array does it fine.
When a spot is open, grab and remove the first thing from the array

#

When someone joins, put them at the end of the array

autumn summit
#

array in what?

solemn latch
#

What do you mean?

autumn summit
#

what do you mean by array

#

like in a json?

#

or array array

solemn latch
#

An array array

autumn summit
#

oh ok

#

you mean list

solemn latch
#

However an array array is something else.
Its just an array

#

Pretty sure every programming language calls an array

autumn summit
#

oh

solemn latch
#

An array

autumn summit
#

ok

#

oh shit

#

i was confused

#

yeah I guess I could use an array

#

however im not so familar with that, how do I replace stuff from the array

solemn latch
#

Depends on the language.

autumn summit
#

python

solemn latch
#

Covers modifying arrays, including slicing the first one out, and adding(extending) new ones in

autumn summit
#

im looking at w3 schools rn

#

thanks for your help

modest maple
#

why would you use arrays in Py when you can use a list or deque for that job

#

Arrays have zero benifit for that purpose lol

autumn summit
#

no

solemn latch
#

Why does python have two seperate things for array and list

modest maple
#

Because Arrays only support 1 data type

restive furnace
#

well c# has like 6 different array types

modest maple
#

Lists support any combination of data types

solemn latch
#

I wonder why it's needed

modest maple
#

Because Arrays are quicker

#

But only 1 data type

solemn latch
#

Numerical?

#

Then an array would be better here?

modest maple
#

you can have any data type

#

but only the array can only hold that data type

solemn latch
#

Since you only are storing the id of the user I would presume

modest maple
#

Legit a list of be easier

solemn latch
#

And the user data in the cache

earnest phoenix
solemn latch
#

Ah

#

Ty, just was curious. I am not a python dev

earnest phoenix
#

i use discord.js

jaunty frigate
#

Windows 2012 kullanmasını bilen varmı
(Does anyone know how to use Windows 2012)

restive furnace
#

wdym

weary ridge
#

heroku only works in administrator cmd but git doesnt but without administrator git works but heroku doesnt ???????? someone help me

#

lol 😭

restive furnace
#

what???

weary ridge
#

thats what i said

#

you know what heroku is right?

restive furnace
#

yes ofc

#

but i dont understand ur question

autumn summit
#

d.py: How do I make a text channel and set the permissions to specific members can read and text?

autumn summit
#

thx

hushed jungle
#

How accurate is client.users.cache.size for displaying total members the bot is serving in each guild?

tight plinth
#

100% if you cache all members, else depends on size of guilds your bot is in

hushed jungle
#

But I wonder if it actually caches all members or not

#

Now it is a reasonable 29 but if it gets approved it will be much bigger because of the user size of this server

tight plinth
#

There is an option for that but it's disabled by default

#

You have to manually enable it

#

But users takes ram

chrome garden
#

Hi, I have an XP System which works kinda' okay until people start to spam. I thought it was something else but when I disabled my Xp Cog everything worked fine. I tried to debug my code and it seems that the problem lies somewhere in when the bot gives Xp. Also the Bot is made in Python3.

#
    async def _add_xp(self, user: discord.User, amount):
        await self._submit_xp(user, amount)

        userData = Rank.getUserRank(user)
        if userData["level"] >= 10:
            newRole = Rank.getClassFromRank(userData["rank"])
        else:
            newRole = "Citizen"

        if not newRole in [y.name for y in user.roles]:
                member = DisplayName.memberFromId(user.id)
                await Rank.stripMemberClasses(member)
                new_role = discord.utils.get(member.guild.roles, name=newRole)
                await member.add_roles(new_role)```
hushed jungle
#

How does one enable it

chrome garden
#

The bot slows down completely when people start to spam, if anyone might know what's wrong let me know!

restive furnace
#

make cooldown

#

or simply dont store in db everytime

#

just cache, and make interval wjen it saves to db

slender thistle
#

I'd suggest using IDs and get_role instead of using names

earnest phoenix
#

It's a just a warning.

#

Don't mind it

heavy pollen
#

But I'm waiting long time, after this error shards is not starting

#

When I try some codes about shard, it says shard are still spawniing

chrome garden
#

I have a cooldown

earnest phoenix
#

so?

#

@jaunty frigate English only in here(Burada sadece ingilizce konuşabilirsin diye biliyorum.)

vale garden
#

hello

#

does anyone know

#

how to

#

collected certain messages after certain other words are collected

#

like

#

i made a blackjack command

#

so if you

#

hit

#

you get more cards

#

but i made another filter for the next hit if someone wanted one more

#

but now what happens is

#

if i type hit both the hits take place at the same time

#

what do i do

solemn latch
#

you have two collectors both collecting "hit"

vale garden
#

yea

solemn latch
#

both will always go if you have two

#

is this a situation with split?

heavy pollen
#

@earnest phoenix can you help me for sharding? in dms?

#

i want to speak my main lang

vale garden
#

@solemn latch so like what do i do

solemn latch
#

use diffrent terms for it

#

hit and hit2

#

or
hit <number>

earnest phoenix
#

@heavy pollen No,i can't sorry bc i'm not using "shard".

vale garden
#

see

#

how do i

#

allow the message to be collected only after the first one

#

so someone doesnt do hit2 at the starting itself

solemn latch
#

Why do you need two hit collectors again?

#

You can just use one, delete it when it collects a hit, and create the same collector again if the game is still going

vale garden
#

oh

#

how do i do that

restive furnace
#

delete collector

solemn latch
#

Or just make it collect a max of one

#

And it will delete itself

long yew
#

can anyone help me?

#
client.on('message', message => {
  if (message.content === `${prefix}help`) {
    message.channel.send
const exampleEmbed = new Discord.MessageEmbed()
    .setTitle('Help')
  .setDescription(`
  The commands are as listed:
  .kick = kick command
  .ban = ban command
  .server = shows basic stats of the server you are in.
  .user = shows name and id of user.
  .invite = invite the bot to your server!
  .join = join the official server!`)};
message.edit(exampleEmbed);
#

what is wrong?^

solemn latch
#

whats the error given

#

or whats not working

long yew
#

@solemn latch idk i haven't tried it

solemn latch
#

Then try it Hmmm

long yew
#

i got the error as un expected end of input

magic jackal
#

Can you post the entire stack?

long yew
#

ok

earnest phoenix
#

why u using const after message.channel.send ?

magic jackal
#

yeah wait

long yew
#

idk i'm dumb

#

that is it all

#

on a txt

golden condor
#

Hi uh anyone know how to move from mongodb localhost to mongodb cluster

magic jackal
#
const embed = new Discord.MessageEmbed()
        .setColor('#26ff00')
        .setTitle(`Join Guild!`)
        .addField(`Guild Name`, guild.name, false)
        .addField(`Guild ID`, guild.id, false)
        .addField(`Member Count`, guild.memberCount - 1, true)
        .addField("Humans", `${guild.members.cache.filter(member => !member.user.bot).size} `, true)
        .addField("Bots", `${guild.members.cache.filter(member => member.user.bot).size}` - 1, true)
        .addField(`Owner`, `${guild.owner.user.tag}[${guild.owner.id}]`, false)
        return embed```
#

@long yew

#

This works

long yew
#

what's the command?

#

i use

magic jackal
#

message.channel.send(embed)

long yew
#

where do i put that?

magic jackal
#

do it like this one sec

long yew
#

ok

heavy pollen
#

Hello guys, I updated my bot to v12 but my bot not works in v12 with sharding. But works in v11 with sharding. I'm getting this error when wait some minutes:
Discord.js v12.2.0
Node.js v12.18.1
My bot have 4.000 servers.

Error: https://hasteb.in/adeteyux.sql
Shard.JS: https://hasteb.in/yovukupo.js
@heavy pollen any help please?

golden condor
#

Full error?

quartz kindle
#

show server.js

long yew
#
const embed = new Discord.MessageEmbed()
        .setColor('#26ff00')
        .setTitle(`Join Guild!`)
        .addField(`Guild Name`, guild.name, false)
        .addField(`Guild ID`, guild.id, false)
        .addField(`Member Count`, guild.memberCount - 1, true)
        .addField("Humans", `${guild.members.cache.filter(member => !member.user.bot).size} `, true)
        .addField("Bots", `${guild.members.cache.filter(member => member.user.bot).size}` - 1, true)
        .addField(`Owner`, `${guild.owner.user.tag}[${guild.owner.id}]`, false)
        return embed```

how do i make this into a help command or other command?

solemn latch
#

I think TXJ is writing something up for ya

long yew
#

ok

vale garden
#

hi

#

im really dumb

#

someone

#

plz tell me

long yew
#

txj seems pro at this

quartz kindle
#

you're really dumb

vale garden
#

how do i collect

#

only one message

#

lol

magic jackal
#

this works

#

@long yew

long yew
#

ok thanks i'll try it

quartz kindle
#

@vale garden collectors have a max option

solemn latch
#

In the options, its max: 1 I think @vale garden

vale garden
#

ok thx

magic jackal
#

if you want to make it easier on yourself move the embed variable to a file

peak venture
#

How come my SQL database can not be awaited using Javascript?

quartz kindle
vale garden
#

kk

#

thx

long yew
magic jackal
#

@peak venture Need more context then that

peak venture
#

ofcourse

magic jackal
#

@long yew show me what is on that line 168

quartz kindle
#

@long yew your index.js has some missing brackets or unclosed blocks

peak venture
#

so i was trying to search the database and then continue working with the command

#

Though the command goes on and does not await my db.query(`SELECT...

quartz kindle
#

@peak venture which library

peak venture
#

nodejs

quartz kindle
#

i mean database library

restive furnace
#

library

peak venture
#

mysql

#

lawl

restive furnace
#

libraryy

quartz kindle
#

mysql from npm?

vale garden
#
    const collector = message.channel.createMessageCollector(filter, { time: 15000}, {max: 1})
peak venture
#

uhu

vale garden
#

is this

#

how you do it

#

cuz it isnt working

solemn latch
#

Then no CBPikaThink

quartz kindle
#

@peak venture i dont see promises in their docs

magic jackal
#

@vale garden posting in here "it isnt working" doesn't help, send errors and where its crashing

long yew
peak venture
#

@quartz kindle means it can not be used to await hm?

heavy pollen
quartz kindle
#

yes, the await keyword is only for promises

#

the mysql library uses callbacks

magic jackal
#

@long yew Still can't do anything with that, there is still missing brackets or something

solemn latch
#

Not at my desk but it's
{ time: 15000, max: 1 }

#

Or should be

peak venture
#

can i not work around using a function and await that function?

quartz kindle
#

you will need to promisify the callbacks yourself

long yew
#

@magic jackal what line?

peak venture
#

ah. thats an option aswell

magic jackal
#

it tells you right there, 167

#

Can you share the code you're trying please

quartz kindle
#

@peak venture ```js
await new Promise(resolve => {
db.fetch(..., result => {
resolve(result)
})
})

vale garden
#

i fixed it

magic jackal
#

k

vale garden
#

i didnt have any errors btw

#

but yeah

magic jackal
#

nice

long yew
turbid bough
#

anyone know what permission is required to delete emotes from a message?

long yew
#

last line

#

idk what to change

quartz kindle
#

that block is not closed

solemn latch
#

Your editing someone else's message too

quartz kindle
#

youre missing the closing brackets

solemn latch
#

Message.edit is editing the inputed message

turbid bough
#

there is alot of stuff wrong there

magic jackal
#

fixed here

#

I think you should read through the docs more, this is the example file and you're getting into stuff you don't understand yet

quartz kindle
#

@heavy pollen 2 things you can do. init().catch(console.log) and client.on("debug",console.log)

long yew
#

@magic jackal ok ty

quartz kindle
#

that should help you find the problem

long yew
#

ur a pro

magic jackal
#

mhm

quartz kindle
peak venture
#

😛

#

getting a null out of the result now

heavy pollen
#

that should help you find the problem
@quartz kindle my sharding is true?

long yew
turbid bough
#

messageEmbed is out of scope

long yew
#

it's this code

#

@turbid bough

lyric plover
#

/invite

turbid bough
#

messageEmbed is out of scope

#

means

#

its outside of the if statment

#

that does not work

lyric plover
#

:/ español?

turbid bough
#

dont spoonfeed too much

quartz kindle
lyric plover
#

Ok

heavy pollen
#

currently spamming 429 hit on route /gateway/bot @quartz kindle

quartz kindle
#

where is your bot hosted?

long yew
#

@magic jackal ty so much i've been trying to add embeds for so long

quartz kindle
#

try to learn and understand what the code means

#

just so you dont keep copying and pasting whatever people give you

heavy pollen
#

where is your bot hosted?
@quartz kindle in vps, 6gb ram turkey location

#

its spamming now too

quartz kindle
#

you might have been banned by discord

heavy pollen
#

i never see a problem in v11

#

you might have been banned by discord
@quartz kindle i can open bot with v11

quartz kindle
#

they usually ban for 1 hour, if your bot makes too many invalid requests

heavy pollen
#

its like for 1-2 days

#

maybe my phone is deleted from my acc

quartz kindle
#

try with only 1 shard

heavy pollen
#

okay 1 minute

#

try with only 1 shard
@quartz kindle same spam

quartz kindle
#

that usually means discord is temporarily blocking you

#

if your v11 also in the same vps?

heavy pollen
quartz kindle
#

you need to specify total shards to start only one

#

for example totalShards:4

#

then manager.spawn(1)

heavy pollen
#

I write 2 to totalShards

earnest phoenix
heavy pollen
#

later i need to write manager.spawn() or manager.spawn(1) or manager.spawn(manager.totalShards)

quartz kindle
#

manager.spawn() = spawn all shards

#

if you want to test only 1 shard, then manager.spawn(1)

earnest phoenix
#

wow i understood now..

#

can someone pls help me with my music bot queue where did i mess it up

quartz kindle
#

sharding = splitting a bot into multiple connections

#

for load balancing

slow tartan
#

zd

solemn latch
#

its the same bot, but seperated in a way that lets it handle more load

quartz kindle
#

there are many ways to shard, it can be done all inside the same process and have it handle multiple websockets, or have it in separate processes to make use of multithreading

#

each shard will be assigned a certain number of guilds out of the total guilds your bot is in

#

and will only handle events for those guilds

earnest phoenix
#

shard with cluster?

quartz kindle
#

cluster is the same thing as separate processes

earnest phoenix
#

so, i don't need to use it right?

quartz kindle
#

not necessarily, but depends what you want to do

#

if you have a machine with multiple cpu cores, traditional sharding is better for you, doesnt matter if sharding manager, child processes, cluster... its all the same thing

earnest phoenix
#

Ok,thx.

pure lion
#

helpme(discord.js)
code:

bot.on('message', async msg => {

  let args = msg.content.substring(PREFIX.length).split(" ");
  let _command = msg.content.toLowerCase()
  if (!_command.startsWith(PREFIX)) return;

  let snipes = require("./commands/snipe.json");
  let chn = `${msg.channel.id}`;
  var snipechannel = snipes[chn];



  function random_item(snipeResponse) {

    return snipeResponse[Math.floor(Math.random() * snipeResponse.length)];

  }

  var snipeResponse = [
    "Lma9 there\'s no ammo left",
    "Hah there's nothing there",
    "He's got an ubered medic :(",
    "AAAAAAAAAAAAAAAAAAAAAA (there's nothing to snipe, idiot)",
    "Jsjsjsjsjsjsjsjssjsjsjsjsjajherfiuow34gheoiufgweqiurygtfogiuys",
    "Are you going to learn how to aim or what lol",
    "I cAnT FiNd tHaT uSeR",
    "First you must fall before you can rise",
    "Delete it first lol",
    "Use brein and de-1337 a message",
    "Stop trying and let MEEEEEEEE do it\n`aa!purge 99`",
    "Aeugh",
    "Imrunningoutofideas (delete a message l o l)",
    ":pog:lete a message",
    "Are you okay?",
    "https://www.delete.com",
    "pls snipe sux",
    "rubrubrubrubrub DELETE",
    "Nomthimng to snimpe!",
    "But nobody came...",
    "`De le te th em es sa ge`",
    "msg.delete()",
    "oHnoTheLoGiSeMpTy!!!!"
  ]

  var dateA = new Date(snipechannel[2]);
  var timeA = (`${dateA.getHours}:${dateA.getMinutes}`);

  switch (args[0]) {
    case 'snipe':

      if (snipechannel[0] === "NaN") {
        msg.channel.send(random_item(snipeResponse))
      } else {
        msg.channel.send(`${snipechannel[1]} said:\n` + "```" + snipechannel[0] + "```\nAt " + JSON.stringify(timeA()))
      }

      snipechannel[0] = "NaN";

      break;
  }
})

And here is error:
(node:17672) UnhandledPromiseRejectionWarning: TypeError: timeA is not a function
aaaaaaa

#

idk how necessary this is but uh

#

:3

long hare
#

Which is the function who show all the members , even if they are offline, in a server with 1000+ members? Please? actually i'm noob

long yew
#

can anyone help me with a basic poll command?

magic jackal
#

remove the () from timeA

#

it's a string

pure lion
#

ohshit-

quartz kindle
#

@long hare guild.memberCount in discord.js

magic jackal
#

thats not a valid function how you're calling it

long hare
#

yep, in discord.js

long yew
#

can anyone help me with a basic poll command that i can work on?

pure lion
#

can anyone help me with a basic poll command?
msg.react(' ').then(() => msg.react(' '));

long hare
#

@long yew i can make that command, if you need

long yew
#

yes please

pure lion
#

i just did uwu

long hare
#

ok, right now

long yew
#

@pure lion it needs to copy what i say

long hare
#

accept the friend request

pure lion
#

o h

long hare
#

it is simple

long yew
#

i'm old

#

at js

pure lion
#

@pure lion it needs to copy what i say
@long yew simple enough

#

dm

magic jackal
#

@long yew We are not here to spoonfeed you

#

Please look at the DiscordJS docs and get yourself situated with how the lib works

long yew
#

@magic jackal how long does it get for my bot to get checked on top.gg?

quartz kindle
#

2-3 weeks

solemn latch
#

So, the GUILD_MEMBERS intent is only for getting a lot of users?

quartz kindle
#

the intent controls whether or not you receive guild member events and data

#

for example, guildMemberAdd, guildMemberUpdate, guildMemberRemove

#

or fetching members

solemn latch
#

ohhh

#

ok

quartz kindle
#

also the initial members that come with the guild at login

solemn latch
#

getting someone tagged in a message wouldnt be under that correct?

quartz kindle
#

no, messages still contain member data

solemn latch
#

sweet thanks

heavy pollen
#

no, messages still contain member data
@quartz kindle sir can i show my code to you

#

Why its not working

#

Im trying same codes with another bot

#

It works

acoustic kiln
#

hello

#

small help

#
let spawns = [
"https://cdn.bulbagarden.net/upload/thumb/2/21/001Bulbasaur.png/250px-001Bulbasaur.png"  ]
module.exports = {
  name: "spawn",
  category: "info",
  description: "spawning a pokemon by devs",
  run: async (bot, message, args) => {
    
    let spawn = spawns[Math.floor(Math.random() * spawns.length - 1)];
      let Embed = new MessageEmbed()
        .setTitle(`8Ball!`)
        .setDescription(spawn)
        .setColor(`RANDOM`);
      message.channel.send(Embed)

    
    
     }
     
};```
#

is that the way of spawning

#

or is there another way where we can make each type pokemon spawn within a given spawn rate

#

plz ping and reply

#

thats for testing only

#

please say

#

someone

spark breach
#

What are you trying to do?

acoustic kiln
#

pokecord

#

@spark breach im trying to make pokecord like bot

spark breach
#

hmmmm

#

does it give any errors?

#

if yes can you send it?

acoustic kiln
#

it spawning if we give command

#

and the link only spawning

spark breach
#

So it needs to just send the picture?

acoustic kiln
#
"https://cdn.bulbagarden.net/upload/thumb/2/21/001Bulbasaur.png/250px-001Bulbasaur.png"  ]```that kinda thingy
summer torrent
#

or is there another way where we can make each type pokemon spawn within a given spawn rate
@acoustic kiln use setInterval

acoustic kiln
#

@spark breach yes of course and within some sort of time limit

#

@summer torrent can you tell the actual line where i have to do

#

plzz

summer torrent
#

no

#

learn js basics

acoustic kiln
#

please

#

im bit confused

spark breach
#

What I could think off is you save the image in a folder you have in your bot folder, then make a code that makes it random which one it picks

summer torrent
#

no one will spoonfeed you

acoustic kiln
#

@spark breach should i save all pokemons in a folder nd use that one

spark breach
#

yeah

#

save all of them in 1 folder

#

number them like 1 to idk how many pokemons there are

acoustic kiln
#

yea

spark breach
#

and then make it random which one it picks

acoustic kiln
#

800+

spark breach
#

o o f

#

800+ pictures, that's a lot

#

maybe you should use like 100 xD

acoustic kiln
#

yea

spark breach
#

I mean like the basics, charmander, charmeleon, snorlax etc

wind kayak
#

Is there a list of all the images you can create with that flip note api?

acoustic kiln
#

@spark breach is it like open folder--save all pokemons--rename 1,2,3,4--upload it--

#

type

spark breach
#

wait a sec

#

like that

#

and then make a code that randomly pics a pokemon

winter basalt
#

numbers extra convenience

spark breach
#

so from the number 1-100 it picks a random one

#

numbers extra convenience
Yeah you can use a math code

acoustic kiln
#

and place it in the thing where i put the link??

#

k tnx

#

i try

spark breach
#

kk

#

And idk, does it need to be summoned on command or?

wind kayak
#

Is there a list of all the images you can create with that flip note api?

spark breach
#

What coding langauge are you using

#

discord.js?

tight plinth
#

discordjs is not a language

spark breach
#

oof

#

javascript then

golden condor
#

Anyone know how to move from mongodb localhost to mongodb cluster

tired nimbus
#

how can you awaitmessages in a dmchannel?

#

if the message is from a guild

summer torrent
#

which lib

tired nimbus
#

discord.js

summer torrent
golden condor
#

Anyone know how to move data from mongodb localhost to mongodb cluster

earnest phoenix
#

How can i Make a number counter?
so whenever someone reacts to a message it sends message following the queue from 1 to 2 to 3
sorry If I didn't explain well 😦

summer torrent
#

which language

earnest phoenix
#

D.js

#

or python doesn't matter

#

I know both

summer torrent
#

you can use loop

earnest phoenix
#

Alright

#

thanks

golden condor
#

Is it possible to move from mongo dB local to a cluster without manually moving all data?

amber fractal
#

?

#

oh wait

#

that's atlas

summer torrent
amber fractal
digital ibex
#

oh

golden condor
#

Yeah I want to move from local to atlas

chrome garden
#

anyone know how to use aiohttp?

earnest phoenix
#

no but you can read docs and you can be the one that knows 👀

chrome garden
#

I was using requests and built a small class system that I could call easily to perform post and get requests. But since it's causing "blocking" I was told to move over to aiohttp.

jagged gulch
#

ughhh i hate mongoose

#

it fucked me overrrrr

solemn latch
#

it did?

earnest phoenix
#

i got error

Error: Cannot find module 'discord.js'
Require stack:
- /app/server.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:610:15)
    at Function.Module._load (internal/modules/cjs/loader.js:526:27)
    at Module.require (internal/modules/cjs/loader.js:666:19)
    at require (internal/modules/cjs/helpers.js:16:16)
at Object.<anonymous> (/app/server.js:1:34)
    at Module._compile (internal/modules/cjs/loader.js:759:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at Function.Module._load (internal/modules/cjs/loader.js:555:12)
    at Function.Module.runMain (internal/modules/cjs/loader.js:826:10)```
smoky spire
#

Install discord.js

earnest phoenix
#

i have

#

v12

#

it is funny

#

lol

digital ibex
#

check ur package.json

solemn latch
#

whats your package.json look like

earnest phoenix
#

i have

solemn latch
#

🤔

earnest phoenix
#

"dependencies": {
"discord.js": "^12.2.0",

#

lol

#

hahaha

digital ibex
#

you're laughing but ur the one getting the error lul

solemn latch
#

guess you dont need help

digital ibex
#

try installing it again

#

uninstall and install again

earnest phoenix
#

i thing it is an system error i have to reinstall all

#

ok thanks

#

installing package.json again

#

@digital ibex thanks

#

working

#

but it taken 20 to 30 mins

earnest phoenix
#

So I bought this database from strato but cant seem to figure out how to use it in nodejs via mysql

digital ibex
#

what database r u using?

earnest phoenix
#

what do you mean exactl7u

digital ibex
#

u bought what database from strato?

empty owl
#

Okay so i have a package I made right? it has two dependencies, nodefetch and prismarine nbt

prismarine nbt has 1 dependencies and that dependecy has a long chain

when I downloaded prismarine nbt, it downloaded the other dependcies in the chain.

Can I remove the ones in the chain and only keep nodefetch prismarinenbt in my packagelock json

earnest phoenix
#

my dad bought it for me

#

pretty sure it is just the basic sharded one]

#

@digital ibex

digital ibex
#

um

#

im not sure how ur expecting to get help when u don't know what db ur using lol

earnest phoenix
#

do you need to pay for a mysql database ?

digital ibex
#

you can

earnest phoenix
#

also free?

digital ibex
#

i've never worked with mysql, only nosql

#

yeah, my db is free, only because im hosting on it on my pc, so i don't have to pay for it

earnest phoenix
#

does it go offline if you turn your pc off ?

plush escarp
#

Hi! Is anyone getting this error message? (node:6240) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.
at Client.login (C:\Users\bertr\OneDrive\Desktop\Documents\GitHub\ReliaBot\ReliaBot\node_modules\discord.js\src\client\Client.js:204:52)
at Object.<anonymous> (C:\Users\bertr\OneDrive\Desktop\Documents\GitHub\ReliaBot\ReliaBot\index.js:6:8)
at Module._compile (internal/modules/cjs/loader.js:1200:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
at Module.load (internal/modules/cjs/loader.js:1049:32)
at Function.Module._load (internal/modules/cjs/loader.js:937:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
(Use node --trace-warnings ... to show where the warning was created)
(node:6240) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:6240) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

earnest phoenix
#

not a valid token

digital ibex
#

yeah, you can use it on ur host tho

#

its localhost

plush escarp
#

I am sure that the token is correct

earnest phoenix
#

what you mean

plush escarp
#

@earnest phoenix

#

I tried regenerating it

#

And nothing...

digital ibex
#

so host ur bot and ur db on the same place

earnest phoenix
#

im so confused

#

about this whole database thing

plush escarp
#

Same

digital ibex
plush escarp
#

Why is it saying this when the token is correct:
(node:6240) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.
at Client.login (C:\Users\bertr\OneDrive\Desktop\Documents\GitHub\ReliaBot\ReliaBot\node_modules\discord.js\src\client\Client.js:204:52)
at Object.<anonymous> (C:\Users\bertr\OneDrive\Desktop\Documents\GitHub\ReliaBot\ReliaBot\index.js:6:8)
at Module._compile (internal/modules/cjs/loader.js:1200:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
at Module.load (internal/modules/cjs/loader.js:1049:32)
at Function.Module._load (internal/modules/cjs/loader.js:937:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
(Use node --trace-warnings ... to show where the warning was created)
(node:6240) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:6240) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

digital ibex
#

theres no need to send it twice or send the error stack.... just regen ur token and save it again

empty owl
#

PLEASE use code blocks or ghostbin

plush escarp
#

Ok

earnest phoenix
#

but will the database work if my pc is off

empty owl
#

and u dont have to send the WHOLe error

plush escarp
#

@digital ibex wdym?

#

ping me when u answer pls

digital ibex
#

@earnest phoenix no, have u got a host?

earnest phoenix
#

I only have a VPS where i host my discord bot

digital ibex
#

then u can host it there

solemn latch
#

VPS's can do multiple things at once

jagged gulch
#

really fucking confused here, but I have this code that checks if a mongoose model exists or not (model is LikedSong), if not then make one, but it always returns true even if there is literally no collection in my db with the criteria ```js
//checking if user has liked a song before
if(LikedSong.exists({userID: ${user.id}})) {
console.log('User has a document for liked songs');
LikedSong.findOne({userID: ${message.member.id.toString()}}, 'likedSongs', function (err, songsDoc) {
if (songsDoc.likedSongs.includes(${currentSong})) {
message.reply("Looks like you've already liked that one mate!");
return;
} else {
//pushing song to their arr
songsDoc.likedSongs.push("${currentSong}");
songsDoc.save();
}
});
} else {
//creating database entry and
//pushing to db
const pushSong = new LikedSong({userID: ${user.id}, likedSongs: []});
pushSong.likedSongs.push("${currentSong}");
pushSong.save();
}

earnest phoenix
#

How can I do that @digital ibex

jagged gulch
#

are u using mongo? You just dl mongo server and run it

digital ibex
#

you don't need to do anything, just add the code there and boom

#

you can do if(!ilkedSong) { likedSong = { };

#

maddie ^

jagged gulch
#

for mongoose?

digital ibex
#

ur issues got nothing to do with mongoose lol

radiant estuary
#

how can i set a custom status with discord.js v12?

digital ibex
#

ur statements r incorrect

#

u can't flamex

radiant estuary
#

okay, thank you

jagged gulch
#

you can do if(!ilkedSong) { likedSong = { };
@digital ibex yeah, but I wanna check if a collection exists for a certain user, not if there's just one in general

digital ibex
#

you wanna check for a collection?

jagged gulch
#

yeah, checking if theres a collection with a value userID: `${user.id}`

digital ibex
#

just for reference, you're gonna use A LOT of ram and storage creating collections for each user

#

but you'd do the same, if (!collection) { collection = new <Model>{} }

jagged gulch
#

im using an atlas cluster, but what would be the best way to save it?

digital ibex
#

in a collection called users or members, and in that include documents

jagged gulch
#

and how would I specify the collection criteria?

#

wait

#

that might be what im doing

#

yeah, nvm i have a db, and within a collection i have documents

earnest phoenix
#

How can I host a local MySQL server on a VPS?

jagged gulch
#

sry im new to mongo!

#

How can I host a local MySQL server on a VPS?
@earnest phoenix google?

digital ibex
#

ah

#

well, i'd do something like this: js const Model = model; const user = model.findOne({ userID: user id }); if (!user) { user = new Model({ store whatever default data for ur user }); await model.save(); } else { user = { user } }

#

assuming ur using es6 you can do the user = { user }bit, otherwise u'd do user: user

jagged gulch
#

yeah, im on node v12

#

what exactly does user = { user } do tho

digital ibex
#

well, thats es6, what its doing is whatever user is, thats what it is ig lol, and the no : is es6 only

pure lion
#

i need help

#

big time

digital ibex
#

whatcha need?

pure lion
#

im dying i just want this pain to end

digital ibex
#

um

pure lion
#

so basically i wanna write a role to a JSON file but uh

#

i am in pain

amber fractal
#

what lib?

pure lion
#
bot.on('message', async msg => {

  let args = msg.content.substring(PREFIX.length).split(" ");
  let _command = msg.content.toLowerCase()
  if (!_command.startsWith(PREFIX)) return;

  let muterole = msg.mentions.roles.first()

  var muteroles = require("./commands/muteroles.json");
  muteroles[`${msg.guild.id}`] = [`${muterole}`];

  let gld = `${msg.guild.id}`;
  var glds = muteroles[gld];



  switch(args[0]) {
    case 'muteroleset':
      glds[1] = muterole.id.toString()
            fs.writeFile(muteroles, JSON.stringify(muteroles, null, 1)),function (error) {
        if (error) {
          return console.log('oops')
        }
  }
}})

^ code (discord.js)

#

(node:8072) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_CALLBACK]: Callback must be a function. Received undefined

#

error

digital ibex
#

add the function (error)... bit in the parenthesis

pure lion
#

parenthesis
?

amber fractal
#

eh, it'd probably still error

pure lion
#

i feel like i should know this, are they brackets like ()?

amber fractal
#

( and ) are parentheses

solemn latch
#

brackets are []

digital ibex
#

y- o

pure lion
#

a h

#

lemme try

empty owl
#

is it considered advertising if i send a glitch forum post to get support

amber fractal
#

what if you try

fs.writeFile(muteroles, JSON.stringify(muteroles, null, 1), (err) => {
  if(err) console.error(err)
})
#

basically the same thing, but using an arrow function

empty owl
#

oh hey steven

pure lion
#

aightttttt

#

(node:17672) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received an instance of Object

#

p r o g r e s s

digital ibex
#

wheres that coming from?

pure lion
#

at writeFile

digital ibex
#

i mean, the arrow function bit?

earnest phoenix
#

How can I host a local MySQL server on a VPS?

pure lion
#

.writeFile
^
here

earnest phoenix
#

hi

autumn eagle
#

@earnest phoenix get yourself a VDS

#

and install node.js in it

earnest phoenix
#

in need website online

#

not programs on pc

autumn eagle
#

I don't think there is a site similar to glitch

pure lion
#

importthefiles?

autumn eagle
#

¯_(ツ)_/¯

pure lion
#

did your bot just get verified lol

#

nvm

#

uh

#

so who's gonna help m-

quartz kindle
#

@pure lion path must be a string

#

you gave it an object

pure lion
#

i did?

quartz kindle
#

thats what the error says

pure lion
#

what would i need to turn into a string-

quartz kindle
#

its not about turning it into a string

#

its probably just that you did something wrong in the first place

pure lion
#

ugh

quartz kindle
#

would help if you showed code

pure lion
#

scroll up

quartz kindle
#

muteroles is an object

pure lion
#

ah?

#

i literally have no clue about json this is a today thing uh im so sorry

quartz kindle
#

writeFile wants to know the path of the file to write, ie: directory and file name.
youre giving it an object, ie: "save my file in [object Object]" instead of "save my file in /folder/file.json"

pure lion
#

but i did?

#

var muteroles = require("./commands/muteroles.json");

quartz kindle
#

you didnt

#

fs.writeFile(muteroles, JSON.stringify(muteroles, null, 1)),function (error) {

#

where is the path? folder and file name

pure lion
#

ok brb

#

AAAAAAAAAA IT LOGGED IT THANK YOU

graceful igloo
#

when are the votes reset?

summer torrent
#

1st day of every month

jaunty frigate
solemn latch
#

I think the error messasge explains it pretty well

stable grail
lyric mountain
#

Yep

stable grail
#

how do i use css with it?

#

i have to link it but how does it know it huh

summer torrent
#

in <style> tag

stable grail
#

ah ok

#

ty

#

how do i do this with images?

#

is it possible to upload images from my pc?

summer torrent
#

no

earnest phoenix
#

yes and no

summer torrent
#

use image uploaders

earnest phoenix
#

upload them to an image host, ^

#

and then use the url from that

summer torrent
#

imgur, etc.

stable grail
#

ok

earnest phoenix
#
    with open('prefixes.json', 'r') as f:
        prefixes = json.load(f)

    return prefixes [str(message.guild.id)] 

client = commands.Bot(command_prefix = get_prefix)
@client.remove_command('help')

@client.event
async def on_guild_join(guild):
    with open('prefixes.json', 'r') as f:
        prefixes = json.load(f)

    prefixes[str(guild.id)] = '/'

    with open('prefixes.json', 'w') as f:
        json.dump(prefixes, f, indent=4)

@client.event
async def on_guild_remove(guild):
    with open('prefixes.json', 'r') as f:
        prefixes = json.load(f)

    prefixes.pop(str(guild.id))

    with open('prefixes.json', 'w') as f:
        json.dump(prefixes, f, indent=4)

@client.command()
async def prefix(ctx, prefixes):
    with open('prefixes.json', 'r') as f:
        prefixes = json.load(f)

    prefixes[str(ctx.guild.id)] = prefixes

    with open('prefixes.json', 'w') as f:
        json.dump(prefixes, f, indent=4)

    await ctx.send(f'I changed the prefix to: {prefixes}')```
#

Why is this not working? 🤔

#

cant tell ya cause i use discord.js

#

i use javascript

dusky marsh
#

wow, very useful. information!

earnest phoenix
#

yes

slender thistle
#

Tell me why

#

you open a file

earnest phoenix
#

wdym

slender thistle
#

On each event emit

earnest phoenix
#

So, what should i do?

#

Do you want to see the error?

slender thistle
#

Sure

earnest phoenix
#
Traceback (most recent call last):
  File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\client.py", line 312, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\bot.py", line 930, in on_message
    await self.process_commands(message)
  File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\bot.py", line 926, in process_commands
    ctx = await self.get_context(message)
  File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\bot.py", line 842, in get_context
    prefix = await self.get_prefix(message)
  File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\bot.py", line 787, in get_prefix
    ret = await discord.utils.maybe_coroutine(prefix, self, message)
  File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\utils.py", line 317, in maybe_coroutine
    value = f(*args, **kwargs)
  File "C:\Users\Lenovo\Desktop\rareh\rareh.py", line 16, in get_prefix
    return prefixes [str(message.guild.id)]
KeyError: '110373943822540800'```
slender thistle
#

Well it's a keyerror

#

Meaning a key with that ID doesn't exist

#

Therefore, you don't have a set prefix for that server

earnest phoenix
#

So, what i need to do now

#

I keep getting this error on my vps

slender thistle
#

Either add it manually or handle such cases automatically

earnest phoenix
#
Error: Error: Cannot find module '/root/bot/node_modules/@discordjs/opus/prebuild/node-v67-napi-v3-linux-x64-glibc-2.27/opus.node'
0|bot    | Error: Cannot find module 'node-opus'
0|bot    | Error: Cannot find module 'opusscript'
slender thistle
#

either use dictionary.get or a try-except with the way you're doing it. Also, please, use cache for prefixes.

earnest phoenix
#
    newUser = {
    "money" : 0,
    "boost" : 1,
    "cooldown" : 0,
    "job" : "",
    "item" : ""
    }
    users[userID] = newUser
#

Can i use this thing?

#

like

#

to make it work?

#

I mean, i will change it for sure 😛

slender thistle
#

That's possible

earnest phoenix
#

so

#

jk

slender thistle
#

Fall back to a default prefix if custom one wasn't found and save it

#

Preferably use .get with the dictionary you're getting

earnest phoenix
#

Can u tell me please what i need to change in

#
    newUser = {
    "money" : 0,
    "boost" : 1,
    "cooldown" : 0,
    "job" : "",
    "item" : ""
    }
    users[userID] = newUser
slender thistle
#

How is it related to the code snippet you sent before

earnest phoenix
#

I keep getting this error when i try to install @discordjs/opus on my vps

pure lion
#

hey so uh

#

h e l p

wind kayak
#

how do i access the data from the flipnote steam link?

earnest phoenix
#

keep getting node-pre-gyp: Permission denied when trying to install something on vps

#

elevate it with sudo or give your user proper permissions

#

how can i give myself permissions

jagged gulch
#

@earnest phoenix usermod if ur on linux

earnest phoenix
#

im on linux yes

jagged gulch
#

also you prolly should learn more bash if you're running a vps

earnest phoenix
#

what do i need to type in

jagged gulch
#

use the usermod command

earnest phoenix
#

i typed

#

sudo usermod -a -G sudo root

#

but i am still missing permisison s

jagged gulch
#

what

#

are you running as root?

earnest phoenix
#

ye si logged in as root

jagged gulch
#

you shouldn't do that on a production server....

earnest phoenix
#

should i make a new user

jagged gulch
#

but anyways if ur on root, just run sudo npm i whatever package u want

#

id reccomend it yes, but you'll hafta migrate ur files if u wanna easily access them

#

srsly, learn bash

earnest phoenix
#

this keeps and keeps happening

#

sh: 1: node-pre-gyp: Permission denied

#

😦

jagged gulch
#

did u use sudo

earnest phoenix
#

sudo npm i @discordjs/opus

jagged gulch
#

also do u have ur build tools installed? idk if opus needs them or not

earnest phoenix
#

what do you mean with build tools

jagged gulch
#

also what lunux distro are u using?

#

build tools allows modules to be built from source code

earnest phoenix
#

im using Ubuntu 18.04 x64

jagged gulch
#

mkay

earnest phoenix
#

why cant i have perms to do stuff

jagged gulch
#

real quick, what happens when u try and run the su command

#

if you're root then you should have perms

solemn latch
#

root should have every perm 🤔

earnest phoenix
#
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
jagged gulch
#

unless youre not actually running as root

#

who do u get ur vps from

earnest phoenix
#

but it worked before

#

i resetted it and now imma tryna get my bot up and running again

#

but dont have perms for some reason

lyric acorn
#

how do i start a python bot lol

jagged gulch
#

python <ur bot file>.py

pure lion
#

can someone help me i need help with JSON shit and aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

dm please

lyric acorn
#

ok ty

earnest phoenix
#

maddie what can i do

slender thistle
#

Just state your issue

jagged gulch
#

^^^

slender thistle
#

You didn't need to post all the a's either tbh

prime cliff
#

Spamming a is not gonna help

pure lion
#

i wanna get a role ID from a json but its not working

lyric acorn
#

I don’t believe python can integrate with json files :/

jagged gulch
#

@earnest phoenix is it a fresh vps, or did u just remove ur old files from it

prime cliff
#

All langs can integrate with json

jagged gulch
#

i think python can with proper packages

prime cliff
#

It's just a data format

earnest phoenix
#

@earnest phoenix is it a fresh vps, or did u just remove ur old files from it
i completely resetted it

#

so it is pretty much fresh

#

reinstall

jagged gulch
#

you reinstalled the os

earnest phoenix
#

yes it does that automatically

jagged gulch
#

mkay

earnest phoenix
#

should i destroy it and open a new one

#

new vps

jagged gulch
#

i mean if u want

#

but first

#

what happens when u try running sudo

#

does it ask you for a password?

earnest phoenix
#

I forgot to put my bot online this morning and now I can’t put it on until tomorrow afternoon pepesadboi ( I’ve gone camping )

#
usage: sudo -h | -K | -k | -V
usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user]
usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user]
            [command]
usage: sudo [-AbEHknPS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p
            prompt] [-T timeout] [-u user] [VAR=value] [-i|-s] [<command>]
usage: sudo -e [-AknS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p
            prompt] [-T timeout] [-u user] file ...

jagged gulch
#

no i mean like sudo npm i

#

like sudo to install opus

earnest phoenix
#

I’m on Mac so I can’t help you

jagged gulch
#

mac is linux based????

earnest phoenix
#

Not really

jagged gulch
#

but nvm lol

earnest phoenix
#

MacBooks are mainly used for music production and Linux is mostly used for coding

jagged gulch
#

I forgot to put my bot online this morning and now I can’t put it on until tomorrow afternoon :pepesadboi: ( I’ve gone camping )
@earnest phoenix are u using a vps?

earnest phoenix
#

Nope

jagged gulch
#

damn, was gonna say u could just ssh

earnest phoenix
#

Lol

#

i just installed things

#

With my bot atm I’m working on making a stats page for Minecraft server stats

jagged gulch
#

i just installed things
@earnest phoenix did it work?

#

With my bot atm I’m working on making a stats page for Minecraft server stats
@earnest phoenix o nice

earnest phoenix
#

i installed it in the wrong folder

#

i cant install things in the /bot

#

im missing permns there

jagged gulch
#

what are the permissions for the directory?

earnest phoenix
#

idk default

#

how cna i check

jagged gulch
#

google it, then allow read/write access with chmod

#

srsly pls learn bash or just google stuff, it'll help u work so much quicker

earnest phoenix
#

can you tell me how i can allow read/write

#

Google it?

#

fine fine

#

dont understand why you cant help m

#

sudo chmod -R 777 /bot

solemn latch
#

help is donated, we are people too, with our own projects

earnest phoenix
#

"chmod: cannot access '/bot': No such file or directory"

quartz kindle
#

that folder doesnt exist

earnest phoenix
#

thank facking god

#

i fixed it

#

everything

#

thank guys

willow river
earnest phoenix
#

Can't find the module you're requiring

quartz kindle
#

canvas requires some extra things on windows

sick cloud
#

what permission is used for unbanning?

summer torrent
#

BAN_MEMBERS

sick cloud
#

assumed so

#

ty

#

and how do you unban someone

#

if there's no way to get the guildmember

summer torrent
#

fetch from bans

quartz kindle
#

pretty sure you can guild.members.unban(id)

summer torrent
#

^