#development

1 messages ยท Page 1755 of 1

old latch
sudden knoll
earnest phoenix
#

how to ban ban-kick for regular players?

sudden knoll
#

add a permissions check

#

or a roles check

lavish bramble
#
client.on("message",  message => {
if(message.content === "!gif"){
   clients.search('gifs', {"q": "anime slap", "limit": 1})
.then((response) => {
   var gif = response.data[0].url
   const m = new MessageEmbed()
   .setImage(gif)
   message.channel.send(m)
 })
}
})

My code

#

And I get this blank

old latch
sudden knoll
#

i think

old latch
#

ah lol

lavish bramble
#

Ping?

sudden knoll
#

their English is hard to understand

old latch
#

yep

sudden knoll
#

no one pinged you

clear marlin
lavish bramble
#

Yup

clear marlin
#

giphy needs api token, you know that right?

earnest phoenix
#

@sudden knoll bro i need

#

reaction like this

sudden knoll
#

just use unicode then.......

earnest phoenix
#

unicode

#

wht

clear marlin
#

\โœ…

#

that is unicode

earnest phoenix
#

i know how add in commad by member

sudden knoll
#

discord does auto conversions from unicode to discord emoji so unicode is nice

earnest phoenix
#

i need in embed

lavish bramble
sudden knoll
#

that's a reaction right there

clear marlin
#

you need to add the .then().catch()

sudden knoll
#

that's not part of the embed

clear marlin
#

what

earnest phoenix
#

some bot do

sudden knoll
#

that's a reaction

earnest phoenix
#

yes

#

i need

#

that

lavish bramble
#
var GphApiClient = require('giphy-js-sdk-core')
const {MessageEmbed} = require("discord.js")
const clients = GphApiClient(process.env.GIPHYTOKEN)
earnest phoenix
#

i cnt know how add it embed

sudden knoll
#

I'm confused on how you made your bot

earnest phoenix
clear marlin
#
message.channel.send(embed).then(msg=>{
msg.react("โœ…");
})

sudden knoll
#

hm....

#

what father of three said

clear marlin
#

yes

earnest phoenix
clear marlin
#

I'm not sure why its not

lavish bramble
#

When I do this without embed

#

Then it's sends

clear marlin
#

see the .setImage method uses a url

lavish bramble
#

Yup

clear marlin
#

giphy urls work fine too

#

I don't how its not working

lavish bramble
#

Can I use tenor?

clear marlin
#

you can

#

you can use any api

elfin cape
#

hello anybody know how can i define voice channel in slash commands

lavish bramble
earnest phoenix
#

it cn work

#

one message come 2 times

sudden knoll
#

what does cn mean

earnest phoenix
sudden knoll
#

it sends the emoji twice?

earnest phoenix
#

no embed

#

ok no pro

#

lisean

sudden knoll
#

that's not an error with the reaction then

earnest phoenix
#

bro

sudden knoll
#

that's just an error in your code

earnest phoenix
#

i cnt have nitro

#

how cn i copy id

#

of emoji

#

cn any trick

sudden knoll
#

bots don't need nitro

earnest phoenix
sudden knoll
#

the bot needs to be in the same server as the emoji it's trying to use comes from

earnest phoenix
#

when bot in another server

sudden knoll
#

considering you didn't even know what reactions were you should first get used to using reactions before you tackle custom emojis

#

also a bot can send an emoji from any server it's in to any other server it's in

earnest phoenix
#

:844512161649000469:

#

i need like this

sudden knoll
#

that means nothing to me

earnest phoenix
#

do

#

:844512161649000469:

#

any thing i add

#

say here

sudden knoll
#

I don't own this server so I don't know what the emoji ids are

#

you're gonna have to make your own or steal them from somewhere

earnest phoenix
#

bro i say how make

#

emoji id

#

pls tell na

#

it too hard because i cnt have nitro

#

so pls say na

sudden knoll
#

you don't need nitro to make an emoji

#

you just need your own server

earnest phoenix
#

bro i say

#

how make id

sudden knoll
#

you can get the id from there

thin quarry
#

now look how

earnest phoenix
#

:844512161649000469:

#

what here

thin quarry
#

print the message with emoji to bot console

#

and this is the raw emoji text

earnest phoenix
#

time only one

thin quarry
sudden knoll
#

and follow the instructions

earnest phoenix
earnest phoenix
#

i cnt need emoji

sudden knoll
#

just google it

earnest phoenix
thin quarry
#

u need your bot on the server

sudden knoll
#

do you not have google

#

how do you have discord

#

or bing

#

or IE

earnest phoenix
#

๐Ÿ‘€ hindi ati ha

sudden knoll
#

You can get a custom emoji ID by right clicking the custom emoji and copying it's URL, with the ID being the image file name. All bots can use custom emoji on any server, just like Nitro users.

earnest phoenix
#

kisko ko

sudden knoll
#

do that

thin quarry
earnest phoenix
#

bro i say

sudden knoll
#

say.... what

earnest phoenix
#

oho

#

nice

#

i see youtube

old latch
#

wtfffff

#

lmao

#

this is hilarious

pale vessel
#

true

old latch
#

Iโ€˜ll come here when I need something to laugh at thx guysexitedCat

gritty lintel
#

how to host bot 24/7 For Free??

#

currenlty using botghost

sudden geyser
#

If you're hosting a Discord bot, your options are slim.

#

I recommend you purchase a cheap VPS instead.

#

Or use the free trial that likely comes with it

earnest phoenix
#

How much time will it take to get my bot added to top.gg

gritty lintel
sudden geyser
#

It's currently 3 weeks or more.

gritty lintel
earnest phoenix
#

Ohk

thin quarry
gritty lintel
#

`const Discord = require('discord.js');

const clinet = new Discord.Client();

clinet.once('ready', () => {
clinet.log('Parth Coders Is Online');
});

client.login('NOT SEE MY TOKEN');`

#

What Is Wrong In This??

#

@thin quarry

thin quarry
gritty lintel
thin quarry
#

in python

gritty lintel
#

okay

thin quarry
#

and i see a mistake

gritty lintel
thin quarry
#

everywhere you type clinet

slender wagon
thin quarry
#

and in the last line it`s client

gritty lintel
thin quarry
#

everywhere must be the same

thin quarry
gritty lintel
thin quarry
#

no

#

it

#

must

#

be

#

clinet

#

there

#

too

gritty lintel
#

client.login

earnest phoenix
#

Hey, I have a problem because my bot will not count invitations on the server

thin quarry
#

const clinet = new Discord.Client();

clinet.once('ready', () => {
    clinet.log('Parth Coders Is Online');
});


clinet.login('NOT SEE MY TOKEN');```
thin quarry
#

should be like this

#

i corrected it

gritty lintel
#

no

#

then also error

thin quarry
#

what error?

#

show me

gritty lintel
#

