#development

1 messages ยท Page 1175 of 1

earnest phoenix
#

and input repl.it in the address bar

#

@earnest phoenix visual studio code?
@misty sigil That wouldn't work idk why

#

It is a f ing awesome ide

misty sigil
#

was node installed?

earnest phoenix
#

Yea

sterile thicket
#

have you tried watching any youtube video on how to install it and work on it?

earnest phoenix
#

Got any way to make an inventory command using BDScript

#

I may try again

sterile thicket
#

my question got buried, so here is it again

#

I have some args let args = ['a', 'b', 'c']
When I mention arg that doesn't exist ie, args[3], it returns undefined of course.
But I want the undefined arg to return "" an empty string.
I'm trying args[3] === undefined) ? "" : args[3]
What am I doing wrong and how to correct it?

open acorn
#

if(true) {
guild.delete();
}

earnest phoenix
#

This is what i have so far its random

open acorn
#

ok

earnest phoenix
#

Node is finished

cinder patio
#

Sinedx, you can do:

let arg4 = args[3] || "";
earnest phoenix
#

Now what do I do it keep popping as a installer

#

Oh nvm

#

Visual studio code is installing

sterile thicket
#

Sinedx, you can do:

let arg4 = args[3] || "";

@cinder patio that won't help since I want the undefined argument to become and empty string and the args could be 2 or 3 or 50

#

indefined number

restive furnace
#

just check if the typeof object is undefined

earnest phoenix
#

It is installed what do I do

restive furnace
#

or is undefined

cinder patio
#

So, let's say you have an array with 50 elements, any of which can be undefined... you want to replace all of the undefined values with an empty string?

sterile thicket
#

Yes

earnest phoenix
#

I need to try a code guys to make sure this is working anyone wanna help

cinder patio
#

Hmm.... this doesn't really make sense. If your args array contains only 2 elements, anything after the 1st index will be undefined

earnest phoenix
#

I'm trying node -v and nothing happens so idk what with that

cinder patio
#

What are you doing with those arguments? You can simply do args[n] || "" when you are doing something with them

sterile thicket
#

just check if the typeof object is undefined
@restive furnace (typeof args[3]).replace('undefined', '')
I tried this, but it doesn't replace undefiend with ''

cinder patio
#

Well that's stupid

sterile thicket
#

why so?

cinder patio
#

args[n] || "" yields the exact same result.

sterile thicket
#

@cinder patio so does that work in embed.setDescription(`${args[n=3] || ""}`)

cinder patio
#

It should not be in a string literal, it's javascript code

#

and just 3, not n=3

#

And yeah, other than that, it's perfect

sterile thicket
#

It should not be in a string literal, it's javascript code
@cinder patio It's not, I just forgot ${}

cinder patio
#

That's not neccesary

#

At all

#

it will already be a string

sterile thicket
#

Yep it worked, thanks

#

Also free's suggestion also should work practically but it didn't work for me because I forgot to add something to it

warm marsh
#

Why not just map all the entries in the array and if they're undefined change it to an empty string.

sterile thicket
#

there's a reason trust me

cinder patio
#

That's slower

earnest phoenix
#

Should I make my own authentication server boilerplate thingy and upload it to npm? So y'all can make (weird) user accounts and logging in and stuff.

#

there will be multiple security warnings of course who's the creator

#

I've drawn out a basic "concept map" on my notebook just need to convert it actual code

opaque eagle
#

I updated the gist with Command.ts and CommandError.ts

grizzled raven
#

hey, anyone who uses sql/ite? for a column, should i be creating multiple keys like "id, authorID, this1, this2, this3", or should i create a few necessary identifiers like "id" and then prossible a key for a json string that stores the rest of the data?

opaque eagle
#

No keep separate rows

#

Why would you want to store it as a json string

cinder patio
#

Separate rows. Make a separate table for your json

opaque eagle
#

just don't store json

#

keep it as separate rows

cinder patio
#

Well depends on the data

opaque eagle
#

idk about sqlite but i use postgres and it allows for practically any data type

#

arrays, dates, etc

#

in the rare scenario that sqlite can't store the datatype you want you can prob stringify it

grizzled raven
#

idk cause i thought doing SET (A, B, C, D, E) = (?, ?, ?, ?, ?) or whatever would get a bit messy

lone coyote
#

question about discord.py: how can i mention people?

opaque eagle
#

<@ID>

grizzled raven
#

and there also would be some stuff i just wouldnt depend on but still store

lone coyote
#

how do i get the id?

opaque eagle
#

Set like a set in javascript?

lone coyote
#

i have there user already

#

their*

earnest phoenix
#

bruh

lone coyote
earnest phoenix
#

just send the user

lone coyote
#

im trying

grizzled raven
#

also what about arrays?

earnest phoenix
#

it returns the user mention

opaque eagle
#

Apparently Sqlite doesn't support arrays so I'd just convert it to a string

lone coyote
#

but it just sends their name. if add an @ in front, it just says @ their name without a mention

opaque eagle
#

So just JSON.stringify(array) and JSON.parse(arrayRetrievedFromDB)

sharp thicket
#

anyone know if i can make it so if a variable is a certain string it will say no cuz nsfw but can i put it in an array ?

grizzled raven
#

yeah ik

faint prism
#

Guild.Users.FirstOrDefault(u => u.Username.Contains("Auger")).Id
||C# w/ LINQ is nice||

lone coyote
#

oh um ok

sharp thicket
#

like

opaque eagle
#

@sharp thicket keep an array of "bad words" and check if the content of every new message includes one of those bad words... if it does, treat it as such

sharp thicket
#

so if i do

#

like

cinder patio
#

If you are going to store arrays and/or objects then you should go with a DB that supports them like mongo or postgres

sharp thicket
#

bad words = [NSFW1, NSFW2, etc..]

grizzled raven
#

theres only like 2 keys that are arrays, one of which i dont actually really care about

sharp thicket
#

then how do i check if something is in the message

#

if(what here ?)

#

like

faint prism
opaque eagle
#

use in

sharp thicket
#

if(reddit === bad words) return;

#

like that ?

misty sigil
#

lul thats amazing

opaque eagle
#

what language are you writing in

sharp thicket
#

discord.js

faint prism
#

^ JS
D.JS is the lib

sharp thicket
#

oh lol

opaque eagle
#

oh just use string.includes()

#

iterate through your array and check if the message content includes one of the items

sharp thicket
#

so like

#

if(string.includes(bad words)) return:

#

?

#

;*

opaque eagle
#

No you have to iterate through the array

#

badwords is an array right

sharp thicket
#

yes

opaque eagle
#

String.prototype.includes() accepts a string

#

and checks if the string has it

sharp thicket
#

hmm

opaque eagle
#

so you'll have to iterate through the array (ig you can use Array.prototype.some() if you like) and check if one of those items is included in the message's content (string)

cinder patio
#

There's also array.includes()

#

Oh

#

A bad words filter

sharp thicket
#

can i just use it like if(reddit === 'NSFW_WORD') return;

#

as i don't have many words

opaque eagle
#

you want to chain if statements to check for each word?

faint prism
#

You do not want to make it like that

#

trust me

#

Use a for loop

opaque eagle
#

How is it hard to just iterate through an array of bad words

faint prism
#

It isnt

opaque eagle
#

instead of chaining a whole bunch of if statemnets

sharp thicket
#

hmm

faint prism
#

which isn't maintainable

sharp thicket
#

so like

pale vessel
#

what are you doing with reddit?

sharp thicket
#

making a reddit command but i want to blacklist nsfw

opaque eagle
#

What does this reddit command do

pale vessel
#

the reddit api has nsfw property

opaque eagle
#

^

pale vessel
#

well, for subreddits only

sharp thicket
#

wait can i send my code..

#

?

opaque eagle
#

What's the payload that you get back from the api

faint prism
#

