#development

1 messages · Page 1198 of 1

solemn leaf
#

the find for custom status

#

@faint prism thanks

opal plank
#

looks awfully like that one

#

but with author rather than footer

fringe axle
#

Vx_avatar PedroKarum

solemn leaf
#

yeah it does

fringe axle
#

Vx_avatar @digital wagon

faint prism
#

😉

solemn leaf
#

bcs Im using beautify

fringe axle
#

=m/avatar PedroKarim64

faint prism
digital wagon
#

Vx_avatar @digital wagon
@fringe axle oof

#

x3

opal plank
#

what does beutify have to do with this?

fringe axle
#

WRONG CHANNEL

solemn leaf
#

wdym

fringe axle
#

I‘m too dumb, sorry.

solemn leaf
#

can you help me with wat I asked?

opal plank
#

bcs Im using beautify

faint prism
#

@solemn leaf just after ", do a \n mmLol

solemn leaf
#

imma go ask somewhere else then 🤦

lament meteor
#

Bruh

solemn leaf
#

what

faint prism
#

It'd miss tabs of course

solemn leaf
#

a!eval let n = message.author.presence.activities.find((a) => a.name === 'Custom Status')
JSON.stringify(n.testin)

#

Im trying to get the status

#

could you help

lament meteor
#

Hmm

solemn leaf
#

let n = message.author.presence.activities.find((a) => a.name === 'Custom Status')
JSON.stringify(n.state)

lament meteor
#

What does it return?

#

On mobile rn so cant do much but if u giv me enough info i can help

solemn leaf
#

got it

lament meteor
#

What

hazy girder
#
let a = "900"
var intervalId = null;
var varCounter = 0;
var varName = function(){
     if(varCounter <= a.charAt(1)) {
          varCounter++;
        message.channel.bulkDelete(100)
         
     } else {
          clearInterval(intervalId).then(() => {
        message.channel.bulkDelete(a - a.charAt(1) + "00")
   });
          }
};
  intervalId = setInterval(function() {
    message.channel.bulkDelete(100)                      
   }, 1000)
#

uh oh im trying purge more than 100 messages with interval

#

but thst interval does not stop

opal plank
#

wait wtf

#

@solemn leaf why the heck you stringifying a string?

#

setINterval is not meant to stop

#

if you want a loop that stops you using the wrong thing

hazy girder
#

i wants it will purge 100 messages then again then again to wants messages size to purge

opal plank
#

thats api spam btw

hazy girder
#

oh uh it will be slowly

opal plank
#

still api spam

#

you're only suppose to delete 100 messages

hazy girder
#

i have seen this a lot of bots (verified bots)

opal plank
#

¯_(ツ)_/¯

hazy girder
#

like carl, dyno

opal plank
#

even they say in the verification that some bots recieve different stuff

#

discord does make exceptions more often than you'd think @hazy girder

solemn leaf
#

how canI get what client a user is on

karmic compass
#

if the bot is missing permissions, it still says "Error!", how do i make it say "Missing Permissions" if it is missing permissions?

slender thistle
#

BotMissingPermissions

#

Or, hell, discord.Forbidden

#

Depending on what you need

thick gull
#

how canI get what client a user is on
@solemn leaf presence

#

I know with presence update event you get like desktop: onlinr

#

etc

robust belfry
#

In top.gg what is the detailed description field for?
Do i have to know html and javascript to use it?

solemn leaf
#

JSON.stringify(message.author.presence.clientStatus)

#

yeah

#

I found out

thick gull
#

👍

solemn leaf
#
if (ment.presence.clientStatus === "mobile") {
        image2 = "https://cdn.discordapp.com/emojis/734835368427389099.png?v=1"
    }
    if (ment.presence.clientStatus === "web") {
        image2 = "https://cdn.discordapp.com/emojis/734835368423063664.png?v=1"
    }
    if (ment.presence.clientStatus == "desktop") {
        image2 = "https://cdn.discordapp.com/emojis/734835368204959857.png?v=1"
    }

so I can just do this

#

@thick gull

thick gull
#

no because it's like

#

{ "mobile": "idle"}

#

etc

#

you can also have multiple in one

solemn leaf
#

ik

#

so

#

how do I do

#

clientStatus[0]

faint prism
#

if clientStatus is an array you can access the [n] index
[0] is the first index
[1] is the second index
and so on

But I suspect it isn't an array

#

@solemn leaf

solemn leaf
#

yeah

#

How do I get the { "mobile": "idle")

#

@faint prism

opal plank
#

you do know how to access an object property, no?

#

thats basic js

faint prism
solemn leaf
#

no

#

oh

#

I see

faint prism
#

It's looks like a prop like Not Erwin#8753 said

drifting wedge
#

how do i make it like what i send

#

so like if i do ?check hi

#

how do i make hi a var

earnest phoenix
#

store the argument in a variable

#

but it's already stored

solemn leaf
#

thank

drifting wedge
#

like how do i get what i sent?

earnest phoenix
#

it's in your arguments

#

Anybody know how to fix this? Kinda got confused

npm WARN using --force I sure hope you know what you are doing.
npm WARN vxcomplexity@1.0.0 No repository field.

npm ERR! code EEXIST
npm ERR! path /home/container/node_modules/.bin/yt-search
npm ERR! Refusing to delete /home/container/node_modules/.bin/yt-search: is outside /home/container/node_modules/yt-search and not a link
npm ERR! File exists: /home/container/node_modules/.bin/yt-search
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/container/.npm/_logs/2020-08-28T20_27_50_954Z-debug.log```
#

just delete the node_modules folder

faint prism
#

Anybody know how to fix this? Kinda got confused
Node: I sure hope you know what you are doing
@earnest phoenix KEKW

earnest phoenix
#

that always fixes it :haha:

#

@faint prism <Using force does that> without it still same

karmic compass
#

BotMissingPermissions
@slender thistle that nor discord.Forbidden din work

faint prism
#

I have no doubt it's because you did --force.
I just find it funny in the context

worthy glacier
#

is there any way to set the status of a bot as mobile

earnest phoenix
#

you need to modify your lib

#

Yea i know, it said use --force to overwrite it recklessly so idk @faint prism

misty sigil
#

is there any way to set the status of a bot as mobile
@worthy glacier its against the api tos iirc

earnest phoenix
#

it isn't

worthy glacier
#

o

misty sigil
#

oh right

#

i swear i seen something saying that

earnest phoenix
#

discord probably doesn't like it but it isn't against the tos

#

It's against guidelines, modifying the gateway identifier

#

uh

#

no

#

oh guidelines

#

if you set the device in the IDENTIFY gateway payload to mobile the whole connection gets treated as a mobile connection, you get the mobile indicator

#

So cry got any ideas about my error, I'm confused

#

have you tried deleting the node_modules folder yet?

misty sigil
#

i mean

#

it works

earnest phoenix
#

Wait should i really

#

Well it's gonna be recreated through the build of npm

misty sigil
#

if you wanna re-install everything i suppose

earnest phoenix
#

I mean if that's the only way to fix the error i suppose?

#

running npm install redownloads the modules anyways

#

Yea, lemme try

faint prism
#

Gotta love how dangerous a typo in bash can be
||sudo rm -rf / node_modules/ #Dont copy and paste this||

earnest phoenix
#

Yea deleting the folder and rebuilding the packages worked

#

Thanks

digital wagon
#

Gotta love how dangerous a typo in bash can be
||sudo rm -rf / node_modules/ #Dont copy and paste this||
Hackerman ? oof

drifting wedge
#

how do i like check it this is this

#

like how do i check it the command has the code?

#
async def verify(ctx, arg):
    if arg == 9999:
        add_roles('699779377113727136')

        await ctx.send(f'Welcome to the losers club / Verified!')
    else:```