(node:10832) UnhandledPromiseRejectionWarning: TypeError: clinet.log is not a function
at Client.<anonymous> (C:\Users\Toshiba\Documents\Custom Office Templates\main.js:6:12)
at Object.onceWrapper (events.js:421:28)
at Client.emit (events.js:315:20)
at WebSocketManager.triggerClientReady (C:\Users\Toshiba\Documents\Custom Office Templates\node_modules\discord.js\src\client\websocket\WebSocketManager.js:431:17)
at WebSocketManager.checkShardsReady (C:\Users\Toshiba\Documents\Custom Office Templates\node_modules\discord.js\src\client\websocket\WebSocketManager.js:415:10)
at WebSocketShard.<anonymous> (C:\Users\Toshiba\Documents\Custom Office Templates\node_modules\discord.js\src\client\websocket\WebSocketManager.js:197:14)
at WebSocketShard.emit (events.js:315:20)
at WebSocketShard.checkReady (C:\Users\Toshiba\Documents\Custom Office Templates\node_modules\discord.js\src\client\websocket\WebSocketShard.js:475:12)
at WebSocketShard.onPacket (C:\Users\Toshiba\Documents\Custom Office Templates\node_modules\discord.js\src\client\websocket\WebSocketShard.js:447:16)
at WebSocketShard.onMessage (C:\Users\Toshiba\Documents\Custom Office Templates\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
(Use node --trace-warnings ... to show where the warning was created)
(node:10832) 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:10832) [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.

#

this error @thin quarry

thin quarry
#

it says

#

that clinet.log doesnt exist

gritty lintel
#

yes

thin quarry
#

so then log to console

#

idk

#

i dunno js

gritty lintel
#

yes

thin quarry
#

@gritty lintel u cant log to discord.client

#

it says

gritty lintel
#

i am trying in python

thin quarry
#

ok

#

yee

#

did you see the guide?

lyric mountain
#

that's a C then: specialized table for i18n

thin quarry
#

yes

sudden geyser
#

Yay

gritty lintel
#

leave it i am working on python

frosty valve
#

Whats the key for message content in webhooks?

sudden geyser
#

What do you mean?

frosty valve
#

when making a post to a webhook. You send data. I dont remember what the key for the message content is

vivid fulcrum
#

content

frosty valve
#

that doesnt work

vivid fulcrum
#

then you're doing it wrong

frosty valve
vivid fulcrum
#

it's a json object sent through the body data

#

not query params

frosty valve
#

oh yea

earnest phoenix
#

client.on('message', message => {

if (!message.guild) return;

if (message.content.startsWith('!ban')) {

const user = message.mentions.users.first();

if (user) {
  
  const member = message.guild.member(user);
  
  if (member) {
    
     
     
     
     
     
     
    member
      .ban({
        reason: 'They were bad!',
      })
      .then(() => {

        message.reply(`Successfully banned ${user.tag}`);
      })
      .catch(err => {



        message.reply('I was unable to ban the member');

        console.error(err);
      });
  } else {

    message.reply("That user isn't in this guild!");
  }
} else {

  message.reply("You didn't mention the user to ban!");
}

}
});

#

Here is the working code, is it possible for someone to supplement and throw it off already with the rights of a ban from the admin?

sudden geyser
#

Change the user mentions validation and conversion to a single members.mention to only read member mentions

#

You aren't checking if the member has permission to ban the other member

#

Nor are you checking for a hierarchy in roles to measure the executor's importance

earnest phoenix
#

How to implement this code?

umbral zealot
#

Reminder: you need to learn javascript, we will not spoonfeed you code.

earnest phoenix
umbral zealot
#

I mean you can be rude all you want, but no one can help you, it's written in the rules.

earnest phoenix
#

mem

umbral zealot
earnest phoenix
#

The funniest fact is that you help others)

#

xD

carmine summit
#

How do I run a python script with required arguments using a python script?

py1.py

str = "hello world"

py2.py

print(str)
#

Hope i made sense

umbral zealot
umbral zealot
#

You could, of course, be a self-taught person. But if you're asking others to spoonfeed you an answer, you are not "learning", you're begging for scraps.

earnest phoenix
#

Help is useful to ask

umbral zealot
#

Yes, and the answer has been provided.

woeful pike
#

at some point it's time to step back and catch up on what you're missing

#

and then continue writing your bot or whatever you were doing until you hit a roadblock like this again

#

that's how self-learning works

near stratus
#

or like export--import ?

carmine summit
#

Im not sure. I just want to get a variable from a file to use it in another file

earnest phoenix
#

Just import it, assuming it's in the same dir

from .py1 import str
print(str)
# or
from . import py1
print(py1.str)
#

Redefining built-ins is a bad idea though

#

You can just do from py1 import str if it's not in a package

#

is any thing to check who invite your bot

#

in server

earnest phoenix
#

Wdym?

#

Everything in Python is public

carmine summit
#

Oh ok thanks

mental raven
#
@use.pc.error
async def pc_error(ctx, error):
    if isinstance(error, commands.group.CommandOnCooldown):
        embedVar = discord.Embed(title=f"You are on cooldown!" , description='You may use this command again in {:} Seconds.'.format(error.retry_after), color= ctx.author.color)
        await ctx.send(embed=embedVar)
    else:
        raise error
#

why does t not work

#
Traceback (most recent call last):
  File "main.py", line 472, in <module>
    @use.pc.error
AttributeError: 'Group' object has no attribute 'pc'
#

Error

earnest phoenix
#

Referring to the subcommand doesn't work?

mental raven
#

yeah

earnest phoenix
#

What error

earnest phoenix
#

You're referring to the parent, I'm asking if referring to the subcommand directly doesn't work

mental raven
#

wdym?

#

how do i do that?

slender thistle
slender thistle
carmine summit
#

Yes I will replace it in my code. Im just so used in JS

slender thistle
#

(Then you have me overwriting id because God forbid I ever need it)

worn sonnet
#

i got hit with syntax isuues

#

in python

#

f"{desc}"

#

and desc variable contains \n

slender thistle
#
>>> doodoo = "hahaa\nlol"
>>> yeet = f"{doodoo}"
>>> yeet
'hahaa\nlol'
>>> print(yeet)
hahaa
lol
worn sonnet
#

i tried using str.format()

#

try again with multiple variables

slender thistle
#

Any specific examples you can provide?

#
>>> f"{'\n'.join([str(e) for e in range(5)])}"
  File "<stdin>", line 1
    f"{'\n'.join([str(e) for e in range(5)])}"
                                              ^
SyntaxError: f-string expression part cannot include a backslash

I do know this

worn sonnet
#
                     f">> **__{cmd.name}__**\n\```\n{signature}\n\```\n{desc}\n"
                     if isinstance(entity, Command)
                     else f">> **__{cmd.name}__**\n{desc}\n    {subcommand}\n"
                 )```
slender thistle
#
>>> f"{'\n'.join([str(e) for e in range(5)])}"
  File "<stdin>", line 1
    f"{'\n'.join([str(e) for e in range(5)])}"
                                              ^
SyntaxError: f-string expression part cannot include a backslash
>>> s = '\n'.join([str(e) for e in range(5)])
>>> f"{s}"
'0\n1\n2\n3\n4'
>>> print(f"{s}")
0
1
2
3
4
#

What error are you getting? Can you post the full traceback?

worn sonnet
worn sonnet
#

it cuts off the remaining part

#

lemme show

#
                  "Example-1: `fa!aar inviter role` will give the role to the member when they join using inviter's "
                  "link\n"
                  "Example-2: `fa!aar inviter role1 role2` will give the `role2` to the member when they join using "
                  "inviter's link and get the `role1`"```
#

but it only prints
Auto assigns a role to the member when joined or after they claim the required role. Example-1: `fa!aar inviter role` will give the role to the member when they join using inviter's link

#

the text after \n isn't there

slender thistle
#

Can you show your full code related to whatever you're doing?

worn sonnet
#

wait

#

lemme share

trail finch
#
const Discord = require('discord.js')

