#development

1 messages ยท Page 1266 of 1

feral aspen
#

๐Ÿ˜‚

#

I bet all mods are just gonna resign saying, ENOUGH, 1 Million BOTS testing and we approved 1%, thank you, bye.

#

Jk

#

I just got my bot Verified! ๐Ÿฅณ

#

But no badge, which is a

earnest phoenix
#

you can thank badge hunters for that

feral aspen
#

Ah. ๐Ÿ˜

earnest phoenix
#

badges should be displayed to friends only imo

feral aspen
#

Im just going to

#

You know

#

I got the badge

#

Yay!

#

๐Ÿคฆโ€โ™‚๏ธ

earnest phoenix
#

hello

#

someone can help

silent cloud
#

File is not db

umbral zealot
#

yeesh quick.db on glitch... that's gonna be fun.

obtuse niche
#

For sure

final path
#

Lmfao.

earnest phoenix
#

how can i fix this?

zenith terrace
#

only logged one

silent cloud
#

const songInfo = await ytdl.getInfo(args[0]);

#

Have an error

#

Wgy?

#

Why

umbral zealot
#

@earnest phoenix well first you wouldn't use glitch because you can't run your bot 24/7 on it anyway. Once you've found a better host, we'll need to see your code because just the error isn't enough.

#

@silent cloud what error ๐Ÿ˜‰

silent cloud
#

Syntax

earnest phoenix
#

@umbral zealot message.js is erroring

final path
#

@earnest phoenix well first you wouldn't use glitch because you can't run your bot 24/7 on it anyway. Once you've found a better host, we'll need to see your code because just the error isn't enough.
@umbral zealot True lmfao

umbral zealot
#

ok it's error

#

what error

#

what code

earnest phoenix
#

this

slender thistle
#

I feel like that's d.js's weird behavior

umbral zealot
#

why is noob hour always filled with people that have absolutely no idea how the hell to describe a problem.

slender thistle
#

that's why it's a noob hour :^)

umbral zealot
#

true

zenith terrace
#

@earnest phoenix what error does it say

earnest phoenix
#

wait

umbral zealot
#

honestly, I feel like you missed the first part of what I said. glitch.com is not an appropriate hosting service.

earnest phoenix
#

saying this

#

@zenith terrace

umbral zealot
#

Unless I'm mistaken, it's simply impossible to run quickdb on glitch anyway

zenith terrace
#

I used quick.db on glitch

earnest phoenix
#

Me too using quick.db

umbral zealot
#

Even if so, you can't have a 24/7 bot on glitch anymore

slender thistle
#

It is

#

and they moved to hours like Heroku afaik

tight plinth
#

@zenith terrace u tried

silent cloud
#

You have intsalled db?

earnest phoenix
#

no

silent cloud
#

Installed*

#

...

earnest phoenix
#

no

tight plinth
#

yep they did @slender thistle

silent cloud
#

Go to package.json

tight plinth
#

+banning ping services

silent cloud
#

And install it

earnest phoenix
#

Okay

silent cloud
#

So guys

#

const songInfo = await ytdl.getInfo(args[0]);

umbral zealot
earnest phoenix
#

this?

umbral zealot
#

@silent cloud what error

zenith terrace
#

and they moved to hours like Heroku afaik
@slender thistle 1000 hours a month iirc

umbral zealot
#

They limit the hours but more importantly, they do not let your app stay online.

tight plinth
#

aka not a full month

slender thistle
silent cloud
#

Syntaxerror: await is only valid in async function

umbral zealot
#

@silent cloud so put it in an async function?

obtuse niche
#

why is noob hour always filled with people that have absolutely no idea how the hell to describe a problem.
Noob hour ๐Ÿ˜‚pogey

slender thistle
#

Honestly I'll probably just fuck around with Glitch at some point

tight plinth
#

make your function async then @silent cloud

silent cloud
#

@earnest phoenix yes

#

How?

umbral zealot
earnest phoenix
#

Im installed

zenith terrace
#

they dont ban users, they just delete your project if they detect it trying to use a ping service

silent cloud
#

Ty

tight plinth
#

async function

earnest phoenix
#

And giving errors too @silent cloud

opal plank
#

@zenith terrace thats odd

zenith terrace
#

that doesnt help, is there any error above that

opal plank
#

doesnt a month have 720 hours?

#

i find it weird that they give 1000h

zenith terrace
#

probably

earnest phoenix
#

@silent cloud glitchs says module errors

opal plank
#

i assume thats total?

slender thistle
#

730

#

1000 hours per all apps probably

opal plank
#

well, depends on month but yeah

#

so you CAN run it 24/7

zenith terrace
#

@earnest phoenix have you installed discord.js

slender thistle
#

smartass gang ๐Ÿ˜‚

umbral zealot
#

Between 696 and 744

slender thistle
#

aka 2 hours are exhausted per month for each hour if you run 2 apps

earnest phoenix
#

@zenith terrace yeah

zenith terrace
#

so you're telling me you coded stuffbut never actually inst

#

ok

#

I was meant to delete that message

#

but meh

opal plank
#

hmmm

earnest phoenix
#

oh

#

glitch gives me SyntaxError

zenith terrace
#

what does the error say

opal plank
#

its not glitch btw

#

its error

earnest phoenix
zenith terrace
#

did you update discord from v11 straight to v12

opal plank
#

its catch {}

#

its node

#

update node version

zenith terrace
#

that

#

yea

earnest phoenix
#

@zenith terrace yeah

#

my discord.js version is now v12.3.1

zenith terrace
#

update node version

opal plank
#

^^

earnest phoenix
#

done updated

opal plank
#

updated in 4 seconds

#

im amazed

earnest phoenix
#

oh not updated :D

opal plank
obtuse niche
#

Yeah

earnest phoenix
#

wait :D

obtuse niche
#

Are u trolling those who want to help u?

umbral zealot
#

they're not trolling they're just the standard d.js user.

obtuse niche
#

Ahahahhaha

final path
#

XD

umbral zealot
#

ESL, probably underage, absolutely no knowledge of javascript, using the worst possible platform. It unfortunately describes most of d.js users.

obtuse niche
#

Maybe thats the reason why i stick woth discordpy

final path
#

Lmfao!

#

Very true @umbral zealot !

obtuse niche
#

With*

opal plank
#

actually, that gave me an idea

obtuse niche
#

So i cant help d.js users okeh

final path
#

Maybe thats the reason why i stick woth discordpy
@obtuse niche Discord.js Is better!

