#development

1 messages ยท Page 1712 of 1

eternal osprey
pale vessel
#

So I think URL class is redundant on this one

earnest phoenix
tardy hornet
earnest phoenix
#

i use topgg-autoposter

copper cradle
#

ah yes I need my token for X website, I probably need to check it on Y website

earnest phoenix
#

so if dblapi.js will not work you could try that module

narrow steeple
#

What can bot vote do?

eternal osprey
#

hey message.guild.channels.delete(channel1) returns Uncaught TypeError: message.guild.channels.delete is not a function

#

i thought that this was the v12 way to do it>?

pale vessel
#

You use channel.delete()

#

You can't delete through the manager

eternal osprey
#

so in my case: channel1.delete()

pale vessel
#

Yeah

eternal osprey
#

okay lovely!

#

owh my bad, one last question.. how do i get someones id by just his username?

#

for example an array like this:

#

i want to get the ids of all the users in the array

earnest phoenix
#

Thing is username isn't unique

eternal osprey
#

yeah i figured that

#

but it's allright

earnest phoenix
#

so it s not the best ideea

#

but if you need it try something like this

eternal osprey
earnest phoenix
#
guild.members.cache.find(member => member.user.username === 'Steve')
#

name or username

#

i think

#

xd

eternal osprey
#

lovely... i love you!

#

thanks

earnest phoenix
#

np

eternal osprey
#

it's username.

earnest phoenix
#

yea

#

my bad

#

xd

eternal osprey
#

np, i love you for the help you've given me!

earnest phoenix
#

tell me if is working

pale vessel
#

member.user.username

lusty quest
#

i would just work with mentions, is probably a bit more reliable

#

sure names are fun, until you have 12 people with the same name in one guild

crimson vapor
#

does language support on a discord bot actually make any sense?

pale vessel
#

If it's a big bot I guess

lusty quest
#

i have it, where a pain in the ass to setup, but it works sortof

pale vessel
#

but if the majority of users can read english, then no

lusty quest
#

some stuff i cant really localize like getting memes from r/memes

crimson vapor
#

yea

eternal osprey
#

hmm yeah i get the issue

crimson vapor
#

issue for me is that some languages are built differently

eternal osprey
#

1 last question before i fuck off

crimson vapor
#

like sentence contruction

#

so one input wouldn't work the same

pale vessel
#

Didn't you use something like "WELCOME": "Welcome, {}!"

lusty quest
#

i support Bulgarian with my bot, did the first translation with google translate, and a friend of mine is Bulgarian who Proofread it

eternal osprey
#

so i am foreaching the array to get all the users: . Defined to the variable names. Now i can just search by variable names right? Or should i foreach this too?

lusty quest
#

if you want sentences construction i guess i18n is helpfull

#

but i havent figured out how it works

#

also moving my existing translations over is annoying

crimson vapor
#

so the way I currently do it is this

pale vessel
#

Ah

#

Shouldn't that work for all languages then?

crimson vapor
#

but some languages are different ex. changing congugations based on the subject

lusty quest
#

i do something like this, i just use string.replace and add placeholders to the translation strings

#

not the best way but it sort of works

crimson vapor
#
  private formatString (string: string, ...args: string[]): string {
    return string.replace(/{(\d+)}/g, function (match, number) {
      return typeof args[number] !== 'undefined' ? args[number] : match
    })
  }``` this is what I do
#

just gotta order them correctly

lusty quest
#

but one thing im a bit proud of is how i keep the translations updated. i have a github repo with the translations, and when the bot starts he downloads the translations from github and loads them into a map

crimson vapor
#

oh

#

thats smart

#

open sourced translations but not bot code

lusty quest
#

yep

#

if someone finds a typo he can fix it and make a pr

crimson vapor
#

yea

#

smart

pale vessel
#

Million900o/terano-translations

pale vessel
#

It's 12

crimson vapor
pale vessel
#

Ah, the rose one is OSS too? oh right you sent it to me iirc

crimson vapor
#

almost all of my code is OSS

pale vessel
pale vessel
#

I c

crimson vapor
#

I don't really have any real reason to make anything closed sourced

#

its not like its amazing code

#

or new features

eternal osprey
pale vessel
#

Forget about the fetch part, you only have usernames which is impossible to fetch with

crimson vapor
eternal osprey
#

i am searching differently

#
 let p = haha.forEach(element => console.log(element));
      const poom = p.map() 
      let k = guild.members.cache.find(member => member.name === `${poom}`)
      console.log(k)```
crimson vapor
#

what the fuck is this

cinder patio
#

very informative variable names lol

crimson vapor
#

p: undefined
poom: undefined.map
k: finding a member named undefined

pale vessel
#

poom!

eternal osprey
#

but didn't i already define p to the foreach

crimson vapor
#

nope

#

forEach is void

#

defining it is redundant

eternal osprey
#

owh so i should use the variable inside the function?

crimson vapor
#

im not sure what you are attemptig to accomplish

eternal osprey
#

i am trying to get the info inside the haha,foreach

crimson vapor
#

console.log also returns undefined

eternal osprey
#

no

#

it did return me what i wanted

crimson vapor
#

in the console.log

eternal osprey
#

yeah

#

so my question is, how can i define that info from the console.log to a certain variable so i can keep on using it

crimson vapor
#

which one

#

its an array

cinder patio
#

haha is already that info

eternal osprey
#

console.log(haha) returns me:

cinder patio
#

you're just console logging each element separately

eternal osprey
#

foreach returns me:

#

wait can't i just escape the array using ...

crimson vapor
#

what do you need then

cinder patio
#

Because forEach just iterates through the array, it doesn't return anything

crimson vapor
#

what the fuck are you trying to do

cinder patio
#

haha is already what you want

crimson vapor
#

you can't separate an array

#

like you can

#

but not how you want I think

heady flint
#

hi

eternal osprey
#

ooowh no i got it already

#

i ofc can just use haha in the map

crimson vapor
#
const arr = [1, 2, 3]

// this doesn't work
const a = ...arr