earnest phoenix
#

how can i show the servers and users?

#

here?

faint prism
misty sigil
#

yes it would be auger

drifting wedge
#

like how do i check a message against another message

#

and if its true, do this

#

like a veriffy thing, that they need to put a code

wheat jolt
#

I'm using ytdl-core to stream an youtube video's audio on a voiceconnection, but does anyone know how I can seek the audio without making a new stream?

slender thistle
#

client.wait_for

drifting wedge
#

client.wait_for
@slender thistle wait for what lol

slender thistle
#

"message"

#

I suggest you refer to the d.py docs for this one

faint prism
#

I'm using ytdl-core to stream an youtube video's audio on a voiceconnection, but does anyone know how I can seek the audio without making a new stream?
@wheat jolt There should be a "current position" property or something somewhere

drifting wedge
#

then how can i send like correc

#

or wrong

wheat jolt
#

@wheat jolt There should be a "current position" property or something somewhere
@faint prism yes, there's a seek option for voiceConnection.play but this means a new stream

karmic compass
#
@bot.command(pass_context=True)
async def editnick(ctx, member: discord.Member, nick):
    try:
        await member.edit(nick=nick)
        await ctx.send(f'Nickname was changed for {member.mention} ')
    except discord.Forbidden:
        await ctx.send("I am missing permissions!")
``` how do i check if member or nick is missing?
sudden geyser
#

At the moment I think member and nick are both required arguments.

#

You'd need to use typing Optional[...] if you wanted to make it optional according to the documentation (I think).

slender thistle
#

= None works too

#

You can set default value None to both and then check if both/either are/is missing

uneven jetty
#

.verify

solemn leaf
#

how can I check If a pinged user is a bot

uneven jetty
#

!verify

faint prism
#

how can I check If a pinged user is a bot
@solemn leaf isBot might be a Boolean property of a user

karmic compass
#

You can set default value None to both and then check if both/either are/is missing
PING PONG yeah that worked for me

covert condor
fringe lion
#

how to use emoji from other servers? discord.py library

earnest phoenix
#

i don't know, most people here

#

escape it in the server, and copy paste it in your string

fringe lion
#

thanks, I'll try now

forest whale
#

can someone explain me how i can use Threads in java or what is a good start to learn asynchronous Programming. My main problem is that i have create a discord bot and never realized that one task that have to work a little bit longer blocked all my listeners and i have know i dear how i can rund my methods without blocking any other codes

earnest phoenix
#

Is there a reason and/or fix to why my bot takes so damn long to login?

ionic dawn
#

why am I using JSON.parse(stuff) on the YTAPI result and isnt working?

#

should format the obj to a JSON?

lilac pollen
#

How can I add the index.js file to my bot?

earnest phoenix
#

?

lilac pollen
#

The file with all the bot’s code

earnest phoenix
#

yeah u want to run it?

lilac pollen
#

I want to post it to the top.gg page

#

Cause I can’t have it running forever on my laptop

earnest phoenix
#

u can add ur bot , not ur code

lilac pollen
#

How can I add my code

earnest phoenix
#

thats why u buy a server

lilac pollen
#

bruh

earnest phoenix
#

or use heroku

lilac pollen
#

Thanks

dusk vault
#

Is there any clean way to listen for new channels specifically? The channel create event triggers whenever a channel is added to the cache, including when the bot starts

#

(Djs)

pale vessel
#

The channel create event triggers whenever a channel is added to the cache, including when the bot starts
@dusk vault doesn't happen to me

dusk vault
#

is it a library bug?

drifting wedge
#

i have the ffmpeg thing working on my computer

#

how can i export to heroku?

dusk vault
#

Define "not working"

#

no error?

halcyon ember
#

I have this

pale vessel
#

it only triggers when a channel is created, at least for me

halcyon ember
#
async function crash(collected) {
        var currentmulti = 1
        const crashmsg = await message.channel.send(":loading: "+currentmulti+"x")
        var m
        var crashed = false
        for (m = 0; crashed===false; m++) {
          var sleepsecond = 1000-currentmulti*85
          var slpsec = sleepsecond.toFixed(0)
          await new Promise(r => setTimeout(r, slpsec))
          currentmulti += 0.1
          if(currentmulti >= multi) {
            var toadd = multi*amount
            await crashmsg.edit(":check: Cashed out at "+currentmulti.toFixed(1)+"x! You won "+toadd.toFixed(2)+" "+coind.emote)
            await connection.query("UPDATE balances SET "+coind.ticker+"="+coind.ticker+"+? WHERE id=?", [toadd.toFixed(2), message.author.id])
            crashed = true
          } else if(Math.random() < 0.04) {
            await crashmsg.edit(":boom: Crashed at "+currentmulti.toFixed(1)+"x! You lost "+amount+" "+coind.emote)
            crashed = true
          } else {
            await crashmsg.edit(":loading: "+currentmulti.toFixed(1)+"x")
          }
        }
      }
dusk vault
#

which lib @pale vessel

pale vessel
#

discord.js

halcyon ember
#

but every 5 loops it has a 2-3 sec pause

dusk vault
#

v12?

pale vessel
#

yes, of course

dusk vault
#

Hmph

#

Ill look into it further

#

Thanks

#

Anyone have the ratelimit reference link handy?

solemn latch
#

ratelimits change for each user/bot iirc.

#

so theres no real reference.

dusk vault
#

k

slender thistle
#

They're dynamic aka can either change anytime or can be increased

dusk vault
#

whats the default for channel name updates

slender thistle
#

2 requests per like 10 minutes iirc

dusk vault
#

what

#

how do member counter bots update all the time then

slender thistle
#

shrug

#

it's a per channel ratelimit

lilac pollen
#

How can I put the bot in top.gg after putting it in heroku?

slender thistle
#

so it's possible they recreate the channels

#

-faq 1 @lilac pollen

gilded plankBOT
#

@lilac pollen

Frequently Asked Questions 📜
dusk vault
earnest phoenix
#
        if(args[0] === '--biyo') {
            let user = message.author;
            if (!args[1]) {
                    return message.channel.send(`**${message.author.tag}**: Komutun doğru kullanımı \`${prefix}rütbe --bio <yazı>\` şeklindedir.`)
            }
            let infotest = args.join(' ')
blablablabla.......

i have a command like this. when i type /rank --biyo <text>. his biography is changing.
but the biography changes as --biyo <blablabla>. what should i do.