earnest phoenix
#

giving errors too

obtuse niche
#

@obtuse niche Discord.js Is better!
Ok thanks for the info

final path
#

giving errors too
@earnest phoenix Are you just copying and pasting?

umbral zealot
final path
#

Evie.

#

I think they are copying and pasting.

earnest phoenix
#

Is all you do is make fun of you?

obtuse niche
#

You should take a course

earnest phoenix
#

all i want is for you to help me but here you are kidding

final path
#

all i want is for you to help me but here you are kidding
@earnest phoenix We can't help someone that dose not know d.js!

earnest phoenix
#

or js

ionic dawn
slender thistle
#

What's your node.js version @earnest phoenix

earnest phoenix
#

No spoonfeed here

obtuse niche
#

Just learn javascript first before developing a bot @earnest phoenix nobosy is here to spoonfeed

earnest phoenix
ionic dawn
#

People that have no clue of what they are doing making stupid questions before the even look YT or Google

earnest phoenix
#

@slender thistle

ionic dawn
#

Everyday journy

umbral zealot
#

man that's a lotta crap in that package.json.

earnest phoenix
#

@umbral zealotThat's just bigbrain

umbral zealot
#

yeah I'm sure trying to re-import every single core node js feature as their npm module that's gonna work fine ๐Ÿ˜‚

#

fs, util, http....

earnest phoenix
#

Lol

slender thistle
#

idk man

earnest phoenix
#

http

#

xd

#

lol

#

I Know glitch is very bad

slender thistle
#

half of that seems weird to me considering I'm not a JS dev

earnest phoenix
#

???

#

It isnt even glitch

#

its u

#

Could you suggest me a coding program to make bot I know the glitch is too bad

quartz kindle
#

@earnest phoenix node.js is not a package. node.js is the entire engine that runs your code. how to update it depends on where your code is hosted. for glitch.com you need to change its version in the "engines" field in your package.json

earnest phoenix
#

npm i nodejs@20.0.0

ionic dawn
#

VScode

umbral zealot
earnest phoenix
#

discord.js is a package not node.js, node.js is the main part of the whole system

#

so you run npm install discord.js

#

then you can follow the rest of the steps

umbral zealot
#

Because at this point you've awoken all the trolls and people that step in halfway into the help process with information that's completely irrelevant.

#

getting help from us right now isn't going to be possible, Astrax. You need to take the time to learn the language.

earnest phoenix
#

ye @umbral zealot is true

honest perch
#

so you CAN run it 24/7
@opal plank no

opal plank
#

explain

honest perch
#

It gives you xyz hours

#

Projects that have a package.json will NOT stay online

earnest phoenix
#

well i found a way to run my bot 24/7 it never shuts down unless i run a command to do it

honest perch
#

Only static projects will stay online while not using those hours

earnest phoenix
#

well i found a way to run my bot 24/7 it never shuts down unless i run a command to do it

honest perch
#

And the editor also eats up the hours

faint prism
#

Projects that have a package.json will NOT stay online
@honest perch so standalone nodejs apps stay up?

opal plank
#

if you only have 1 app with a total of 1000 hours, you can get it, no?

pale vessel
#

don't use package.json we_smart

honest perch
#

@opal plank if its not static then it won't stay up

#

And you cant ping it

thick gull
#

I use package.json.js 6brainWillow

faint prism
#

I don't get why people use glitch. I have an obsession to own the hardware I host from

honest perch
#

If it cant be hosted on their s3 buckets then it won't stay online

thick gull
#

glitch = free

#

mom wonโ€™t pay 3$ for a VPS

honest perch
#

Lmao

faint prism
#

old android = free mmLol

thick gull
#

laptop is too weak to run

honest perch
#

Raspis are great tbh

faint prism
#

too weak?

thick gull
#

little kids

#

parents who buy them random laptop

#

random laptop has viruses

honest perch
#

I'm running a whole npm registry and proxy on mine

thick gull
#

etc

#

do you think most underage kids (users of glitch probably) have a decent pc, or an old android..?

faint prism
#

Don't need a decent pc

#

Pretty sure I could get by with terrible specs

thick gull
#

no I meant decent in the way it can stay online properly

honest perch
#

But they dont know how to set it up

thick gull
#

that too

honest perch
#

Glitch does everything for you

thick gull
#

a good amount are on school chrome books too now1spinHooty

faint prism
#

Except

...stay online properly
apparently

thick gull
#

I had a laptop

#

i ratio have it

#

still*

#

itโ€™s dead

#

it still works

#

itโ€™s just a pain to keep on

#

at least in my area thatโ€™s the kind of laptop kids get

faint prism
#

Ive run a bot from: A gaming Desktop, an android smartphone, an old Dell poweredge Desktop, and an old Gateway laptop with a broken screen

#

As long as it runs javascript really lol

thick gull
#

you can run it on anything

faint prism
#

I bet a smart fridge runs js oliythink

thick gull
#

your overestimating the average age/smartness thing of people using glitch though

faint prism
#

probably

#

I explained to a complete beginner last night how to do an android deployment

#

but I gave up when they asked how to do JS. I'll help with the niche part for android/linux setup but can't teach someone to code

thick gull
opal plank
umbral zealot
#

"avarage" is right ๐Ÿ˜‚

thin turret
#

Oh yeah well im pretty experienced at js and use vs code ๐Ÿ˜Ž where's my cookie

umbral zealot
#

verified is my cookie ๐Ÿ˜›

faint prism
earnest phoenix
#

Is there a script for eval that I can make my bot have a mobile status?

opal plank
#

thats only done in the gateway identification payload

#

so, no

#

@earnest phoenix

earnest phoenix
#

F

opal plank
#

you'd have to hack the library to do that

#

or make your own library to login into discord for you

faint prism
#

Or make the API call

earnest phoenix
#

or make your own library to login into discord for you
@opal plank starenoot

opal plank
earnest phoenix
#

:/

#

Ok.

thin turret
#

El chapo bot

opal plank
#

thats just nickname

#

its @earnest phoenix , but the beta branch

#

10 mil in 15h

#

noice

honest perch
#

I need advice

#

I want to make a css framework

#

And need a name

thin turret
#

Strawberry

honest perch
#

Too basic

#

It needs to be unique

next flax
#
.setDescription(${member.user} Welcome to Our Server + db.get(`welmessage`));
#

This doesnt work

honest perch
#

@opal plank >:

thin turret
#

Homie said quickdb

opal plank
#