// this works
const b = [...arr]```
eternal osprey
#

the last one

cinder patio
#

that just copies the array tho...

crimson vapor
#

thats making an array thats exactly the same tho

cinder patio
#

I don't think you know what you want ๐Ÿ˜•

crimson vapor
#

I sure as hell don't

eternal osprey
#

wait so i was told to map the array haha

#

so i can easily foreach it and get everyones id

#

however, i don't get how i can map it

#

it would just be: const p = array1.map(x => x );

#

as i want the whole names

pale vessel
#

that also clones it though

cinder patio
#

array1 is already an array with all the names in it... what do you want to with the names

#

get the IDs of everyone with the name in the array?

eternal osprey
cinder patio
#

a single for...of loop does the job

#

you don't need anything else

#
for (const name of array) {
    // Find the user ID with the name somehow
}
pale vessel
#

map() would be better I think

#

but you have to rely on cache

eternal osprey
#

const name of array?

pale vessel
#

but that's the only option anyway

#

Actually, WS

cinder patio
#

I guess, depends on what they want to do with the id

pale vessel
#

you can use the WS operation and search by query

cinder patio
#

discord's fetch method uses the WS event

#

discord.js*

eternal osprey
#

and i can then search by name with the variable names?

cinder patio
#

mhm

eternal osprey
#

for (const names of haha) { let k = guild.members.cache.find(member => member.name === `${names}`) console.log(k) }
if i understand it right, it would be likes this.

cinder patio
#

try it, looks good to me

#

except it's member.username

#

or memer.displayName

eternal osprey
#

member.user.username

crimson vapor
#

why don't you just do js haha.map(e => guild.members.cache.find(member => member.name === e)).filter(e => e)

pale vessel
#

e

cinder patio
#

Then they'll have to loop through that again if they want to do something with each member individually

#

so what's the point

crimson vapor
#

good point

eternal osprey
#

okay it worked great

#

so i first wanted to add a role to the users whose id i just retrieved, but can't i directly add it to a user as i already have variable k defined?

#

nvm got it already

cinder patio
#

k is your Member

eternal osprey
#

my bad for asking so much

cinder patio
#

k.roles.add

fierce ether
#

is there a way of passing events to another folder aswell as events?

crimson vapor
#

@pale vessel js if (!userFetch || (userFetch == null)) continue this is some actual code I have

pale vessel
#

(() () () ())

crimson vapor
#

thats not the bad part

#

im checking if !userFetch then im checking if it is null

earnest phoenix
lyric mountain
#

yk, music stuff is hell by definition

cinder patio
#

Hmmm... so I have 2D coordinates, which are all 8 bits in size, and I'm curious what method of storing them would be faster / use up less memory:

  • Using a single Map, where the keys are the 2D coordinates turned into an 16 bit number (first 8 bits x, last 8 y)
  • A 2D array
lyric mountain
#

16 bit ig

#

there's a reason colors are stored like 0x112233

rapid light
#

can anyone help me on some code for my bot?

lyric mountain
#

yours would be 0x1122

rapid light
#

please?

odd stratus
rapid light
#

nvm

proven lantern
#

what's the best way to test a feature that requires 6 different accounts? make 6 accounts?

sudden geyser
#

You could mimick accounts

#

But this depends on what "accounts" is and how easy it may be able to replicate.

green kestrel
#

{"d":{"guild_id":"537746810471448576","user_id":"326465432389287946"},"op":0,"s":21923,"t":"GUILD_JOIN_REQUEST_DELETE"} whats this event?

sudden geyser
#

It's probably some internal event

quartz kindle
#

never seen that before

sudden geyser
#

Searching it on Google only brings up 3 results

green kestrel
#

same

quartz kindle
#

maybe its something new

green kestrel
#

yeah all dated 1 week ago

sudden geyser
#

One result from a month ago

green kestrel
#

well the content looks simple enough

delicate zephyr
#

Its a new undocumented event atm

green kestrel
#

but this indicates that somewhere is a GUILD_JOIN_REQUEST_ADD and a GUILD_JOIN_REQUEST_UPDATE

sudden geyser
#

Someone says it's for membership screening

quartz kindle
#

ye looks like it

#

i saw the reply from the api discord

fierce ether
#
    registerListener(event, listener) {
        console.log(event, listener)

        this.beta.on(event, listener, this);
    }``` dosent allow the event to work,  log returns `messageCreate [Function: messageCreate]`
pale vessel
#

What is this for

#

That's useless

fierce ether
#

well it dosent change anything

sudden geyser
#

I'm interested in building a platform online. I believe I'll need to create a backend API and frontend for a website and mobile app (if I ever get there; each their own separate projects/repositories), but it's something I've never done before nor do I know where I would start. Does anyone have advice on where I should start to learn about it?

vivid fulcrum
#

i'd definitely recommend picking up c# and using asp.net core as your backend

fierce ether
green kestrel
#
    /**
     * @brief on guild join request delete.
     * Triggered when a user declines the membership screening questionnaire for a guild.
     * 
     * @param _guild_join_request_delete User function to attach to event
     */
    void cluster::on_guild_join_request_delete(std::function<void(const guild_join_request_delete_t& _event)> _guild_join_request_delete);

another undocumented event bites the dust!

near igloo
#

what are you doing firefox ๐Ÿ˜‘

#

not broken at all

#

probs from when i was trying to corrupt my memory in c++ and never restarted

slim umbra
#

or wtf

#

not

pale vessel
#

bruh ok doge

hearty sluice
#

hi

#

i need help

#