dusk vault
#

slice the name's length off the start and trim left?

halcyon ember
#

why does my for loop pause for a bit every 5 loops

dusk vault
#

is it using the api

#

you're probably getting ratelimited

earnest phoenix
#

@dusk vault can you give me a little sample? I am also a beginner

dusk vault
#

let infotest = args.slice(1).join(' ')

earnest phoenix
#

thx. @dusk vault

drifting wedge
#

whaty do i need to change to make ffmpeg work with heroku?

#

using python

ionic dawn
#

Hi, I have a problem trying to parse something to JSON from the YouTubeAPI, JSON.parse(thing) isnt working, but the console.log of the thing does show the thing

pale vessel
#

are you sure you need to parse it?

ionic dawn
#

yo

pale vessel
#

that it's not already parsed

ionic dawn
#

im stupid

#

nvm

#

I was reading at youtube api docs i was reading an older version

#

the response im getting is already an array

#

just have to do result[0].stuff

pale vessel
#

bruh

#

nice

ionic dawn
#

atleast is solved hehe

#

thanks anyway

midnight blaze
#

how to print hello world?

drifting wedge
#

print('hello world')

#

@midnight blaze

midnight blaze
#

I get an error

drifting wedge
#

wtf

midnight blaze
#

do you have a tutorial for that?

drifting wedge
#

r u joking?

midnight blaze
#

yes, I was trying to

drifting wedge
#

@slender thistle

#

pls delete

midnight blaze
#

@sharp plover you can get banned

drifting wedge
#

advertizing

midnight blaze
#

you 5HEAD

#

5000IQ5head

drifting wedge
#

some dude like was sending his bot thing

slender thistle
#

Bismillah

drifting wedge
#

sorry for ping

midnight blaze
#

his bot thing?

drifting wedge
#

yea

#

@sharp plover thats the dude btw

midnight blaze
#

you mean invite link for his bot

#

they already saw it dw

slender thistle
#

@sharp plover Why do you think I deleted it

drifting wedge
#

ah ok

#

i thought he deleted it

#

sorry

#

my bad

sharp plover
#

IM PORTUGUSE IM NOT ENGLISE @midnight blaze

wicked skiff
#

Help me

midnight blaze
#

@sharp plover you are 5head!

#

❤️

drifting wedge
#

IM PORTUGUSE IM NOT ENGLISE @midnight blaze
@sharp plover br?

wicked skiff
#

I need help

sharp plover
#

Yes

slender thistle
#

Seriously

#

I told you we can't help you

midnight blaze
#

@sharp plover muchos cracias

wicked skiff
#

:(

slender thistle
midnight blaze
#

that was English

#

@wicked skiff what is your question?

topaz fjord
#

@slender thistle u use jetbrains ide right?

drifting wedge
#

that was english

#

tho me have question

midnight blaze
#

it is a slang here in California

drifting wedge
#

i made an ffmpeg bot thing that works on my pc

midnight blaze
#

we are influenced by spanish people

slender thistle
#

well, more like putting up with them because of lowend laptop but yeah

drifting wedge
#

but it doesnt play any sounds on heroku

#

wut should i do?

midnight blaze
#

@drifting wedge make a dispatcher

drifting wedge
#

me is dumb

#

wuts a dispacher?

midnight blaze
#

you should know this, when using ffmpeg pepowot

nimble kiln
#

guildMember.guild.channels.cache.get('699053185058340876').send("<@" + guildMember.id + ">", {welcomeEmbed}).catch(console.error);

Can someone tell me how to properly send a tag and the embed in the same line? My syntax is off.
Currently it only tags the member. It doesn't send the embed.
@fleet hornet User pings start with <@! - And if I remember correctly then you dont need the {} brackets, so like:
[...] ">", welcomeEmbed).catch [...]

drifting wedge
#

well i probably shouldnt even be making bots

#

i am big lp

midnight blaze
#

@drifting wedge did you copy a music bot

#

let me guess..

drifting wedge
#

yes actually lol

midnight blaze
#

yes

#

ofc

drifting wedge
#

but....

midnight blaze
#

5head

drifting wedge
#

i wont use it as my bot

#

its on a dev branch

#

i need to know how it works

midnight blaze
#

try to make a ping pong bot first

drifting wedge
#

I DID

midnight blaze
#

nxt make a 8ball command

drifting wedge
#

i did lol

midnight blaze
#

as if

drifting wedge
#

my bot is like really advanced lol

slender thistle
#

What are you trying to do honestly

#

Other than putting up random pieces of code together

midnight blaze
#

he copied a music bot and is confused by it to run it

drifting wedge
#

use heroku as a music bot hosting

slender thistle
#

Bad idea

#

Genuinely an idea worse than throwing grenades at a tornado

drifting wedge
#

hwyyyy

slender thistle
#

Because Heroku does support music natively

midnight blaze
#

how about you check the discord js guide about voice

slender thistle
#

doesn't

midnight blaze
#

get the basics first

slender thistle
midnight blaze
#

oh

drifting wedge
#

i have a hosting thing

#

its like terrivle

midnight blaze
#

true, I forget that people are using py

drifting wedge
#

its even worse than heroku

#

but it supports music

#

would that work?

slender thistle
#

As long as it's an actual VPS

#

Should work

sharp plover
#

How do I add my bot to your site? I'm new to discord! As I am Portuguese BR I am using GOOGLE TRANSLATOR 🙂 @midnight blaze

drifting wedge
#

does discord bot hosting work?
not a vps

#

i know it sucks

#

but does it WORK

midnight blaze
#

@sharp plover ❤️

slender thistle
#

-faq 1 @sharp plover

gilded plankBOT
#

@sharp plover

Frequently Asked Questions 📜
slender thistle
#

No fucking idea. Try it tbh

midnight blaze
#

@drifting wedge get vps and you will be making progress

slender thistle
#

But generally it's a lot simpler to just rent a VPS

drifting wedge
#

so heroku doesnt work

ionic dawn
#

Any idea why is this happening? CBCattoCry

const YTSearch = search(query , opts, function(err, results) {
  console.log(results[0].link)
  results[0].link.toString()
});

server.queue.push(YTSearch);

Output:


(node:5240) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string.```
midnight blaze
#

heroku is a bad idea, just forget about it and if you have 5 euros per months, go and get a normal vps

drifting wedge
#

yea ik

#

but like my bot is still in development

#

can i use heroku

#

i know its bad

#

and its def not a good choice

#

but can I?

slender thistle
#

You can. "Should you" is the more appropriate question

drifting wedge
#

ok

#

well the "you can" method

#

what would i do?

#

i promise

#

i will get a vps

slender thistle
#

Run audio on Heroku?

midnight blaze
#

yes, you can

#

but I think it is has problems, when your music bot is used by many servers

drifting wedge
#

add discord py voice to requirements?

#

@midnight blaze

midnight blaze
#

if you want to make a bot for your own server

drifting wedge
#

it would be used like once per time

#

like dont worry, capacity wont be a issue

static trench
#

Can someone help me with a d.py. Command to see how many users my bot has?

drifting wedge
#

@static trench

#

sure 1 sec

static trench
#

🙂

drifting wedge
#

lemme get my code

midnight blaze
#

@slender thistle can I link a tutorial for him?

drifting wedge
#

memberCount = len(client.users)

midnight blaze
#

or is it not allowed to post youtube videos here? I think I found something for beginners

drifting wedge
#

this is total members

static trench
#

K

pale vessel
#

users aren't members

drifting wedge
#

so this is an example

#

embed.add_field(name="Total Users:", value=memberCount)

#

users aren't members
@pale vessel for me works great

slender thistle
#

Something tells me Heroku doesn't support crap like ffmpeg, ytdl, etc.

midnight blaze
#

it does

slender thistle
#

Oh well have fun with that

drifting wedge
#

well for me the issue isnt capacity

#

its like is it POSSIBLE

midnight blaze
#

it is crap tho, it only will work for your own server

slender thistle
#

feel free to link tutorials per necessity

midnight blaze
#

ok^^

drifting wedge
#

@midnight blaze love you ❤️

#

jk

#

thanks tho

#

the ffmpeg build pack works with python?

midnight blaze
#

yes, why shouldnt it work with python?

drifting wedge
#

idk lol

#

i readded buildpack

#

imma try

#

how do i load opus?

#

says opus not loaded

pale vessel
#

worked fine when i was testing music on heroku with that

drifting wedge
#

worked fine when i was testing music on heroku with that
@pale vessel on heroku?

sharp plover
#

@midnight blaze I'm finished and now I can send the link?

pale vessel
#

yes

#

music worked on heroku, surprisingly. headless chrome too

sharp plover
#

On here?

midnight blaze
#

@sharp plover 👍 (no clue what you are talking about)

drifting wedge
#

music worked on heroku, surprisingly. headless chrome too
@pale vessel mhm

#

what buildpacks?

#

ffmpeg?

#

youtube dl?

drifting wedge
#

didnt work for me

midnight blaze
#

o_o

drifting wedge
#

maybe cuz of different code

pale vessel
#

did you restart/redeploy?

drifting wedge
#

i tihnk so

#

im trying again

pale vessel
#

can't help much here

thick gull
#

is it easy to swap from djs to djs-light?

dusk vault
sinful belfry
#

is it easy to swap from djs to djs-light?
@thick gull yeah it isn't too hard

#

it really depends what the purpose of your bot it

#

probably the biggest consideration you need to take is the caches that you need/don't need

sand skiff
#

i need help

sinful belfry
#

with?

sand skiff
#

so im trying to make embeds

#

with the bot

sinful belfry
#

lib?

sand skiff
#

like as a response

#

but idk how

sinful belfry
#

what lib are you using?

#

discord.js?

sand skiff
#

yes

sinful belfry
#

@undone solar what lib are you using?

undone solar
#

discord.js @sinful belfry

sinful belfry
#

ah so you can do <client>.guilds.cache.size

#

or if you're using dblapi.js then it will send your server count automatically

undone solar
#

thank you for your quick and accurate answers

lilac pollen
#

-faq 1 @lilac pollen
@slender thistle it didn’t say anything

errant perch
#

how do i get a value from a argument. for example a message has the number 5 and i wanna multiply it by 3 but it just returns NaN

#

discord.js

faint prism
#

yeah it did

lilac pollen
#

ik

#

The link didn’t answer my question

faint prism
lilac pollen
#

I know how to do that but I asked how to dos o once I’ve put it on heroku

#

*do so

faint prism
#

Your listing on top.gg doesn't affect your hosting?

earnest phoenix
#

how do i get a value from a argument. for example a message has the number 5 and i wanna multiply it by 3 but it just returns NaN
@errant perch Can i see how you do it? I maybe able to provide a fix

opal plank
#

likely parseInt incorrectly

#

or mutiplying string by number

#

which is why
clears throat, reads ad script
You should try typescript as it catches those hefty bugs before even compiling ASMarisaWink

earnest phoenix
#

String + Number would turn the number into a string and add it to the string, but if used like this

Math.floor(String + Number);``` it would return NaN
faint prism
#

right because `hello` + 5 = hello5

  • also means to append
opal plank
#

i wonder

errant perch
#

wait

#

i think i got it

#

but it just wasnt saving

faint prism
#

but it just wasnt saving
@errant perch If I had a dime

opal plank
errant perch
#

ye i got it

#

sorry

#

for wasting your time

earnest phoenix
#

@opal plank Are you making your entire eval an async function

opal plank
#

yes indeed

earnest phoenix
#

To be able to use await

opal plank
#

yup

#

havent pushed it on the main branch yet though

earnest phoenix
#

Well i don't do that, just awaiting if the result is a promise

opal plank
errant perch
#

oh wait

#

now its

#

15+5 = 155

opal plank
#

string

earnest phoenix
#

But yea trying to put the whole thing inside a async function just to use await is annoying @opal plank

opal plank
#

parse them first

#

i mean, it works fine

earnest phoenix
#

I wish await didn't need async

#

That would have been epic

opal plank
#

parse them before doing operations

errant perch
#

magik

#

ok

opal plank
#

you're adding strings, not numbers

#

thats why that happens

errant perch
#

makes sense

#

thanks

opal plank
#

@earnest phoenix just make everything async kek

earnest phoenix
#

@errant perch Could try that too

errant perch
#

yes

earnest phoenix
#

@earnest phoenix just make everything async :kek:
@opal plank Yes but using return on everything is something that i hate

opal plank
#
//index.ts
async function () {
 client;
login();
more shit
whole index


He attacc
he protecc
but most importantly
the whole index whacc

}
#

@earnest phoenix

earnest phoenix
#

That's what i do

opal plank
#

literally the whole index kekdog

earnest phoenix
#

But i do everything inside the message event so we wack

opal plank
#

not even, whole thing dude

#

like all of it

earnest phoenix
#

I know

opal plank
#

balls deep

earnest phoenix
#

C o c k

opal plank
#

if you goin g to screw up the code, at elast do a good job at it

#

be the best at whatever you do, be it good or bad

earnest phoenix
opal plank
#

await impacts a bit of performance iirc

errant perch
#

im genos

#

me make numbers parse

faint prism
#

What is happening rn?

opal plank
#

aham?

earnest phoenix
#

await focuses on the function/promise/static property or whatever until it's done so yes

faint prism
#

I saw someone's code today where they implemented a static instance of a class within itself. It was really weird

class MyClass
{
  private MyClass _instance = new MyClass();

  private MyClass() {}

  public static Instance() return _instance;
}
opal plank
#

ez pz, make everything async, then once you finish code, do ctrl+shift+f, replace async with '' and fix where errors happen, 300 iq 🧠

earnest phoenix
#

I saw someone's code today where they implemented a static instance of a class within itself. It was really weird
@faint prism it's actually a common pattern for libraries - i.e when you need to create a single instance of a class and keep it alive all throughout the lifetime but not allow any more creations of it

#

mostly used for reflection