module.exports = {
  name: "say",
  description: "a command to say",
  
  
  run: async (client, message, args, prefix) => {
    
    
    const user = message.author
    const target = message.mentions.users.first()
    
    let msg
    
    if(!target) {
      msg = args.slice(0).join(" ")
      .catch(console.error)
      if (!msg) return message.reply("What do you want me to say? Command Usage: `"+prefix+"say <message>` or `"+prefix+"say <user> <message>`")
      message.channel.send(msg)
      message.delete()
    } else if (target) {
      msg = args.slice(1).join(" ")
      if (!msg) return message.reply("What do you want me to say? Command Usage: `"+prefix+"say <message>` or `"+prefix+"say <user> <message>`")
      
      message.channel.send("Send the message in `[1] DM` or `[2] Channel with ping`\n\n*Say the ID of that you choose.*")
      
        .then(() => {
            message.channel.awaitMessages(response => response.content == '1' && response.author.id == message.author.id || response.content == '2' && response.author.id == message.author.id, {
                max: 1,
                time: 20000,
                errors: ['time'],
            })
            .then((collected) => {
                if (collected.first().content == '1') {
                  message => message.delete({ timeout: 20000 })
                  target.send(message.author.toString() + " Told me to say you this: ```" + msg + "```")     
                }
                else if(collected.first().content == '2') {
                  message.channel.send(target.toString() + ", " + msg)
                }
            })
            .catch(() => {
                message.channel.send(`No response! Request has been declined`);
            });
        });       
      
      
    }
    
  }
}```
#

this is my code and

worn sonnet
#

so apparently cmd.help only gives this ```Auto assigns a role to the member when joined or after they claim the required role. Example-1: fa!aar inviter role will give the role to the member when they join using inviter's link

trail finch
#

I want the bot to delete the

 message.channel.send("Send the message in `[1] DM` or `[2] Channel with ping`\n\n*Say the ID of that you choose.*")``` this message after the response message is collected
#

is it possible to do so?

worn sonnet
#
@command(name=f"autoassignrole", aliases=["aar"],
             help="Auto assigns a role to the member when joined or after they claim the required role. "
                  "Example-1: `fa!aar inviter role` will give the role to the member when they join using inviter's "
                  "link\n"
                  "Example-2: `fa!aar inviter role1 role2` will give the `role2` to the member when they join using "
                  "inviter's link and get the `role1`")
earnest phoenix
#

Why don't you just make a docstring instead

slender thistle
trail finch
#

ok thank you

earnest phoenix
#

Fr doe, just make a docstring. It'll get the docstring if nothing passed on to the help kwarg

slender thistle
#

Docstrings are love

#

Weird how it cuts out on the newline though

earnest phoenix
#

Might / might not have something to do with inspect.cleandoc

trail finch
#

the bot is going directly to the .catch

mental raven
#
async while true:
  await client.change_presence(activity=discord.Streaming(name='Economy Stats in {:,} Servers...'.format(int(len(client.guilds))), url='urllsdlsdjsai'))

Why this not work
error:

SyntaxError: invalid syntax
#

url is an actual url but I blanked it out

earnest phoenix
#

Omit the leading async

mental raven
#

omit?

slender thistle
#

remove

sage bobcat
#

One message removed from a suspended account.

mental raven
#
SyntaxError: 'await' outside function
slender thistle
#

int(len(...)) aaaaaaa

earnest phoenix
#

Then make your function async instead

#

not your while block

slender thistle
#

Rather, put it in an async function

mental raven
#

a

slender thistle
#

because it's outside of one completely

sage bobcat
#

One message removed from a suspended account.

mental raven
slender thistle
#

Stop trying to convert me to gay

earnest phoenix
slender thistle
#

I'm being bullied

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

Imagine being bullied

mental raven
earnest phoenix
#

Smh my smh

slender thistle
# mental raven like?
async def THIS_IS_MY_ASYNC_FUNCTION_AND_I_DO_WHATEVER_THE_HELL_I_LIKE_WITH_IT():
    ...
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

slender thistle
#

In your case you probably want to put it in some event instead

slender thistle
sage bobcat
#

One message removed from a suspended account.

earnest phoenix
sage bobcat
slender thistle
#

Yes that's why I'm about to snakecase you

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

@earnest phoenix

worn sonnet
#

so after looking into the help property of Command class i got to know they strip the new lines

earnest phoenix
#

@earnest phoenix

#

Wrong channel, can you go in #commands voltrex?

#

Aight

worn sonnet
#
            return self.brief
        if self.help is not None:
            return self.help.split('\n', 1)[0]
        return ''```
#

this code was there

slender thistle
#

kekw

worn sonnet
#

I mean why would they do that

near stratus
worn sonnet
slender thistle
#

In most cases you can just do if x: but in this case Danny decided to check strictly for None

earnest phoenix
#

At that point, just make your own help class

worn sonnet
#

lol i got escaped with using breif

earnest phoenix
#

Tmw brief is not brief

worn sonnet
#

since they were not modifying anything in it

slender thistle
worn sonnet
#

who is danny?

slender thistle
#

Though honestly I'm not sure why he did it this way lol

worn sonnet
#

oh lol

earnest phoenix
#

exdee

worn sonnet
#

it always showed Raptzz

slender thistle
#

He named himself Danny on Discord iirc so

worn sonnet
#

oh

earnest phoenix
worn sonnet
#

didn't know

mental raven
#

sad

main.py:492: RuntimeWarning: coroutine 'statusUpdate' was never awaited
  statusUpdate()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
earnest phoenix
#

await statusUpdate()

mental raven
earnest phoenix
#

There's no top-level await statements

worn sonnet
slender thistle
#

For fuck's sake

#

What are you trying to do

mental raven
#

Me?

slender thistle
#

Yes

worn sonnet
#

prolly yes

mental raven
#

I am trying to make the bot status a live server count

earnest phoenix
#

Coroutine in non async code christmasthink

worn sonnet
earnest phoenix
#

Any idea how you know if a user has a flag? I have the public_flags value and want to manually check the flags.

slender thistle
slender thistle
earnest phoenix
#

Yes exactly

worn sonnet
slender thistle
#

Like it didn't take me that long to open the d.py docs ToC and find discord.tasks

worn sonnet
#

lol

earnest phoenix
#

(values & to_check) == to_check? Pretty weird naming but w/e

mental raven
#

the tasks

#

i mean

oak nymph
#

Hey guys, I was tryna use the nekobot api and make a few commands with it and idk where I'm going wrong in the code but it returns no errors and nothing happens, here's the code :```py
@commands.command(aliases=['df', 'deep-fry','deep_fry'])
async def deepfry(self,ctx,member: discord.Member = None):
if member is None:
member = ctx.author
async with aiohttp.ClientSession() as session:
request = await session.get(f'https://nekobot.xyz/api/imagegen?type=deepfry&image={member.avatar_url}')
req = await request.json()
embed = discord.Embed(ctx.author.color, timestamp=ctx.message.created_at)
embed.set_image(url=req['message'])
embed.set_footer(text=f"Requested by {ctx.message.author.display_name}")
await ctx.send(embed=embed)

@commands.command(aliases=['tt','trump_tweet','trump-tweet'])
async def trumptweet(self,ctx,*,message):
    async with aiohttp.ClientSession() as session:
        request = await session.get(f'https://nekobot.xyz/api/imagegen?type=trumptweet&text={message}')
        req = await request.json()
        embed = discord.Embed(ctx.author.color, timestamp=ctx.message.created_at)
        embed.set_image(url=req['message'])
        embed.set_footer(text=f"Requested by {ctx.message.author.display_name}")
    await ctx.send(embed=embed)

@commands.command(aliases=['cmm','change-my-mind','change_my_mind'])
async def changemymind(self,ctx,*,message):
    async with aiohttp.ClientSession() as session:
        request = await session.get(f'https://nekobot.xyz/api/imagegen?type=changemymind&text={message}')
        req = await request.json()
        embed = discord.Embed(ctx.author.color, timestamp=ctx.message.created_at)
        embed.set_image(url=req['message'])
        embed.set_footer(text=f"Requested by {ctx.message.author.display_name}")
    await ctx.send(embed=embed)```