because I get argument "0" with the "1" on the onsled?
command is: !entregar julian julian96

  let perms = message.member.hasPermission("MANAGE_GUILD"); 
  if(!perms) return message.channel.send(':x: No tienes permisos.');
  let user = args.slice(0).join(" ") 
  let clave = args.slice(1).join(" ") 
  // message.channel.send('**'+message.author.username+'** *Te respondo por privado!*'); 
   message.channel.send({embed: {
     color: 3447003,
     title: ":zap: Entregar :zap:",
     fields: [
       {
         name: "Usuario:",
         value: ( user)
       },{
       name: "Clave:",
       value: (clave)
     }
     ],
   }})
 }```
sudden geyser
#

You should get the value from the index alone rather than get anything after the index.

#

Aka instead of doing args.slice(x).join(" "), do args[x]

lament rock
#

Understanding what Array.slice does is also important

hearty sluice
#

How would the code look to achieve what I'm looking for?

snow urchin
#

https://i.callumdev.pw/hrmg5.png
Why are the first 2 case ids ALWAYS 00001, the second one SHOULD be 2? Every case ID after the first 2 go up just fine, with the 3rd one being 3, and so on

sudden geyser
#

Does it make sense to have an API and database in the same project for a backend?

lament rock
#

could be a public api

sudden geyser
#

It may be a public API in the future, but right now, it's a project I'm developing with the API being private.

lament rock
#

You're saving yourself some trouble by making the design how you intend it to be in the future

gritty bolt
#

does anyone know why pm2 would be spinning up 65 instances of my process instead of just 1?

#

im trying to have it make a screen, and each time I do it instead of 1 i end up with it exponentially growing

quartz kindle
snow urchin
#

was literally just missing () around length || 0, fixed ages ago ๐Ÿ˜„

quartz kindle
#

i assumed so, just leaving it here so the channel is not dead

#

:^)

long crow
#

Hi Tim

wet ember
#

P

#

#profile

zenith knoll
#

if anyone has used mongoDB decently

Is it possible to easily transfer db from atlas to localhost and vice versa when i need to? Or is it i need to stay with whatever i started with

soft glade
#

does anyone know what this means??

Traceback (most recent call last):
  File "main.py", line 288, in <module>
    client.run(os.getenv('TOKEN'))
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 718, in run
    return future.result()
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 697, in runner
    await self.start(*args, **kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 660, in start
    await self.login(*args, bot=bot)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 509, in login
    await self.http.static_login(token.strip(), bot=bot)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/http.py", line 293, in static_login
    data = await self.request(Route('GET', '/users/@me'))
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/http.py", line 209, in request
    raise HTTPException(r, data)
discord.errors.HTTPException: 429 Too Many Requests (error code: 0): You are being blocked from accessing our API temporarily due to exceeding our rate limits frequently. Please read our docs at https://discord.com/developers/docs/topics/rate-limits to prevent this moving forward.
quartz kindle
#

its written what it means lol

soft glade
#

Shat

zenith knoll
#

I wonder how big bots operate then lol

soft glade
#

Same

quartz kindle
#

by being efficient

soft glade
#

mine was only in 38 Servers

quartz kindle
#

big bots dont spam requests

zenith knoll
#

i mean

soft glade
#

mine doesnt ether

zenith knoll
#

true i guess they can prevent it

quartz kindle
#

well you did something

#

that got you rate limited

soft glade
#

nvm i just watched it request it 3 times in 2 secs

quartz kindle
#

lul

zenith knoll
soft glade
#

it requests 3 times ever 5 min

zenith knoll
#

the cap is 10k per 10 mins

quartz kindle
#

the limits for sending messages are 5 per second per channel

zenith knoll
#

per CHANNEL

quartz kindle
#

each channel has separate limits

#

just make sure your bot doesnt spam the same channel

zenith knoll
#

so its not 10k globally per 10 mins

soft glade
#

is it bad im using a website to host my bot

#

Lol

zenith knoll
#

what

quartz kindle
#

the global limit is 50 per second

zenith knoll
#

you use a webhost to host a dbot?

soft glade
#

replit

waxen bough
#

is it public

soft glade
#

yes

zenith knoll
#

POG

#

we can yoink token lmao

#

change it

waxen bough
#

u must hide tokens

zenith knoll
#

regen ir

soft glade
#

no

#

my token is in a private env

waxen bough
#

i heard .env is only visible for owners is that true

soft glade
#

you cant see it unless i let you

quartz kindle
quartz kindle
#

aka requests that return errors, for example trying to send a message without having permissions

waxen bough
#

ohh that's good did you put the token there

soft glade
#

which i can let you see it if i was to give you perms

quartz kindle
#

if you send 10k invalid requests in 10 minuts you will get banned for 1 hour

soft glade
#

Shat

zenith knoll
soft glade
#

not the token

#

they made an update

zenith knoll
zenith knoll
#

someone could just yoink the code and make their own bot and say its theirs

#

and use their own token

soft glade
#

its fully private even if they fork it the token doesnt fork

#

oh ik

soft glade
zenith knoll
#

the point isnt token security lmao

soft glade
#

ik

quartz kindle
#

dont worry, nobody is gonna steal your code

zenith knoll
#

i just use .json for tokens mmLol

soft glade
#

idk i made it an open sorce So people can take it

waxen bough
quartz kindle
#

the chances of someone stealing your code depend on:

  1. your code being actually good
  2. your code and your bot being popular or widely used
  3. people actually knowing what they're doing
soft glade
#

3 Most people dont have that

quartz kindle
#

exactly

zenith knoll
quartz kindle
#

people who steal code have no idea what they're doing

waxen bough
#

i make my code as ugly as possible

zenith knoll
#

like they are the only lib i know of that still supports the dreaded ||selfbot||

zenith knoll
soft glade
quartz kindle
#

a lot of people copy code from open source music bots on github and then ask here why its not working

#

xd

zenith knoll
#

why code say token not define

waxen bough
#

ive seen on #mod-logs some denied bots because they are dupes

quartz kindle
#

ye

#

"cant read property x of undefined"
"where/how did you define it?"
"i dont know"

soft glade
#

If i was going to take someone else work i would change it to make it not see able to the naked eye or just give credit

zenith knoll
#

yeah like botghost

odd stratus
#

I always encounter music clones in the bot queue

#

As well as BotGhost bots

#

So annoying

quartz kindle
#

ghostbot ghosts

zenith knoll
old cliff
#

how can I get the result of different capturing groups of a regex?

waxen bough
#

asking to ask

zenith knoll
sudden geyser
#

But this depends on the parser and the regex

old cliff
#
const urlRegex = /((http|https):\/\/)(www.)?([a-zA-Z0-9@:%._\+~#?&//=]{2,256}\.[a-z]{2,6})\b([-a-zA-Z0-9@:%._\+~#?&//=]*)/gi;

const str = "https://www.google.com/google.png";

console.log(str.match(urlRegex)); // ["https://www.google.com/google.png"]

// I want it to be 
["https://","https","www.","google.com","/google.png"]

how can I get the result of its different capturing groups?

sudden geyser
old cliff
#

so should I use RegEx#exec ?

#

.exec()

#

ah... its been deprecated... trying matchall

sudden geyser
#

.exec and .match work similarly, but .match should be fine in your case. .exec is not deprecated for the record.

If you're using Node.js, there's a built-in URL module I believe you can use to validate the URL as well (https://nodejs.org/api/url.html).

old cliff
#

I am trying to get the domain and also validate the url

#

so I need capturing group 4

earnest phoenix
#

Just [...<Your string>.matchAll(<regex>)]

sudden geyser
#

I believe your issue stems from adding the g flag

earnest phoenix
#

You have all of the parts after that

sudden geyser
#

When the g flag is present, the entire string is returned. When it's not, the matches are there

#

then you can see the array parts

old cliff
#

uh... but I will match it from strings such as "Hmm check this... https://google.com"

#

so I think g is necessary

sudden geyser
#

Then prefix the regex with ^ and suffix it with $ so it forces the entire string to be just the url

old cliff
#

then it won't match ._.

#

"Hmm check this... https://google.com"

#

ah wait... it still matches Thonk after removing g

sudden geyser
#

yeah

waxen bough
#

how about Lite's advice to use URL

old cliff
#

thanks... now it works

#

I am learning regex....

sudden geyser
#

Though, I very much recommend you use the built-in url module instead of writing your own URL parser

earnest phoenix
#

How To Put Imgur Images In Bot Description?

old cliff
waxen bough
old cliff
#

uh...

sudden geyser
#

@earnest phoenix If you're using markdown, do ![tooltip](url)

waxen bough
#

consnt { URL } = require('url')

sudden geyser
#

URL is already imported in all scopes to my knowledge

old cliff
#

ok... but can it search for a url from a string such as "Hmm check this... https://google.com"

sudden geyser
#

You wanted to put an image in your bot description

#

The bot description supports markdown

earnest phoenix
#

Ohk

sudden geyser
#

So you can use that markdown I gave you

earnest phoenix
#

ok

#

What's tooltip? @sudden geyser

sudden geyser
#

It's text that'll appear when the user hovers over it I think.

earnest phoenix
#

can I leave that blank?

sudden geyser
#

probably

waxen bough
#

afaik it's the label. tooltip is [label](url "tooltip")

earnest phoenix
#

Tooltip is optional

#

So yea you can leave it blank if you want

old cliff
#

fixed my regex... time to start work...

sudden geyser
old cliff
#

Thanks @sudden geyser

#

for the help

earnest phoenix
sudden geyser
#

are you sure the url it points to is correct + an image

earnest phoenix
#

That happens if the URL doesn't return any buffers resolving to an image

#

Hm

#

Means Url isn't correct?

#

Or the URL is just incorrect

sudden geyser
#

well what did you put

earnest phoenix
#

Lemme Check

#

ah

#

this

#
http://imgur.com/a/8XlloKh```
sudden geyser
#