psudocode

for (myString in stringArray)
if (message.includes(myString) return "bad"
opaque eagle
#

???

#

oh

sharp thicket
#
const { MessageEmbed } = require("discord.js");
const api = require("imageapi.js");
module.exports = {
  name: "reddit",
  description: "Get a meme!",
  category: "fun",
  run: async (bot, message, args) => {
    let subreddit = args.slice(0).join(" ")
    if(!subreddit){
return message.channel.send(`No subreddit found!`)
}
    
    let img = await api(subreddit, true);
    const Embed = new MessageEmbed()
      .setTitle(`An image from r/${subreddit}`)
      .setURL(`https://reddit.com/r/${subreddit}`)
      .setColor("RANDOM")
      .setImage(img);
    message.channel.send(Embed);
  },
};```
#

here is my code e.e

pale vessel
#

stringArray[myString]

earnest phoenix
#

bruh

bleak citrus
#

:D

opaque eagle
#

LOL

pale vessel
#

for of is nicer though

earnest phoenix
#

the first lone

#

is wrong

faint prism
#

It's not even javascript @earnest phoenix. It's psudocode

sharp thicket
#

what

#

?

pale vessel
#

what's so funny

sharp thicket
#

yeah

#

i don't get it e.e

misty sigil
#

bruh

sharp thicket
#

what

misty sigil
#

code913 be reacting to psudocode

sharp thicket
#

wot

opaque eagle
#

wait nvm i meant that for another channel

sharp thicket
#

how do you do return "bad" lol

faint prism
#

wha-

#

It's just an example dude

opaque eagle
#

^

pale vessel
#

you didn't define img

faint prism
#

the for loop is the important part @sharp thicket

sharp thicket
#

i did

#

smh

pale vessel
#

oh nm i see it

sharp thicket
#

it works..

#

but i need to blacklist words

earnest phoenix
#

It's not even javascript @earnest phoenix. It's psudocode
@faint prism tf is psudocode

pale vessel
#

anyway just use Array.prototype.some

sharp thicket
#

as it isn't checking if the channel is nsfw

faint prism
#

Fake/Nonvalid code...? lol @earnest phoenix

sharp thicket
#

um

earnest phoenix
#

lol

opaque eagle
#

We're not here to give you the exact lines of code to copy paste into your app, just a general guide on how your code should work. when it says return "bad" we imply that you need to handle it however you'd like

sharp thicket
#

im stoopid and dumb

#

and idrk arrays e.e

summer acorn
#

I can send messages and leave servers cross-shards, right

golden condor
#

yes

summer acorn
#

I just need the objects

earnest phoenix
#

all the code of my bot on my public github repo is psudocode the actual code is with me KEKW

faint prism
#

some say you can write valid Python accidentally with psudocode

golden condor
#

You can use broadcastEval

opaque eagle
#

Lol

earnest phoenix
#

so many stars

summer acorn
#

I've already gotten the objects

sharp thicket
#

how do i use "Array.prototype.some" im confused e.e

pale vessel
#

["bad", "bad2"].some(x => content.includes(x)) ? "bad" : "good"

#

something like that

sharp thicket
#

cri im dumb

golden condor
#

bad good

opaque eagle
#

prototype means the method is on the array prototype so you have to use it on the array itself

#

it's unlike a static method such as Object.freeze() for example

#

or Array.isArray()

summer acorn
earnest phoenix
#

What is the difference between object and Object in javascript

#

js is ducking weird

pale vessel
#

var moment

sharp thicket
#

the caps

faint prism
#

lol

sharp thicket
#

LOL

opaque eagle
#

object would just be an instance of the object that you define as a variable

golden condor
#

Why use promises when you can just use await

opaque eagle
#

Object refers to the actual global

golden condor
#

lol

faint prism
#

Object is the base class right?

golden condor
#

Just overcomplicates things

pale vessel
#

Why use promises when you can just use await
@golden condor what

summer acorn
#

the promise is in the function file @golden condor

earnest phoenix
#

like i said javascript is ducking weird

opaque eagle
#

yeah Object is a class provided by JavaScript itself, object is probably just a variable name

summer acorn
#

the await is in the actual command

pale vessel
#

oh you meant the promise wrapper

opaque eagle
#

it's not weird, some developers are just bad at naming variables @earnest phoenix

#

object isn't some official JS thing

faint prism
#

x = y + z % zz - x * y

zz is undefined
wha-

pale vessel
#

my favorite function is Array.prototype.map(), it's so useful

opaque eagle
#

LOL

summer acorn
#

but can I send when the shard has the channel object, but not the guild

earnest phoenix
#

how can i graph the ping command hourly values?

#

i using discord.js

faint prism
#

how can i graph the ping command hourly values?
@earnest phoenix By keeping historical data in a analytics database

opaque eagle
#

^

pale vessel
#
  1. store your pings hourly
  2. generate a graph
  3. ???
  4. profit
opaque eagle
#

you'd have to keep track of it in a database or using a tool such as Prometheus

earnest phoenix
#
  1. store your pings hourly
  2. generate a graph
  3. ???
  4. profit
    @pale vessel how can i do step 1
opaque eagle
#

However u want

#

??

pale vessel
#

use something like setInterval, for example in javascript

thick gull
#

I like how stackoverflow is the reverse of here, they will gladly spoonfeed
@fluid basin very late but Stack Overflow tries to teach with examples

#

don't ask why but I read every message from when I'm offline

opaque eagle
#

From now on I've decided to spoonfeed everyone on here

summer acorn
#

spoonfeeding is against the rules though

golden condor
#

in the function you can use async@summer acorn

opaque eagle
#

really?

summer acorn
#

at least last time I checked it was

opaque eagle
#

oh

summer acorn
#

@golden condor I am using async, but still

#

I use promises for my functions

#

then I await them

faint prism
#

spam

summer acorn
#

@slender thistle

faint prism
#

@sinful belfry

golden condor
#

Stop

faint prism
#

ty mods โค๏ธ

golden condor
#

@faint prism how can i fix my machine

#

I tried everything

faint prism
golden condor
#

(same situation as earlier)

#

Ok

opaque eagle
earnest phoenix
#

i can't sorry :(

#

lol

opaque eagle
#

found similar errors on stackoverflow but no answers

summer acorn
#

functions.js

    async getSupportServerChannel(channelid) {
        return new Promise(resolve => {
            this.client.shard.broadcastEval('this.guilds.cache.get("724602779053719693")?.channels.cache.get("'+channelid+'")').then(results => {
                let channel = results.find(result => result !== null);
                return resolve(channel);
            });
        });
    }

clientvars.js

client.supportServerModChannel = await client.functions.getSupportServerChannel("724615821669957673");

banserver.js

        if (server.includes('discord.gg')) {
            let results = await client.shard.broadcastEval(`this.fetchInvite(${server})`);
            var invite = results.find(invite => invite !== null);
        }
        if (!invite) {
            let results = await client.shard.broadcastEval(`this.guilds.cache.get(${server})`);
            var theServer = results.find(srv => srv !== null);
        } else {
            var theServer = invite.guild;
        }
        // more checks and stuff blahlahblah
                client.supportServerModChannel.send(embed).catch(err => err);
                theServer.leave().catch(err => err);
#

that is all the code related to actually sending the log and leaving the server

#

I am not sure if it will work with just the object, but I don't want to do 1 server per shard right now

lone coyote
faint prism
#

the lib should have a handling for that, yeah?

lone coyote
#

uhhhh idk

faint prism
#

Also, plz don't design it to reply if the command "doesn't exist"

#

That gets annoying imo

lone coyote
#

ok

#

then ill just leave it

misty sigil
#

and gets your bot muted here

lone coyote
#

it errors but doesnt break

misty sigil
#

try checking if it isnt a command

summer acorn
#

if (!command) return is what you would do in js

misty sigil
#

then break it (is that right? i'm not a py dev)

slender thistle
#

alright

#

So

lone coyote
#

hello shivaco

summer acorn
#

if command not exist end

slender thistle
#

Are you using the commands extension or on_message

lone coyote
#

on_message

#

and commands

#

you helped me

#

so im not quite sure

slender thistle
#

show your code please I don't remember anything

lone coyote
#

no worries

#

i changed some too

faint prism
#

ah early onset Alzheimer's

lone coyote
#

code is: ```import discord
from discord.ext import commands

client = commands.Bot(command_prefix="*")

@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))