slender thistle
earnest phoenix
#

Nevermind shiv, found out.

#

I was using && for some reason

#

guys wanna see some bs

slender thistle
#

I confuse ^ with & sometimes so I feel you

earnest phoenix
#

And there's ~ blobweary

#

ternary operator internet explorer polyfill

(condition && (doiftrue)) || doiffalse
deep mantle
earnest phoenix
#

Anyways, thanks shiv and norizon :)

slender thistle
earnest phoenix
#

Hikari provides raw flags, so gotta do things on my own paincom

#

(perms & ~deny) | allow applying overwrites be like

slender thistle
#

KEKW Just write your own perm wrapper

earnest phoenix
#

Yes exactly

slender thistle
#

I feel bad for you

earnest phoenix
#

It's pretty worth it anyway, the only thing it lacks is a command handler. There's an official unofficial command handler for it, but not as good as d.py's

slender thistle
#

As long as it works and dblpy users can get it /s/s/s

earnest phoenix
#

At some point it should have a deprecation warning

slender thistle
#

I'll release a v0.6.9 specifically for that

earnest phoenix
#

KEKW I'm sticking with 0.4 anyway

slender thistle
#

LMFAO I'm not gonna add anything to it

#

Everything is gonna have a deprecation warning

earnest phoenix
#

tmw it's getting deprecated but the docs tell you to do pip install dblpy

slender thistle
#

top.gg docs: pip install dblpy
dblpy README: pip install topggpy

#

Just as intended

#

I will update that along with examples so yeah\

earnest phoenix
#

pog

rocky hearth
#

for firestore, in document snapshot. Can I detect the changes?

earnest phoenix
#

It's topggpy

mellow cairn
#

Thanks

earnest phoenix
#

And to make the addition of the user flags it's

#

1<<1 | 1<<6

#

for a user that has partner and bravery flags

summer torrent
#

freenode gone

restive furnace
#

why

frosty birch
#

hi

humble rock
#

what does += mean?

deep mantle
cinder patio
#

and mutate the variable

worn sonnet
#

Yep

quartz pier
#

Ok, so Iโ€™m making a discord bot in discord.js. I do โ€œnpm run devโ€ and it starts up my bot but it gives me the unhandled promise rejection error. Iโ€™m also using vs code and node.js. This is the unhandled rejection code it gives me โ€œ--unhandled-rejections=strictโ€

spare badger
#

@quartz pier thats too little information. Can you send the full error? A lot of the time promise rejections donโ€™t show a lot, maybe you can catch the rejection somewhere you think itโ€™s occurring?

quartz pier
#

Iโ€™ve searched everywhere but canโ€™t find a fix. Iโ€™ll have to show the code later as Iโ€™m busy rn, is it ok if I ping you with the error later?

spare badger
#

Sure!

quartz pier
#

Ok, thank you! Iโ€™ll talk to you later, bye!

tribal quest
#

can somebody help me in javascript

spare badger
#

@tribal quest Don't ask to ask. Feel free to just tell the people what you are struggling with, there are always people that want to help!

tribal quest
#

im making a meme commands but there comes an error i am going to send the code an the error

#

iยดll upload it on source.bin

#

and the error:

  message.channel.send(imageembed)
                                ^