it needs to be the direct link to the image

#

that's the link to the site

#

notice the i. and .jpg

earnest phoenix
#

hm

#

is there a way to download images to a certain folder using requests in python

sudden geyser
earnest phoenix
sudden geyser
#

right click the image and press copy image address

#

the text may differ per browser

earnest phoenix
#

how do you make that thing when you invite a bot that on the permissions it says:

ready you a story
?

cinder patio
#

It's randomized by discord

#

you can't change it

earnest phoenix
#

wdym

oak nymph
#

Guys I wanna make a toggle command that disables or enables commands for a specific server in discord.py, can someone help me?

earnest phoenix
#

how do i add that to my own bot

earnest phoenix
#

do you want a channel by id?

oak nymph
#

not the channel

#

I want the guild id

earnest phoenix
#

ok

oak nymph
#

to disable commands for a specific server

earnest phoenix
#

what code do you have now?

oak nymph
earnest phoenix
#

ok

oak nymph
#

@earnest phoenix Yo

#
@commands.has_permissions(administrator=True)
async def(ctx, * , command):
    command= client.get_command(command)

    if command is None:
        await ctx.send("I can't find a command with that name!")

    elif ctx.command==command:
        await ctx.send("You cannot disable this command!")

    else:
        command.enabled = not command.enabled
        ternary = "enabled" if command.enabled else "disabled"
        await ctx.send(f"I have {ternary} {command.qualified_name} for you!")```
#

here's the code

earnest phoenix
#

first of all you can't have
async def(ctx, *, command):

earnest phoenix
earnest phoenix
#

how?

#

ohh

oak nymph
#

@earnest phoenix aight then after that?

earnest phoenix
#

make
if command is none
to
if command == None:

oak nymph
earnest phoenix
#

ok

#

i have to go

oak nymph
#

BRUH -_-

earnest phoenix
#

if you still can't figure this out dm me tomorrow bc rn its 1:20 am here

earnest phoenix
#

1|run      | (node:21696) UnhandledPromiseRejectionWarning: Error: Undefined binding(s) detected when compiling SELECT. Undefined column(s): [guild_id.guildID] query: select `name`, `channelID`, `ownerID` from `category` left join `guild_id` on `category`.`ownerID` = `guild_id`.`id` where `guild_id`.`guildID` = ?```

I understand that the column **guild_id.guildID** is undefined, but it exists ...
median iris
#

guys what i fill here

#

WHAT SYSTEMS AND INFRASTRUCTURE DO YOU USE?

#

no reply

neon current
#

Hey, I have a Question:

I'm creating a Reddit Bot with Python/discord.py/praw. But how do I enable an NSFW Filter - or a Safe Search?

earnest phoenix
cinder patio
#

how?

earnest phoenix
#

remove all other then the thing you want

#

oh wait

#

you cant do it anymore

earnest phoenix
#

Discord randomly chooses a phrase and puts when you need to check what permissions to your bot