faint prism
#

mostly used for reflection
@earnest phoenix It was in some productions code. I was getting a really weird exception when creating unit tests for it.
Really banging my head against it.
I ended the day by removing the GetInstance and it's references so I could register it in our IoC container
So hopefully that works

heavy anchor
#

@earnest phoenix I formatted your index file today (the one I had for the backup) and it made like 80 errors so I just uploaded it the way you had it lol

earnest phoenix
#

In my index.js file, everything goes by my rules, change something and you're in hell

faint prism
#

In my index.js file, everything goes by my rules, change something and you're in hell
@earnest phoenix Sounds like unmaintainable code

#

Learn some design patterns

earnest phoenix
#

Not unmaintainable, just you need to understand it

opal plank
#

my code is pretty idiot safe tbh, its quite hard to get it to error

heavy anchor
#

He is on mobile dude...

opal plank
#

why is that an issue?

earnest phoenix
#

You do realize how hard it's to code on mobile right

opal plank
#

js is js regardless of your platform, that just shows you have less will to live than the rest of us if you code on mobile

heavy anchor
#

No way to easily format it

earnest phoenix
#

Mobile doesn't have things like visual studio code to easily code and format everything

undone solar
#

Re, (using discord.js)
I installed node.js on my VPS after that
I went to the directory of the bot and started with (node .) but when I close my ssh session the bot doesn't stay on.
can you help me ?

earnest phoenix
#

That pc does have, so what can i say than try before saying

#

Re, (using discord.js)
I installed node.js on my VPS after that
I went to the directory of the bot and started with (node .) but when I close my ssh session the bot doesn't stay on.
can you help me ?
@undone solar use a window manager like screen or tmux

#

@undone solar Maybe you did something that it closes the session when cutting out of it

heavy anchor
#

You need a process manager like pm2 nodemon

undone solar
#

@heavy anchor Thanks
I'm trying to make the BOT stay on even if my computer is turned off (sorry for the bad English)

earnest phoenix
#

love it when the easiest solution gets ignored lol

undone solar
#

@undone solar use a window manager like screen or tmux
@earnest phoenix i need to pay settings on vps or i can just install it

earnest phoenix
#

they're just... packages

#

linux is open source there's nothing to pay

#

You don't buy node package manager packages

#

They're made for free

#

chances are your linux distro came with screen preinstalled

undone solar
#

Will search how to (screen) my bot , thanks for answers guys 🙂

#

chances are your linux distro came with screen preinstalled
Ok doesn't have to install it

faint prism
#

CTRL+A and D
will "minimize" or detatch the screen

errant perch
sage bobcat
#

One message removed from a suspended account.

sudden geyser
#

There are a number of reasons the bot couldn't be able to ban someone. One is role hierarchy.

#

The code looks correct according to the docs and my eyes.

#

But the scoping is not so good

#

You should at least add brackets to indicate the start and end of your scope as your whitespace only makes it look like it's supposed to ban the message author for every message sent.

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

clever vector
#

hey guys

#

how to fix this error

#
Error [TOKEN_INVALID]: An invalid token was provided.
    at DiscordBot.login (C:\Users\User\Pictures\Oppa\discordBot\node_modules\discord.js\src\client\Client.js:205:52)
    at Object.<anonymous> (C:\Users\User\Pictures\Oppa\discordBot\index.js:13:8)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  [Symbol(code)]: 'TOKEN_INVALID'
}
Found total 6 categories.
Found total 5 command(s) from Action.
Found total 1 command(s) from Developer.
Found total 3 command(s) from Fun.
Found total 2 command(s) from General.
Found total 7 command(s) from Image.
C:\Users\User\Pictures\Oppa\discordBot\node_modules\canvacord\src\Canvas.js:25
        throw new Error(`The class ${this.constructor.name} may not be instantiated!`);
        ^

Error: The class Canvacord may not be instantiated!
    at new Canvacord (C:\Users\User\Pictures\Oppa\discordBot\node_modules\canvacord\src\Canvas.js:25:15)
    at Object.<anonymous> (C:\Users\User\Pictures\Oppa\discordBot\commands\Image\jail.js:3:16)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at C:\Users\User\Pictures\Oppa\discordBot\handler\module.js:30:22
    at Array.forEach (<anonymous>)
#

??

#

Why wrong

muted dock
#

nvm sorry

clever vector
#

i put the token correctly

muted dock
#

sorry sorry dude i thought another thing

clever vector
#

ohh

muted dock
sonic lodge
#

if you're getting that error the token has to be invalid somehow

clever vector
#

Arghhh headache coming

radiant patio
#
    return channel.send(embedleave)
                   ^

TypeError: Cannot read property 'send' of undefined```
sonic lodge
#

that means channel is undefined

radiant patio
#
    const channel = member.guild.channels.cache.get(channelId)```
#

it is

sonic lodge
#

in that case, it means there was no channel found with that id

radiant patio
#

but sometimes it will send the message

royal laurel
#

can anyonw tell me how i would like tie a certain amount of credits to users

#

andi f they spend something they lose some credits

#

im not sure how i would go about it

sonic lodge
#

on the occasions it does the channel has already been cached for whatever reason

karmic compass
#
#Trying to make a number guessing game
@bot.command()
async def guess(ctx, playerNumber = None):
    if playerNumber is not None:
        if math.isnan(playerNumber):
            await ctx.send(f"The number {playerNumber} is not a number! Please guess a number 1-100")
        else:
            playerNumber = int(playerNumber)
            computerNumber = random.randint(0, 100)
            if playerNumber > 100:
                await ctx.send(f"The number {playerNumber} is higher than 100! Please guess a number 1-100")
            elif playerNumber < 1:
                await ctx.send(f"The number {playerNumber} is lower than 1! Please guess a number 1-100")
            else:
                if playerNumber == computerNumber:
                    await ctx.send(f"Congratulations! You guessed the correct number , {computerNumber}!")
                else:
                    await ctx.send("Sorry, you did NOT guess the correct number. Another day, friend :(")
    else:
        await ctx.send("Please submit a number 1-100!")