css library

honest perch
#

Yes

#

Wait

#

Franework

#

Same thing

opal plank
#

definetly not

honest perch
#

Yes

next flax
#

Hey I m new to JS

#

i m unable to set this

opal plank
#

enjoy coding in css then

thin turret
#

@next flax you need back tics for template literals

#

Its still a string

next flax
#

ok

#

Why this

#

I think the syntax was Okay

#

@thin turret

faint prism
#

missing a '

#

probably put it in the wrong place

next flax
#

missing a '
@faint prism where

opal plank
#

not missing

#

not ESCAPING

#

template literals only need 2 ``

umbral zealot
#

not knowing basic javascript syntax

#

that's the problem

#

learn about how template literals work

faint prism
next flax
#

Hey I m new to JS
๐Ÿ˜„

thick gull
#

And need a name
@honest perch mislee

#

easy to say, rolls off your tongue, and feeds your ego

#

oh you already said mislee it is

orchid vortex
#

whats the best way to implement git connection within a nodejs bot, on a linux ubuntu 16.04 machine

earnest phoenix
#

${sampiyon[hah.freeChampionIds].slice(0,20).join('\n')}

TypeError: Cannot read property 'slice' of undefined
#

So how else can I change the values of hah.freeChampionIds?

next flax
earnest phoenix
#

like replace

orchid vortex
#

hm i see that uh

faint prism
#

Yeah, sampiyon[hah.freeChampionIds] the object at that index doesn't exist in that array if it's undefined

orchid vortex
#

first off to use ${} youve gotta use `` notation

next flax
#

oh that

#

wait for that

#

i m trying custom

#

message

orchid vortex
#

custom what

next flax
#

for welcome

#

message

earnest phoenix
#

@faint prism How can I replace hah.freeChampionIds values?

orchid vortex
#

${sampiyon[hah.freeChampionIds].slice(0,20).join('\n')}

TypeError: Cannot read property 'slice' of undefined

@earnest phoenix it may also be the situation such that that hah.freeChampionIds is also an array

#

what is freeChampionIds

umbral zealot
orchid vortex
#

ill need to know that to be able to help

earnest phoenix
#
{"freeChampionIds":[3,14,23,25,38,44,45,48,54,58,79,104,110,119,238],"freeChampionIdsForNewPlayers":[18,81,92,141,37,238,19,45,25,64],"maxNewPlayerLevel":10}
faint prism
#

Replace them?

earnest phoenix
#

yeah

faint prism
#

Well the index is 0 -> arr.length

#

so use a for loop

earnest phoenix
#

As if it would write Test if the value is 3

orchid vortex
#

alright so obviously you need to also have an index there at
[hah.freeChampionIds]
^ here

#

now what index, you'll define that yourself

#

try putting just [0] at the end, it will work

#

but thats just gonna give you the first id

earnest phoenix
#

I want to draw all the strings

orchid vortex
#

then use a for loop

earnest phoenix
#

If I write things like [0] [15] it will give an error if there is no 15th value.

#

I'll try to use loop

orchid vortex
#
for (let i = 0; i < hah.freeChampionIds.length; i++)
  // some code that uses that "i"
earnest phoenix
#

i'm trying now okay.

orchid vortex
#

back to my question if anyone can help:

earnest phoenix
#

I will use push

faint prism
#
myArr = [3, 5, 3, 5, 3]
for (i = 0; i < myArr.length, i++) {
  if (myArr[i] === 3) { myArr[i] = 5; }
}

Would set everything to 5 in this instance

orchid vortex
#

whats the best way to implement git stuff on a nodejs bot on ubuntu16.04

umbral zealot
#

what "git stuff"

orchid vortex
#

git pull mainly

umbral zealot
#

probably using child_process

orchid vortex
#

and be able to interact with that stuff in code

#

uh

#

okiguess

faint prism
#

Yeah child_process allows you to use exec iirc

umbral zealot
#

"interacting" with it though is going to be much harder.

orchid vortex
#

obviously yes

faint prism
#

You'd have to redirect std out and std in

umbral zealot
#

you would be fairly limited to commands that don't require input

orchid vortex
#

so im just looking for being able to pull rn

#

thanks

slender thistle
#

local websockets!

earnest phoenix
#
const aktiviteler = [];
for (var i = 0; i < hah.freeChampionIds.length; i++) {
switch (hah.freeChampionIds[i]) {
case  `${hah.freeChampionIds[i]}`: 
aktiviteler.push(`${hah.freeChampionIds[i]}`);
break;
  }
}
embedx.addField('ลžampiyonlar', aktiviteler.length ? aktiviteler.join("\n") : "Yok.")

I've tried but it doesn't work.

faint prism
#

uh

orchid vortex
#

uh

earnest phoenix
#

:d

orchid vortex
#

whats that use of switch case

faint prism
#

you're using indexes wrong lol

orchid vortex
#

why is that use of switch case

faint prism
#
const aktiviteler = [];
for (var i = 0; i < hah.freeChampionIds.length; i++) {
    aktiviteler.push(`${hah.freeChampionIds[i]}`);
  }
}
embedx.addField('ลžampiyonlar', aktiviteler.length ? aktiviteler.join("\n") : "Yok.")

Just gonna delete that for you lmao

orchid vortex
#

thanks

earnest phoenix
#

ok working

#

my fault

#

thx boys

next flax
#

how can i make the field thing above description

earnest phoenix
#

can you send the code

#

there is probably no such variable

next flax
#

ok

#
  .setImage("attachment://hello.png")
  .setThumbnail(member.user.avatarURL())
  .addField("Welcome", `<@${member.user.id}>`)
  .setDescription(db.get(welmessage) );```
faint prism
#

Or you're just printing the string

earnest phoenix
#

we need to see this

next flax
#

hm wait lemme send u full code

faint prism
#

no no

#

that's fine

next flax
#

kk

#

its for mentioning the welcomed user

faint prism
#

I get that

#

try replacing the ` with '

next flax
#

k

#

field right @faint prism

#

or description

faint prism
#

the field

next flax
#

done

faint prism
#

Tbh idk how to do JS string interpolation, so you can just do '<@' + someVariableHere + '>' instead

#

which is using ` and not '

#

Oh well. Go which ever route

pale vessel
#

you can use `${member}`

#

or member.toString() without `

#

with?

faint prism
#

just ask

pale vessel
#

you need to tell us what you need help with bruh

faint prism
pale vessel
#