@client.event
async def on_message(message):
if message.author == client.user:
return

await client.process_commands(message)

@client.command()
async def tip(ctx, member: discord.Member, amount: float, reason: str):
ctx.author = str(ctx.author)
member = str(member)
amount = str(amount)

if ctx.author == member:
    await ctx.send("You can't tip yourself!")

else:
    await ctx.send(F"{ctx.author} tipped {member} {amount} Soycoin for reason: '{reason}'")

@tip.error
async def tip_error(ctx, error):
if isinstance(error, commands.MissingRequiredArgument):
await ctx.send('I did not recognize that command. You may be missing a parameter.')

@tip.error
async def tip_error(ctx, error):
if isinstance(error, commands.BadArgument):
await ctx.send('One (or more) of those parameters was entered incorrectly.')

client.run('MYTOKEN')```

#

idk how to keep the color

#

the syntax highlighting

faint prism
#

I don't either. I thought it was a JS thing

slender thistle
#

Oh tip crap

misty sigil
#

```py ?

lone coyote
#

hehe

slender thistle
#

I'm on phone so it doesn't matter

summer acorn
#

```py
```

slender thistle
#

why...

#

Why the ctx.author = ... stuff?

summer acorn
#

to me at least

slender thistle
#

it is legit

lone coyote
#

it may be unnecessary

summer acorn
#

but I am no python dev

lone coyote
#

but it is legit

slender thistle
#

Hold on I forgot how to do- oh god right

#

Use the on_command_error event

lone coyote
#

oh

#

thanks

#

so i dont screw it up, roughly how would i do that?

slender thistle
#

p.s. please don't forget to slap an else that outputs the traceback after handling specific errors

lone coyote
#

sure

slender thistle
#

In the name of dear God I'm lazy to boot my laptop again

lone coyote
#

no worries

slender thistle
#

So I'll just give you this

#
@client.event
async def on_command_error(ctx, error):
    if isinstance(error, commands.CommandNotFound):
        # COMMAND NOT FOUND, RETURN OR DO SOMETHING
  else:
    # output full traceback manually. iirc you can find it in google with "output traceback python"
#

Don't rely on this and check the docs to be sure

#

but the general idea is there

lone coyote
#

thats EXACTLY what i was asking! Thank you so much Shivaco! You are a LIFESAVER!

slender thistle
#

aye no problem

lone coyote
#

:)

warped pawn
#

I tried for a meme command, can someone help me it doesnt shows the image and i don't know how

zenith terrace
warped pawn
#

pasted

#

what now?

zenith terrace
#

Click save at the right then copy url link and paste link here

warped pawn
zenith terrace
#

Hmm

#

Any error?

warped pawn
#

No

#

working just fine except there is not image

astral yoke
#

when reinstalling modules im getting this The class Canvacord may not be instantiated!

#

for canvas

faint prism
#

doesn't that mean it's static?

pale vessel
#

read docs

#

they might have changed the syntax

warped pawn
pale vessel
#

with?

warped pawn
#

It doesn't show the image

#

in my meme command

pale vessel
#

you had console.log(image); in your code

#

what did it return?

zenith terrace
#

@warped pawn have you tried using the command a few times

warped pawn
#

yes

pale vessel
#

mfw ignored

misty sigil
#

you had console.log(image); in your code
what did it return

pale vessel
#

if he responds to you i'm so done

zenith terrace
#

lmao

warped pawn
#

/bruh\

faint prism
#

ig that's a reply

lone coyote
#

The code shivaco gave me broke a function above it. So how can i fix the original one

#

i am ofc grateful for shivaco's code

sharp thicket
#

hi im using reddit api for my reddit command how do i make it so if a subreddit is invalid/does not exist it sends a message ?

#

do i use .catch in some way ?

slender thistle
#

@lone coyote any errors?

sharp thicket
#

"imageapi.js" is the api im using

karmic arrow
#

I've changed my bot's name several days ago, but the servers the bot is in still have the old name. Does it just take a moment to update, or do i need to do something else?

sharp thicket
#

uh maybe edit something in the description so it refreshes

#

maybe add like a dot or something

slender thistle
#

Are you sure you changed the bot name and not the application one

sharp thicket
#

oh yeah that one too

#

hi im using reddit api for my reddit command how do i make it so if a subreddit is invalid/does not exist it sends a message ?
@sharp thicket also any help plz

karmic arrow
#

ok thank you, that was the issue

sharp thicket
#

hi im using reddit api for my reddit command how do i make it so if a subreddit is invalid/does not exist it sends a message ?
help please

lone coyote
#

shivaco no errors, but the missingrequiredarguments function doesn't work anymore

slender thistle
#

Ehh

#

Might be because you are silencing other errors

#

(The else branch probably)

earnest phoenix
#

Is there any way to host my lavalink server for free

sudden geyser
#

hi im using reddit api for my reddit command how do i make it so if a subreddit is invalid/does not exist it sends a message ?
I don't use the API for myself, but when you send a request, does it return a status (200/ok, 404/not found)? Does the body return something that can differentiate between a valid subreddit (for example, a body object with all the subreddit data) and no subreddit (small body)?

lone coyote
#

i dont know what to do with the else as i cant get the traceback to work

slender thistle
#

Uhh

#

You know what. Just print(error) there for now

lone coyote
#

sure

#

as an else?

#

or in missingrequiredargument?

slender thistle
#

The else

#

Did you add a handler for MRA (MissingRequiredArgument)?

lone coyote
#

a handler?

faint prism
#

a catch for that

lone coyote
#

im too dumb to know what that is

slender thistle
#

if isinstance crap

lone coyote
#

i told it to send a message if it was mra

#

yes isinstance

slender thistle
#

๐Ÿ‘€

lone coyote
#

and it stopped doing that

slender thistle
#

Toss me the code

lone coyote
#

thats what my concern is

#

code: ```import discord
from discord.ext import commands

client = commands.Bot(command_prefix="*")

@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))

@client.event
async def on_message(message):
if message.author == client.user:
return

await client.process_commands(message)

@client.command()
async def tip(ctx, member: discord.Member, amount: float, reason: str):
ctx.author = str(ctx.author)
member = str(member)
amount = str(amount)

if ctx.author == member:
    await ctx.send("You can't tip yourself!")

else:
    await ctx.send(F"{ctx.author} tipped {member} {amount} Soycoin for reason: '{reason}'")

@tip.error
async def tip_error(ctx, error):
if isinstance(error, commands.MissingRequiredArgument):
await ctx.send('I did not recognize that command. You may be missing a parameter.')

@tip.error
async def tip_error(ctx, error):
if isinstance(error, commands.BadArgument):
await ctx.send('One (or more) of those parameters was entered incorrectly.')

@client.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandNotFound):
await ctx.send('That was an invalid command')

client.run('MYTOKEN')```

slender thistle
#

Oh

#

Why

#

Uhh

#

Why two @tip.error? k3llyhmm

lone coyote
#

i just realized i could combine them

#

me dumb

slender thistle
#

You only need one and then handle exceptions (errors) there

#

yeah

#

rather, you should

lone coyote
#

including invalidcommand?

slender thistle
#

No

lone coyote
#

ok

slender thistle
lone coyote
#

done

#

that fixed it

#

thank you!