lunar patio
#
(name=f"Guilds | {len(bot.guilds)}")``` 
what for the members in server?
neon current
rotund river
#

Sorry, how can I set the title and description of an embed from discord via command?

oak nymph
rotund river
#
exports.run = (client, message, args, ops) => {
    const Discord = require("discord.js");
    if (message.author.bot) return;
      message.delete();
      const embed = args.slice(2).join(" ");
      const title = args.slice(1).join(" ")
      const embedembed = new Discord.MessageEmbed()
  
        .setColor(`#ff9e00`)
        .setTitle(title)
        .setDescription(embed)
        .setTimestamp();
      message.channel.send(embedembed);
    };```
#

i use this, but it print in title the desription

umbral zealot
#

const title = args.slice(0).join(" ") takes all the args and joins them

#

slice(0) slices nothing

oak nymph
#

yea

#

ah this guy is using js

#

lul

umbral zealot
#

I think you were just trying to get the first array element, probably?

#

[0] to access that...

#

like literally just args[0]

oak nymph
#

it shld be dis in the end

umbral zealot
oak nymph
#

ik but js doesnt hv dat ?

umbral zealot
#

If you do'nt know JS please don't try to help

oak nymph
#

um ok

rotund river
#

I want to do for example: f! embed hello (the title) hello (the desription), but it print hello hello (the title) hello (the description)

opaque moat
rotund river
#

yes

opaque moat
#

.0.

#

py or js?

umbral zealot
#

That's clearly javascript

#

and I already answered ๐Ÿ˜›

opaque moat
#

oh

rotund river
#

or do f! title hello then f! description hello and then f! send

rotund river
#

it work

umbral zealot
rotund river
#

instead to put spaces in the title? I thought with _ but how do I get it removed? @umbral zealot

umbral zealot
#

use replace()

rotund river
#

ok

#

@umbral zealot

#

const title = args[0].replace("_")

opaque moat
#

.0.

umbral zealot
#

you're replacing it with nothing

#

did you even try to read the docs on string.replace?

#

smh

rotund river
#

no .-.

umbral zealot
#

So start with that

rotund river
#

thanks, it work

fierce ether
#
            <div class="taak0c-4 dcumgc">
              <img src="../assets/imgs/ModerationLogo.png">
            </div>
            <div class="taak0c-5 kzFnqY">
              <div class="taak0c-6 kpvzAk" href="/" >Moderator</div>
              <div class="taak0c-7 cXZMsb">Power up your serever with cool moderation and automations!</div>
            </div>
          </div>``` if i use `href` to redirect it never will redirect anyone know?
umbral zealot
#

href only works on the <a> element

fierce ether
#

what can i use on a div?

umbral zealot
#

pretty much just class and style and id

#

divs are the "generic" element, you shouldn't use them for everything

#

it's always best to use the closest semantic equivalent

fierce ether
#

i added this an it worked so i guess this will do js <a href="/"><div class="taak0c-3 djzcKk"> <div class="taak0c-4 dcumgc"> <img src="../assets/imgs/ModerationLogo.png"> </div> <div class="taak0c-5 kzFnqY"> <div class="taak0c-6 kpvzAk">Moderator</div> <div class="taak0c-7 cXZMsb">Power up your serever with cool moderation and automations!</div> </div> </div></a>

lunar patio
#
@bot.event
async def on_ready():
    print('Bot is ready!')
    await bot.change_presence(activity=discord.Streaming(name=f"Members | {len(bot.users)}", url="https://www.twitch.tv/garuda0007", description="Use !help to start."))
    await bot.change_presence(activity=discord.Game(name="Managing Garuda's Server!"))```
How do i make this in change in within 12 sec.?
earnest phoenix
earnest phoenix
#

Code:```JS

let invite = guildInvites.find(i => ei.get(i.code).uses < i.uses);
console.log("Used invite :" + invite.code + " by " + invite..inviter.username)```

guildInvites returned : https://pastebin.com/raw/KdxeZ91H

But he tell me cannot read property invite.code, how can i do?

#

what should I replace it with?

willow mirage
#

anyone know what does this called?
a > b ? a : b

cinder patio
#

ternary operator

willow mirage
#

thx

rotund river
#

@umbral zealot how can i resolve this?

umbral zealot
#

uhhhh ... no idea man, maybe... show us code?

#

I can't magically guess wtf you're doing here darling dogekek2

rotund river
#
exports.run = (client, message, args, ops) => {
    const Discord = require("discord.js");
    if (message.author.bot) return;
      message.delete();
      const embed = args.slice(1).join(" ");
      const title = args[0].replace('_', ' ')
      const embedembed = new Discord.MessageEmbed()
  
        .setColor(`#ff9e00`)
        .setTitle(title)
        .setDescription(embed)
      message.channel.send(embedembed);
    };```
umbral zealot
#

Also what you mean by "Resolve this". I can't guess what the problem is either.

rotund river
#

sorry

reef ibex
#

Okay

earnest phoenix
#

args.slice().join(" ")

#

what is this mean?

eternal osprey
#
{ "userid": "", "reps": ""}```hey, how can i push a certain userid into this file using fs?
quartz kindle
#

read

#

json parse

#

modify user id

#

json stringify

#

write

umbral zealot
eternal osprey
#

already done

earnest phoenix
#

Hi, i have a issue

#

Imagine that i have message 1 and message 2. I want that my bot send messages 1 and 3 seconds later edit it and put message 2

#

How i can do it

pale vessel
umbral zealot
#

Yeah they have

#

still haven't figured out simple json

pale vessel
#

That sucks

umbral zealot
#

Literally should have been able to do this day 1...

crimson vapor
#

@eternal osprey you should really be learning more js, not just relying on people here for your issues

umbral zealot
#

I mean... look I'm going to be rude and condescending here but I have to: @eternal osprey if you've been struggling with extremely simple json read/writes for 8 months, just... stop. Not just json, but programming in general. You're not made for it.

#

I've literally never seen someone struggle with such a simple concept for so long.

#

Actually tbh it's even longer than that since 8 months ago you claimed you tried to make one in the past, before that even. This is just... scary.

earnest phoenix
#
                                                      ^
TypeError: Cannot read property 'url' of undefined
umbral zealot
#

That probably indicates that the message didn't have any attachments.

earnest phoenix
#

i need url to url

#

like i use url and he covert image by discord

umbral zealot
#

attachments is for message attachments though

#

if you want a URL you sent in a message, just get your message.content

earnest phoenix
umbral zealot
#

...

#