you'll only need to wait, luca will dm you regarding your bot approval, if that's what you mean

#

๐Ÿ‘Œ

modest smelt
#

hey everyone

#
    def createFolder(directory):
        try:
            if not os.path.exists(directory):
                os.makedirs(directory)
        except OSError:
            print ('Error: Creating directory. ' +  directory)
            

    # Example
    createFolder('.\\'+ str(guild.id) +'\\')
#

my code is not working for some reason

#

im tryna make my bot such that when the bot joins the guild it makes a new directory with the guild id as the name of the directory

#

pls help me

thick gull
#

is that a file like json database pepowot

modest smelt
#

its python?

thick gull
#

oh

#

atShiv python

modest smelt
#

Auger have any clue?

faint prism
#

It's a File based database :goodgod:

thick gull
#

sorry I like harassing people over json

faint prism
#

Auger have any clue?
@modest smelt Not a python dev, sorry

modest smelt
#

ok

faint prism
#

Are you doing this to store data?

earnest phoenix
#

How do I create folders with python on repl.it?

#

This is my code currently:

#
import discord
from discord.ext import commands
import os

client= commands.Bot(command_prefix=['bob,', 'b,'], case_insensitive=True)

@client.event
async def on_ready():
  print(f'Logged in as {client.user}')

@client.event
async def on_guild_join(guild):
  idofguild= str(guild.id)
  number= guild.id
  path = '/'
  path += idofguild
  os.makedirs(path)

I need help, it's not creating a folder.

next flax
faint prism
#

Hey Augger I Tried what u said ๐Ÿ˜„ but now it came as
@next flax send code again

next flax
#
  .setImage("attachment://hello.png")
  .setThumbnail(member.user.avatarURL())
  .addField("Welcome", '<@${member.user.id}>')
  .setDescription(db.get(welmessage) );```
faint prism
#

It looks the same as the first time

umbral zealot
#

Still not using template literals

next flax
#

now see

#

whats that @umbral zealot

umbral zealot
#

I've pointed you to this twice already

#

go read it

faint prism
#

Still not using template literals
@umbral zealot I may have mislead him on that accidentally

drifting wedge
#

invoke_without_command=True

faint prism
#

be patient

drifting wedge
#

what is this tag?

earnest phoenix
#

oh sry

earnest phoenix
#

hi i really need help

#

creating the folder

next flax
#

u can do like

#

/folder/file.py

#

and upload ur files

#

once your files are uploaded

umbral zealot
#

Dude you don't even know JS, it's probably not a good idea to try to help people with their python problems.

faint prism
#
async def on_guild_join(guild):
  idofguild= str(guild.id)
  number= guild.id # get rid of this
  path = '/' # this means root directory, which is NOT what you want probably
  path += idofguild
  os.makedirs(path)
#

@earnest phoenix

next flax
#

Dude you don't even know JS, it's probably not a good idea to try to help people with their python problems.
@umbral zealot that isnt py problem

#

bro

#

thats just a basic faq

umbral zealot
#

They're wanting to create a file dynamically, you're talking about uploads, clearly you misunderstood what the problem even was. smh.

next flax
#

atleast i tried to help

earnest phoenix
#

Oh thanks

inner wharf
#

[discord.py] Anyone know of a way to see if the bot has finished playing music? I am currently using

voice.play(FFmpegPCMAudio(executable='./ffmpeg/bin/ffmpeg.exe', source='song.wav'),
                   after=lambda e: nextQueue(Queue[0]) if len(Queue) > 0 else print("Finished Queue"))

And this would normally work, but I need to await the function and I can't do that through lambda. So, is there any other way to see if the audio has ended?

peak osprey
#
{ name: 'Account Age', value: message.member.user.createdTimestamp, inline: true },```
#

why is it showing seconds?

celest schooner
#

try createdAt

peak osprey
#

ok

#

it works now

celest schooner
peak osprey
#

im dumb

earnest phoenix
#

nobody can help me with a problem?

celest schooner
#

createdTimestamp is the miliseconds from Jan 1st 1970

#

i think

peak osprey
#

oh

#

ok

celest schooner
#

@earnest phoenix whats the problem

earnest phoenix
#

TypeError [INVALID_TYPE]: Supplied roles is not a Role, Snowflake or Array or Collection of Roles or Snowflakes.

celest schooner
#

what line

earnest phoenix
#
if (!message.guild.roles.cache.find(c => c.name === 'Muted')) {
        message.guild.roles.create({
              name: 'Muted',
              color: '#ff0000',
              permissions: {
                    SEND_MESSAGES: false,
                    ADD_REACTIONS: false
              }
        })
    
    };```
#

i think this is problem

celest schooner
#

hm

umbral zealot
#

probably. this is a promise, if you don't await it, it may resolve after the rest of the code

celest schooner
#

ยฏ_(ใƒ„)_/ยฏ

earnest phoenix
#

thx

peak osprey
#
{ name: 'Highest Role', value: message.member.guildMember.roles.highest, inline: true },```
#

im back my second part of the code isnt working

umbral zealot
#

pretty sure member.guildMember isn't a thing

#

if that's discord.js, it's literally mesage.member.roles.highest

celest schooner
#

yea message.member is guildMember

peak osprey
#

ah ok

celest schooner
#

theres no guildMember property of guildMember

earnest phoenix
#

Hey I have another question.

Like there is a member:discord.Member is there a channel: discord.Channel?

#

also, if not, how would i get the id of a mentioned channel

#

Help!

#

Accident sry

twilit rapids
#

-atmods @earnest phoenix

gilded plankBOT
#

@earnest phoenix

Please do not mention (ping) more than one or two moderators for help, unless there is an emergency.

Here are some examples of emergencies:

  • Raids / Multiple members mass spamming.
  • Severe disruption of Discord's ToS (NSFW content, etc)
  • Anything that requires more than 2 moderators to handle.
flat pelican
#

...

twilit rapids
#

Deleting it afterwards doesn't help at all

earnest phoenix
#

I am sorry, it was an accident

flat pelican
#

yeah sure

glad charm
#

ghost pinging

tight plinth
#

imagine pinging mods

faint prism
#

Uhoh

slender thistle
earnest phoenix
#

thanks

remote kernel
#

[discord.js] can someone answer this question i dont want to use the setInterval function for this since that ruins it one restarted
https://stackoverflow.com/questions/64048103/how-can-i-make-my-discord-js-bot-send-messages-at-specific-times

earnest phoenix
#

@earnest phoenix how the hell does one "accidentally" ping a whole role