``` gives me the error "TypeError: must be a real number, not str"
faint prism
#

Pretty pretty cool, Google

#

Just slap a database on it, and tweak the sensitivity a bit, and boom ready for production (probably w/o reactions)

static trench
#
Error [TOKEN_INVALID]: An invalid token was provided.
    at DiscordBot.login (C:\Users\User\Pictures\Oppa\discordBot\node_modules\discord.js\src\client\Client.js:205:52)
    at Object.<anonymous> (C:\Users\User\Pictures\Oppa\discordBot\index.js:13:8)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  [Symbol(code)]: 'TOKEN_INVALID'
}
Found total 6 categories.
Found total 5 command(s) from Action.
Found total 1 command(s) from Developer.
Found total 3 command(s) from Fun.
Found total 2 command(s) from General.
Found total 7 command(s) from Image.
C:\Users\User\Pictures\Oppa\discordBot\node_modules\canvacord\src\Canvas.js:25
        throw new Error(`The class ${this.constructor.name} may not be instantiated!`);
        ^

Error: The class Canvacord may not be instantiated!
    at new Canvacord (C:\Users\User\Pictures\Oppa\discordBot\node_modules\canvacord\src\Canvas.js:25:15)
    at Object.<anonymous> (C:\Users\User\Pictures\Oppa\discordBot\commands\Image\jail.js:3:16)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at C:\Users\User\Pictures\Oppa\discordBot\handler\module.js:30:22
    at Array.forEach (<anonymous>)

@clever vector go to the dev portal and regen the token and use it

thick gull
#

wait why is the discordbot in their pictures folder

#

wacky

earnest phoenix
#

How do i make a discord bot

pale vessel
#

shitpost somewhere else

earnest phoenix
#

I heard from someone that webhooks arent rate limited, is that true?

faint prism
#
//#region Command handling
  if (message.content.startsWith(process.env.PREFIX)) {
    let reqCommand = message.content.split(process.env.PREFIX)[1];
    switch(reqCommand) {
      case 'karma': karmaCommand(message); break;
      case 'help': helpCommand(message); break;
      default: break;
    }
  }
  //#endregion

I understand the switch/case meme now

pale vessel
#

what meme

earnest phoenix
#

I really need help

#

How do I remove all of a mentioned user's roles

#

so for example:

#

remove @mentioneduser

#

And all their roles should go away.

#

Help anyone?

#

Loop through the roles a user has a remove them

#

How do we find the user's roles?

#

@earnest phoenix

#

ahhhhhhhhhh pls help

#

Idk python

#

But get the guildmember

#

And it has toles property

#

Roles*

#

member.roles?

#

so something like this:

for remove in member.roles:
  await member.remove_roles(remove)
#

I'm sure it's in the docs

#

ok

#

Yea

#

Something like that

#

ok

#

thanks

#

Np

frosty oriole
#

Error:

 const embed = new MessageEmbed()
   ^^^^^

SyntaxError: Unexpected token 'const'
    at wrapSafe (internal/modules/cjs/loader.js:1053:16)
    at Module._compile (internal/modules/cjs/loader.js:1101:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47

obtuse jolt
#

What’s the code?

#

For that bit of the bot

frosty oriole
#

i tried to make a messageembed, done but when i start it, the console logs that error

faint prism
#

@frosty oriole Typically means a syntax error is on the line above/before it

frosty oriole
#

oh k

#

oh wait there is

faint prism
#

If you get an error that says Unexpected token that means you have a syntax error somewhere

frosty oriole
#

ok ty, its fixed

faint prism
#

Since a "token" for a programming language is stuff like { } ; , etc
Basically the grammar

frosty oriole
#

oh well anyways

gritty bolt
#

how do people make bots that you can link accounts to using APIs?

#

i've been wanting to explore this idea for a bot but I don't know where to start

royal laurel
#

how would i attach like credits/currency to a user?

#

i dont know where i would start

earnest phoenix
#

look into databases

#

if you want to do sql, use sqlite for small scale, postgresql for large scale

#

if you don't, look into mongo or other nosql databases

royal laurel
#

k, those work with disc js im guessing

faint prism
#

Yeah, they have libraries

royal laurel
#

k

fringe axle
#

Is it possible to change the bots avatar every 4 hours with code?

earnest phoenix
#

why would you want to do that

fringe axle
#

Will be cool

faint prism
#

lol

fringe axle
#

Other colors

#

Any idea?

earnest phoenix
#

as long as you're not verified, it's possible

fringe axle
#

Oh, my bot is on 20 servers. It will take a long time till I‘m verified. Any docs for it?

radiant patio
#

code: ```
//reactor
client.on('message', async message => {
const args = message.content.substring(PREFIX.length).split(" ")

const embedpermission = new Discord.MessageEmbed()
    .setColor("BLUE")
    .setAuthor(message.author.tag)
    .setTitle("Unausreichende Berechtigung")
    .setDescription(`Du bist nicht berechtigt, diesen Befehl auszuführen!`)
    .setFooter("Mehr Infos dazu bekommst du im Support!")


if(message.content.startsWith(`${PREFIX}react`)) {
    const messageiwannareact = await message.channel.messages.fetch(args[1])
    if(message.author.bot) return
    message.delete()
    
    if(!message.member.hasPermission("ADMINISTRATOR")) return message.channel.send(embedpermission)
    messageiwannareact.react(args[2])
    

}

}) ```

error: (node:19660) UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Message at RequestHandler.execute (C:\Users\MAINFABIAN\Desktop\RayBotDP\node_modules\discord.js\src\rest\RequestHandler.js:170:25) at processTicksAndRejections (internal/process/task_queues.js:97:5) (node:19660) 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:19660) [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
#

Is the invite bot broken? Cause it won’t count the invites in my server any more

fringe axle
#

That‘s not Invite bot support :0

earnest phoenix
#

nevermind i was wrong, it's the username you can't change after being verified

fringe axle
#

Oh xD

#

And any docs for avatar changing with code?

earnest phoenix
#

library or raw api request?

fringe axle
#

Hmm

#

Okay, thanks.

#
client.user.setAvatar('imageurl');
``` that‘s easy
#

Just a timeout, random links, and done

thick gull
#

        let reactMessage = message
        const filter = (reaction, user) => {
            return reaction.emoji.name === '👍' && user.id === message.author.id;
        };
        reactMessage.react('👍')
        reactMessage.awaitReactions(filter, {
                max: 4,
                time: 5000,
                errors: ['time']
            })
            .then(collected => console.log(collected.size))
            .catch(collected => {
                console.log(`After a minute, only ${collected.size} out of 4 reacted.`);
            });

i quite literally copy pasted this from discordjs.guide
and it doesnt work at all

#

I only changed the await reactions max/time thing

fringe axle
earnest phoenix
#

you got a syntax error

fringe axle
#

Know I got a function error

#
client.once('ready', () => {
  console.log('Ready!');
  client.user.setActivity(`${prefix}help | ${client.guilds.cache.size} servers`, {
    type: 'LISTENING'
  });
var url = ["https://cdn.discordapp.com/avatars/610122588110192681/4b38ec582504b3efaa7b2bdedf7e3832.webp?size=512", "https://api.alexflipnote.dev/filter/blur?image=https://cdn.discordapp.com/avatars/610122588110192681/4b38ec582504b3efaa7b2bdedf7e3832.png?size=512"];
      var urls = Math.floor(Math.random() * url.length);
client.user.setAvatar(url[urls], {
setTimeout( function () {
    }, 10000);
})
});
#

@earnest phoenix, any idea?

tranquil patrol
#

last time i checked setavatar only has one argument

obtuse jolt
#

uhh yeah

fringe axle
#

Hm, it‘s just for the random avatars

obtuse jolt
#

.setAvatar(url)

tranquil patrol
#

the settimeout literally does nothing in this case

obtuse jolt
#

You could make the url inside the set avatar a function to randomly pick one also

pale vessel
#

why are you doing this

tranquil patrol
#

good point

#

😂

pale vessel
#

every 10 seconds?

#

what the fuck