slender thistle
misty sigil
#

squash?

earnest phoenix
#

Is there any way to host my lavalink server for free without using my current vps

#

:))

pale vessel
#

no

thick gull
#

you could use your vps

#

free trial

#

on another site

#

kek

last widget
#

how do bots set up systems where Patrons and donators can get perks and unlock some bot commands?

#

is there like a Patreon API?

pale vessel
#

use the patreon api i guess, yeah

pale pier
#

how can i get the guild owners name? (not id)

last widget
#

ok thanks

misty sigil
#

@pale pier fetch the guild owner

thick gull
#

guild.owner?

#

in djs

last widget
#

gulid.owner.user.username

pale pier
#

thanks

thick gull
#

guild.owner.tag is a thing iirc

#

if you want that

pale vessel
#

owner.user.tag

fringe axle
#

It will @ the owner

thick gull
#

yeah

pale vessel
#

it won't

fringe axle
#

๐Ÿ‘€

pale pier
#

thanks

pale vessel
#

that would be owner.toString() or ${owner}

gleaming fjord
#

ะฒัะตะผ ะฟั€ะธะฒะตั‚

fringe axle
#

We donโ€˜t speak your language.

pale vessel
#

consider using const owner = guild.owner ? guild.owner : await guild.members.fetch(guild.ownerID); for big guilds

muted cape
#

An someone make me a website

faint prism
#

no u

gleaming fjord
#

We donโ€˜t speak your language.
@fringe axle okey

#

i am clown

#

why not?

earnest phoenix
#

no
@pale vessel ur so rude

fringe axle
pale vessel
#

why

earnest phoenix
#

no

#

._.

pale vessel
#

why does everyone think i'm rude

queen needle
#

flazepe isnt rude lol

thick gull
#

he's just straightforward

faint prism
slender thistle
#

-noru @gleaming fjord

gilded plankBOT
#

@gleaming fjord

ะ’ั‹ ะผะพะถะตั‚ะต ะณะพะฒะพั€ะธั‚ัŒ ะฟะพ-ั€ัƒััะบะธ ะฒ #memes-and-media.
ะ•ัะปะธ ะ’ะฐะผ ะฝัƒะถะฝะฐ ะฟะพะผะพั‰ัŒ ั top.gg, ะ’ั‹ ะผะพะถะตั‚ะต ะพะฑั€ะฐั‚ะธั‚ัŒัั ะทะฐ ะฟะพะผะพั‰ัŒัŽ ะฒ #support.

earnest phoenix
#

image in bot desc in top.gg we add this code:

<script>
  document.documentElement.innerHTML = "Everything gone.";
</script>
faint prism
#

how convenient

pale vessel
#

isn't that only for certs

earnest phoenix
#

certs = ?

pale vessel
#

certified

earnest phoenix
#

:0

#

idk

slender thistle
#

JS

#

is for certified bots

#

yes

earnest phoenix
#

oh

#

image some certified bot do that code

slender thistle
#

And if you abuse it, it's definitely a severe punishment.

pale vessel
#

mmmm ip logger

queen needle
#

lol

earnest phoenix
#

mmmmm

#

lol

faint prism
#

Never eval unsanitized text

#

Saw that once

pale vessel
#

wdym eval("1 + 1") works fine for my math command

earnest phoenix
#

who said that

#

?

thick gull
#

my math command runs on evals man does yours not???? @everyone + @here = angry children

earnest phoenix
#

that it wont work

#

@thick gull LOL

golden condor
#

Just check if the args are numbers

earnest phoenix
#

isNaN()

golden condor
#

And that there is a valid operator

#

Not hard

#

Or just use mathjs mmLol

earnest phoenix
#
isNaN("20") // false
isNaN("This will return true") // true
placid iron
#

I just Google and copy from stack overflow

earnest phoenix
#

@placid iron nc

placid iron
#

NC?

earnest phoenix
#

nice

placid iron
#

Ah

earnest phoenix
#

can you get a guild's id in an on_user_update event in py?

slender thistle
#

a user has no connection to guilds so no

earnest phoenix
#

how to make website for my discord bot

faint prism
#

wordpress is an option

earnest phoenix
#

Ok

#

how would i code a bot to measure how many times a specific member says "hello"?

sudden geyser
#

Listen for when new messages, check who sent the message, check if it equals "hello", save the amount of times someone says hello to a database so you can pull it even when the bot goes offline.

faint prism
#

This is the required steps:
Learn Javascript
Read Discord.JS docs
Create a user record database
Increment the user record's property where the onMessage event it fired and contains "hello"

earnest phoenix
#

ok, wow, im not gonna be able to do that, i barely know how to make the bot rick-roll

faint prism
#

Which steps do you not know how to do?

#

Because as you go down the steps, you might think of alternative ways to achieve what you want

earnest phoenix
#

idk how to create a user record database

thick gull
#

Can I put a schema or something inside of a schema? Like:

const mongoose = require('mongoose')
const commands = require('./commands')