TypeError: Cannot read property 'send' of undefined
    at IncomingMessage.<anonymous> (D:\Users\david.jaros\Desktop\DavBotBeta\commands\utility\meme.js:53:33)
    at IncomingMessage.emit (events.js:327:22)
    at endReadableNT (internal/streams/readable.js:1327:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! DavBot@5.0.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the DavBot@5.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\david.jaros\AppData\Roaming\npm-cache\_logs\2021-05-19T17_41_55_785Z-debug.log
#

can somebody help me

#

and maybe fix it

snow urchin
#

under execute(message, args) { put console.log(message)

zenith terrace
#

or code own

fresh verge
#

So, I am trying to make a quote command, but I keep getting this error. The code is ```javascript
const { MessageEmbed } = require("discord.js")
const { NOMEM } = require("dns")

const Discord = module.require("discord.js")

module.exports = {
name: "quote",
description: "Easily find a message by ID",
usage: "quote <message id>",
category: "fun",
callback: async (client , message, args) => {
console.log(message)
const messages = await message.channel.messages.fetch({around: "352292052538753025", limit: 1})
const msg = messages.first()
if(!msg) {
const NoMessage = new MessageEmbed()
NoMessage.setColor("#7289da")
NoMessage.setAuthor(${message.author.tag}, message.author.avatarURL)
NoMessage.setDescription(Enter a message id to quote a message!)
message.channel.send(NoMessage)
}
if(msg) {
const quote = new MessageEmbed()
quote.setColor("#7289da")
quote.setAuthor(${message.author.tag}, message.author.avatarURL)
quote.setDescription(${msg.content} \n\n [Jump to Message!](${msg.url}))
quote.setFooter(${message.guild.name} ${message.channel.name} ${message.createdAt})
}}}``` and the error is.

snow urchin
#

smh both same error

boreal iron
#

lmao

#

message is no message object, that easy

snow urchin
fresh verge
snow urchin
#

ok

tribal quest
#

is it that what you need

snow urchin
#

change execute(message, args) to execute (client, message, args)

snow urchin
tribal quest
#

freaking legend XD

snow urchin
#

๐Ÿ™‚

snow urchin
#

sidekid

fresh verge
#

๐Ÿ‘

snow urchin
#

show me ur command handler, where it executes the callback

tribal quest
#

yes

fresh verge
snow urchin
#

wot

fresh verge
zenith terrace
#

inb4 the kid comes back with another error in his stolen code

snow urchin
#

delete this message and regenerate your bots token btw, you accidentally leaked it

boreal iron
#

It's getting even more strange.

tribal quest
#

oh

#

thanks XD

snow urchin
#

np

rocky hearth
#

Im using nextjs, in the useEffect, I am listening to snapshot of a firestore document.
But I the state is not updating, in this useEffect. What other method should I use?

Do I have to add state as a dependency?
If so, then the snapshot listener will rerun, which I dont want.

tribal quest
#

this commes btw

https://preview.redd.it/lsnpziq9f2071.jpg?auto=webp&s=003caf9cd78f5f699f3b086ac4602bda1f8873d7
D:\Users\david.jaros\Desktop\DavBotBeta\commands\utility\meme.js:54
                message.channel.send(imageembed)
                                ^

TypeError: Cannot read property 'send' of undefined
zenith terrace
#

can easily tell it is stolen/copy pasted code

snow urchin
#

mhmm

tribal quest
#

wow haha

fresh verge
#

๐Ÿ˜”

solemn latch
snow urchin
#

woo, can you delete the message that they put the log in btw, it shows their client token

tribal quest
#

yes ofc

tribal quest
#

im new in coding

solemn latch
#

first of all, dont use stolen code. doesnt help you learn

#

second of all, use the message not client.

tribal quest
#

i have a book in front of me so im learing it from it

#

and a 60 site pdf file

snow urchin
#

and now you have https://discord.js.org ๐Ÿ™‚

fresh verge
solemn latch
#

(client , message, args)
on the execution side, you are sending something other than a message in the second parameter of the function.

solemn latch
#

is that your execution side?

#

you should just do the exact same thing for each.
(client, message, args)

eager scarab
#

how to shutdown my bot with a command?

tired panther
#

process.exit() on js

#

or you have to kill it with shelljs (shell package for shell exec)

solemn latch
# fresh verge I am still confused.
function someFunction(firstParm, secondParm){

}
someFunction(firstParm, secondParm);
// ^ correct way to use a function. firstParm and secondParm need to be in the correct order.
function someFunction(firstParm, secondParm){

}
someFunction(secondParm, firstParm);
// ^ Wrong way to use a function. parms are out of order.
swift cloak
#

do any of yalls know why my vs code does not open

earnest phoenix
#

nah

solemn latch
#

seems to be the same issue, just in a different place.

earnest phoenix
#

message.author.avatarURL is v11 and what is this NoMessage.setAuthor

tired panther
#

btw use v12, v11 is outdated and will crash bc of stage channels

fresh verge
#

const messages = await message.channel.messages.fetch({around: "352292052538753025", limit: 1}) is undefined, how do I fix?

solemn latch
#

messages is undefined?

fresh verge
solemn latch
#

is the id provided in around an actual message id.

vivid fulcrum
#

it shouldn't ever be undefined

#

it should be an empty array / throw a 404

vivid fulcrum
#

show the error stacktrace //if any

fresh verge
vivid fulcrum
#

๐Ÿค”

fresh verge
# vivid fulcrum ๐Ÿค”

const Discord = module.require("discord.js")

module.exports = {
    name: "quote",
    description: "Easily find a message by ID",
    usage: "quote <message id>",
    category: "fun",
    callback: async (message, args) => {

const msg = await message.channel.messages.fetch({around: `${parseInt(args[0])}`, limit: 1})
console.log(msg)
        if(!msg) {
const NoMessage = new MessageEmbed()
NoMessage.setColor("#7289da")
NoMessage.setAuthor(`${message.author.username}#${message.author.discriminator}`, message.author.avatarURL)
NoMessage.setDescription(`Enter a message id to quote a message!`)
message.channel.send(NoMessage)
        }
        if(msg) {
            const quote = new MessageEmbed() 
            quote.setColor("#7289da")
            quote.setAuthor(`${msg.author.username}#${msg.author.discriminator}`, message.author.avatarURL)
            quote.setDescription(`${msg.content} \n\n [Jump to Message!](${msg.url})`)
            quote.setFooter(`${msg.guild.name} ${msg.channel.name} ${msg.createdAt}`)
        }}}```
#

Now it is logging Collection(0), so for some reason no message is being collected.

vivid fulcrum
#

alright, so that's something

#

i was confused as to why it was undefined

#

because the api should never return null arrays

fresh verge
vivid fulcrum
#

what

fresh verge
# vivid fulcrum what

I forgot to change it to parseInt(args[0]) in the fetch, but now it is saying "Cannot read property '0' of undefined", so for some reason message, and args are undefined.

cinder patio
#

How are you calling callback

vivid fulcrum
#

protip to clean up your commands and the argument mess

#

instead of taking in multiple arguments (i.e (message, client, args, ...)) just take a single argument that's a context object instead (so your run method signature would just be async (ctx) =>)

#

and where you execute commands pass in that object with whatever values

fresh verge
#

Javascript?

vivid fulcrum
#

i.e.

command.run({
  client: myDiscordClient,
  args: myArguments,
  whateverYouWant: here
});
#

yes

#

this simple change will make your life easier

#

you won't have to mess with argument lists

#

instead, all of your commands will have a single argument and they'll be able to access everything through that object

#

i've seen people do something like

if(command === "ping")
  command.run(client, args);
else if(command === "ban")
  command.run(client, args, member);
...

which you can imagine, is just a mess

fresh verge
vivid fulcrum
#

no

#

the run method in your command file is supposed to look like something like this

run: async (ctx) => {
//ctx.client or whatever
};
fresh verge
vivid fulcrum
#

js allows destructuring variables so you can even do something like

run: async (ctx) => {

const { message, client } = ctx;

await message.channel.send(...);

};
vivid fulcrum
vivid fulcrum
#

this is what you place in your command handler

#

aka your message event

fresh verge
vivid fulcrum
#

can you show your code?

fresh verge
#

const Discord = module.require("discord.js")

module.exports = {
    name: "quote",
    description: "Easily find a message by ID",
    usage: "quote <message id>",
    category: "fun",
    run: async (ctx) => {
const { message, args} = ctx;
const msg = await message.channel.messages.fetch({around: `${parseInt(args[0])}`, limit: 1})
console.log(msg)
        if(!msg) {
const NoMessage = new MessageEmbed()
NoMessage.setColor("#7289da")
NoMessage.setAuthor(`${message.author.username}#${message.author.discriminator}`, message.author.avatarURL)
NoMessage.setDescription(`Enter a message id to quote a message!`)
message.channel.send(NoMessage)
        }
        if(msg) {
            const quote = new MessageEmbed() 
            quote.setColor("#7289da")
            quote.setAuthor(`${msg.author.username}#${msg.author.discriminator}`, message.author.avatarURL)
            quote.setDescription(`${msg.content} \n\n [Jump to Message!](${msg.url})`)
            quote.setFooter(`${msg.guild.name} ${msg.channel.name} ${msg.createdAt}`)
        }}}```
#

Bottom half btw.

vivid fulcrum
#

that should work just fine ๐Ÿค”

#

can you screenshot the console.log output

#

it's probably big, so just the author area is fine

fresh verge
#

Error.

vivid fulcrum
#

it's a map (more specifically a collection)

#

not a message object

fresh verge
vivid fulcrum
#

should work yeah

fresh verge
vivid fulcrum
#

define correct

#

if you want to check if a message with the id exists, you have no choice but to fetch and see

onyx hare
#

im having a moment plz send halp
(node:24632) UnhandledPromiseRejectionWarning: RangeError: Maximum call stack size exceeded

const Discord = require("discord.js");
const randomPuppy = require('random-puppy');

exports.run = async (client, message, args) => {
    const subReddits = ["Cheesetopia"]
    const random = subReddits[Math.floor(Math.random() * subReddits.length)];
    const img = await randomPuppy(random);
    
    const embed = new Discord.MessageEmbed()
    .setColor('RANDOM')
    .setImage(img)
    .setTitle(`From /r/${random}`)
    .setURL(`http://reddit.com/${random}`)
    .setFooter(`Requested By: ${message.author.username}`, message.author.displayAvatarURL({ format: 'png' }))
    message.channel.send(embed);
    message.delete({timeout:10});
}
``` it didnt even show one of the cheese images i posted to my subreddit
sacred palm
#

How do u make an event that sends a message in a channel if the server name matches Spooky Time?

#

I think it includes: GuildUpdate and filtering it

#

I need the exact code for this

onyx hare
#

i have a very basic message event

module.exports = (client, message) => {
  if (message.author.bot) return;
  if (message.content.indexOf(client.config.prefix) !== 0) return;
  const args = message.content.slice(client.config.prefix.length).trim().split(/ +/g);
  const command = args.shift().toLowerCase();
  const cmd = client.commands.get(command);
  if (!cmd) return;
  cmd.run(client, message, args);
};
fresh verge
# vivid fulcrum if you want to check if a message with the id exists, you have no choice but to ...

const Discord = module.require("discord.js")

module.exports = {
    name: "quote",
    description: "Easily find a message by ID",
    usage: "quote <message id>",
    category: "fun",
    run: async (ctx) => {
const { message, args} = ctx;
const errors = 0
const msgs = await message.channel.messages.fetch({around: `${parseInt(args[0])}`, limit: 1})
.catch((err) => {
const NoMessage = new MessageEmbed()
NoMessage.setColor("#7289da")
NoMessage.setAuthor(`${message.author.username}#${message.author.discriminator}`, message.author.avatarURL)
NoMessage.setDescription(`Enter a message id to quote a message!`)
return message.channel.send(NoMessage)
        })
        console.log(errors)
        if(args[0]) {
            const msg = msgs.first()
            const quote = new MessageEmbed() 
            quote.setColor("#7289da")
            quote.setAuthor(`${msg.author.username}#${msg.author.discriminator}`, msg.author.avatarURL)
            quote.setDescription(`${msg.content} \n\n [Jump to Message!](${msg.url})`)
            quote.setFooter(`${msg.guild.name} | ${msg.channel.name} | ${msg.createdAt}`)
            message.channel.send(quote)
        }}}```?
#

Would that work?

craggy pine
#

Try and see mexShrug

fresh verge
#

Still runs the other one and gives me erros.

#

Also, how do I make it so I can quote a message from another channel that is different then the one the command is ran on?

fresh verge
#

...

rocky hearth
#

@fresh verge await message.channel.messages.fetch({around: "${parseInt(args[0])}", limit: 1})
this not how u fetch messages

#

simply pass the messageId

sudden geyser
#

why is the string being parsed as an integer back to a string

humble rock
sudden geyser
#

the command doesn't exist in the collection

#

You should verify the command's existence by checking if command is undefined

sudden geyser
#

log the collection

#

it could also be a parse issue but I doubt that's the case

#

is guild.fetchMember even a thing

humble rock
#

1 mom

humble rock
lyric mountain
#

Bruh, align that grid

humble rock
#

but...

sudden geyser
#

aka console.log(client.commands)

humble rock
# sudden geyser aka `console.log(client.commands)`

'ParnterManager' => {
name: 'ParnterManager',
desc: 'Give the permissions to make a Partnership for the server.',
run: [Function: run]
},
'test' => {
name: 'test',
desc: 'A simple test command',
run: [AsyncFunction: run]
}
}

Maybe it's because PartnerManager command isn't an AsyncFunction as test command...

sudden geyser
#

It's probably not.

#

Your issue is because you converted the command input to lower case.

#

But you stored the command in its original capitalization (PartnerManager instead of partnermanager)

humble rock
#

i didn't understand...

sudden geyser
#

I recommend you do one of the following:

  • Declare all your command names as lowercase in your module.exports
  • Update your command handler to convert the name to lowercase beforehand
quartz pier
#

@spare badger here is the error i get

#

heres the error i get when i run a command

spare badger
#

@quartz pier Yea thats what I already thought. A promise error doesnโ€™t say a lot. You have to look for the promise you think the error is originating from.

quartz pier
#

what could have happened?

spare badger
#

Not sure. I donโ€™t know your code. But an error has taken place inside a promise

quartz pier
#

hm ok ty

#

is there a way to fix a promise? and where can i find the promise?

#

nvm

#

is it ok if i send you a picture of my code and maybe you can help me?

spare badger
#

@quartz pier yea sure send it. Promises are for asynchronous functions. So somewhere with โ€œawaitโ€ or โ€œasyncโ€ probably. You can catch the error and then it will show you more information about what is going wrong.

quartz pier
#

ok, one second

#

you know what, i gtg. ill send it in an hour or less.

spare badger
#

I will be asleep by then. Surely somebody else will be able to help then!

quartz pier
#

ok ty!

quartz pier
#

ok so, i have created a kick command but it gives me an error. here is my code

#

here is the error

digital swan
fresh verge
fresh verge
quartz pier
#

ok ty ill try that

digital swan
fresh verge
digital swan
#

ah

fresh verge
digital swan
quartz pier
#

it gave me 4 errors and it didnt give me anything in terminal

quartz pier
digital swan
#

like at the end of the line

#

instead of using a try catch block

quartz pier
#

give me an example please

fresh verge
lyric mountain
#

you're supposed to have a .catch for every single promise

digital swan
#
try {
  someCode()
} catch (e) {
  console.log(e)
}

would become:

someCode().catch((e) => {
  console.log(e)
})

quartz pier
#

ah ok ty ill try that

brave tendon
#

would this work?

#

sendMessage

digital swan
#

.catch is for promises

#

ig u could try it tho

quartz pier
#

is this right?

brave tendon
quartz pier
fresh verge
#

const Discord = module.require("discord.js")

module.exports = {
    name: "quote",
    description: "Easily find a message by ID",
    usage: "quote <message id>",
    category: "fun",
    run: async (ctx) => {
const { message, args} = ctx;
const msgs = await message.channel.messages.fetch({around: `${parseInt(args[0])}`, limit: 1})
.catch((err) => {
const NoMessage = new MessageEmbed()
NoMessage.setColor("#7289da")
NoMessage.setAuthor(`${message.author.username}#${message.author.discriminator}`, message.author.avatarURL)
NoMessage.setDescription(`Enter a message id to quote a message!`)
return message.channel.send(NoMessage)
        })
        if(args[0]) {
            const msg = msgs.first()
            const quote = new MessageEmbed() 
            quote.setColor("#7289da")
            quote.setAuthor(`${msg.author.username}#${msg.author.discriminator}`, msg.author.avatarURL)
            quote.setDescription(`${msg.content} \n\n [Jump to Message!](${msg.url})`)
            quote.setFooter(`${msg.guild.name} | #${msg.channel.name} | ${msg.createdAt}`)
            message.channel.send(quote)
        }}}```An issue I have is that if an invalid ID, or nothing imputed, it gives me this error. I tried fixing it multiple times.
boreal iron
#

Just check if msgs is your expected type or generally not null or undefined

#

if(!msgs) return evil

earnest phoenix
quartz pier
#

hm, is there any other ways to fix it?

#

what could be another problem with this?

#

is that what i need to do?

#

if so ok

boreal iron
quartz pier
#

one second

boreal iron
#

Let me guess the code has an error close to your MessageEmbed line?

quartz pier
#

no, it gives me an unhandled error

boreal iron
#

Still waiting for the error

quartz pier
#

didnt work @opaque fern

#

i have 1 error in the code

boreal iron
#

Not gonna repeat myself... paste it

#

here

quartz pier
#

what?

#

paste what

slender thistle
boreal iron
#

Whatโ€™s the issue?

#

Whatโ€™s wrong with the world...?

#

I see at least one error in his screenshot already

quartz pier
#

heres my new code

quartz pier
boreal iron
#

Omg I know

#

MessageEmbed will throw an error

quartz pier
#

ok, how can i fix it?

boreal iron
#

Discord.MessageEmbed

#

Take a look at the line you defined it and you will see the issue

quartz pier
#

i dont see it

delicate zephyr
boreal iron
#

I still donโ€™t even know what his issue is

delicate zephyr
#

The code wont run

#

because he messed up the syntax

quartz pier
#

how do i fix it?

boreal iron
#

Just see he required "discord" and used "Discord" as var name

#

*saw

#

Thatโ€™s why it should throw an error

delicate zephyr
#

there are multiple issues

boreal iron
#

Iโ€™m driving ... thatโ€™s the first I saw

quartz pier
#

wow i am not good at writing code lol

boreal iron
quartz pier
#

@delicate zephyr do you mind guiding me through solving them?

quartz pier
boreal iron
#

Ok so not really which makes me guess itโ€™s just copied code, right?

quartz pier
#

yeah a bit from a well known coder

#

it all makes sense though

fresh verge
#

For some reason it isn't displaying the user's avatar. quote.setAuthor(`${msg.author.username}#${msg.author.discriminator}`, msg.author.displayAvatarURL)

