#development

1 messages Β· Page 1046 of 1

pure lion
#

πŸ˜„

earnest phoenix
#

Thank you guys soo much

#

Thats was my alt

opal plank
gray zealot
#

any ideas why this doesnt work? js if (message.content === `${prefix}join`) { // Only try to join the sender's voice channel if they are in one themselves if (message.author.voiceChannel) { message.author.voiceChannel.join() .then(connection => { // Connection is an instance of VoiceConnection message.reply('I have successfully connected to the voice channel!'); }) .catch(console.log); } else { message.reply('You need to join a voice channel first!'); } } I want it to join the vc that you are in if you type $join. but It keeps sending You need to join a voice channel first!

opal plank
#

i havent used voice at all, but clearly the check thats failing is that first one message.author.voiceChannel. Add a breakpoint there and see its value when the command is ran

gray zealot
#

ok...

#

it didnt work...

summer basin
#

Is there anyway for a person to mess up a bots connection

gray zealot
#

😐 not telling

summer basin
#

:/

gray zealot
#

;/

summer basin
#

:(

sonic lodge
#

why

summer basin
#

For how my bot runs one it disconnects I have to restart it

sonic lodge
#

oh you want to test a disconnect

summer basin
#

no...

#

I want to make sure user can’t cause the bot to lose connection

sonic lodge
#

the only way i would see this happening is exposing an eval command to your user

gray zealot
#

For how my bot runs one it disconnects I have to restart it
@summer basin oh πŸ˜„ I though of something else, sorry

#

😬

summer basin
#

Wait what

gray zealot
#

nvm

summer basin
#

Uhhhh

sonic lodge
#

a user can't cause your bot to disconnect basically

summer basin
#

Ok

#

Thanks

sonic lodge
#

unless if you give them the power to run code with eval

earnest phoenix
#

someone have a command for a meteo ?

#

pls

sonic lodge
#

which you won't

gray zealot
#

how do I make the prefix the prefix or bot tag like this? ```js
const prefix = $ || BOTNAME#0000

solemn latch
#

That example would only work if someone typed
BOTNAME#0000

gray zealot
#

well

#

@botname

solemn latch
#

You would want to check for a mention

gray zealot
#

how...? πŸ˜„

solemn latch
#

@botname also doesn't work

gray zealot
#

why?

#

#0000

#

or something πŸ˜‚

solemn latch
#

Discord sends it like this
<@userid>

gray zealot
#

okk

#

oh yeah πŸ˜„

#

I think I have it...

#

one sec...

solemn latch
#

Anyway. Anidots guide has a good example

gray zealot
#

ok

cunning gorge
#

Hey, I have a reddit command which pulls a post from a specific reddit, however, sometimes it sends the url to a video or text rather than an image. Would anyone be kind enough to perhaps help me filter my command to produce an image only. Thanks!

opal plank
#

doesnt reddit have a url bit for image extension?

misty sigil
#

I think yea

opal plank
#

previews at least contain the name.file

#

@cunning gorge

cunning gorge
#

Ah

#

I see

misty sigil
#

what is your code

#

just saying help doesn’t help us

solemn latch
#

πŸ€”

#

for some reason, i never understand whats wrong when people post images

misty sigil
#

We aren’t majik men who can read code majikally

#

if we could we’d prob be stealing mee6’s token

winter basalt
#

glitch

solemn latch
#

thats only part of the code

misty sigil
#

it’s because the emojis

#

the bot isn’t in the same servers as the emojis

#

I bet

winter basalt
#

that server ur testing in?

hollow basin
#

Does anyone know is discord recognizes and deals with Cache-Control headers when loading embedded images?

earnest phoenix
#

ok.

solemn latch
#

ok.

earnest phoenix
#
@client.event
async def on_guild_join(guild):
    general = find(lambda x: x.name == 'general',  guild.text_channels)
    if general and general.permissions_for(guild.me).send_messages:
        await general.send('Hello {}!'.format(guild.name))```
#

I'm trying to make it so when bot joins

#

it sends a msg in the top channel or any channel it's able to

gray zealot
#
if (message.content === `${prefix}start`) {
        const channel = client.channels.cache.get("731314888835727490");
    if (!channel) return console.error("The channel does not exist!");
    channel.join().then(connection => {
        // Yay, it worked!
        console.log("Successfully connected.");
    }).catch(e => {

        // Oh no, it errored! Let's log it to console :)
        console.error(e);
    });
```is there a way it could join by channel name? not id?
#

pls ping me

#

(@gray zealot )

earnest phoenix
#

Try ```js
// Search in all guilds
var channel = client.channels.cache.find(channel => channel.name === "Channel Name");

// Search in user guild
var channel = message.guild.channels.cache.find(channel => channel.name === "Channel Name");

#
@client.event
async def on_guild_join(guild):
    general = find(lambda x: x.name == 'general',  guild.text_channels)
    if general and general.permissions_for(guild.me).send_messages:
        await general.send('Hello {}!'.format(guild.name))```
#

how od i make bot send msg to server

#

when it joins

trim saddle
#

@earnest phoenix don't look for general

earnest phoenix
#

how else then

trim saddle
#

just look for the first channel that you can send messages in

earnest phoenix
#

can u show me how i don't understand

trim saddle
#
chan = [x for x in guild.text_channels if x.permissions_for(guild.me).send_messages][0]
earnest phoenix
#

@trim saddle

#

Then chane.send?

#

chan*

trim saddle
#

yeah

earnest phoenix
#

oh ok

#

ty man

#

life saver

trim saddle
#

you might want to add a try: except: in case theres no channel

earnest phoenix
#

hmm

#

what should the bot do

#

if no channel?

#

dm them?

trim saddle
#

not say anything

earnest phoenix
#

what if you don't add the try

#

just an ugly error lol

trim saddle
#

well, it's an error if there's no sendable channels

earnest phoenix
#
@client.event
async def on_guild_join(guild):
  chan = [x for x in guild.text_channels if x.permissions_for(guild.me).send_messages][0]
  chane.send('Hey')
#

so this would be fine?

trim saddle
#

the variable is wrong and there's no await

earnest phoenix
#

it doesn't work

#

oh yeah

#

wdum variable is wrong

trim saddle
#

chane

earnest phoenix
#

await is always an error lol

#

i fix it tho

#

but it's like php

#

with the ;

trim saddle
#

...

#

you're supposed to await chan.send()

earnest phoenix
#
@client.event
async def on_guild_join(guild):
  chane = [x for x in guild.text_channels if x.permissions_for(guild.me).send_messages][0]
  await chane.send('Hey')```
#

This doesn't work either

#

@trim saddle

trim saddle
#

uhhh

#

i don't see any issues unless there were no channels found

earnest phoenix
#

there were channels tho

trim saddle
#

print the list

earnest phoenix
#

how

trim saddle
#

print()

earnest phoenix
#

print what

#

the chane?

#

@trim saddle

#

it doesn't print the list

#

so the event is just messed up

#
@client.event
async def on_guild_join(guild):
  chane = [x for x in guild.text_channels if x.permissions_for(guild.me).send_messages][0]
  await chane.send('Hey')
  print(chane)```
#

nor does it print anything

trim saddle
#

uhhh...

earnest phoenix
#

did I do on guild wrong

trim saddle
#

how about this

#

put it in a try and except

earnest phoenix
#

I did

#

it's not going past

#

async def

#

i even did print('f')

trim saddle
#

uhh...

#

where is this function at

earnest phoenix
#

wait

#

you have a if statement

#

and no :

#

@trim saddle

trim saddle
#

an if statement should work

earnest phoenix
#

@trim saddle

#
@client.event
async def on_guild_join(guild):
  print('hey')```
#

in general the async isn't working

trim saddle
#

so

#

your function is somewhere it shouldn't be

earnest phoenix
#

how tho

#

I have another function

#

and it's not effecting

noble magnet
#

@earnest phoenix

#
@client.event
async def on_guild_join(guild):
    def check(event):
        return event.target.id == client.user.id
    bot_entry = await guild.audit_logs(action=discord.AuditLogAction.bot_add).find(check)
    await bot_entry.user.send("Hello! Thanks for inviting me!")
earnest phoenix
#

@noble magnet, I appreciate your enthusiasm for having that respect to wanting to help me out! However I solved the issue, but thanks!

noble magnet
#

Nobody bro!

hazy sparrow
#

how to send images without the link in a embed

astral yoke
#

switching to v12 right. I have this .addField("Prefix", prefix, true) how come its erroring this UnhandledPromiseRejectionWarning: TypeError: fields.flat is not a function

solemn latch
#

Do you have an empty field sonewhere?

astral yoke
#

thats where it goes to when you click on it

#

is .addField("Prefix", prefix, true)

solemn latch
#

Is your nodejs version 12+

#

Discordjs 12 requires nodejs 12+

astral yoke
#

v12.18.2

#

so it sends me to the MEssageEmbed node module and i did this

#

i switched the thing to the other thing and it worked

wheat hornet
#

like hell

#

pls ping me if u know

fast glen
#

I dont know whats wrong with that but I would rather do something like

if (message.author.bot) return;
wheat hornet
#

wdym?

#
&& message.author.bot === false
// i included it 
fast glen
#

You are checking if author is bot. And thats causing some problems because I dont know your code I would put that every on_message event by bot will get returned

earnest phoenix
#
@commands.command()
    async def prefix(self, ctx, prefix:str=None):
      if prefix == "":
        await ctx.send('To be filled in')
      else:  
        if len(prefix) >= 3:
          embed=discord.Embed(title="Bot Prefix:", description=f"**Prefix** can't be longer than **3** characters!\n\n\`\`\`{prefix} <<<\n\nInvalid Type\`\`\`", color=0x4faaff)
          await ctx.send(embed=embed)
        else: 
          with open('prefixes.json', 'r') as f:
            prefixes=json.load(f)
            prefixes[str(ctx.guild.id)] = prefix
            with open('prefixes.json', 'w') as f:
              json.dump(prefixes, f, indent=4) 
            embed=discord.Embed(title="Server Prefix Changed!", color=0x4faaff)
            embed.add_field(name="New Prefix:", value = prefix, inline=False)
            await ctx.send(embed=embed)```
#

how come this doesn't work

fast glen
#

whats the error?

earnest phoenix
#

Sry my bad

#

I realize saying it doesn't work doesn't explain much

#

so basically

#

it works

#

but I want to make it so it executes the if statement if they just typw !prefix

#

!prefix <prefix> works good tho

wheat hornet
#

it sees that the prefix is ""

#

which is not

earnest phoenix
#

I also tried it with prefix == None

#

that didn't work either

#

it just bypasses the if and goes to the else

golden condor
#

That's because it has to be defined in the function

#

Can you print prefix ?

fast glen
#

so when you put there prefix it works? But when you dont put it it doesnt work?

wheat hornet
#

u havent defined prefix

earnest phoenix
#

it is defined

golden condor
#

Like comment out the other code and print prefix

earnest phoenix
fast glen
#

He defined prefix it would return that it wasnt defined.

earnest phoenix
#

I'm confused

#

this works in my help command?

#

ignore the if just trying new stuff

golden condor
#

Can you just print prefix and comment out the rest of the code?

earnest phoenix
#

ok sure

golden condor
#

And send the result

#

Ty

earnest phoenix
#

I typed !prefix

#

then !prefix idk

golden condor
#

Oh

fast glen
#

type:
if not prefix:

golden condor
#

So it does work

earnest phoenix
#

let me try it Marvis

fast glen
#

and put return in the end of it

golden condor
#

if prefix is not None:

#

Is that the way to do it in python?

earnest phoenix
#

return where

#

Python is confusing

#

we have a lot of ways to do the same thing

fast glen
#

after that await ctx.send("fill it in")

earnest phoenix
#

if var is None

#

if var == None

#

if None in Var

fast glen
#

if not var

earnest phoenix
#

;/

#

anyways

#

let me try it

fast glen
#

thats the right way python does it

earnest phoenix
#

where does return go

fast glen
#

after that await ctx.send("fill it in")

golden condor
#

I am kinda new to python

earnest phoenix
#

Looking sharp

golden condor
#

Nice

earnest phoenix
#

works

#

I hate beginning stages lol

#

You struggle on the easiest stuff

golden condor
#

Yeah it can be annoying

earnest phoenix
#

well you aren't rlly expected to memorize it all

fast glen
#

Like in my beggining with d.py I was searching 2 hours how to send a message

earnest phoenix
#

But I have my own documentation of notes

#

I refer to it a lot

#

doesn't always help

#

and ikr

#

I learned a lot of d py

#

then had to relearn when using cogs

#

πŸ˜‚

wheat hornet
#

@fast glen

if (message.author.bot) return;
// it worked thx
fast glen
#

np

earnest phoenix
#

I would do cmds like this

@client.event
async def on_message(message):
  if message.content.contains("!help")
    await ctx.send("foo")
#

this is how I used to do my crap

#

πŸ˜‚

#

worked for the time being

#

lol

#

I put ctx

#

I have a question

fast glen
#

ask

earnest phoenix
#

this is my json file

#

How could I fetch the x

#

or the prefix

#

I want to display the current prefix

#

if they don't specify one

#

and keep in mind there will be multiple of these

#

for more sevrers

fast glen
#

open that prefixes.json load it and use it as dictionary

earnest phoenix
#

uh

fast glen
#

and then do prefixes[str(ctx.guild.id)] and thats their prefix

earnest phoenix
#
prefixes=json.load()```
#

like this?

fast glen
#

yes

pure lion
#

@earnest phoenix I'd reccomend against using json as your database

earnest phoenix
#

what goes inside ()

wheat hornet
#

wait it repeats sometimes and dont repeat sometime

fast glen
#

Like my bot uses 50/50 database and json

pure lion
#

Yyyyyyyy

earnest phoenix
#

@pure lion I know a dude and his bot is on 12k servers

fast glen
#

nothing

earnest phoenix
#

he uses json

#

:/

pure lion
#

What are you gonna do when it corrupts?

earnest phoenix
#

Why would it?

pure lion
#

Its json

earnest phoenix
#

at that point mongodb

#

and it won't corrupt

#

unless you hit 50k+ servers

fast glen
#

oh not nothing put there a file you loaded

with open("prefixes.json") as f:
pure lion
#

Mine corrupted at 32 servers

wheat hornet
#

@fast glen still repeating

earnest phoenix
#

Dice

#

you did it wrong then

#

like this?

fast glen
#

yes and then load it and into () put that f

earnest phoenix
#

ok

fast glen
#

and thats your dict

earnest phoenix
#

like this

fast glen
#

@fast glen still repeating
@wheat hornet Like i dont know what is wrong with that

#

yes

earnest phoenix
#

Marvis my json shouldnt corrupt right

#

usually what causes that to corrupt is inproper json tho

#

or someone exploiting your bot

pure lion
#

I know how to json :/

#

Also is slow

earnest phoenix
#

I don't need to have a proper database at this moment IN TIME

#

I wonder what happens if it corrupts

#

LOGIC.. fix it

#

πŸ˜‚

#

Anyways

#

Marvis what next

#

sry

fast glen
#

json have one major disadvantage against database. You need to read that json file to update it. But in the time of updating it there can be some update which will get lost

earnest phoenix
#

what's an alternative that's just as easy that doesn't cost $?

fast glen
#

but you would need to be really unlucky

pure lion
#

Mongodb

fast glen
#

sqlite database for example

#

its just a file

earnest phoenix
#

is it fine if I use json

#

in the beg?

pure lion
#

Quick.db

fast glen
#

totally

earnest phoenix
#

and upgrade in future

#

I'm not ready for that

#

Why go mongo when need to perfect json

meager jasper
#

mh

earnest phoenix
#

my other friend has his in 300 servers and hasn't corrupted

pure lion
#

Isjeisnd

earnest phoenix
#

I don't anticipate my bot even making it that big

pure lion
#

Json will always be slow and corruptible

earnest phoenix
#

ok well rip

#

but I still want to do it

#

this is progress

#

Marvis

#

now how do we depict the prefix

pure lion
#

If you want, just switch to literally any nosql, sql or slqite wrapper for py

fast glen
#

as I said

prefixes[str(ctx.guild.id)]
earnest phoenix
#

hm

#

what is the [] for

#

and done

fast glen
#

oh I explained it wrong

earnest phoenix
#

reading info from json seems easier

#

than writing in it

pure lion
#

The [] is the key

fast glen
#

you should send it

earnest phoenix
#

Dice but don't get mad at me for using json pls, it's a learning prep where most of us start.

#

If It fails then at least I get that experience right?

fast glen
#

and also you can put it out of with open

pure lion
#

Sorry ><

earnest phoenix
#

wait so

#

I got all of it done?

#

that last part is the prefix

#

like the key

fast glen
#

yes

earnest phoenix
#

so it finds the discord is

fast glen
#

now you can just put it into message

earnest phoenix
#

then goes and gets the value?

fast glen
#

yes

earnest phoenix
#

oh

#

that makes more sense

pure lion
#

Did you add something that checks if there is a prefix for the guild in the Json so it can't trigger for multiple prefixes?

earnest phoenix
#

btw is pickle better than json or worse

#

Dice do you mean a never ending prefix nightmare

fast glen
#

I never used pickle. Maybe in courses

earnest phoenix
#

πŸ˜‚

pure lion
#

Yes

earnest phoenix
#

how would that be made

#

a prefix that detects a prefix?

#

if it's changing how would it work hmm

fast glen
#

like you need some function which checks the prefix

pure lion
#

if not prefix [guild ID thing]
prefix = default
elif prefix = prefix[guild ID thing]

earnest phoenix
#

wait

pure lion
#

Or something

#

Idk py

earnest phoenix
#

I added

#

a 3 chracter limit

#

is that fine?

fast glen
#

yeah

earnest phoenix
#

ok

pure lion
#

I have a 10

earnest phoenix
#

why 10

pure lion
#

X)

fast glen
#

I dont have limit

earnest phoenix
#

well

#

if u don't allow limit

#

i feel users can exploit

#

and break your bot

#

xd

#

Marvis is mongo db easier than this json we have going ?

pure lion
#

I'm gonna remove

#

When it's set up, mongo can be really easy

fast glen
#

mongodb is still db. I used it only in web development so no clue how is it in python

earnest phoenix
#

ok

fast glen
#

I more like sql databases

earnest phoenix
#

if my bot is in 50 servers or less

#

json will work?

#

or no

fast glen
#

will

earnest phoenix
#

and is there a way to simulate a corruption or attempt to break it

astral yoke
#

got a question here TypeError: message.guild.channels.forEach is not a function im switching to v12 so what would this be

earnest phoenix
#

and what does a corruption even mean? Like the file loses all it's data?

astral yoke
#

in the docs it has nothing of that

pure lion
#

@astral yoke in V12 everything is cached

astral yoke
#

so should i just add cache?

#

is it that easy?

pure lion
#

channels.cache.forEach

astral yoke
#

ty

pure lion
#

Np

#

and what does a corruption even mean? Like the file loses all it's data?
Malformed

earnest phoenix
#

Is there a way to like

#

save all the data

#

before it corrupts

pure lion
#

You can add a buffer but I'm not sure how

fast glen
#

there is a way how to destroy it

pure lion
#

And that'd slow it down more

earnest phoenix
#

it's happening again

#

when I type !prefix

#

nothing

#

hmmmmm

fast glen
#

hmm

earnest phoenix
#

I think

#

I messed up

fast glen
#

First

pure lion
#

What's the prefix in the json

earnest phoenix
#

its x

#

:/

pure lion
#

xprefix

fast glen
#

or just put it inside the message send

#

also put it outside of with open

earnest phoenix
#

not working at all now

pure lion
#

X is your prefix

earnest phoenix
#

OH

fast glen
#

because you have syntax error

earnest phoenix
#

im an idiot

#

πŸ˜‚

#

imagine being that dumb

pure lion
#

x)

fast glen
#

No its fine

robust furnace
#

Xxx

#

Ddd

#

XD

earnest phoenix
#

I wasn't thinking about it

fast glen
#

as I say also put it outside of that with open

earnest phoenix
#

Dice

pure lion
#

Hi?

earnest phoenix
#

I will transition to mongo if u dm me and are willing to help, but tmr

#

Mice are you well aware of how to use mongo?

pure lion
#

Idk how to uuuuse

#

Fuck I deleted the wrong message sorry

earnest phoenix
#

eh

#

well

#

when the times comes

#

to abandon

#

json

#

i will

#

does resetting the database for prefixes piss a lot of people off or on?

#

Who use your bot.

fast glen
#

like maybe

earnest phoenix
#

Marvis do you own a bot?

fast glen
#

yes

earnest phoenix
#

How many servers

pure lion
fast glen
#

not many. Just these I tested it on. I worked 6 months on it and it will soon approved (I think)

#

or declined

#

who knows

pure lion
#

I have a command to reset the database for the guild so if the commands break they can

astral yoke
#

hey so how come this muterole = await message.guild.roles.create({ name: "Muted", color: "#514f48", permissions: [] //create muterole name + color }); instead of making like the role named Muted it makes a role but just does "new role"

earnest phoenix
#

Dice why would you want to reset

#

what's better

pure lion
#

Because mongo is nosql, everything is stored as documents

earnest phoenix
#

storing everyone insdie 1 json

#

or giving everyone there own unique file

pure lion
#

Every prefix?

earnest phoenix
#

well I mean

#

some bots can afford it

#

this was just an improbable question that I wanted to know lol

#

so yes, every server gets there own file

pure lion
#

OMFG my internet sorry

earnest phoenix
#

would that be better or a lot worse

pure lion
#

That's storing it like nosql

#

But less organised

earnest phoenix
#

hm

fast glen
#

I like sql more

earnest phoenix
#

can unbuntu store noswl?

#

or sql

#

I'm using linux ubuntu

fast glen
#

most people use their cloud services

#

but yes you can

#

I think

pure lion
#

PyMongo is a thing

earnest phoenix
#

uh

pure lion
#

Also mysql is usable on py

earnest phoenix
#

MongoDb seems the best honnestly

#

and MongoDb has a lot of free storage

pure lion
#

Well it's massive overkill

earnest phoenix
#

why

astral yoke
#

can uh

#

yall help me

earnest phoenix
#

@astral yoke help him

#

I will stop talking for a sec

#

so you get helped

astral yoke
#

it makes the role but dosent name it, or color it

pure lion
#

Dude read the docs

astral yoke
#

dude

earnest phoenix
#

Welp

astral yoke
#

i have the docs pulled up already

earnest phoenix
#

here we go

pure lion
#

That's probably a v11 thing

astral yoke
#

do i just put data: infront of it

pure lion
#

Send the doc link

earnest phoenix
#

Dice

astral yoke
earnest phoenix
#

sometimes the docs don't help

pure lion
#

Ik

earnest phoenix
#

discord.js

#

looks fun

#

πŸ˜‚

astral yoke
earnest phoenix
#

Discord.js embeds are easier/better in my oppinion

#

why does your light shot have that embed around it

#

mine is just a image

astral yoke
#

because you copied it

#

i sent it as a link

#

you copied it as an image

#

i can do that too

earnest phoenix
#

isn't copying better

astral yoke
#

yeah

#

but its just faster in my rbain lol

#

would i just add data though

#

({ data: name: "Muted", color: "#514f48", permissions: [] });

#

does that look right or sum

#

nH

#

errors

earnest phoenix
#

How to make a command in which The bot is able to send MSG to the proper channel by any user mentioning # channel name

astral yoke
#

@earnest phoenix d.js version?

earnest phoenix
#

Yea

astral yoke
#

no

#

what discord version

#

12 or 11

#

lol

earnest phoenix
#

Hmm

#

How do u check that?

astral yoke
#

im not gonna just give all the code but i can help a bit

#

do you have your console pulled up?

earnest phoenix
#

yea

neat thicket
#

how would i know my bot is verified?

earnest phoenix
#

a tick in the side

how would i know my bot is verified?
@neat thicket

pure lion
#

@astral yoke it's literally right there put the params in a data: { }

neat thicket
#

mean

astral yoke
#

@astral yoke it's literally right there put the params in a data: { }
@pure lion its already as that

#

muterole = await message.guild.roles.create({ name: "Muted", color: "#514f48", permissions: [] });

earnest phoenix
neat thicket
#

how can i make a database for my bot?

pure lion
#

muterole = await message.guild.roles.create({data:{ name: "Muted", color: "#514f48", permissions: [] }});

astral yoke
#

that looks like something i would never- thank you

earnest phoenix
neat thicket
#

lol

astral yoke
#

How to make a command in which The bot is able to send MSG to the proper channel by any user mentioning # channel name
@earnest phoenix so your trying to make it like !send #channel hello and it sends in the channel hello?

earnest phoenix
#

Ya

neat thicket
#

@dreamy jacinth.command
async def msg(ctx, channel:discord.Channel, *, msg):

pure lion
#

@earnest phoenix mentions.channels.firsr()

earnest phoenix
#

>say hello an announcement # channel

neat thicket
#

channel.send(msg)

earnest phoenix
#

HUH?

fast glen
#

I am sad for the guy named bot

wheat hornet
#

lmao

#

well @fast glen i solved it i used command handler

earnest phoenix
#

how do i make an announcements channel i am in Hypesquad but it doesn't Show up as an announcements category while making channels and i ripled apart English

fast glen
#

ok thats good

neat thicket
#

any know how to make database in py

earnest phoenix
#

Use javascript lol

neat thicket
#

is that easy?

#

i use discord py

wheat hornet
#

javascript>py

neat thicket
#

lol

wheat hornet
#

ok boi my next task is to add a translate command

pure lion
#

javascript>py
Β·_Β·

neat thicket
#

oh

earnest phoenix
#

is that easy?
@neat thicket yes especially if you are going to make a website dashboard since javascript is compatible with webpages and bots

neat thicket
#

hmm

#

anyone use python here?

earnest phoenix
#

No

#

Probably not

#

Lol

neat thicket
#

oh

wheat hornet
neat thicket
#

mean

wheat hornet
#

u dont know about python chatbot module

neat thicket
#

no

earnest phoenix
#

Also javascript is a LITTLE harder than python but it is a HECK LOT better

neat thicket
#

hmmm

#

@wheat hornet no

wheat hornet
#

havent used py in ages

neat thicket
#

can that module is capable of discordpy

wheat hornet
#

u can even make a goat speedtest command using speedtest-cli

neat thicket
#

lol

#

any help with database for bot

earnest phoenix
wheat hornet
#

whats that pikachu

neat thicket
#

lol

earnest phoenix
#

my question

wheat hornet
#

aa

neat thicket
#

i can do that in py @earnest phoenix

earnest phoenix
#

😦

#

I use .js

neat thicket
#

oh

#

@earnest phoenix what is name of ur bot

wheat hornet
#

@earnest phoenix bruh its discord login

earnest phoenix
#

HUH?

#

@earnest phoenix what is name of ur bot
@neat thicket MOD BOT XD

wheat hornet
#

what is the question

neat thicket
#

my one name is Tem

#

How to make a command in which The bot is able to send MSG to the proper channel by any user mentioning # channel name
@earnest phoenix this is the q

earnest phoenix
#

how 2 login to bot

wheat hornet
#

lmao

#

its out of dtos

earnest phoenix
#

How to make a js code in which any user can type a msg and send it in a specific channel by # channel

#

i made discord bot in assembly

#

c++ discord bot?!

#

maybe?!!??!?!

#

#development message How to make a js code in which any user can type a msg and send it in a specific channel by # channel

fast glen
#

yeah that will be fun

wheat hornet
#

@earnest phoenix

#
const channel = member.guild.channels.cache.find(ch => ch.name === 'welcome');
#

like that

#

change welcome with any channel name

neat thicket
#

first i m thinking its a useless serveer but know i m thinking its a very good server many people like @wheat hornet help to solve prob

earnest phoenix
#

But then That will be like only 1 channel

#

and in 1 server only

wheat hornet
#

ever heard of commas

earnest phoenix
#

😦

wheat hornet
#
const channel = member.guild.channels.cache.find(ch => ch.name === 'welcome', 'general');
earnest phoenix
#

i use heroku is good?

neat thicket
#

yep

earnest phoenix
#

yes ez

stoic ocean
#

Anyone use discord bot maker lmfao

earnest phoenix
#

me

#

!!

#

i bought it

#

LMFAOP

stoic ocean
#

lmfao

#

epic

earnest phoenix
#

best $5 of my life

#

LMAO I can give it for free

wheat hornet
#

@earnest phoenix

stoic ocean
#

10$

earnest phoenix
#

@earnest phoenix
@wheat hornet Yea

#

its $5

#

How to send an image in embed and mark it as spoiler

stoic ocean
#

10$

earnest phoenix
#

@earnest phoenix thats saying you cracked it

#

which is illegal

#

Nope

#

yea

#

retard

#

My friend gave it

stoic ocean
#

no

#

retard

earnest phoenix
#

But it sucks

#

Bad choice for a developer

wheat hornet
#

what?

earnest phoenix
#

ur not actually codding

stoic ocean
#

how long does it take for my bot to get approved?

fast glen
#

what are you doing there? πŸ˜„

#

how long does it take for my bot to get approved?
@stoic ocean 2-4 weeks

wheat hornet
#

@stoic ocean 2weeks

stoic ocean
#

F

fast glen
#

I am waiting already 3 weeks

stoic ocean
#

f

earnest phoenix
stoic ocean
#

lmfao

earnest phoenix
#

my man making bank

#

wait is that 50k - 10k

fast glen
#

a lot of money

earnest phoenix
#

for 50 to 10k

#

or*

wheat hornet
stoic ocean
#

robux though?

#

do it for $$$

wheat hornet
#

this channel is for help

stoic ocean
#

s

#

o

wheat hornet
#

a mod will ban u

stoic ocean
#

:o

earnest phoenix
#

no they wont

#

they will mute us

stoic ocean
#

lmfao ik

#

true

earnest phoenix
#

dumbo head

wheat hornet
#

then talk idc

earnest phoenix
#

k

stoic ocean
#

a

#

b

#

c

#

d

#

e

#

f

#

g

#

:)

earnest phoenix
#

cute

astral yoke
#

how come this works in bot.channels.queue.get(channel).send({ in other things but not in my unmute command

#
    at Object.run (C:\Users\Cools\Downloads\dogbotv12\src\commands\moderating\unmute.js:40:34)```
limber swan
#

How can I get the user tag using express
I have this but it gives me undefine: req.user.tag

midnight blaze
#

yo, got some problems.
My goal is to make a command that creates a voice channel in a certain catogry. I have done that so far, but how to make that the channel gets deleted if after a certain amount of time the voice channel is empty?

#
client.on('message', async function(message){

    if(message.author.bot){
     return;
    }

    if(isValidCommand(message, "teacher")){
      
            message.guild.channels.create("classes", {
            type: 'voice',
            parent: 'category id'

        }).then(vc => {
            message.member.voice.setChannel(vc);
        })
    
    }
#

this is where I am currently

pure lion
#

@midnight blaze if (msg.member.voice.connection) {
setTimeout({})

midnight blaze
#

I get that bro, but with the promises

#

not so sure

#

I am also not sure how to delete a voice channel

pure lion
#

Await the channel create or store the channel ID

midnight blaze
#

message.delete() I know this one

#

oh

#

but thanks

#

voice.connection

#

this was what I have needed

pure lion
#

Yeah

#

You could attach another .then()

limber swan
#

How can I get the user tag using express
I have this but it gives me undefine: req.user.tag

pure lion
#

Fetch it from client?

limber swan
#

Im tryin to a do a dashboard

#

trying*

#

Gte the tag from the user that has login with discord

pure lion
#

Make a request to fetch the info object for the user (assuming you use oauth2)

wheat hornet
#

i have a question how can i take data from console log and send it through bot

pure lion
#

No

cinder patio
#

just... don't console.log it and send it through discord?

limber swan
#

Make a request to fetch the info object for the user (assuming you use oauth2)
Alright

pure lion
#

(don't use ejs yet UwU)

hazy sparrow
#

how to send images without the link in a embed

wheat hornet
#

just... don't console.log it and send it through discord?
@cinder patio bro console.log shows the log if i disable it, it wont show me log nothing else

astral yoke
#

fixed

earnest phoenix
#

if theres anyone who can add me to their bot development team, if they're applying for bot verification dm me, that bot badge looks cool haha

fast glen
#

I think that nobody will do that

torpid juniper
#

@earnest phoenix if you're purely looking for the badge, you're doing things for the wrong reasons

#

make a bot yourself, no one here will add you a team so you can freeload

obtuse jolt
#

Yes the badge is for people who work hard for their bots

#

You can’t just tag along because you want a profile badge

astral yoke
#

@earnest phoenix dont ever fucking ask a a fucking person for a bot so that you can have a little "coolb ot badge". people work really fucking hard of tons of testing and advertising to get over 75 servers plus having to apply for verification and your the type of person no fucking developer likes. " that bot badge looks cool haha" then make your own bot and get the badge on your own.

fast glen
#

looks like people are angry

astral yoke
#

its not our damn problem you think a badge is cool we're not gonna add a random ass person to our development team so you can get a badge and then leave for the hard work that said developer worked hard for

torpid juniper
#

also the badge is a curse anyway

obtuse jolt
#

yes its hard to get the "cool badge" and takes a lot of hard work so when people want to join dev teams so they can "get the cool badge" not cool

torpid juniper
#

it's a permanent link to their faq page that you can never remove and it's a constant reminder that you sold your soul

obtuse jolt
#

My bot was a unique concept and it’s in 9 servers

#

It’s hard

fast glen
#

life is hard

obtuse jolt
#

Yeah I know that

astral yoke
#

i had to spend 50 servers just to get my bot over 75 servers

torpid juniper
#

btw, (bot) development implies that other forms of development can be talked about here? thinking_derp

astral yoke
#

and this dude is asking?

torpid juniper
#

@astral yoke the badge is useless

#

for your bot anyway

obtuse jolt
#

spend 50 servers?

torpid juniper
#

let me get the reddit post

astral yoke
#

spent 50 bucks on advertising for economy and grew to about 170 servers @obtuse jolt

fast glen
#

like 100 servers isnt that much if you want to have big bot πŸ˜„

obtuse jolt
#

oh

torpid juniper
hazy sparrow
#

how do i make a command work in only 1 server and not others?

obtuse jolt
#

uhh don’t send the result to other servers?

hazy sparrow
#

what?

unique sundial
#

hello everybody

obtuse jolt
#

ahh ok

#

I see

#

What language?

hazy sparrow
#

d.js

obtuse jolt
#

Do this

#
if(message.guild.id === "GUILD ID) {
// code
}```
hazy sparrow
#

thanks!

obtuse jolt
#

WAIT

#

Shit

hazy sparrow
#

but shouddnt it be

obtuse jolt
#

There

#

Yes it should

hazy sparrow
#

lol ty

wheat hornet
#

can anyone help me in making translate command for discord.js as i am unable to find any good doc that explains well

midnight blaze
#

yo, so I have got a little problem. First time working with channels. The documentation doesnt help me, I can not find the methods for some weird reasons. My plan is to create a command like this:
It creates a channel, when the channel stays empty for a certain amount of time, it will get deleted again.
I have come so far, but I am not able to delete the channel.

client.on('message', async function(message){

    if(message.author.bot){
     return;
    }

    if(isValidCommand(message, "teacher")){

            message.guild.channels.create("classes", {
            type: 'voice',
            parent: 'category_id'

        }).then(cha => {
            let channelname = message.guild.channels.find(channel => channel.name === cha)
            if(!message.member.voice.channel)
            setTimeout({cha.delete(channelname)},2000)
        })
    
    }

astral yoke
#
        embed: embed
        });```
#
    at Client.bot.on (C:\Users\Cools\Downloads\dogbotv12\src\index.js:106:25)```
#

why is this happening while switching to v12

honest perch
#

Cache

#

its cache.get

frosty swan
#

hi

astral yoke
#

why tf do i keep confusing cache with queue

#

wtf

frosty swan
#

who want to make bot with me :p

quartz kindle
#

@midnight blaze cha is already the created channel

#

no need to find it again

#

and channel.delete(channel) is redundant

#

its just channel.delete()

midnight blaze
#

oh, thanks^^ yeah, I wasnt sure about this

quartz kindle
#

and setTimeout requires a function

midnight blaze
#

true lol

quartz kindle
#

setTimeout(() => channel.delete(), 2000)

midnight blaze
#

I have just forgotten to include the function in it

#

thanks for the help

honest perch
#

TIM

midnight blaze
#

wait misly!

#

xD

#

give Tim a break

#

I have to ask him one more question

honest perch
#

When will dbl hire him

#

As our stackoverflow guy

midnight blaze
#

good question^^

#

they should hire him asap

quartz kindle
#

Lol

#

nobody wants to pay for it tho

honest perch
#

Why buy your patreon plan for development support when you can join dbl

midnight blaze
#

hey Tim, one final question.

if(!message.member.voice.connection)```
How should I change this, so the bot knows, that I am talking about a specific channel?
message.member.voice.connected
quartz kindle
#

no, it looks up the member's voice connection, if any

#

could be other voice channels

#

or could be none

midnight blaze
#

ah

#

ok

#

thanks

quartz kindle
#

you first need to check if connection exists

#

then channel which channel is it

#

if(message.member.voice.connection && message.member.voice.connection.channelID === chn.id)

#

for example

#

or if you're on node 14, you can use the new optional chaining

#

if(message.member.voice.connection?.channelID === chn.id)

midnight blaze
#

I see, yeah, that makes a lot more sense xD I always get confused with stuff I didnt do before

honest perch
#

Tim should make dyno v2

quartz kindle
#

ew

honest perch
#

Timno

wheat hornet
#

dont tell me tim created dyno

quartz kindle
#

no lol

honest perch
#

He didn't

#

He created earth

quartz kindle
#

dyno already existed long before i even started messing with discord

hazy sparrow
honest perch
#

Dyno is owned by blitz

#

Bitz is owned by tsm?

restive pebble
#

map user roles lol

honest perch
#

And theyre owned by some corp idk

quartz kindle
#

tsm as in team solo mid?

honest perch
#

The gaming team

#

Check the footer of tsm site

#

And dyno site

quartz kindle
#

lmao really

honest perch
#

There's some corporations name

#

The corp website is tsms exact site

quartz kindle
#

swift

hazy sparrow
#

tim help me lol

honest perch
#

Read the docs

hazy sparrow
#

which docs?

honest perch
#

map user roles lol

midnight blaze
#

Timo created mocha

quartz kindle
#

lol no

pure lion
quartz kindle
#

@hazy sparrow iterate over guild.roles.cache

honest perch
#

Tim created dbl

hazy sparrow
#

iterate?

honest perch
#

Og owner

quartz kindle
#

iterate = loop over = for/foreach/map/etc

hazy sparrow
#

ok thanks

pure lion
#

Tim whats status code 400 for a failed request?

quartz kindle
#

bad request

pure lion
#

Okay

quartz kindle
#

means you did something wrong

honest perch
quartz kindle
#

lmao

#

how did i not know about this

pure lion
#

:o

honest perch
#

It shows all the errors in cat form

pure lion
#

i love it

honest perch
pure lion
#

Awwww

honest perch
lavish vessel
#

#unknown

midnight blaze
#
client.on('message', async function(message){

    if(message.author.bot){
     return;
    }

    if(isValidCommand(message, "teacher")){

            message.guild.channels.create("classes", {
            type: 'voice',
            parent: 'category Id'

        }).then(cha => {
          if(message.member.voice.connection && message.member.voice.connection.channelID === chn.id){
            console.log(connected)
          }else{
            setTimeout(() => {cha.delete(), 10000})
          }
            
        })
    
    }

Update. this seem to work, one problem tho. I dont know why but my bot deletes the channel immediately.
Anyone an idea?

earnest phoenix
midnight blaze
#

client.on('message', async function(message)

quartz kindle
#

remove the {}

#

otherwise you're doing (() => {cha.delete()},0) aka, setting the timer to 0

midnight blaze
#

thanks man xD why did I include that

earnest phoenix
#

@midnight blaze which line should I add that?

#

client.on('message', async function(message)

midnight blaze
#

just add "async"

#

before function

hazy sparrow
#

how can i make my bot pick a random emoji from the emoji picker thing

quartz kindle
#

you cant

#

you can access the guild's custom emojis through guild.emojis.cache but default emojis are not included anywhere

hazy sparrow
#

can i make it select from an amount of emojis i put in the code?

quartz kindle
#

you need to make a list of them yourself

hazy sparrow
#

ah forget about the emoji

#

can i make it pick a random colour

quartz kindle
#

yes

hazy sparrow
#

how?

quartz kindle
#

there are many color schemes, the most used one is RGB which can be represented as three 8-bit values

#

so you can randomly pick 3 numbers between 0 and 255

#

or 3 hexadecimal values between 00 and ff

hazy sparrow
#

oh ok ty

earnest phoenix
#

just add "async"
@midnight blaze I didnt understand

midnight blaze
#

write async before function

marble juniper
#

how would I make it so that I can do prefix! command so that you can still use prefix!command (js)

earnest phoenix
#

write async before function
@midnight blaze Which function? :/

earnest phoenix
midnight blaze
#

client.on('message', async function(message){

#

add {

#

after (message)

earnest phoenix
#

K

#

Thnx so much

midnight blaze
#

Tim are you here?^^
a last question(hopefully)
if(message.member.voice.connection )
Can I change this to any member to the creater of the channel? My idea is that the channel is only there, when the creator of the channel is in the channel.

marble juniper
#

how would I make it so that I can do prefix! command so that you can still use prefix!command (js)
anyone gonna answer me

digital ibex
#

remove whitespaces

marble juniper
#

yeah but prefix! command then command would be treated as an argument

#

when done normally

digital ibex
#

if you remove whitespaces, it won't

marble juniper
#

k

#

so just trim()

digital ibex
#

because its treating: prefix! as prefix!

marble juniper
#

k

digital ibex
#

yes

delicate shore
#
if (command === "lyrics") {
    const genius = require("genius-lyrics");
    const G = new genius.Client(process.env.GENIUS);

    G.tracks
      .search(
        msg.content
          .split(" ")
          .slice(1)
          .join(" "),
        { limit: 1 }
      )
      .then(results => {
        const song = results[0];
        msg.channel.send(
          `**${song.artist.name} - ${song.title}**\n<${song.url}>`
        ); //song.lyrics
      })
      .catch(err => msg.reply(err));
  }```
#

i want it to embed

#

should i fetch it

#

can this link be fetched

astral yoke
#

when is discord.js 11 version expired

delicate shore
#

when is?

astral yoke
#

yeah

short siren
#

expired?

quartz kindle
#

7th october i think

astral yoke
#

when do you have to push-

#

thank you tim

#

i just spent three hours pushing dogbot into 12.2.0

#

but it was worth it

quartz kindle
#

@midnight blaze you'd need to track the channel's creator somewhere

#

like save its id in a variable/object

brittle orchid
#

Hi, where's wrong with that?
.addField('Old Username', user.oldNickname)

quartz kindle
#

user.oldNickname doesnt exist, unless you created it yourself

astral yoke
#

how do you check your discord.js version out of your packages

#

for node you do node -v

quartz kindle
#

npm ls packagename

obtuse jolt
#

u wot

#

v11 has an expiration?

brittle orchid
#

@quartz kindle pls dm

obtuse jolt
#

Fuck

quartz kindle
#

on october 7th discord will start requiring intents to allow you to connect

astral yoke
#

@obtuse jolt oh hi i remember talking to you

quartz kindle
#

and v11 doesnt support intents

obtuse jolt
#

ahh yes

astral yoke
#

but you gotta switch to 12 eventually

obtuse jolt
#

frick

quartz kindle
#

(although its very easy to add support for intents yourself)

astral yoke
#

we talked like three hours ago and ive been pushing my bot into 12.2.0

obtuse jolt
#

intents?

slender thistle
#

I wonder when d.py will add support for intents KEKW

astral yoke
#

seems kinda hard for a beginner though tim

#

says the one whos a certified developer tim

slender thistle
#

is it just some JSON sent over the websocket connection?

astral yoke
#

its easy for you tim

obtuse jolt
#

I’m really good at v11 and really bad at v12

astral yoke
#

you gotta switch eventually

obtuse jolt
#

I actually tried to make a bot in v12 and gave up it was that hard

astral yoke
#

i kept coding and asking for help for three horus but its worth it

#

i wouldn't prefer riding it out until october

#

its still longs away but still

#

make the switch now you wont have to later

obtuse jolt
#

What will actually happen in October

slender thistle
#

Discord verification restrictions will apply

quartz kindle
#

@slender thistle its a ws option in the initial "identifiy" packet

slender thistle
#

Oh I see

quartz kindle
#

im pretty sure d.py can do that

#

if it gives you access to ws options

#

such as ws.large_threshold

#

you can just add ws.intents

astral yoke
#

when tim says its easy but dosent realize hes a certified developer and its hard to the naked eye or a beginner clap your hands πŸ‘ πŸ‘

brittle orchid
#

@quartz kindle look dm pls !

quartz kindle
#

let me see how easy it is