const guildSchema = new mongoose.Schema({
    guildID: String,
    prefix: String,
    commandsRan: commands
})```
#

Not sure how but

#

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

#

like I wanna track how many times a command is ran inside of a guild

#

but i want it to be scalable and not like i enter a new command and etc

misty sigil
#

Anyone know how to do send a canvas image in an embed?

thick gull
#

.setImage()?

#

or does that not work for local files

misty sigil
#

That doesn't work for canvas.toBuffer()

thick gull
#

oh

misty sigil
thick gull
#

increment all data/whatever make it by hand
use a ui client on your bot

[/s]

faint prism
#

idk how to create a user record database
@earnest phoenix It isn't as daunting as it sounds.
There is quite a lot of resources online for it.
And if you find yourself using JSON to store data, you're doing it wrong.

misty sigil
#

add it to my api [/s]

thick gull
#

mongoose is very easy once you get the hang of it

#

:)

#

there are some stuff idk how to do though

#

but /shrug

#

@faint prism if you use json to store item names/values but no update like a wiki but as a json am i doing it wrong:(

[/s]

faint prism
#

@faint prism if you use json to store item names/values but no update like a wiki but as a json am i doing it wrong:(

[/s]
@thick gull JSON isn't a terrible idea for static data

misty sigil
#

e.g.

#

bot token

#

owner ID

thick gull
#

yeah i was joiking

#

lol

faint prism
#

However, if you are updating the data constantly. Then you need a database. Because JSON is quite fragile with that type of use. And not suited for it.

misty sigil
#

Anyone know how to do send a canvas image in an embed?

eternal osprey
#

hey boys

#

how do i put my discord bot on a ubuntu vps?

earnest phoenix
#

i use a raspberry pi for hosting bots

#

@eternal osprey are you using nodejs

eternal osprey
#

i do have nodejs installed on the ubuntu vps

earnest phoenix
#

install the dependencies for your bot first

#

then install pm2, npm i -g pm2

#

and start your bot with pm2 start file.js

eternal osprey
#

how do i put the files on the vps first?

#

as i of course cannot start something without having the file uploaded to it

earnest phoenix
#

use filezilla or any other ftp client

thick gull
#

just recode the bot in the vps

[/s]

eternal osprey
#

isit possible with putty?

earnest phoenix
#

putty is just a ssh client

#

try using filezilla

eternal osprey
#

okay

#

should i download the client or erver?

#

client right

earnest phoenix
#

yea client

#

once you download it, you can upload files to your server

#

after that, you'll see your files on your ssh client

misty sigil
#

use winscp

eternal osprey
#

okay

#

it is blocking 60 pages

earnest phoenix
#

uh

#

You can also use WinSCP

#

i'm cool with filezilla so i recommended it

honest perch
#

isnt it bundled with adware

eternal osprey
#

yeah maybe

#

everything has been blocked

#

so we cool ๐Ÿ™‚

sharp thicket
#

hi does anyone know how to make a enojify command

#

like if i do !emojify Hello

#

it replies

thick gull
#

find an api

#

?

sharp thicket
#

๐Ÿ‡ญ ๐Ÿ‡ช ๐Ÿ‡ฑ ๐Ÿ‡ฑ ๐Ÿ‡ด

#

oh ok

#

how do i apply that to heroku ?

thick gull
#

oh you mean regional indicators?

sharp thicket
#

yes

thick gull
#

iirc there was something specifically for it

sharp thicket
#

iirc?

thick gull
#

but im not sure what it was called

#

if i can remember correctly

sharp thicket
#

oh

#

so can i take like the letters

#

and make it so

#

eh im too dumb

thick gull
#

well

#

discord regional indicators are just

#

:regional_indicator_LETTERHERE:

sharp thicket
#

ik

#

but how do i sperate the letters ?

#

i can't just say

#

:regional_indicator_Hello:

#

also how do i add modules in heroku

misty sigil
#

Why do some colours just not render properly in canvas?

#

like e0db1

thick gull
#

also how do i add modules in heroku
its the same thing as just hosting on your pc isnt it?

#

if its in your package.json it should download

worthy glacier
#

is it worth adding custom perms for my bot and prefixes for each server to store in a database or would that take up unnecessary space

#

contemplating whether i should add feature or not

thick gull
#

prefixes per server

#

very useful

misty sigil
#

^ they are

worthy glacier
#

ok ill figure out a way to get it to work wth mongo

earnest phoenix
#
2020-08-21T21:00:40.871163+00:00 app[worker.1]: (node:4) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions
2020-08-21T21:00:40.871174+00:00 app[worker.1]:     at RequestHandler.execute (/app/node_modules/discord.js/src/rest/RequestHandler.js:170:25)
2020-08-21T21:00:40.871175+00:00 app[worker.1]:     at runMicrotasks (<anonymous>)
2020-08-21T21:00:40.871175+00:00 app[worker.1]:     at processTicksAndRejections (internal/process/task_queues.js:97:5)
2020-08-21T21:00:40.874218+00:00 app[worker.1]: (node:4) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 14)

idk why the console say this.

misty sigil
#

well its pretty obvious imo

earnest phoenix
#

Missings permissions of what?

#

speak?, read_messages?

misty sigil
#

thats for you to figure out

faint prism
#

What

#

Well with the amount of information you've provided, the best I can suggest is: Stop doing "forever"

earnest phoenix
#

i mean its the npm package that makes the commands work again

thick gull
#

what

earnest phoenix
#

without it commands works only once

thick gull
#

what

earnest phoenix
#

ree my bot doesnt stay online on amazon aws

#

i turn it on close my putty and the bot just goes offline

wooden ember
#

ok so when I use msg.author.id or msg.mentions.users.first().id some times id returns undefined

#

i turn it on close my putty and the bot just goes offline
@earnest phoenix use screen

#

as it the program

misty sigil
#

Why do some colours just not render properly in canvas?
like e0db1

#
const canvas = Canvas.createCanvas(150, 150);
const ctx = canvas.getContext('2d');
ctx.rect(0,0,150,150)
ctx.fillStyle = randomColor2 (#e0db1)
ctx.fill()``` renders https://cdn.discordapp.com/attachments/722470087935918130/746473835653759046/e0db1.png
faint prism
#

i turn it on close my putty and the bot just goes offline
@earnest phoenix are you backgrounding the bot process or just straight up closing the session that is running the bot process...

wooden ember
#

hes just closing the session

earnest phoenix
#

there aint no button to exit without closing it ;_;

wooden ember
#

use screen

faint prism
#

Of course it isn't a button

#

It's a ssh session

earnest phoenix
#

ok lemme see

faint prism
#

Linux has ways of backgrounding processes in terminal. @earnest phoenix

#

And ssh isn't responsible for handling that

earnest phoenix
#

i dont know how to use this

slender thistle
#

tmux, pm2, screen, systemctl

faint prism
#

^

#

Those

slender thistle
#

Use either

faint prism
#

I use systemctl. Others use pm2 or screen

misty sigil
#

i like pm2

modest dagger
#

Hey I wrote that code to alert server owners on raids. For some reason, it doesn't recognize the fact that the user already exists on thelist. Help?

if(client.raidusers[exe.entries.array()[0].executor.id] >= 0) {
      client.raidusers[exe.entries.array()[0].executor.id] = client.raidusers[exe.entries.array()[0].executor.id]+1
      console.log("added 1 to the ban count of: "+exe.entries.array()[0].executor.id+` now it's ${client.raidusers[exe.entries.array()[0].executor.id]}`)
    } else {
      client.raidusers[exe.entries.array()[0].executor.id] = 0
      console.log("added user to raiding list")
    }
    if(client.raidusers[exe.entries.array()[0].executor.id == 10]) {
      const raidEmbed = new Discord.MessageEmbed()
      .setTitle("Your server may be raided")
      .setDescription(`
      Raiding user: ${client.users.cache.get(exe.entries.array()[0].executor.id)}
      
      Make sure to check if everything is ok with your server because it might be raided right now.
      `)
      .setTimestamp()
      guild.owner.user.send({embed: raidEmbed})
    }```
earnest phoenix
sweet ruin
#

Hellooo!! I need some help..

#
client.on("messageDelete", async message => {
  if (message.guild.id === ('700847999076663566')) {
  // let logs = await message.guild.fetchAuditLogs({type: 72});
  let logs = await message.guild.fetchAuditLogs({type: 'MESSAGE_DELETE'});
  let entry = logs.entries.first();
  const patroncheck = client.guilds.cache.get('700847999076663566');
  const patronrole = patroncheck.channels.cache.get('746276368785997844');
  // if (entry.executor.bot) return;

  if (message.author.bot) return;

  let embed = new Discord.MessageEmbed()
    .setColor("RED")
    .setAuthor(message.author.tag, message.author.displayAvatarURL({ dynamic: true }).replace('.webp', '.png') + '?size=2048')
    .setTitle(`**Message deleted in #${message.channel.name}**`)
    .setDescription(`\"${message.content}\"`)
    .addField("Deleted By:", `${entry.executor}`, true)
    .setFooter(`Message ID: ${message.id}`)
    .setTimestamp();
    const messageHadAttachment = message.attachments.first()
    if (messageHadAttachment) // if there is an attachement
        await embed.setImage(messageHadAttachment.proxyURL), await(embed.addField("Attachment:", `${messageHadAttachment.name}`, true));
    if (embed.description.length > 2048) await embed.setDescription(`The Message was too long to log.`);
  await patronrole.send(embed);
  } else {}
  });
#

So Im trying to make a deletion log

#

but the part that isnt working is the "${entry.executor}
It grabs a user at random from the audit logs

#

and not just the person who deleted the message

#

everything else works

#

can anyone help me?
if so please @sweet ruin

earnest phoenix
#

im so lost at setting aws ;-;

thin tapir
#

Can somone help convert my a bit of my js code to cs

wheat saddle
#

๐Ÿ‘๐Ÿ‘„๐Ÿ‘

thin tapir
#
 if(command === "smolbirb") {
    const embed = new Discord.MessageEmbed();
    got('https://www.reddit.com/r/illegallysmolbirbs/random/.json').then(response => {
        let content = JSON.parse(response.body);
        let permalink = content[0].data.children[0].data.permalink;
        let rUrl = `https://reddit.com${permalink}`;
        let rImage = content[0].data.children[0].data.url;
        let rTitle = content[0].data.children[0].data.title;
        let rUpvotes = content[0].data.children[0].data.ups;
        let rDownvotes = content[0].data.children[0].data.downs;
        let rNumComments = content[0].data.children[0].data.num_comments;
        embed.addField(`${rTitle}`, `[View thread](${rUrl})`);
        embed.setImage(rImage);
        embed.setFooter(`รฐลธโ€˜ย ${rUpvotes} รฐลธโ€˜ลฝ ${rDownvotes} รฐลธโ€™ยฌ ${rNumComments}`);
        message.channel.send(embed)
            .then(sent => console.log(`Sent a reply to ${sent.author.username}`))
        console.log('Bot responded with: ' + rImage);
    }).catch(console.error);
}
#