#

No errors.

oak cliff
#

iirc displayAvatarUrl is a function so it needs to have ()

pale vessel
#

What discord.js version are you using? Discord.js v12 and above would have that as a method instead of a property

oak cliff
#

Yeah not function sorry method

#

Wrong terminology

quartz pier
#

what is the latest version of vs code?

zenith terrace
#

pretty sure Xiuh is correct, this is 12.4.0 @pale vessel

sudden geyser
fresh verge
#

How does one get a channel by ID?

sudden geyser
#

Depends.

#

Do you want to do it conveniently on your account

#

e.g. Right click and copy ID

#

Or do you want to do it programmatically

errant hornet
#

How would the bot get the ID of a role it just created?
Discord.js

sudden geyser
#

How are you creating the role?

#

It's likely returned as a promise resolving to a new role.

errant hornet
#

message.guild.roles.create()

sudden geyser
sudden geyser
#

So after you resolve the promise, just access its .id getter.

errant hornet
fresh verge
sudden geyser
#

That was not directed at you

#

What library are you using anyway

#

I'll assume Discord.js from your previous code

sudden geyser
#

One solution is to get a guild instance and do <Guild>.channels.cache.get(...). .channels is a manager, so its cache of channels is under the .cache property.

#

Once you have a channel instance, you can just access its .id property.