obtuse jolt
#

Yeah that too

fringe axle
#

As test

tranquil patrol
#

isn't that api abuse

obtuse jolt
#

Why

fringe axle
#

If it‘s working

tranquil patrol
#

you get ratelimited for like couple of hours

obtuse jolt
#

Yeah

tranquil patrol
#

well i do for setname 😂

fringe axle
#

I‘ll set it on 4 hours later

#

But yea, kinda useless. xD

obtuse jolt
#

it would make sense for like activities

#

But

#

Avatars?

fringe axle
#

Yea

thick gull
#

no stupid avatar

fringe axle
#

;-;

thick gull
#

brrr

fringe axle
#

I deleted it. xD
It was kinda useless

thick gull
#

yeah no changing your avatar that fast is probably

#

api abuse

#

doing x every y is usually api abuse

fringe axle
#

I‘ll set it on 4 hours later

thick gull
#

ok

bronze mauve
#

Hey Ehm- I’m new to the bots and all- but how can I upload my bot to the websiteshywatch

tranquil patrol
#

like your code?

thick gull
#

rip

#

wrong link

fringe axle
#

@thick gull DUDE NOT SO FAST!

bronze mauve
thick gull
tranquil patrol
#

^

fringe axle
#

Still fast

tranquil patrol
#

why does that embed as discord

#

lmfao

thick gull
#

idk

#

probably log in

tranquil patrol
#

oh yeh

fringe axle
#

Yea

thick gull
#

what do you mean not so fast

#

???

fringe axle
#

You wrote really fast

#

That was... fast!

earnest phoenix
#

hi

#

I am having trouble with developing a moderation bot

thick gull
earnest phoenix
#

.

drifting wedge
#

Can anyone explain simply what’s sharding

earnest phoenix
#

take a bowl and break it

#

you're left with shards of the bowl

#

splitting it into smaller pieces

torn ravine
fickle dune
#

why does

#

this happen

crystal socket
#

full screenshot please @fickle dune

earnest phoenix
#

why does it keep saying event loop is closed when i run my bot

crystal socket
#

screenshot

#

python or js

earnest phoenix
#

python

crystal socket
#

do you get any other error logs?

fickle dune
#

ok

earnest phoenix
#

no

fickle dune
#

lol why did i blur it

#

xd

crystal socket
#

@earnest phoenix improper token has been passed

earnest phoenix
#

lol how

crystal socket
#

like wrong token

#

like its the wrong token

earnest phoenix
#

yeah how

crystal socket
#

like it doesn't work

#

like its missing something

#

or its invalid

#

its a bot token right @earnest phoenix ?

earnest phoenix
#

yes

crystal socket
#

re-copy it

#

and try again

earnest phoenix
#

kk

crystal socket
#

@fickle dune sorry my mistake

#

your branch isn't synced with git

#

do git pull

fickle dune
#

Oh ok

#

It pushes but the command dosent work and when i do node . it work

earnest phoenix
#

Me: do not turn on the bot it is in maintenance and might cause SHENANIGANS
Karens: well the developer said "If the bot is down goto repl.it and turn it on" so I'll turn it on
Me in the morning: The day is so cool!
Five minutes later
The welcome channel of my server: REEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE

#

I hate humans

eager granite
#

Can someone fix this

#
const { MessageEmbed } = require("discord.js");
const got = require('got');

 module.exports = {
    name: "ban",
  category: "Moderation",
  description: "Ban Cmd!",
  execute(message) {

        if (!msg.mentions.users.size) {
                        return msg.reply('you need to tag a user in order to ban them!');
                }

        if (!msg.member.hasPermission("BAN_MEMBERS")) return;
        var member = msg.mentions.members.first();
        member.ban().then((member) => {
            msg.channel.send(random(success) + member.displayName + " has been banned");
        });
    },
};```
misty sigil
#

what wrong

earnest phoenix
#

@eager granite we won't spoonfeed

eager granite
earnest phoenix
#

we won't just sit and fix your code. we can help with some stuff

misty sigil
#

what error

earnest phoenix
#

but we won't just give you fixed code

eager granite
#

@earnest phoenix We dont mini mod

#

ReferenceError: msg is not defined
at Object.execute (/home/container/commands/ban.js:10:9)
at Client.<anonymous> (/home/container/index.js:78:13)
at Client.emit (events.js:315:20)
at MessageCreateAction.handle (/home/container/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (/home/container/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
at WebSocketShard.onPacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
at WebSocketShard.onMessage (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
at WebSocket.onMessage (/home/container/node_modules/ws/lib/event-target.js:125:16)
at WebSocket.emit (events.js:315:20)

earnest phoenix
#

Lmao

cinder patio
#

You haven't defined msg.

earnest phoenix
#

execute(message)

#

XD

misty sigil
#

bruh

eager granite
#

ty

misty sigil
#

@earnest phoenix We dont mini mod
@eager granite that isn't minimodding

#

its literally telling you that we won't spoonfeed

earnest phoenix
#

ty
@eager granite the hell

thick gull
#

when you copy paste code

misty sigil
#

ikr

midnight blaze
#

I upload my bot.js
pls fix it

misty sigil
thick gull
#

I upload my token.json pls fix it

earnest phoenix
#

i hate to spoonfeed and if they beg i link them my bot's open source code XD

misty sigil
#

I upload my token.json pls fix it
@thick gull

{
"t":"first 5 letters",
"o":"second 5",
"k":"third 5",
"e":"fourth 5",
"n":"the rest"
}
const token = config.t + config.o + config.k + config.e + config.n
midnight blaze
#

or make a for loop

earnest phoenix
#

no

thick gull
misty sigil
#

so you put the wrong part of it on starboard momentarily

#

good work

earnest phoenix
#

lol

hidden spade
#

.

earnest phoenix
#

this is how i store tokens:

thick gull
#

-dotpost

earnest phoenix
#
process.env.TOKEN;
thick gull
#

wait fuck this isn’t shitpost

earnest phoenix
#

I've got a whole 100+ lines of code which is my template for creating userData objects and inserting them to my mongodb collections

dusk vault
#

So I store my data into json files by guild, channel, member, user, and role. Since my commands are asynchronous and sometimes they do fast tasks in between loading and saving the data, does this mean that if two commands were run extremely quickly, one might overwrite the other's changes?

misty sigil
#

dont use json db

#

json db will easily corrupt

thick gull
#

I suggest mongodb;)

misty sigil
dusk vault
#

Which is JSON

misty sigil
#

no

#

its bson

#

and it has queueing

#

and its a proper db

thick gull
#

it does not overwrite itself and corrupt

misty sigil
#

because its a proper db

thick gull
#

and quite simple to use once you get the basic

fluid basin
#

uh a json file is very different from a json db

misty sigil
#

no @fluid basin you can easily see that the person is using json files as a database.

fluid basin
#

that won't be called a database

misty sigil
#

they are using it as a database

fluid basin
#

it will just be persistent storage

misty sigil
#

yes but they are using it as a database

fluid basin
#

ok lemme rephrase that

misty sigil
#

please do

fluid basin
#

json file is not the same as json file db nor a json-like db

dusk vault
#

I'll switch to MySQL, since I was hacking together a relational structure with JSON anyway

#

The painful part is going to be changing the 40 files of my bot to use MySQL instead of JSON

fluid basin
#

just use mongodb lol

dusk vault
#

No

misty sigil
#

you can literally import data from json

#

but ok i suppose

dusk vault
#

There is no data

#

And I need the ability to store keys with . and $ so MongoDB isn't for me

fluid basin
#

bruh

misty sigil
#

bru h

dusk vault
#

and _dot_

misty sigil
#

objects have joined the chat

dusk vault
#

objects with $ or . in mongodb cause errors...

misty sigil
#
let object = {foo:"bar", a: "b"}
object.a // returns b
object.foo // returns bar
``` iirc
thick gull
#