why... ()[0]

#

message.content is a string

earnest phoenix
#

direct?

#
            request(url, async function(err, res, body) {
              if (err !== null) return;
            ```
#

not working

cinder patio
#

strings do not have a "url" property

earnest phoenix
#

huh

#

Hello can anyone say why my bot is not responding it's offline but it's hosted

#

:/

#

No responds

quartz kindle
#

we cant say why your bot is not working

#

you have to check that yourself

#

open logs, look for errors

earnest phoenix
#

There is no error

quartz kindle
#

where did you look?

#

where are you hosting?

dense pollen
#

did u run the file on your host

quartz kindle
#

your* :^)

dense pollen
#

wow

earnest phoenix
earnest phoenix
earnest phoenix
quartz kindle
#

what does the console say?

earnest phoenix
#

Wait

#

This

#

The Fontconfig Error Was From Before

#

Hello

dense pollen
#

did u restart after the fontconfig error

earnest phoenix
#

Yeah

#

I did 2 times but same

dense pollen
#

well then it seems u still have a fontconfig error cuz its still the latest entry in your console

earnest phoenix
#

:')

#

Hmm there is no way to fix that I thonk

#

i want convert this

        for(var i = 0; i < message.embeds.length; i++){
        if (message.embeds[i].title.includes("test") || message.embeds[i].title.includes("test")) {
          if (e.image) {
            let url = e.image.url;
            
            request(url, async function(err, res, body) {
              if (err !== null) return;  

without embed

#

i try message.content or attachments

#

but not working

#

anyone help me plz

#

I think my bot is dead

quartz kindle
#

which language are you using?

#

node.js? with discord.js?

earnest phoenix
#

ds.js

#

i mean discord.js

quartz kindle
#

i meant Shark but ok

earnest phoenix
#

lol

quartz kindle
#

why a loop inside a loop

earnest phoenix
quartz kindle
#

to your code

#

and restart the bot

earnest phoenix
#

Where?

quartz kindle
#

see what the console says

earnest phoenix
#

Ok

#

I should add In index.js right?

quartz kindle
#

yes

earnest phoenix
#

Ok

#

Woah there is {no} hit on route {Letters}

#

Still pffline

#

Offline*

quartz kindle
#

429 hit on /gateway/bot?

earnest phoenix
#

Yeah

#

100%

#

Same

quartz kindle
#

that means you're temporarily banned

earnest phoenix
#

Why

quartz kindle
#

you did too many invalid requests

rustic nova
#

Need a quick info regarding webm-usage on embeds: I assume they're not working the same like gifs do right?

earnest phoenix
rustic nova
#

animated webms to speak

quartz kindle
# earnest phoenix What u mean?!

invalid requests: requests that were rate limited because you sent too many at once, requests that caused errors because you dont have permissions or similar, requests to things that dont exist, etc...

earnest phoenix
#

Ok

#

When will it get unbanned?

quartz kindle
#

usually it lasts for 1 hour

earnest phoenix
#

Oooo

#

That is a lot

#

:/

quartz kindle
#

you have to turn your bot off and wait

earnest phoenix
#
                                                                    ^
TypeError: Cannot read property 'url' of undefined
#

Ok

#

Done

#

what to do

steady latch
#

Owo sunucunun linkini nerde bulabilirim

earnest phoenix
#

?

crimson vapor
earnest phoenix
crimson vapor
#

well im not sure why you are trying to get message.content.url because that is a string not an object

earnest phoenix
#

okey. i am sorry

earnest phoenix
steady latch
crimson vapor
#

use message.attachments but it will only fire on edit iirc

earnest phoenix
#

no response

            request(url, async function(err, res, body) {
              if (err !== null) return;```
quartz kindle
#

i still dont get what you're trying to do

#

how about you explain what you want and show the full code?

crimson vapor
#

please learn basic javascript

delicate shore
#

how to get this

#

the banner

#

thing

quartz kindle
#

meta tags

#

opengraph and twitter tags

delicate shore
#

no like

#

I mean

#

https://github.com/pgamerxdev/projects/issues/11
Doesnt have a banner like this

crimson vapor
quartz kindle
#

idk my repos have them

#

and i didnt do anything

delicate shore
crimson vapor
#

none of mine

#

it seems

delicate shore
#

no issues

#

so no way to test

crimson vapor
#

no its an example

#

oh good point

#

issues ig?

delicate shore
#

see

#

wait wha

crimson vapor
#

hmmm

delicate shore
#

why doesn't it say that
issue this and this

#

and this and this

quartz kindle
#

its probably discord caching

delicate shore
#

Ohh

earnest phoenix
#

@quartz kindle i want this ``` let url = message.embeds[0].image.url

#

url/attachments

#

got it?

rare steeple
#

https://hello.com

#

:D

quartz kindle
#

this?

earnest phoenix
#

no

quartz kindle
#

you can do message.attachments.first() which is the same as [0]

earnest phoenix
#

i want url/attachments to run cmd

#

@quartz kindle listen

quartz kindle
#

what?

#

i dont understand what you mean

earnest phoenix
#

weit

jovial elk
#

anyone else's bot sometimes gets a "Connection reset by peer" error when someone uses a command?

earnest phoenix
# quartz kindle i dont understand what you mean
      message.embeds.forEach((e) => {
        for(var i = 0; i < message.embeds.length; i++){
        if (message.embeds[i].title.includes("avatar") || message.embeds[i].title.includes("avatar")) {
          if (e.image) {
            let url = e.image.url;
            request(url, async function(err, res, body) {
              if (err !== null) return;
            
              imghash
                .hash(body)
                .then(hash => {
                  let result = db[hash];
                  
                  if (result === undefined) {
                    embed
                      .setTitle("image not found")
                      .setDescription("sed");
                    return message.channel.send(embed);
                  }
                ```
#

i want this without embed

#

understand ?

tired stirrup
#

How can I get coding for economy

#

Bot

#

@earnest phoenix

umbral zealot
#

You don't get coding. You write coding.

tired stirrup
#

O

#

Ok

earnest phoenix
quartz kindle
#

then just do message.embeds[0].image.url?

#

this? ```js
if (message.author.id == "id") {
let url = message.embeds[0]?.image?.url;
request(url, async function(err, res, body) {
...
})
}

placid meadow
#

@quartz kindle

#

๐Ÿ˜‚

tired panther
placid meadow
#

oh sorry

#

is code related tho

#

๐Ÿ˜›

quartz kindle
#

lmfao

#

i remember some russian dude naming his variables after vodka

placid meadow
#

hahahaha rly? XD

quartz kindle
#

and someone here also decided to name all his variables after emojis

placid meadow
#

haha genius

#

there are few program languages out there that are extremely unqiue

opaque moat
#

What will happen after my bot reaches 100th server?

lusty quest
near stratus
opaque moat
#

Nice

placid meadow
#
Similar to Brainf*ck, Befunge was developed by Chris Pressey in 1993, with the aim of creating a language that would be as hard to compile as possible. He does this by implementing self-modifying code and having the same instruction being executed in four different ways, not to mention the instruction set itself. However, a number of compilers were eventually created. Below is the source code for โ€˜Hello World!โ€™:

>              v
v  ,,,,,"Hello"48*,          v
v,,,,,,"World!"25*,@
#

thats even worse then brainfuck

#

self-modifying

#

tricky af

quartz kindle
#
float away; 
long long ago; 
char coal; 
placid meadow
#

hahaha

quartz kindle
#

my favorite esolang is chef

placid meadow
#

oh yeah ive seen that one

#

so cool

lusty quest
#

Cow lang is also stupid

sudden geyser
#

esketit is better

solemn quartz
#

Guys how to get a boolean that says if a role has a certain permission in a certain channel?

placid meadow
#

ever seen the Piet code ?

opaque moat
placid meadow
#

oh i wouldnt do that

opaque moat
#

Why

placid meadow
#

a discord server altho not owned, still is a private server

#

i got spanked for this too

opaque moat
#

.....oH

near stratus
#

inorganic growth and suspicious growth

dusky sundial
opaque moat
#

What if a random guy invites em to 100 servers

near stratus
near stratus
#

dosen't matter who
If they have same user set then it's sus

earnest phoenix
opaque moat
#

._.

dusky sundial
#

Just don't try to fake it, let it grow like it's supposed to

placid meadow
#

you need their consent

#

always

cinder patio
#

just make a good bot, problem solved

opaque moat
#

.0.

#

...

near stratus
#

all bots have awaifu pfp (at least 80%)

placid meadow
#

i think we need a new set of bot rules called The Ethical Discord Bot Etiquettes ๐Ÿ˜›

#

he he

#

@dusky sundial

dusky sundial
#

Discord tos will handle that themselves :)

placid meadow
#

yeah i know, but as u can see... it still doesnt impact

#

i made mistakes too :<

earnest phoenix
#

Code:```JS

let invite = guildInvites.find(i => ei.get(i.code).uses < i.uses);
console.log("Used invite :" + invite.code + " by " + invite..inviter.username)```

guildInvites returned : https://pastebin.com/raw/KdxeZ91H

But he tell me cannot read property invite.code, how can i do?

dusky sundial
#

Well, luckily we don't have anything to do with Discord verification so

placid meadow
#

true, but surely this does cross the same lane path

#

at least thats what i see

earnest phoenix
#

returned undefined

#

but idk Hy

#

why*

cinder patio
#

Well that's your problem

earnest phoenix
#

yes

cinder patio
#

The find function did not find any value that matches the predicate

earnest phoenix
opaque moat
#

._.

placid meadow
quartz kindle
earnest phoenix
#

like https://cdn.discordapp.com/attachments/272764566411149314/833691749704007680/Screenshot_20210419-134608_Instagram.png

#

@quartz kindle

summer torrent
#

like attachment?

earnest phoenix
#

yup

#

attachments link

summer torrent
#

what lib

earnest phoenix
#

wut

summer torrent
#

discord.js?

earnest phoenix
#

yup

summer torrent
quartz kindle
#

like i said, message.attachments.first().url

earnest phoenix
#

but not working with attachments link

quartz kindle
#

what attachments link?

#

you mean if you send a link in the message content as text?

tired panther
#

on discord.js-light, channelCache is off
on MessageUpdate event do you know the message.pinned property?

earnest phoenix
#

https://cdn.discordapp.com/attachments/272764566411149314/833691749704007680/Screenshot_20210419-134608_Instagram.png

#

like

summer torrent
#

what do you want to do

earnest phoenix
#

this link automatic changed to image

quartz kindle
quartz kindle
tired panther
plain holly
#

How would i make a command in discord.py which tells me when my bot is added to a server

earnest phoenix
solemn quartz
#

Is there a way to get a boolean that returns if a certain role has a certain permission in a certain channel? (e.g: @everyone has the send messages permission in #development )

quartz kindle
earnest phoenix
#

i want both

quartz kindle
#

then check both

#

lol

earnest phoenix
tired panther
summer torrent
#

bot avatar Thonk

earnest phoenix
#

@plain holly hello carlo

summer torrent
#

if you are talking about carl-bot, they are using google blobs

plain holly
earnest phoenix
#

pfp

#

@quartz kindle Bot Is Now Online, Thanks For The Help :D

cyan path
#

Hi guys how do i change the amount of points the bot gives for a right answer and how to set it were if 5 ppl answer only the first one is accepted

placid meadow
#

u can go two ways

#

either u go per user or the total point divided by total user

#

since they all give the right answer i would personally go per user

#

else ppl lose interest in ur game

#

bot+

#

coz in their eyes, they also gave the right answer, the satisfaction from that response must be given ๐Ÿ˜›

#

its simple behavior code ๐Ÿ˜›

#

@cyan path

#

if you setup a game, make sure to have it fair, ppl and games.. they go nazi on ur ass with that ๐Ÿ˜›

cyan path
#

Ok what are the commands for i did this Trivia score-5

placid meadow
#

did u make the game urself ??

cyan path
#

Oh i need to say im not hosting the bot i just invited it

placid meadow
#

ok? ๐Ÿ˜›

cyan path
#

I was sent here

#

i was in support

placid meadow
#

yeah ok thats great

#

but did you code the game yourself ?

summer torrent
#

go to support server

summer torrent
placid meadow
#

oh hes not asking a code related question ?

#

my bad

placid meadow
summer torrent
#

@rustic nova -wrongserver moment

rustic nova
#

-wrongserver @cyan path

gilded plankBOT
#

@cyan path

Hey! We think you have our server mistaken. We do not provide support, help, or advice for any bot. You need to click on the "Get Support" button on the bot's page of the bot you need support for, not the "Join Discord" button at the top of our website. If there isn't a button that says Support Server or you were banned from the bot's support server, then we can't help you. Sorry :(

lavish bramble
#

How can I make a command which work in dm too

cyan path
#

humm ok

placid meadow
#

well first we need to know what library u used

lavish bramble
#

Discord.js

placid meadow
#

ok, then the library has (im sure) docus on that

#

i dont do js myself

#

i do dotnet ๐Ÿ˜›

solemn latch
#

Out of the gate djs should let it work on dms unless you do something to prevent it from happening.

#

All messages go to the same event, including dms

placid meadow
#

in the dotnet version, messages come one class, however they can be casted into DM variant if that was tested by Type

#

dunnow how js does that

solemn latch
#

Js doesn't have types.

placid meadow
#

aha

#

If (Not arg.Channel.GetType Is GetType(SocketDMChannel) so nothing like that would even work ?

earnest phoenix
#

open DM channel

placid meadow
#

interesting to see js does things,

#

how+

summer torrent
#

it is js if (message.channel.type == 'dm') { //code } in js

solemn latch
#

You can do something simular, just not using types, just a property.

placid meadow
summer torrent
#

yeah

solemn latch
#

Pretty much everything is.

summer torrent
#

.type is property of Channel

placid meadow
#

fascinating

summer torrent
#

Channel can be TextChannel, DMChannel

placid meadow
#

yeah, i assume the API must be similar in some way, just the form of it is different

opal plank
placid meadow
#

instanceOf ...aha, so js does have a mechanism for this

compact echo
#

What would you choose to build a website from React, svelte, vue, angular, or just expressjs with some ejs? TDT_bongo

opal plank
#

typeof is for primitives, but instace of works on classes

placid meadow
#

not in dotnet it aint

#

yes primitives, but also interfaces, inheritance

opal plank
#

those we dont have natively in js

#

ts adds interfaces and types

placid meadow
#

yeah i know that

opal plank
#

but js can indeed check if someone is from a class

summer torrent
#

there is typescript btw

placid meadow
#

so js is not a true OOP

summer torrent
#

if you don't know

crimson vapor
#

hi @opal plank

pale vessel
#

hi @crimson vapor

opal plank
#

hi @pale vessel

earnest phoenix
#

Why I get this again and again

opal plank
#

well that didnt last long

crimson vapor
#

hahahahaha

opal plank
earnest phoenix
#

I waited for hour

crimson vapor
opal plank
#

429 is being ratelimited

crimson vapor
#

yes you need to wait longer

opal plank
#

check ur headers to see how long you need to wait for

earnest phoenix
#

So I should stop the bot?

earnest phoenix
crimson vapor
#

erwin

opal plank
#

any request u make to discord will return headers

crimson vapor
#

thats too advanced

opal plank
#

erm

#

doesnt d.js have a debug event?

crimson vapor
#

@earnest phoenix just wait or close the repl and reopen it

earnest phoenix
#

Ok

opal plank
#

also fix ur code before running it again

earnest phoenix
#

I did re-open but same

opal plank
#

you are spamming the api

earnest phoenix
#

Which

opal plank
#

you wouldnt get ratelimited otherwise

earnest phoenix
#

Breh

earnest phoenix
solemn latch
#

429 means ratelimited, or that you've requested too much.

earnest phoenix
#

Oo

opal plank
#

discord just doesnt randomly selects a bot out of thousands and say F you, im ratelimiting you for the next 4h

umbral zealot
opal plank
#

so theres definitively something in your code spamming it

earnest phoenix
#

Yeah

umbral zealot
#

Stop your bot, catch your errors, make better code.

earnest phoenix
#

I know

#

K

opal plank
#

isnt that limit tim mentioning on the 10's of thousands rate per day?

#

iirc the cap is 10k error's a day

umbral zealot
#

not sure, could be

#

I wonder if it has to do with the command they have called nuke.js

opal plank
#

bingo

#

it is 10k invalid requests that'll ratelimit you

tired panther
opal plank
#

theres that one which i pointed

#

but i think theres another one per day

#

or used to at least

earnest phoenix
#

Breh my bot turns on automatically if I turn it off and close the repl

tired panther
earnest phoenix
#

Yeah

#

I hab

#

That's why my bot is hosted permanently

#

Bye

lavish bramble
#

Now my command is working on dm but not on channel

opal plank
lavish bramble
#
client.on("message", message => {
	if(message.channel.type == 'dm'){
		if(message.content === "dm"){
			message.channel.send("oook")
		}
	}
})
opal plank
#

well you are checking if its a dm channel

#

and you are doing nothing if it isnt

lavish bramble
#

So can I do else

opal plank
#

you only send a message there if its a dm, nothing else

#

yup, OR

#

you can use the OR operator ||

lavish bramble
#

Ok

#

Thnx for help

opal plank
#

np

umbral zealot
opal plank
#

^^

earnest phoenix
#

;-;

#

;โ€”;

tired panther
earnest phoenix
#

Bye

tired panther
earnest phoenix
#

Ok

umbral zealot
#

sounds like a browser problem

earnest phoenix
#

Yeah

#

Run Button

#

โˆ†

tired panther
umbral zealot
#

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

cosmic forum
#

Anyone know how to convert an svg animation into a gif?

tired panther
sage bobcat
#

One message removed from a suspended account.

cosmic forum
tired panther
cosmic forum
tired panther
cosmic forum
#

Uh, I don't want it as a png.

#

It's an svg animation.

#

So it needs to be a gif

cinder patio
#

Rust is bullying me... the function is returning an Option but the compiler disagrees ๐Ÿ˜ญ

cosmic forum
#

Here's an example of what i'd like (i just screen recorded this)

zenith terrace
earnest phoenix
#

The console is still the same

#

Like this

sudden geyser
tired panther
earnest phoenix
#

Index.js?