#

i meant to ping user

#

but accidentally clicked one down

tight plinth
#

@remote kernel you have to use setinterval sadly

#

or learn js and programming in general to know other methods that were not gonna spoonfeed u

faint prism
#

or base it around specific times of the day

quartz kindle
#

@remote kernel the problem is not setInterval

#

the problem is that you want your program to remember something the next time it starts

#

that can only be done by saving data somewhere outside the program, for example a config file or a database

faint prism
#

If you want to persist across program restarts, you need to store data in the secondary storage instead of memory

#

So an approach could be: When the setInterval function is called, update persistent storage with the current time

#

And when the script is run next, check if that time + interval has elapsed, if so, do the setInterval's function

eternal osprey
#

hey

#

how do i fix this

#

like

#

how do i remove the !

slender thistle
#

How are you getting the message content

faint prism
#

substring

#

you're probably just posting the entire msg content

#

you need to cut off the prefix

eternal osprey
#

queueMessageText += ' ' + message.content.slice(prefix.length).replace(/^tweet/, '').trim()

#

like this?

faint prism
#

+= ' ' + this looks unnecessary as opposed to =

#

but the rest looks like it'll work

eternal osprey
faint prism
#

That's not what you want...?

#

oh the "new tweet"

#

yeah then what you had works fine then

drifting wedge
#

@placid iron gg on getting darling verified, also how did u get the rounded rectangle?

placid iron
#

thanks, and stack overflow XD

drifting wedge
#

i looked it up

#

1 sec

#

@placid iron this one?

#

i checked it out

#

didnt understand it

#

wanna see if it works

fast trench
#

How would you go about making it so you can do @botname command and it uses the mention as an alternative prefix? I've been wanting to for a while but I have no idea where to start...ping me with ideas

drifting wedge
#

@fast trench add @mention as a prefix

#

if u get it lmk

eternal osprey
#

hey

drifting wedge
#

also how can i make a on mention event?

eternal osprey
#

this doesn't work for some reason?

#

queueMessageText += ' ' + message.content.slice(prefix.length).replace(/^tweet/, '').trim()

drifting wedge
#

i looked it up on docs

#

but i couldnt find anything

placid iron
#

i mean yeah you could do that ๐Ÿ‘Œ try it and see

eternal osprey
drifting wedge
#

@fast trench

placid iron
#

cant you just split it at the first space then join all the remaining words

faint prism
#

Why don't more people use chrome dev tools or something when testing JS?

drifting wedge
#

you can do *, arg

#

@eternal osprey
if u using dpy

placid iron
#

he is using js

eternal osprey
#

i am using js

faint prism
fast trench
drifting wedge
#

no sty

#

sry

#

stack overflow might tgo

polar carbon
#

Hello

fast trench
#

all good

faint prism
#

queueMessageText += ' ' + message.content.slice(prefix.length).replace(/^tweet/, '').trim()
@eternal osprey so that definitely works, you shouldn't be getting what you posted in the screenshot

polar carbon
#

Is Glitch Banned

drifting wedge
#

how can i run code when the bot is mention

#

Is Glitch Banned
@polar carbon no

#

tho make it private

faint prism
#

how can i run code when the bot is mention
@drifting wedge on msg event check if it had a mention of your bot

#

Mentions is a msg property

#

Or check the content for your bot id

eternal osprey
#

hmmm

polar carbon
#

Can we help me? I want to make a boat