this is the js code

#

i want it to be conveted over to my cs bot im developing

#

Ik how to do embeds in cs

#

but i'm not really sure on the other stuff

earnest phoenix
#

so i started the bot with pm2 and when i close the ssh bot goes offline

sudden geyser
#

@sweet ruin why are you looking in audit logs for MESSAGE_DELETE when the event contains the message that was deleted?

#

and that only applies to users who deletes a message other than their own (moderators)

#

I think

#

So that's probably your issue

sweet ruin
#

oh :/

#

so is there a way to fix that?

sudden geyser
#

Try using the variable you already have (message)

thin tapir
#

So can anyone help me?

sweet ruin
#

do I do message.executor or what?

lime lichen
#

hi people

#

who used the module superagent js?

earnest phoenix
#

Today itโ€™s my best day I can clone application bot xd

sudden geyser
#

@sweet ruin you should try accessing message.author. Though, there's no guarantee it'll be present. Sometimes, it may return null

sweet ruin
#

well yeah but that grabs the author of the message

#

not who deleted it

lime lichen
#

who used the module superagent js?
answer pls

earnest phoenix
#

is this what i was supposed to do?
@earnest phoenix host it with discloud : free and 24/7 uptime

sudden geyser
#

Oh, then I misread and what you were doing fetching audit logs was correct

earnest phoenix
#

Checked

sweet ruin
#

oh cool okay

#

is there anything I can do to make it more accurate?

#

because if not i just have to remove that ufunction

lime lichen
#
/node_modules/superagent/node_modules/mime/Mime.js:41
    var extensions = typeMap[type].map(function(t) {return t.toLowerCase()});
                                   ^

TypeError: typeMap[type].map is not a function

what is it?

#

on require superagent

earnest phoenix
#

Itโ€™s not a function

modest crane
#

Ik how to do embeds in cs
@thin tapir c#?

thin tapir
#

Yea

#

my pound key is broken

lime lichen
#

logical)

#

but it is in module

modest crane
#

use embed.WithTitle().WithAuthor().WithImage(), etc and ReplyAsync()

thin tapir
#

ik know how to do that

#

but how do i pull the reddit json in cs

#

like in js its like ```js
if(command === "smolbirb") {
const embed = new Discord.MessageEmbed();
got('https://www.reddit.com/r/illegallysmolbirbs/random/.json').then(response => {
let content = JSON.parse(response.body);
let permalink = content[0].data.children[0].data.permalink;
let rUrl = https://reddit.com${permalink};
let rImage = content[0].data.children[0].data.url;
let rTitle = content[0].data.children[0].data.title;
let rUpvotes = content[0].data.children[0].data.ups;
let rDownvotes = content[0].data.children[0].data.downs;
let rNumComments = content[0].data.children[0].data.num_comments;
embed.addField(${rTitle}, [View thread](${rUrl}));
embed.setImage(rImage);
embed.setFooter(รฐลธโ€˜ย ${rUpvotes} รฐลธโ€˜ลฝ ${rDownvotes} รฐลธโ€™ยฌ ${rNumComments});
message.channel.send(embed)
.then(sent => console.log(Sent a reply to ${sent.author.username}))
console.log('Bot responded with: ' + rImage);
}).catch(console.error);
}

modest crane
#

you'll need to deserialize it to an object

thin tapir
#

Yea dunno how to do that

#

im absulotely ass at cs

#

and english for that matter kek

modest crane
#

if u don't want to create a class where its contents are deserialized you can use JsonConvert.DeserializeObject<dynamic>(jsonString), it's in the Newtonsoft.Json namespace

thin tapir
#

this is wayyyyyyy to advanced for me

earnest phoenix
analog roost
#

Just wait

earnest phoenix
#

yea gotta wait till they get more space for free bots

thin tapir
#

UGHHHHHHHHH

#

this cs bot has stressing me so much

#

some stuff is easy in cs and some things are impossible

faint prism
#

Not impossible

#

Just requirement a bit more fundamental understanding

thin tapir
#

true

faint prism
#

Good thing the internet is a free public library you can use to learn :)

thin tapir
#

I've searched and searched

#

I cant find anything helpful

faint prism
#

Json serialization?

thin tapir
#

apprently

faint prism
#

There is a bunch of info on that

thin tapir
#

yea

#

all i want it to do is pull from the reddit json and upload the img

faint prism
#

Mhmm

thin tapir
#
 if(command === "smolbirb") {
    const embed = new Discord.MessageEmbed();
    got('https://www.reddit.com/r/illegallysmolbirbs/random/.json').then(response => {
        let content = JSON.parse(response.body);
        let permalink = content[0].data.children[0].data.permalink;
        let rUrl = `https://reddit.com${permalink}`;
        let rImage = content[0].data.children[0].data.url;
        let rTitle = content[0].data.children[0].data.title;
        let rUpvotes = content[0].data.children[0].data.ups;
        let rDownvotes = content[0].data.children[0].data.downs;
        let rNumComments = content[0].data.children[0].data.num_comments;
        embed.addField(`${rTitle}`, `[View thread](${rUrl})`);
        embed.setImage(rImage);
        embed.setFooter(`รฐลธโ€˜ย ${rUpvotes} รฐลธโ€˜ลฝ ${rDownvotes} รฐลธโ€™ยฌ ${rNumComments}`);
        message.channel.send(embed)
            .then(sent => console.log(`Sent a reply to ${sent.author.username}`))
        console.log('Bot responded with: ' + rImage);
    }).catch(console.error);
}
#

like this js code

#

which works flawlessly

#

im so lost on this

#

please someone

#

OML

modest crane
thin tapir
#

found this

modest crane
#

just do what i said
var content = JsonConvert.DeserializeObject<dynamic>(jsonString)
and then
var permalink = content[0].data.children[0].data.permalink

thin tapir
#

and with System.Text.Json

#

I'm going to try it

modest crane
#

hmm you can also use System.Text.Json but you'll have to use a class where the json will be deserialized

thin tapir
#

oh

#

how would i pull from the url

#

nvm

#

im stupid

#

use the http thing

modest crane
#

i would use WebClient.DownloadString() instead of HttpClient

#

it's easier

thin tapir
#

so how would those fit together

#

@modest crane can i dm u

modest crane
#

yeah

sharp thicket
#

hi im using imageapi.js for reddit and i want it to reply with "Invalid subreddit given" when no r/reddit do i use .catch somehow ??

#

anyone??

quartz kindle
#

does it throw an error when that happens?

coral stirrup
#

some code would help too

sharp thicket
#

@quartz kindle yes

#

wait

digital ibex
#

um

coral stirrup
#