#

For example:

let id = parseInt(someInput, 10);
let channel = message.guild.channels.cache.get(id);

// `channel` may be `null`, so make sure you verify.
errant hornet
#

How would I add a role to the author of a message?

#

Discord.js^

fresh verge
#

How does .first work?

fresh verge
errant hornet
#

I know how to add a role but message.author.roles is undefined

sudden geyser
fresh verge
sudden geyser
#

I don't believe so.

fresh verge
#

Only a .first?

sudden geyser
#

and a .last()

prime mist
#

Anyone know if there is anything out there that parses the discord api docs? For generated types etc.

blissful coral
#

Is a certain server always gonna be on the same shard if the bot is always in the server every time there is a restart?

prime mist
blissful coral
#

if more are added it would stay the same only if some were removed?

prime mist
#

It can change then the total number of shards changes.

#

*when the total

fresh verge
fresh verge
# fresh verge

I have an issue like if you put the message ID as like a correct one, but something to interfere with it as in an extra character [all in on argument], it gives an error that turns off the bot.

fresh verge
#

Also how does one check if a list contains value?

light gorge
#

dumb question that is kind of relevant. How long does it usually take for a discord bot verification request usually take? I submitted mine over 2 weeks ago and haven't heard anything back.

#

The bot still says awaiting verification

#

request processing

opal plank
opal plank
rigid nimbus
#

Can take up to a month at the moment

opal plank
fresh verge
opal plank
#

i wondered about the indentation of ur code, thats usually a sign

fresh verge
#

Anyways?

opal plank
#

also

#

check this

#

add a breakpoint in the beggining of ur code

#

and re-run the command that broke it

fresh verge
opal plank
fresh verge
opal plank
#

it wont return null

#

only an emtpy map

#

if (!msgs.size)

boreal iron
opal plank
#

well like i said, VSC has a debugger, use it

#

if even then you cant see the answer, ask away

boreal iron
#

Microsoft software again...
Youโ€™re now being payed by MS, not Detritus anymore?

opal plank
#

detritus still paying up

boreal iron
#

lmao

opal plank
boreal iron
#

Good luck! Gonna get some sleep

opal plank
#

gnit

worn sonnet
#

Which compiler do you guys use for c?

#

I mean the cdecl or Pascal...

#

I recently got to know about it

#

Since I've been using GCC

#

And the only compiler I know

clear marlin
#

GCC

fresh verge
# fresh verge

Also for some reason, it selects the message above the attended target.

rocky hearth
#

For grid layout in css, how can I arrange childrens like this?

7 8 9
4 5 6
1 2 3
near stratus
#

like this ?

rocky hearth
#

na na, there should be 3 columns
and the items would be in sequence
I just want them to be ordered like that visually

near stratus
#

like that should be hella hard

#

you can try naming the grids (r and c)
Try using grid-template-areas:

#

but you'll end up doing that for every single one

rocky hearth
#

Actually I'm trying to flip a chess board.
So this is the layout I want.

9 8 7
6 5 4
3 2 1
thorny arch
#

can someone explain why my bot is taking a long time to start]

#

when running it locally

#

what used to take less than 10 secs

#

now takes 3 mins +

sharp jolt
#

My bot crashes as he joins new guild without admin perms.... It shows missing permission

#

any fix for this?

vivid fulcrum
#

check if you have the correct permissions before executing and action

vivid fulcrum
#

i.e. before banning, check if you can ban in the first place
before creating a channel, check if you can create a channel in the first place
etc

sharp jolt
thorny arch
#

oh ok

sharp jolt
#

but some ppl dont rely in starting giving admin perms

near stratus
earnest phoenix
#

So, I am trying to whitelist a Specific role to a Ticket Channel, it goes by name, so it locates the Role Name, then allows it to view the channel.

``` message.guild.channels.create(open-${message.author.username}, {
permissionOverwrites: [

    {

      id:message.guild.roles + "Staff Team",
      allow: ['SEND_MESSAGES', 'VIEW_CHANNEL']
      
      
    }  ```

Ik its not right, but how can I make it so the "Staff Team" can be added to the channel, when I use that, it says "The Specified thingy is not a User or Role ID." , Can anyone assist?

#

It's multi guild so using 1 ID will not work, thus the explanation of how I want it to locate the role with the "Staff Team" role and whitelist it to the channel.

vivid fulcrum
#

you're wasting a request

earnest phoenix
#

Calm down @vivid fulcrum , they are trying to help.

vivid fulcrum
#

im calm lol??

#

anyway

#

doing that, and hitting too many 401 | 403 | 429 response codes will get you api banned

#

that's why that advice is horrible

#

you should make your code do the absolute minimal requests to discord

near stratus
vivid fulcrum
#

doesn't matter

earnest phoenix
#

Anyone have any feedback on my request above^?

umbral zealot
#

I mean... the ID needs to be an actual id. What do you think message.guild.roles + "Staff Team" is supposed to do?

#

Trying to add a collection with a string? that... doesn't really make any sense

cinder patio
rocky hearth
#

tailwindcss

rocky hearth
#

I dont find any solution, so I just reversed the array.

cinder patio
#

Are you using a grid layout? The numbers are columns right?

rocky hearth
#

yes grid layout, with 9 childs

cinder patio
#

Isn't there a column-reverse property in css or something similar

rocky hearth
#

naah, not in grid

cinder patio
#

You can use grid-row

#

but reversing the array is also a good solution

earnest phoenix
#

How can I restrict a command to the users who only have the given role, I alr have the role find code:

but, How can I make it so the command will not go unless they have that role?

#

1:35am so my brain has been fried lol.

#

Wait, hold up

#

Why am I doing that, I need to restrict it to a channel D2S_E_why

#

Welp, lemma just go gather my thoughts.

worn sonnet
#

Oke

earnest phoenix
#

Okay, after that little thing, I have restricted the command to users with ADMINISTRATOR permissions, but how can I make it so it only runs if it has ticket- in the channel name?

#

Otherwise if a admin uses x/delete in the wrong channel, poof

rocky hearth
earnest phoenix
spare badger
#

@rocky hearth You wanna know something funny. I didn't know about that function until now. I always used something like channelName.substr(0,7) == 'ticket-' ๐Ÿ˜‚

rocky hearth
#

omg!!

spare badger
#

My life just got a little bit easier

earnest phoenix
#

lol ๐Ÿคฃ;

rocky hearth
#

there's "".endsWith("") as well, or includes etc

sharp jolt
#

can someone help me

#

my bot dosent work without admin perms and gets crashed if added without admin perm

marble juniper
#

There is no way in the world ur bot should ever need or crash without admin perms ever

#

thats completely bullshit

#

Admin perms are just a short cut to giving every permission

pearl trail
#

from the error path, you must be missing

marble juniper
#

your bot defenitly doesn't need all of them

#

also do proper permission handling