wait is there a specific reason why??

dusk vault
#

yes and table.find({$foo:"bar",".a":"b"}) throws an error

slender thistle
#

What kind

dusk vault
#

$set*

#

its a security hole

thick gull
#

And I need the ability to store keys with . and $ so MongoDB isn't for me
no I mean this

dusk vault
#

embed templates with names as keys

#

id rather not limit which chars

#

can be used

lilac pollen
#

How can I put my bot on top.gg after having uploaded the code into heroku?

misty sigil
dusk vault
#

What's wrong with MySQL though? It's a standard database with asynchronous support and an advance query language that suits every need I have for the bot

misty sigil
#

iirc its quite slow

dusk vault
#

MySQL isnt slow

slender thistle
#

Might as well go PostgreSQL

dusk vault
#

Can I use them interchangably

misty sigil
#

i mean if you can secure it properly Shrug

dusk vault
#

Like switch to PostgreSQL or SQLite later

#

from mysql

slender thistle
#

It's SQL so probably won't be too much of a hassle when compared to NoSQL -> SQL

dusk vault
#

aight

#

also prepared statements christmasthink

fluid basin
#

well design wise it rather counter intuitive to set column/key names to variable data

dusk vault
#

yeah in a table i wouldnt do that

#

id have the key be a column itself

fluid basin
#

unless you tell me that you are going to "ALTER TABLE embeds RENAME COLUMN "my embed" TO "wtf"

dusk vault
#

lol

fluid basin
#

yeah thats the same case for mongo wtf

dusk vault
#

no

fluid basin
#
{
  "name": "my embed",
  "value": "embed data here"
}```
#

bruh

dusk vault
#

the embed list isnt a table

#

its part of the guild document

misty sigil
#

objects can be put in documents you know

dusk vault
#

yes i know

slender thistle
#

I mean, embed JSON that you can send to Discord will certainly be supported by MongoDB since there's no special characters in document keys

misty sigil
#

also @fluid basin did you forget a comma in that object

fluid basin
#

¯_(ツ)_/¯

dusk vault
#

i could just SELECT * FROM \embeds` WHERE `guild` = ? AND `channel` = ?and have thetemplate` column be a JSON string

#

too lazy to fix the formatting

fluid basin
#

bruh pls no

nimble jacinth
#

@lean mirage

fluid basin
#

json in sql is dumb

dusk vault
#

why

#

its just JSON.parse

misty sigil
#

i dont know much about sql but storing json seems dumb

#

mongo's probably better for storing json data

dusk vault
#

So heres a question

#

Multiple actually

fluid basin
#

sql is for normalised data

dusk vault
#

But first one

#

Can I store a key named $set inside of an object inside of a document

#

and have it not set anything

misty sigil
#

you can set it as null

thick gull
#

so if I have a json following the embed json format, if I do message.channel.send(require(path.to/json)) will it send the embed?

misty sigil
dusk vault
#

not what im asking

thick gull
#

I like to ask questions about other people’s things so I can learn

dusk vault
#

yes it would

misty sigil
#

wouldn't the json need to be exported?

dusk vault
#

no

misty sigil
#

doubt it but

slender thistle
#

The embed is sent in the request body, right?

thick gull
#

ELI5

dusk vault
#

what?

#

new question

#

how would mongodb solve my problem

#

the one i asked that everyone ignored

#

lol

#

Since my commands are asynchronous and sometimes they do fast tasks in between loading and saving the data, does this mean that if two commands were run extremely quickly, one might overwrite the other's changes?
@dusk vault

#

ill give an example

#
const data = (load guild document)
// do something with data
await someShortAsyncTask();
// do something with data
(save guild document)```
fluid basin
#

In MongoDB, a write operation is atomic on the level of a single document, even if the operation modifies multiple embedded documents within a single document.

dusk vault
#

and two of these get run at the same time

fluid basin
#

you can't fix that with sql either

#

lol

dusk vault
#

ik

#

but how do i fix it

#

is my question

#

i dont want random overwrites

#

that break commands

fluid basin
#

check if someone else is working on this item

#

and use locking

misty sigil
#

mongodb has queue iirc

dusk vault
#

wouldnt help

misty sigil
#

i mean most good db shouldn't just overwrite randomly

dusk vault
#

queue wouldnt fix me saving old data

surreal sage
#

.eval client.user.token

#

/eval

dusk vault
#

you misread the question

#

lol

misty sigil
#

yes i did

surreal sage
#

oops wrong channel

misty sigil
#

mb

surreal sage
#

👀

fluid basin
#

maintain a shared state

dusk vault
#

say like

fluid basin
#

instead of reading it

dusk vault
#

"Someone else is modifying the guild data. Please wait."

#

Lol

fluid basin
#

maintain a shared state
@fluid basin

dusk vault
#

wdym

#

keep it in memory you mean?

#

lets say there's 10GB worth of guild data for my bot and the vps has 4GB of memory

fluid basin
#

yeah great

#

how tf do you even get 10GB of guild data

dusk vault
#

point is

earnest phoenix
#

O

#

Hi

misty sigil
#

yea how

dusk vault
#

thats too much to keep in memory

#

like

earnest phoenix
#

Hey guys i have a question

fluid basin
#

then time™️ to™️ upgrade™️ your™️ vps™️ ™️

dusk vault
#

bruh

#

if im keeping it all in memory ill just use json slonk

earnest phoenix
#

I haVe A Question

dusk vault
#

shoot

fluid basin
#

if you're updating it frequently, I don't see why not to keep it in memory

earnest phoenix
#

Yall got Developer Mode? Like when you can see the users id?

dusk vault
#

ok

#

yes

misty sigil
#

bruh

dusk vault
#

we do

earnest phoenix
#

U do?

dusk vault
#

yes

earnest phoenix
#

O ok

misty sigil
#

if you have 10GB of guild data

#

you shouldn't be on a vps with 4gb of ram

dusk vault
#

i dont

#

it was an example

#

i have a few K

#

lol

#

i like to plan too far ahead

thick gull
#

ok but

fluid basin
#

lol you do know a few K to 10GB is more than 10000000x

thick gull
#

how is it even possible to get to 10GB

#

that’s like

#

10Kx10

dusk vault
#

uh

#

thats 1G x 10