eternal osprey
#
lient.on('message', message=> {
    const args = message.content.trim().split();
    queueMessageText= ('A new tweet has been posted by you: ' + args)
    queueMessageText += ' ' + message.content.slice(prefix.length).replace(/^tweet/, '').trim()
   
    
    if (message.content === (prefix + 'tweet') || message.author.bot) return;

     T.post('statuses/update', { status: args }, function(err, data, response) {
        console.log(data)
        message.channel.send(queueMessageText)
      }```
faint prism
#

Can we help me? I want to make a boat
@polar carbon check the #502193464054644737 it'll tell you how

quartz kindle
#

no, he wants to make a boat

fast trench
#

I like boats

faint prism
#

Oh sorry lol

eternal osprey
#

A new tweet has been posted by you: !tweet test tweet test

#

this is what i get back

faint prism
#

A new tweet has been posted by you: !tweet test tweet test
@eternal osprey did you save and restart bot?

eternal osprey
#

yeah

marble juniper
#

I like boats

quartz kindle
#

@eternal osprey remove args lol

#

that makes no sense there

eternal osprey
#

it does

#

so people can input what they want to send

quartz kindle
#

you're already doing it

#

in the line right after

eternal osprey
#

let me try

#

owh yeah

#

but

#

that gives me status i a duplicate message?

quartz kindle
#

first of all, .split() does nothing, just makes it into an array, but doesnt actually split anything, idk what you're trying to do with it

#

and idk what your T.post does

eternal osprey
#

nvm

#

i got it

stable eagle
#
           return message.channel.send(nowinners)
        })```
why does this not return the error message
eternal osprey
#

it is just the twitter api

quartz kindle
#

@stable eagle it will send the message if the reaction fails, because of an error or permission issues

stable eagle
#

but uh, it also sends the message i dont want to be sent due to the error

quartz kindle
#

yes, because its async

#

its executed in a different context, by the time the catch runs, the outside code is already long gone

#

if you want to stop your code to wait for it, you have to use await

eternal osprey
#

it worked

#

but it still posts !tweet tto

#

too*

#

to twitter

#

in discord !tweet doesn't show

#

however in twitter it posts like this

faint prism
#

are you posting msg.content

#

make sure you're posting the correct variable

earnest phoenix
#

post args.join(" ");

#

it will remove the whole command and prefix for u

tall sentinel
#

What should I add to my Karen Bot? I am trying to think of some commands

faint prism
#

What should I add to my Karen Bot? I am trying to think of some commands
@tall sentinel a help command

tall sentinel
#

I already have one

dire obsidian
#

karen!call-the-manager

faint prism
#

That's all you need mmLol

tall sentinel
#

I have something similar to that as well, when you do k!manager the bot yells at you for your manager

#

And you can send her to other members and make her ask for their manager

#

You can also shoot people but that's not the point-

faint prism
#

Is the manager the admin? l0l

#

That'd be kinda a funny bot to basically be an atmods tbh

fast trench
#

can someone walk me through making regex work with mentioning my bot so it's used as a prefix also?

faint prism
fast trench
#

like I said...can someone walk me through it and help me learn? I am terrible at learning from websites

tall sentinel
#

Is the manager the admin? l0l
@faint prism
Hmm..I could make them the manager zoomeyes

sterile lodge
#

how do i remove a role from a user by just the roles id

faint prism
#

Repurposing your bot to be an atmods would be pretty nice imo

elder thicket
#

https://www.nodexr.net/ this is pretty cool too if you like working with nodes and more of a visual thing

faint prism
#

oh sweet dotnet

elder thicket
#

yup

faint prism
#

oh wow

elder thicket
#

open source too

faint prism
#

that's pretty sick

elder thicket
faint prism
#

I'm bookmarking that

elder thicket
#

lol

tall sentinel
#

lol

#

Wait, I might make a command that allows you to add a manager role to someone zoomeyes

#

I'm so doing that

elder thicket
#

why not make a command that you can add any role to given user?

faint prism
#

yeh, gib mi admun roll

tall sentinel
#

Lmao

#

I will do some more to the bot after my Zoom meeting lol

eternal osprey
#
const args = message.content.trim().split();
  queueMessageText= ('**A new tweet has been posted by you: **')
  queueMessageText += ' ' + message.content.slice(prefix.length).replace(/^tweet/, '').trim()
 
  
  if (message.content.startsWith === (prefix + 'tweet') || message.author.bot) return;



  if (message.channel.id == '734123034243367002'){
   T.post('statuses/update', { status: args }, function(err, data, response) {
      console.log(data)
      message.channel.send(queueMessageText)
    }
  
#

why does it sstill post twitter messages

#

eventhough i am not using my prefix !tweet

hybrid roost
#

Hey! I am saving Message ID (channel ID too).
And I need to get this message after server reboot.

How can I do this?

sudden geyser
#

Like fetch a message by ID?

hybrid roost
#

I know, bot has no access to messages, written before his reboot

#

Like fetch a message by ID?
@sudden geyser hm, I think so

sudden geyser
#

What library are you using

hybrid roost
#

DiscordJS

#

I am trying

bot.channels.cashe.get(chID).messages.cache.get(msgID)

but it returns undefinded

sage bobcat
#

One message removed from a suspended account.

sudden geyser
#

Use <TextChannel>.channels.fetch

sage bobcat
#

One message removed from a suspended account.

sudden geyser
#

If chID was undefined it would throw an error instead

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

hybrid roost
#

ugh

#

it is mistake in message

#

I don't copy it

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

hybrid roost
#

nvm?

#

Sorry, my English skills are so bad :p

#

If chID was undefined it would throw an error instead
@sudden geyser no, chID not undefended. But message is

#

Use <TextChannel>.channels.fetch
@sudden geyser maybe TextChannel.messages?

sudden geyser
#

If you want to fetch a message by ID, you should use <TextChannel>.channels.fetch(...)

hybrid roost
#

So it gonna looks like

bot.channels.cache.get(chID).messages.fetch(msgID)
```?
sudden geyser
#

try it

#

should work

hybrid roost
#

OK, one moment

faint prism
#

why does it sstill post twitter messages
@eternal osprey T.post('statuses/update', { status: args }
is args the same as msg.content

#

because if so, that explains why

eternal osprey
#

t.post

#

sends the message to twitter

#

const args = message.content.trim().split();

#

this is my args defined

faint prism
#

Well don't you want it to not include the prefix ..?

#

Why are you sending it the message.content That's still includes the prefix?

#

Wouldn't that mean that's the cause of your issue?

eternal osprey
#

i just want the bot to only work on commands !tweet

hybrid roost
#

should work
@sudden geyser yes, it work. BUT. It return Promise, so code looks like

bot.channels.cache.get(data.channel).messages.fetch(data.id).then(message=>{});
eternal osprey
#

now it literally works on every message i send

#

auger

#

that was my older question ๐Ÿ˜‰

faint prism
#

Then check if msg starts with a prefix

sudden geyser
#

You need to resolve the promise then.

faint prism
#

if msg.content.startsWith(prefix) { doCommand(); }

hybrid roost
#

You need to resolve the promise then.
@sudden geyser

  1. how can I resolve it
  2. nothing matter. It still work how I need
sudden geyser
opal plank
#

gotta add youtube next

sudden geyser
#

Looks good, but I feel there's a missing sense of location.

faint prism
#

You keep flexing your grafana dashboard

opal plank
#

lmao

#

im 100% gonna keep flexing it

#

theres so much good data in it

faint prism
#

Keep that up and I'll make one too

opal plank
#

competition is always welcome

#

pushes me to get to higher grounds

hybrid roost
orchid vortex
#

btw you can always use ๏ฝ’๏ฝ…๏ฝ‡๏ฝ…๏ฝ˜ for prefix stuff to be professionally unprofessional

opal plank
#

@orchid vortex If you regex your prefix you dont deserve to be called a dev

white vapor
#

is there any other free without paid items hosting

opal plank
#

startsWith()
indexOf()
substring(1) === ''
So many freaking methods

#

and you decide to use regex

orchid vortex
#

yes, because its better than startsWith()

#

to be honest, it is

opal plank
orchid vortex
#

and you can easily have multiple prefixes and all that stuff

opal plank
#

i guess i'll have to do another loop

#

-.-

orchid vortex
#

i mean, i just prefer it

opal plank
#

it doesnt matter

#

your prefixes should be mapped

orchid vortex
#

can i just like have my own preference

opal plank
#

unrelated

#

no

orchid vortex
#

mapped?

opal plank
#

yes

orchid vortex
#

elaborate

charred owl
#

where can i find my DBL token

orchid vortex
opal plank
#

you should have your prefixes mapped, the way you search for prefixes in a string is unrelated to prefixes

orchid vortex
#

mapped in what way

opal plank
#

Map()

orchid vortex
#

yes, and where

opal plank
#

or indexed some other form

orchid vortex
#

and why

opal plank
#

cuz indexers?

#

and speed?

#

in memory?

cinder patio
#

Probably in an array

orchid vortex
#

well thats what i use, an array

opal plank
#

map is likely better for indexing

orchid vortex
#

likely is

cinder patio
#

What's your goal wulfey?

orchid vortex
#

goal? wdym goal

opal plank
#

i'll actually run a test

#

brb

cinder patio
#

What do you want to achieve

orchid vortex
#

im not a like professional developer wannabe or something

#

yet

#

really just wanna have some cool 2d minecraft action going on, to be able to show it to my few friends

autumn aspen
#
const Discord = require("discord.js");
const bot = new Discord.Client({
    partials: ["MESSAGE", "CHANNEL", "REACTION"]
});
const botconfig = require("./botconfig.json");
const fs = require("fs");
bot.commands = new Discord.Collection();

fs.readdir("./commands/", (err, files) => {
    if (err) console.log(err);
    let jsfile = files.filter(f => f.split(".").pop() === "js");
    if (jsfile.length <= 0) {
        console.log("Couldn't find commands.");
        return;
    }
    jsfile.forEach((f, i) => {
        let props = require(`./commands/${f}`);
        console.log(`${f} loaded.`);
        bot.commands.set(props.help.name, props);
    });
});

bot.on("ready", async () => {
    console.log(`${bot.user.username} is online!`);
    bot.user.setActivity("your empire | ?help", { type: "WATCHING" });
});

bot.on("message", async message => {
    if (!message.content.startsWith(botconfig.prefix) || message.author.bot)
        return;
    if (message.channel.type === "dm") return;

    let prefix = botconfig.prefix;
    let messageArray = message.content.split(" ");
    let cmd = messageArray[0];
    let args = messageArray.slice(1);

    let commandfile = bot.commands.get(cmd.slice(prefix.length));
    if (commandfile) commandfile.run(bot, message, args);
});

bot.login('');

Why is it wrong?

sudden geyser
#

Aren't you the one who wrote it and ran into an issue?

#

Tell us what's wrong with it.

white vapor
#

is there any other free without paid items hosting

#

I think Heroku is having maintenance

restive furnace
#

getavps.net and probably readthepins.io

opal plank
#

regex is the least performant

#

indexOf() seems the best one

#

actually substring is a bit better

sudden geyser
#

I'd rather use .startsWith(...) tbh

#

Just to convey meaning & convenience rather than the 1 ms difference.

opal plank
#

like, from all the options you decide to regex prefixes, custom ones at that

#

its the worst option for custom prefixes

sudden geyser
#

ah

#

and for user-defined prefixes probably worse

opal plank
slender thistle
#

I prefer to not use regex unless when forced to

faint prism
#

lmaoo

opal plank
#

regex can cause quite a big impact depending on what you use it for

slender thistle
#

Yup

faint prism
#

neither sites exist
@white vapor readthepins works for me

slender thistle
#

I sure as hell don't want to sleep regexes everywhere

sudden geyser
#

Ah yes, parsers entirely in regex

faint prism
#

werks

white vapor
autumn aspen
#

HAHAHHAAH @slender thistle got demoted

#

what did u do

slender thistle
#

Requested to go on a break

faint prism
#

nah it works

autumn aspen
#

oh

faint prism
white vapor
#

is there a way to disable web helper

slender thistle
#

But I love you too โค๏ธ

opal plank
#

readthepins.io it works for me too jeremy. Have you tried turning your internet on and off?

white vapor
#

is there a login url for it cuz just searching it redirects me

opal plank
#

what?

faint prism
white vapor
#

is readthepins not suitable

opal plank
faint prism
quartz kindle
#

LOL

opal plank
#

bruh theres a limit of how innocent you can be

white vapor
#

im literally just gonna get help somewhere else

faint prism
#

aw come on

opal plank
#

read

#

the

#

pins

faint prism
#

It's in the pins man

opal plank
#

the pinned messages in this channel

quartz kindle
opal plank
#

the fancy pin icon the top right

faint prism
#

My cursor is the best of all of us btw

slender thistle
#

Use repl.it if you don't like heroku

opal plank
white vapor
#

i like heroku its just having maintenance thats why

opal plank
#

custom cursors

#

if your cursor doesnt have flames and leaves sparkles all over the screen like in 2008 you aint doing custom cursors right auger

faint prism
#

it's just cyan

#

you're right

#

I'm gonna make it a OSRS dragon scimmy

opal plank
#

bet

quartz kindle
#

i wish i still had screenshots of my 2005-2006 desktop

#

shit was wild yo

opal plank
#

it was all miniclip

orchid vortex
#

regex was just the easiest for me to use if i wanted **can you like** to be a prefix

opal plank
#

ALL of it

#

fliperama and miniclip

orchid vortex
#

i mean i need to get creative here if i wanna use indexof for that stuff

opal plank
#

30 minutes loading one website with dialed internet

#

its not even about creativity

quartz kindle
#

xD

opal plank
#

imagine this

faint prism
#

ngl I'm afraid to google "free cursor icons"

orchid vortex
#

imagine being a good fucking developer

opal plank
#

let reg = /prefix/

orchid vortex
#

thats what i need

opal plank
#

how you gonna add custom prefixes there?

orchid vortex
#

easy

opal plank
#

you gonna create regexes on the go?

#

rather than just comparing the strings?

white vapor
#

oh i finally got the joke haha so funny thank you shivaco for actually helping

orchid vortex
slender thistle
#

i mean i need to get creative here if i wanna use indexof for that stuff
@orchid vortex use substring

faint prism
orchid vortex
#

i mean, this works just fine

orchid vortex
#

and is loaded only once

#

yes i know

opal plank
#

having 11 event listeners on message with a single command each also works

#

'but it works' isnt a valid excuse for a good dev

pale vessel
#

don't give them ideas

orchid vortex
#

damn, cant even use regex

#

cant have shit in detroit

opal plank
#

having a 71 long chain of if's is also a valid option for command handling

#

ยฏ_(ใƒ„)_/ยฏ

#

the whole point of being a dev is improving your code

orchid vortex
#

its a valid option, but not a good option

opal plank
#

and learning with mistakes

#

same for regex

white vapor
#

just realized i spent 20 minutes on that joke

opal plank
#

rather than just taking a tip of how to improve the code

#

you just throwing 'but it works'

orchid vortex
#

alright - now i beg you to shut the fuck up because i want to forcibly end this conversation, thanks

opal plank
orchid vortex
#

thanks

autumn aspen
#

guys what is the command for if someone mention any IDs its will respond so I wont get any errors

opal plank
#

huh?

autumn aspen
#

Like when a guy tried to mention someone to kick with the ID I got an error

opal plank
#

theres no command for mentions
message has a property mentions in it that you can access, its a map

slender thistle
#

Strip away <@ and <@! from the left

opal plank
#

or Collection<> i never know wtf d.js has with maps and their collections

slender thistle
#

strip > from the right

opal plank
#

this is good case for regex

slender thistle
#

you got an ID out of a mention

#

How fucking hard is it to use subtring instead of regex

opal plank
#

length

#

and making sure theres only numbers in between

autumn aspen
#

but how

opal plank
#

you could do regex or substring(indexof(<@), indexof(>))

#

but if there are 2 mentions

autumn aspen
#

but hwo

#

ow

opal plank
autumn aspen
#

ok

slender thistle
#

I'm sorry but how would indexOf("<") work

#

<@

opal plank
#

indexOf() returns the index of it

slender thistle
#

fucking keyboard

opal plank
#

substring(index start, index end)

#

so you'd be replacing the first and last index with indexOf()

slender thistle
#

I meant a string with more than one char as param for indexOf

earnest phoenix
#

@slender thistle if indexof returns -1 means it doesnt exist

quartz kindle
#

thats actually smart, havent thought of using indexof like that

slender thistle
#

I am familiar with everything you both said

#

But

#

I meant a string with more than one char as param for indexOf
@slender thistle

opal plank
#

indexOf() is a string, its length can be anything shiv

slender thistle
#

This isn't clear to me

opal plank
#

indexOf('string')

slender thistle
#

No shit, how does it behave is what I'm asking

opal plank
#

oh

cinder patio
#

But what would it return? It can't return 1 index

opal plank
#

compiler wise im not sure

autumn aspen
#
if (message.mentions.users.first().id === '@') return msg.channel.send("");```
fervent goblet
#

I have never made a function in a separate file before and i was wondering how i would call my client in it discord.js

autumn aspen
#

like this?

opal plank
#

thats the issue

#

with regex you'd have a better time

#

cuz you can do .test() first

#

for indexOf() you'd have to do 2 checks for -1

autumn aspen
#

erwin is right

opal plank
#

which is when it wasnt found

autumn aspen
#

is it

#

I mean

#
if (message.mentions.users.first().id === '@') return msg.channel.send("");```
slender thistle
#

why

#

compare

#

an ID

#

against @

autumn aspen
#

lmao

cinder patio
#

Are you literally comparing the id with @ or is it just a placeholder for an id?

slender thistle
#

this

obtuse niche
#

He is comparing

autumn aspen
#

but what instead if u like type any ID I got an error and I want to stop that

slender thistle
#

Wh a t i s t h e e r r o r

autumn aspen
#

wait

shy turret
#

is it possible to shard on multiple nodes ๐Ÿค”

quartz kindle
#

yes

shy turret
#

im assuming wait what how

autumn aspen
#
TypeError: Cannot read property 'id' of undefined
    at Client.<anonymous> (C:\Users\admin\reportbot\index.js:100:43)
    at Client.emit (events.js:315:20)
    at MessageCreateAction.handle (C:\Users\admin\reportbot\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Users\admin\reportbot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (C:\Users\admin\reportbot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
    at WebSocketShard.onPacket (C:\Users\admin\reportbot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (C:\Users\admin\reportbot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
    at WebSocket.onMessage (C:\Users\admin\reportbot\node_modules\ws\lib\event-target.js:125:16)
    at WebSocket.emit (events.js:315:20)
    at Receiver.receiverOnMessage (C:\Users\admin\reportbot\node_modules\ws\lib\websocket.js:797:20)
#

error

#

I got

obtuse niche
#

Hastebin

shy turret
#

@autumn aspen id is undefined

#

line 100

faint prism
#

@shy turret
<object>.id the object is undefined

white vapor
#

are free trials ok for temporary issues

shy turret
#

what is your code line 100?

#

@autumn aspen

autumn aspen
#

here look ยดยดยดjs

shy turret
#

@faint prism ikr

autumn aspen
#

oops

#
if(cmd === 'kick'){
        if(!args[0]) return msg.channel.send('Please mention someone to kick.\n\n:warning: `You cant use IDs until its updated!`');
        
        if(!msg.member.hasPermission('KICK_MEMBERS')) return msg.channel.send(":x: **You don't have permission to kick members!** :x:");
        if (message.mentions.users.first() === message.author) return msg.channel.send(":x: **You can't kick yourself!** :x:");
        if (message.mentions.users.first().id === '731927983274721301') return msg.channel.send(":x: **You can't kick me!** :x:");
        let toKick = msg.mentions.members.first();
        let reason = args.slice(1).join(" ");
shy turret
#

what's line 100 ๐Ÿค”

autumn aspen
#

Hm how am I suppost to put em in order'

#
if (message.mentions.users.first().id === '731927983274721301') return msg.channel.send(":x: **You can't kick me!** :x:");
        let toKick = msg.mentions.members.first();```
faint prism
#

if (message.mentions.users.first().id === '731927983274721301')
hardcoding your bot id

shy turret
#

if (message.mentions.users.first().id === '731927983274721301') return msg.channel.send(":x: **You can't kick me!** :x:"); is my geuss

autumn aspen
#

@shy turret

#

there

shy turret
#

um

white vapor
#

are free trials ok for temporary issues

faint prism
#

are free trials ok for temporary issues
@white vapor what does that even mean

opal plank
#
let str = '@untold widget';
if(/<@โ€‹!?(\d+)>/.test(str)/*returns true or false if a match is found*/) {
//if true
let id = str.match(/<@โ€‹!?(\d+)>/)[1]
} 
// using indexOf
let str = '@untold widget';
if(indexOf('<@') !== -1 && indexOf('>') !== -1) {
//indexOf('string') returns the index of the param. if it isnt found, it returns -1
let mention = str.substr(indexOf('<@', indexOf('>'))) /* and hope its all numbers in between*/
//extra check
if(isNaN(parseInt(mention))) { /*the mention isnt composed of numbers, false positive*/}
}
``` @slender thistle
white vapor
#

heroku is having network problems or something

opal plank
#

hope that helps a bit

slender thistle
#

You couldn't write a proper fucking message without JS comments for a mobile user, could you?

shy turret
#

@autumn aspen try .cache?

opal plank
#

here then lmao

slender thistle
#

I'm kidding

opal plank
rancid sand
#

hey guys if there a way to load only the mobile version of a website when using fetch?

opal plank
#

there ya go

#

pretty

slender thistle
#

ly

opal plank
#

Yw

autumn aspen
#

@autumn aspen try .cache?
@shy turret where

opal plank
#

with the regex you already have a +d there checking for ONLY digits

faint prism
#

hey guys if there a way to load only the mobile version of a website when using fetch?
@rancid sand Try sending a mobile User-Agent in the request header