eternal osprey
#

hey does anyone know why miniget is givin me a 404 error code

copper cradle
#

well because the resource you're trying to get doesn't exist

#

that's why

eternal osprey
#

aha alright

zenith terrace
#

@quartz kindle to keep you busy, I just have now learned that message.mentions.users.keyArray(); exists

quartz kindle
#

lel

zenith terrace
#

it do be handy

#

especially when wanting to use mentions for commands

earnest phoenix
#

Is there any JavaScript code for server count! If yes pls reply! PP_nyaLovepls

pale vessel
#

yes there is

earnest phoenix
#

Please sent me

gaunt stag
#

I think spoonfeeding is not allowed?

earnest phoenix
#

Via dms?

#

Is it allowed

gaunt stag
#

Idk

slender thistle
#

Discouraged but not strictly prohibited

cinder patio
#

You call yourself a verified dev and are asking for code for a pretty simple thing :/ Take a look at the docs for the library you're using

earnest phoenix
#

Aka LAZY TRICKZ

opal plank
#

then finish ur work, then go back to your bot

#

we dont spoonfeed here

#

its against the rules

calm pilot
#

It's not that hard wth

earnest phoenix
opal plank
#

here, let me show you how much of a prick you are being

earnest phoenix
#

Uhm

opal plank
#

oh wow, would you look at that

#

if only google had answers for basic questions

#

now you understand why u pissed a few here

slender thistle
calm pilot
#

If he means that he is in the wrong channel KEKWlaugh

opal plank
#

yeah, if its that, it should be asked in #topgg-api

cinder patio
#

laziness isn't an excuse here, if you knew how to do that you would've done it in 1 min instead of wasting your time asking here, even searching on google would've been faster than coming here

opal plank
#

not wrong

torpid otter
#

is it hard to make a dashboard for you bot

spare badger
torpid otter
#

@spare badger what do that do

cinder patio
#

I don't think that's exactly what they mean by dashboard

spare badger
#

What do you want to see in your dashboard?

cinder patio
torpid otter
#

like mee6

spare badger
#

Yes thats a different story

#

You would have to pull out your web development skills for that I'm afraid

torpid otter
#

oh

cinder patio
#

You need to know a lot of different technologies, it's definitely not for beginners

torpid otter
#

ok

#

how do i make this look better and cool not like list

#

@spare badger

eternal elbow
#

Hi, I am using express backend and I will auth users from express but I have no idea how to control this in react. Can you help me?
I will do it with api, but how?
Is it enough to do req.isAuthenticated in the backend?

spare badger
torpid otter
#

ok

torpid otter
#

how do i add button on my bot list on top.g

cinder patio
#

You can add buttons but you can't add any javascript to them - what do you want the button to do?

#

You can style an anchor like a button

earnest phoenix
#

yes

#

get text

slender thistle
#

Send request to that URL, read the response body and set that as your response

torpid otter
#

how do i change from text to css or html

spare badger
#

You can use HTML directly in the description field.

#

To use css you wrap it inside <style> tags

torpid otter
#

try

#

that

torpid otter
cinder patio
#

You don't need canvas for this? Make a http request to the image URL, get the data, send back the data

torpid otter
#

how do imove invite the button with ccs

quartz kindle
#

eslint pls

boreal iron
earnest phoenix
boreal iron
#

More like 1st world problems

quartz kindle
#

something like ```js
let stream = await fetch(imageurl);
stream.pipe(res);

#

using node-fetch

#

you could also simply make a redirect and avoid wasting bandwidth altogether

swift cloak
#
type messageMentionObj = {
    embed?: embedMentionObj
    messageContent?: string
}
type mentionObj = {
    allow: boolean;
    messageOptions: messageMentionObj;
]
interface MyClientOptions extends ClientOptions {
    allowBotMention: mentionObj
}``` how would i see like if embed in messageMentionObj was provided, messageContent would not have to be provided. i want to require both, but if they make it embed, messageContent Isnt Required
torpid otter
#

is there way that you can move intvit button

boreal iron
#

Sure using padding or margin or an absolute or fixed position if you wanna move them around anywhere.

cinder patio
boreal iron
cinder patio
#

If you have other properties too, which can be included with both embed and messageContent you can use Omit instead

boreal iron
#

You don't need canvas for this? Make a http request to the image URL, get the data, send back the data

quartz kindle
#

well, besides ignoring our recommendations and reposting the exact same question, your user is undefined, either because the client is not logged in or because the user is not cached

#

you need to fetch the user instead of getting it

cinder patio
gritty lintel
#

`import discord
from discord import user
from discord.ext import commands
import json
import os
import random

os.chdir("C:\Users\Toshiba\Documents\Custom Office Templates")

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

@client.event
async def on_ready():
print("Ready")

@client.command()
async def hello(ctx):
print("Hello")

@client.command()
async def balance(ctx):
await open_account(ctx.author)

users = await get_bank_data()

wallet_amt = users[str(user.id)]["wallet"]
bank_amt = [str(user.id)]["bank"]

em = discord.Embed(title = f"{ctx.author.name}'s balance",color = discord.Color.red)
em.add_field(name = "Wallet",value = wallet_amt)
em.add_field(name = "Bank",value = bank_amt)
await ctx.send(embed = em)

@client.command()
async def beg(ctx):
await open_account(ctx.author)

users = await get_bank_data()


earnings = random.randrange(1000)


await ctx.send(f"A Person Gave You {earnings} coins!!")

wallet_amt = users[str(user.id)]["wallet"] += earnings

async def open_account(user):

users = await get_bank_data()


with open("mainbank.json", "r") as f:
    users = json.load(f)

if str(user.id) in users:
    return False
else:
    users[str(user.id)]["wallet"] = 0
    users[str(user.id)]["bank"] = 0

with open ("mainbank.json", "w") as f:
    json.dump(users,f)
    return True

async def get_bank_data():
with open ("mainbank.json", "r") as f:
users = json.load(f)

return users

client.run("DO NOT TRY TO TAKE MY TOKEN")

`

#

What Is Wrong In This??

pale vessel
gritty lintel
#

Statements must be separated by newlines or semicolons line 49:
wallet_amt = users[str(user.id)]["wallet"] += earnings

#

@pale vessel

woeful pike
#

+= is not an expression in python

gritty lintel
#

=+

#

??

slender thistle
#

What are you trying to do in that statement

quartz kindle
#

why even += in that specific expression? you wouldnt do that in any other language either

weary crypt
#

Add to the left operator

#

C# uses it

slender thistle
#

In Python it's not valid syntax

quartz kindle
#

i mean you wouldnt use += if you're assigning to a different variable anyway

cinder patio
#

yeah in that case it's kinda pointless, though maybe if they use wallet_amt a bunch then it's justified

#

Also it's useful for when you want to pass the result to a function

near stratus
quartz kindle
#

it would make sense if he wants to update both variables in a single line, but considering the nature of the question, you start getting doubts the person has such comprehension

umbral zealot
#

Y'all missed "Using json as a database" in there? ๐Ÿ˜‰

boreal iron
#

Oh god...

umbral zealot
#

It is exceedingly easy to use.

quartz kindle
#

i dont usually point out people using json, i just let them go through the experience :^)

opal plank
lyric mountain
#

and unbearable remorse

#

for all the lost data

#

and screaming users

#

oh oh and karens

#

don't forget the data karens

sacred palm
#

i want it so my bot sends a message in a channel when the server name is Spooky Month
so it has to keep checking
and i want it so it checks when the server name DOES NOT have the name "Spooky Month"
and when it does have the name it stops the loop
and when u make it not spooky month name again it loops
i think u can use boolean to achieve this idk tho
But noone knows how to do dis