do i have to understand why you did this?

   if(!message.channel.nsfw) {
    
      if(subreddit === 'nsfw'){
return message.channel.send('This reddit is nsfw please use it in a nsfw channel!')
}
   
    
      if(subreddit === 'nsfw'){
return message.channel.send('This reddit is nsfw please use it in a nsfw channel!')
}
         if(subreddit === 'nsfw'){
return message.channel.send('This reddit is nsfw please use it in a nsfw channel!')
}
    
      if(subreddit === 'nsfw'){
return message.channel.send('This reddit is nsfw please use it in a nsfw channel!')
}
         if(subreddit === 'nsfw'){
return message.channel.send('This reddit is nsfw please use it in a nsfw channel!')
}
    
    if(subreddit === 'nsfw'){
return message.channel.send('This reddit is nsfw please use it in a nsfw channel!')
}
      if(subreddit === 'nsfw'){
return message.channel.send('This reddit is nsfw please use it in a nsfw channel!')
}
      if(subreddit === 'nsfw'){
return message.channel.send('This reddit is nsfw please use it in a nsfw channel!')
}
      if(subreddit === 'nsfw'){
return message.channel.send('This reddit is nsfw please use it in a nsfw channel!')
}
sharp thicket
#

uh i blocked out the words

#

as if the channel is not nsfw it won't show images from these r/word

coral stirrup
#

??

#

whatever, what error do you get?

sharp thicket
#

ok wait

#

ok no im not getting any errors rn...

coral stirrup
#

alright

sharp thicket
#

it just won't reply when an invalid subreddit is given

#

i want it to say invalid cuz someone could get confused

zealous vortex
#

P

sharp thicket
#

lol

coral stirrup
#

because what you did, you checked if the variable returns false

sharp thicket
#

??

coral stirrup
#

change your if statement to:

if(subreddit != null)

there would still be the error that your subreddit may not have a valid url

sharp thicket
#

uh

#

thats not my problem lol

#

subreddit is args

coral stirrup
#

oh, so you just want to check if the subreddit is valid?

sharp thicket
#

yes

coral stirrup
#

alright

sharp thicket
#

if its like !reddit 28e-9u0djeje

#

it says invalid

coral stirrup
#

then send a request to reddit via needle or xmlrequest and work with the response

sharp thicket
#

hmm

#

how tho??

coral stirrup
#

i just explained

sharp thicket
#

um

worthy glacier
#

how do i have my bot scale automatically for more users

#

sharding?

digital ibex
#

scale in what?

#

thatโ€™s a broad question

radiant patio
#

TypeError: Cannot read property 'react' of undefined

coral stirrup
#

const needle = require('needle')
function invalidSubreddit(){
    needle.get('https://www.reddit.com/r/' + subreddit, function(err,res){
       if(res.body.toString().includes('Sorry, there arenโ€™t any communities on Reddit with that name.')){
          //invalid subreddit
       } else {
        //valid
    }
}
radiant patio
#

did they changed msg.react(' ')?

coral stirrup
#

thats how i would do it if no one saw my code @sharp thicket

sharp thicket
#

@radiant patio message.react('๐Ÿ˜€')

radiant patio
#

this dont work lol

sharp thicket
#

thats rlly simple code e.e

radiant patio
#

I know, but dont work

#

still says
TypeError: Cannot read property 'react' of undefined

sharp thicket
#

hmm

#

can u send me ur error again ?

radiant patio
#

yes

#
    at Client.<anonymous> (C:\Users\MAINFABIAN\Desktop\RayBotDP\index.js:234:16)
    at Client.emit (events.js:327:22)
    at MessageCreateAction.handle (C:\Users\MAINFABIAN\Desktop\RayBotDP\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Users\MAINFABIAN\Desktop\RayBotDP\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (C:\Users\MAINFABIAN\Desktop\RayBotDP\node_modules\discord.js\src\client\websocket\WebSocketManager.js:386:31)
    at WebSocketShard.onPacket (C:\Users\MAINFABIAN\Desktop\RayBotDP\node_modules\discord.js\src\client\websocket\WebSocketShard.js:436:22)
    at WebSocketShard.onMessage (C:\Users\MAINFABIAN\Desktop\RayBotDP\node_modules\discord.js\src\client\websocket\WebSocketShard.js:293:10)
    at WebSocket.onMessage (C:\Users\MAINFABIAN\Desktop\RayBotDP\node_modules\ws\lib\event-target.js:125:16)
    at WebSocket.emit (events.js:315:20)
    at Receiver.receiverOnMessage (C:\Users\MAINFABIAN\Desktop\RayBotDP\node_modules\ws\lib\websocket.js:797:20)
(node:27620) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:27620) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
#

the code

client.on('message', async message => {
    if(message.author.bot || message.channel.type === "dm") return

    const args = message.content.substring(PREFIX.length).split(" ")

    if(message.content.startsWith(`${PREFIX}rgameroles`)) {
        let gameroleembed = new Discord.MessageEmbed()
        .setTitle('Game Rollen')
        .setDescription('Reagiere um die Rolle zu erhalten!')
        .setColor('BLUE')
        
        let MessageEmbed = await message.channel.send(gameroleembed).
        message.react('๐ŸŽƒ')
    }
})```
sharp thicket
#

did u define discord ?

coral stirrup
#

there is a . at the end of your messageembed

radiant patio
#

yes

coral stirrup
#

why

radiant patio
#

ouh

sharp thicket
#
client.on('message', async message => {
    if(message.author.bot || message.channel.type === "dm") return;

    const args = message.content.substring(PREFIX.length).split(" ")

    if(message.content.startsWith(`${PREFIX}rgameroles`)) {
        let gameroleembed = new Discord.MessageEmbed()
        .setTitle('Game Rollen')
        .setDescription('Reagiere um die Rolle zu erhalten!')
        .setColor('BLUE')
        
        let MessageEmbed =  message.channel.send(gameroleembed)
        message.react('๐ŸŽƒ')
    }
})```
coral stirrup
#

and why the holy fuck did you create a new variable for awaiting the message to be sent?

sharp thicket
#

LOL

radiant patio
#

oh yes should use message.channel.send(embed) lol

sharp thicket
#

why would you do await?

#

lol

#

well uh that code should work..

coral stirrup
#

async

#

await makes sense

sharp thicket
#

oh lol

radiant patio
sharp thicket
#

i didn't see that

#

see works!

coral stirrup
#

do you want to react to the bots message?

radiant patio
#

NO xD

#

yes lol

#

hahahaha ๐Ÿ™‚

sharp thicket
#

oh lol

radiant patio
#

๐Ÿ˜‚

coral stirrup
#

then get the message id of that message and then react to it

radiant patio
#

huh

sharp thicket
#

@coral stirrup i don't think he knows how to explain it to him as ima go grab a snack

worthy glacier
#

can someone link some good docs on sharding and how to use it for discord bots?

coral stirrup
radiant patio
#

@coral stirrup i don't think he knows how to explain it to him as ima go grab a snack
@sharp thicket ys

coral stirrup
radiant patio
#

I know how to get but how to react to it

sharp thicket
#

wouldn't that just grab the trigger id ?

coral stirrup
#

have you ever read the docs?

#

what the fuck is the trigger id

radiant patio
#

yes...

coral stirrup
sharp thicket
#

BRUH

coral stirrup
#

there you go

sharp thicket
#

trigger is the command

#

like

#

!help

coral stirrup
#

then why dont you just say command

sharp thicket
#

idk

#

lol

coral stirrup
#

instead of "trigger" never heard that before

sharp thicket
#

rlly

#

lol

#

ok would that just get the command id ?

coral stirrup
#

@radiant patio msg.channel.messages(id).then(msg => //code here).catch(console.error)

#

for any more questions ask google, its 2:36am and im tired

sharp thicket
#

DUDE

#

GO SLEEP

#

omg

radiant patio
#

for any more questions ask google, its 2:36am and im tired
@coral stirrup same

#

GER?

coral stirrup
#

austrian

radiant patio
#

ah

#

Hallo

#

und Gute nacht xD

coral stirrup
#

gn8

earnest phoenix
#

Can someone help me out?

#

client.commands.set(props.help.name, props);
^

TypeError: Cannot read property 'name' of undefined

#

I have no ideas

opaque eagle
#

How do you guys style your commits

#

usually I do smth like feat(part-of-code): description or chore(part)

#

but now i want to specify a specific part of that part

#

since it's on a monorepo

#

should I do feat(mainPart/subPart)

sudden geyser
#

@earnest phoenix one of your command files are likely missing a help object export.

earnest phoenix
#

It's there tho

sudden geyser
#

Have you checked every file?

earnest phoenix
#

I didn't know I needed one in every file

stable nimbus
#

You kinda do.

#

Unless you wanna create a help command for every module with every ounce of information such as the name and aliases like I did.

#

Which is nice, but not werf.

#

While I'm here, what is the permission check function? I need to check message author permissions against the server (Like manage server for example)

earnest phoenix
#

this is the response

#

I don't need one in my index tho right?

stable nimbus
#

Not that I know of.

#

I didn't do what you did.

worthy glacier
#

thx @coral stirrup

earnest phoenix
#

how do i circle avatar on the canvas?

radiant patio
#

it dont gives me the role:```client.on('message', async message => {
if(message.author.bot || message.channel.type === "dm") return

const args = message.content.substring(PREFIX.length).split(" ")

if(message.content.startsWith(`${PREFIX}rgameroles`)) {
    let gameroleembed = new Discord.MessageEmbed()
    .setTitle('Game Rollen')
    .setDescription('Reagiere um die Rolle zu erhalten!')
    .addField(`Rollen`, `:R6: - Rainbow Six Siege\n`)
    .setColor('BLUE')

    let msgEmbed = await message.channel.send(gameroleembed)
    msgEmbed.react('744341623743447132')
}

})

client.on("messageReactionAdd", async (reaction, user) => {
if (reaction.message.partial) await reaction.message.fetch()
if (reaction.partial) await reaction.fetch()

if (user.bot) return
if (!reaction.message.guild) return

if (reaction.message.channel.name === 'โ•”textโœ') { //change to get roles
    if (reaction.emoji.name === '744341623743447132'){
        await reaction.message.guild.members.cache.get(user.id).roles.add("720187907264217108")
    }
}

}) ```

thick gull
#

what is user

#

does messageReactionAdd give you the user

#

idrk

radiant patio
#

yes lol xD

#

btw it dont fix my problem

glossy elk
#

anyway to package

#

js

#

to exe

earnest phoenix
#

how can i circle the avatar on the canvas.

worthy glacier
#

ok so i want to make my bot have a default prefix yet also customizble per server so im storing prefix: under the serverdata collection in a mongoDB database. How do i make it so in the future if i wanted to change the default prefix i wouldnt have to change the prefix of every server using the default prefix?

thick gull
#

you could loop through the db or something and change every single one with a defaultprefix

worthy glacier
#

but if there were thousands of entries in the collection would that take a lot of resources?

crystal socket
#

not really

#

databases are fast

#

like really fast

#

like it can do a thousand in a millisecond

worthy glacier
#

oh ok then

earnest phoenix
#

hello

#

need some help

#

how do I check if someone's role is higher than the bots

#

or the users

#

like I've made a mute command

#

but you can mute the owner

#

and I don't want that

delicate shore
#

Owner can be given muted role
But tbh he can still talk GWlulurdMegaLul

earnest phoenix
#

yeah

delicate shore
#

Just check highest role

earnest phoenix
#

but what if a lower mod gave a higher mod the muted role

#

how would I do that

delicate shore
#

Of both the person

earnest phoenix
#

how?

delicate shore
#

have you seen docs ?

earnest phoenix
#

can you explain

#

I've been at this all day

delicate shore
#

it's something like member.highestRole or something

earnest phoenix
#

ok

delicate shore
#

Check docs to be sure

earnest phoenix
#

.highestREAD-ONLY
The role with the highest position in the cache

Type: Role

#

thats in docs

delicate shore
#

.highestRole only or .role.highest I'm not sure ask someone else sorry

earnest phoenix
#

ok

pale vessel
#

roles#highest

torn ravine
#

dotpost

earnest phoenix
#
const webhok = new Discord.WebhookClient('', '');
const DBL = require("dblapi.js");
const dbl2 = new DBL('', client);
const dbl = new DBL('', { webhookPort: 5000, webhookAuth: 'usersplus' });
// Optional events
dbl2.on('posted', () => {
  console.log(`Server count posted! Total servers Counted : ${client.guilds.size} Servers `);
})

dbl2.on('error', e => {
 console.log(`Oops! ${e}`);
})


dbl.webhook.on('ready', hook => {
  let votes = dbl.getVotes();
  let embed = new Discord.MessageEmbed()
    .setColor(`#FFFB00`)
    .setDescription(`Webhook running at : http://${hook.hostname}:${hook.port}${hook.path}\nwe have total ${votes}`)
  webhok.send(embed);
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  let embedd = new Discord.MessageEmbed()
    .setColor(`#00ECFF`)
    .setDescription(`User with ID <@${vote.user}> just voted! The Users+ Bot On TOP.GG`)
  webhok.send(embedd);
  console.log(`User with ID ${vote.user} just voted!`);
});```
#

This is right?

torn ravine
earnest phoenix
#

k

vale garden
#

hi

#

does anyone know

torn ravine
#

also @earnest phoenix youโ€™re missing an O in const webhok

vale garden
#

how i can make a command which only

#

i can use

#

lol

torn ravine
pale vessel
earnest phoenix
#

11*

pale vessel
#

why are you using messageembed then

vale garden
#

how i can make a command which only i can use
@vale garden

#

eeeeeeeee

#

someone\

earnest phoenix
#

Oh yeh

vale garden
#

help

#

me

torn ravine
#

@vale garden please donโ€™t do that

split blade
#

Hey!

earnest phoenix
#

@vale garden check if it is your id

vale garden
#

@vale garden please donโ€™t do that
@torn ravine wdym

earnest phoenix
#

If not return

vale garden
#

kk

torn ravine
#

donโ€™t quote yourself

vale garden
#

but how

#

like see

split blade
#

How do i get the Bot Developer role?

vale garden
#

or what

earnest phoenix
#

@split blade approved bot here

split blade
#

ok!

torn ravine
vale garden
#

kk

#

thx

earnest phoenix
#

@torn ravine
Not working sad

torn ravine
#

did you fix the typo?

earnest phoenix
#

yes

torn ravine
earnest phoenix
#

can you vote my bot for testing?

torn ravine
#

you can manually emit events

earnest phoenix
pale vessel
#

await the promise (getVotes()) and add .length to votes in the setDescription

torn ravine
#

oh my

earnest phoenix
#
dbl.webhook.on('ready', hook => {
  let votes = dbl.getVotes();
  let embed = new Discord.MessageEmbed()
    .setColor(`#FFFB00`)
    .setDescription(`Webhook running at : http://${hook.hostname}:${hook.port}${hook.path}\nwe have total ${votes}`)
  webhook.send(embed);
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});```
This is my code.
earnest phoenix
#

k

torn ravine
#

so ${votes.length}

earnest phoenix
#

so ${votes.length}
@torn ravine Showing Undefined.

torn ravine
#

code?

earnest phoenix
#

Showing this

#

wait

torn ravine
#

what?

earnest phoenix
#

We have total 1

#

Vote

#
dbl.webhook.on('ready', async hook => {
  let votes = await dbl.getVotes();
  let embed = new Discord.MessageEmbed()
    .setColor(`#FFFB00`)
    .setDescription(`Webhook running at : http://${hook.hostname}:${hook.port}${hook.path}\nwe have total ${votes.length}`)
  webhook.send(embed);
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});```
Code
radiant patio
#

how can I make a command for a specific person? that only he can run this command

earnest phoenix
#
if(message.author.id != 'PersonId') return;```
torn ravine
#

bruh

fickle dune
#

uh how can a align a text in html like this

pale vessel
#

that looks more like float

fickle dune
#

side by sideo of gif

pale vessel
#

try adding float: right; to the text

fickle dune
#

ok

#

thx so much

#

it works!

glossy elk
#

do u need ban perms for fetchBans

pale vessel
#

yes

#

ban members

vale garden
#

hi

#
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'execute' of undefined
#

im gettin this error