#discord-bots

1 messages · Page 674 of 1

patent lark
#

you should set a default value to role at the top of your code.

velvet tinsel
#

Greetings

slate swan
#

@patent lark got it, ```py
@commands.command()
async def verc(self, ctx):
configured = var.execute("SELECT * FROM verification WHERE guildid = ?", (str(ctx.guild.id), )).fetchall()
vguild = self.bot.get_guild(int(configured[0][0]))
vrole = ctx.guild.get_role(int(configured[0][1]))
vchannel = self.bot.get_channel(int(configured[0][2]))
await ctx.send(configured)
await ctx.send(f'{vguild.id} {vchannel.id} {vrole.id}')
''' if ctx.guild.id == 890306563565305866:
role = ctx.guild.get_role(917284127701598250)

    if ctx.guild.id == 821722608767598663:
        if ctx.channel == 864368495952396309:

            role = ctx.guild.get_role(863016275613319209)
            ctx.message.delete()'''
@commands.command()
async def verify(self, ctx):
    member = ctx.author
    def check(m):
        return m.author == ctx.author
    configured = var.execute("SELECT * FROM verification WHERE guildid = ?", (str(ctx.guild.id), )).fetchall()
    vguild = self.bot.get_guild(int(configured[0][0]))
    vrole = ctx.guild.get_role(int(configured[0][1]))
    vchannel = self.bot.get_channel(int(configured[0][2]))
    if ctx.guild.id == vguild.id:
        if ctx.channel == vchannel.id:
            role = ctx.guild.get_role(vrole.id)
            ctx.message.delete()
#

but i get this error UnboundLocalError: local variable 'role' referenced before assignment when using the verify command

velvet tinsel
#

Use global

#

Global role ig

slate swan
velvet tinsel
#

That’s a way to solve your UnboundLocalError

slate swan
velvet tinsel
#

global

#

its a way to solve the UnboundLocalError

velvet tinsel
#

I'm so stupid

#

they used role before it was declared

#

🚶 I'm out of here

tacit horizon
#

;-;

slate swan
#

!d discord.Member.mention

unkempt canyonBOT
tacit horizon
#
        await message.channel.send('@EggyinIt')```
slate swan
#

But not the correct way

tacit horizon
slate swan
velvet tinsel
#

Do ctx.author.mention or…something else

tacit horizon
slate swan
slate swan
tacit horizon
#

other member in server

slate swan
#

What are you trying to do exactly?

velvet tinsel
#

There was a thing

slate swan
#

Always the same member?

velvet tinsel
#

I think it’s discord.Member

#

MyxI said something about mentioning a member

tacit horizon
velvet tinsel
#

Whilst helping me

slate swan
#

Then you can get the ID and use this @empty moon

velvet tinsel
patent lark
tacit horizon
#

LOL

slate swan
tacit horizon
#

;-;

slate swan
#

Replace the number with the member id

#

You can add a member arg and then ping him 100 times

patent lark
#

use a while loop

tacit horizon
#

ya

velvet tinsel
#

or just do member: discord.Member ig

slate swan
#

But your probably gonna get ratelimited

velvet tinsel
#

Your answer is in my PC somewhere but unfortunately my PC is away rn

tacit horizon
#

ok nvm

patent lark
slate swan
#

Yes very

velvet tinsel
#

Ok

#

Trying to print a PDF it’s doing my head in

#

Trying for an hour yet

#

FINALLY IT WORKED

tacit horizon
#
async def joinn(ctx):
        channel = ctx.message.author.voice.voice_channel
        await channel.connect()```
#

why this bot not joining vc

#

;-;

velvet tinsel
#

because you told it to

#

await channel.connect()

tacit horizon
#

*not

velvet tinsel
#

ok

slate swan
tacit horizon
#

im new ;-;

slate swan
#
    @commands.command()
    async def verify(self, ctx):
        member = ctx.author
        def check(m):
            return m.author == ctx.author

        configured = var.execute("SELECT * FROM verification WHERE guildid = ?", (str(ctx.guild.id), )).fetchall()
        vguild = self.bot.get_guild(int(configured[0][0]))
        vrole = ctx.guild.get_role(int(configured[0][1]))
        vchannel = self.bot.get_channel(int(configured[0][2]))

        if ctx.guild.id == vguild.id:
            if ctx.channel == vchannel.id:
                role = ctx.guild.get_role(vrole.id)
                ctx.message.delete()```
velvet tinsel
#

channel = ctx.author.voice.channel

slate swan
#
    @commands.command()
    async def verc(self, ctx):
        configured = var.execute("SELECT * FROM verification WHERE guildid = ?", (str(ctx.guild.id), )).fetchall()
        vguild = self.bot.get_guild(int(configured[0][0]))
        vrole = ctx.guild.get_role(int(configured[0][1]))
        vchannel = self.bot.get_channel(int(configured[0][2]))
        await ctx.send(configured)
        await ctx.send(f'{vguild.id} {vchannel.id} {vrole.id}')
```see
velvet tinsel
slate swan
#

That should work

velvet tinsel
#

INDENTS

iNDENTS

tacit horizon
#

ok

slate swan
slate swan
velvet tinsel
#

THE INDENTSSS

slate swan
slate swan
velvet tinsel
slate swan
#

cuz im honestly clueless

velvet tinsel
#

4 spaces

slate swan
#

role is defined

slate swan
#

Just lazy

velvet tinsel
#

finally

velvet tinsel
slate swan
#

Not my problem lol

#

Oh yeah forgot to add a int to the var

tacit horizon
slate swan
#
@bot.command()
async def lol(ctx,member:discord.Member):
    a = 0
    while 100 > 0:
        await ctx.send(member.mention) 
        a =+ 1

@tacit horizon

velvet tinsel
slate swan
#

Their

velvet tinsel
slate swan
tacit horizon
#

ok

slate swan
tacit horizon
velvet tinsel
velvet tinsel
slate swan
#

And why creating a variable a if you never use it

#

But just increment it

slate swan
velvet tinsel
#

return it ig

#

also it loops forever

tacit horizon
slate swan
#

Might want

while a < 100:
velvet tinsel
#

because while 100 > 0

slate swan
#

winwar maybe you can help me with something

velvet tinsel
#

it will repeat forever

slate swan
velvet tinsel
#

because it's true

velvet tinsel
#

it repeats forever

slate swan
velvet tinsel
#

because 100 is always bigger than 0

slate swan
#

Well while 100 > 0 is basically while True

#

I ment a 😭

velvet tinsel
#

*meant

slate swan
#

The var a😭

velvet tinsel
#

ok

slate swan
#
    @commands.command()
    async def verc(self, ctx):
        configured = var.execute("SELECT * FROM verification WHERE guildid = ?", (str(ctx.guild.id), )).fetchall()
        vguild = self.bot.get_guild(int(configured[0][0]))
        vrole = ctx.guild.get_role(int(configured[0][1]))
        vchannel = self.bot.get_channel(int(configured[0][2]))
        await ctx.send(configured)
        await ctx.send(f'{vguild.id} {vchannel.id} {vrole.id}')```
meanwhile apperently `role` is not defined
```py
    @commands.command()
    async def verify(self, ctx):
        member = ctx.author
        def check(m):
            return m.author == ctx.author

        configured = var.execute("SELECT * FROM verification WHERE guildid = ?", (str(ctx.guild.id), )).fetchall()
        vguild = self.bot.get_guild(int(configured[0][0]))
        vrole = ctx.guild.get_role(int(configured[0][1]))
        vchannel = self.bot.get_channel(int(configured[0][2]))

        if ctx.guild.id == vguild.id:
            if ctx.channel == vchannel.id:
                role = ctx.guild.get_role(vrole.id)
                ctx.message.delete()
#code
        if role in member.roles: ##error occurs here on 'role'
            alr = discord.Embed(title='Verification', description=f'You are already verified!', color=0x2f3136)
            await ctx.send(embed=alr, delete_after=5)
            return```
#

Mobile isnt easy guys 🕴️

velvet tinsel
slate swan
#

for the mobiles that cant see proper formatting thumbs

slate swan
patent lark
#

i already told you the issue @slate swan

slate swan
velvet tinsel
slate swan
#

It's only defined in the if scope

#

And therefore not outside of it

patent lark
slate swan
#

it is though what

#

In the if scope

#

You can only use it in there

velvet tinsel
#

use global I think

slate swan
#

No where else outside

patent lark
velvet tinsel
#

shit

patent lark
#

just set a default value to role

slate swan
#

the commands only meant to work in specific channels

velvet tinsel
#

alright

slate swan
#

of guilds that are in the database

slate swan
#

And it's await ctx.message.delete()

#

!d global

unkempt canyonBOT
#

7.12. The global statement


global_stmt ::=  "global" identifier ("," identifier)*
``` The [`global`](https://docs.python.org/3/reference/simple_stmts.html#global) statement is a declaration which holds for the entire current code block. It means that the listed identifiers are to be interpreted as globals. It would be impossible to assign to a global variable without `global`, although free variables may refer to globals without being declared global.

Names listed in a [`global`](https://docs.python.org/3/reference/simple_stmts.html#global) statement must not be used in the same code block textually preceding that `global` statement.

Names listed in a [`global`](https://docs.python.org/3/reference/simple_stmts.html#global) statement must not be defined as formal parameters, or as targets in [`with`](https://docs.python.org/3/reference/compound_stmts.html#with) statements or [`except`](https://docs.python.org/3/reference/compound_stmts.html#except) clauses, or in a [`for`](https://docs.python.org/3/reference/compound_stmts.html#for) target list, [`class`](https://docs.python.org/3/reference/compound_stmts.html#class) definition, function definition, [`import`](https://docs.python.org/3/reference/simple_stmts.html#import) statement, or variable annotation.
slate swan
#

Don't use global

velvet tinsel
velvet tinsel
velvet tinsel
patent lark
#

global is not the right answer, the fix is so simple. set a default value to "role" at the top, under your function definition

velvet tinsel
#

yert shit

slate swan
#

Snow is giving the answer lol

velvet tinsel
#

im gonna sleep

tacit horizon
#

._.

velvet tinsel
#

nighty night

slate swan
#

Same here

#

Gn to both of you

velvet tinsel
#

thanks, I'll have nightmares again

slate swan
#

🕴️ 🚶

#

role = ctx.guild.get_role('Member') that can work right?

slate swan
patent lark
#

im not sure if discord.Guild.get_role takes a str or not

#

!d discord.Guild.get_role

unkempt canyonBOT
patent lark
#

takes an int.

slate swan
#

Programming in mobile isnt easy either lol

tacit horizon
patent lark
#

what?

tacit horizon
#

like the id

slate swan
#
@bot.command()
async def lol(ctx,member:discord.Member):
    a = 0
    while 100 > a:
        await ctx.send(member.mention) 
        a += 1

That should work

slate swan
tacit horizon
#

it will mention to who

slate swan
#

To the given member?

patent lark
#

whoever you fill in the parameter with when you run the command

#

you would do
!lol @user and it will mention the user

tacit horizon
patent lark
#

you dont?

slate swan
#

You add a ping or a id

#

Not the name

tacit horizon
#

LOL ITS WORKED

#

op lol

slate swan
#

You get what i mean

patent lark
#

when you called func you needed to pass it as a string.

slate swan
#

I just cant program on mobile for a reason

#

!e

def func(member):
    print(member)

func("@okimii")

@tacit horizon

unkempt canyonBOT
#

@slate swan :white_check_mark: Your eval job has completed with return code 0.

@okimii
slate swan
tacit horizon
#

like that

tacit horizon
#

add the value with user

patent lark
#

add a parameter to hold the value. then break the loop once it hits the parameters value (int value)

tacit horizon
#

😶

slate swan
#

Pretty easy stuff ngl

tacit horizon
#

u guys r in collage ?

#

or more pro

slate swan
tacit horizon
#

wow

slate swan
#

Lol

tacit horizon
#

nc jk

slate swan
tacit horizon
#

-_-

slate swan
#

Most people here arent even 20 lol

tacit horizon
#

same

tacit horizon
patent lark
#
@bot.command()
async def lol(ctx, member: discord.Member, count: int):
  c = 0 
  while True:
    await ctx.send(member.mention)
    c +=1
    if c == int(count):
      break
    else:
      continue```
#

something like this

tacit horizon
#

ok

pliant gulch
slate swan
tacit horizon
#

let me

slate swan
#

while 1 > 2 doesnt it stop?

patent lark
patent lark
tacit horizon
#

my friend will hate u now xD

patent lark
#

thats fine.

#

your idea. i just provided help.

tacit horizon
#

u r a collage guy right

patent lark
#

assuming it was only for trying to wake your friend up. if it were to be used in a harmful case i would have let it be.

slate swan
patent lark
#

no, im 17. senior year of highschool.

slate swan
patent lark
#

xd

slate swan
#

Im a freshman 🕴️

#

🚶

tacit horizon
#

BRUH how u guys know code so wellll

slate swan
#

Mostly passion and because i love what i do and for my future

tacit horizon
#

ahh i mean where do u learn

patent lark
#

it mostly comes from practice, trial and error, and being open to learn. personally, i have a passion for coding/developing. so i dedicated time to it.

slate swan
patent lark
slate swan
patent lark
#

it is.

slate swan
#

In my opinion

tacit horizon
#

im also starting

slate swan
slate swan
patent lark
#

you learn your own ways and your own aspects. rather than someone else's opinion of whats wrong or right.

tacit horizon
#

ya

patent lark
#

i took one computer science class but it didnt much help, it was just the super basic coding, like syntax. they didnt even speak of asynchronous programming or OOP.

tacit horizon
#

which country

slate swan
#

More related to syntax then oop or asynchronous programming or stuff related to apis

pliant gulch
slate swan
#

I think theirs classes for backend tho

slate swan
patent lark
slate swan
#

And patience

#

🚶

tacit horizon
pliant gulch
tacit horizon
#

OOP hmm

patent lark
#

!pep8 this also really helped me with writing clean and understandable code.

unkempt canyonBOT
#

PEP 8 is the official style guide for Python. It includes comprehensive guidelines for code formatting, variable naming, and making your code easy to read. Professional Python developers are usually required to follow the guidelines, and will often use code-linters like flake8 to verify that the code they're writing complies with the style guide.

More information:
PEP 8 document
Our PEP 8 song! :notes:

pliant gulch
#

Specifically if you are writing a python package/program

#

Other languages and other projects follow different guidelines, styleguides and conventions

slate swan
#

Yup

#

Pep8 for me was really helpful

lost wolf
#

how do i check if the member that someone mentions is a bot or not?

#

like member.bot?

patent lark
#

!d discord.Member.bot

unkempt canyonBOT
#

property bot```
Equivalent to [`User.bot`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.bot "discord.User.bot")
lost wolf
#
if member.bot == True:
  Code here
#

and that worked also

neat lake
#

hello can i scrape all message from a user by using my account ?

#

(on a server where im not owner)

final iron
neat lake
#

is that allowed with a bot ?

final iron
#

Yes

neat lake
#

mmmhh okay

#

and how can i "scan" all message from a channel to check their user sender id

#

with a while ?

tacit token
#

hello guys

#

can i how to create command, for command use wikipedia for search. !wikipedia search (idea)

final iron
#

!pypi wikipedia

unkempt canyonBOT
magic ore
slate swan
magic ore
#

member is a member object
member.bot is a bool
member is member is True, while member is <anything else> is False
you would just check if member.bot here

patent lark
jade tartan
#
Traceback (most recent call last):
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "c:\Users\thoma\Desktop\discord.py\python\bot.py", line 40, in on_member_join
    Myembed.add_field(name="Account Created at:", value=f"{member.created_at(datetime)}", inline=True)
TypeError: 'datetime.datetime' object is not callable```
#
async def on_member_join(member):
        guild = client.get_guild(730651046459998218)
        channel = client.get_channel(885464532959526913)
        Myembed = discord.Embed(title= f"Welcome",
        description=(f"Welcome {member.mention}, You are member {guild.member_count}. \n Please enjoy your stay here and dont forget to read the await [#904279966693355550](/guild/267624335836053506/channel/904279966693355550/)"))
        Myembed.add_field(name="Account Created at:", value=f"{member.created_at(datetime)}", inline=True)
        await channel.send(embed=Myembed)
        await member.send(embed=Myembed)
        roles_list = ["Unverified","•.¸¸.•:Colours:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Verification:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Age:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Gender:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Sexuality:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•",
        "•.¸¸.•:Distance:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Ethnicity:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Hobbies:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Relationship:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Location:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•",
        "•.¸¸.•::•.¸¸.•`Seeking`•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:DM:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Levels:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Games:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•"]
        for roles in roles_list:
            role = discord.utils.get(member.guild.roles, name=roles)
            await member.add_roles(role)
            await member.send(f"**{member.author}**, please react with :white_check_mark: on this message in 60 seconds")
    
            def check(r: discord.Reaction, u: Union[discord.Member, discord.User]):
                return u.id == member.author.id and r.message.channel.id == member.channel.id and \
               str(r.emoji) in ["\U00002705"]
        try:
            reaction, user = await client.wait_for(event = 'reaction_add', check = check, timeout = 60.0)
        except asyncio.TimeoutError:
            await member.send(f"**{member.author}**, you didnt react with a ✅ in 60 seconds.")
            return  
        else:
            if str(reaction.emoji) == "\U00002705":
                return 
            await member.send(f"{member.author} reacted with a ✅")```
astral cobalt
#

Is there a way to distinguish between aliases. So if someone uses one of the aliases it knows that they used that one?

jade tartan
#

Can you help me with that?

magic ore
unkempt canyonBOT
final iron
#

What are you trying to accomplish?

tacit token
#

hello guys

#

the wikipedia command delete all basic command, why?M

final iron
# tacit token

Why are you naming your commands.Bot instance client then renaming the client variable to bot?

placid meadow
#

please, help me.

jade tartan
final iron
#

Yes

jade tartan
# final iron Yes

Well it’s where when a member joins if he/she doesn’t verify within a certain time they get kicked from the server

#

Is that right? I should have a member variable

final iron
#

I'm talking about the specific line I showed

placid meadow
jade tartan
#

Well it wanted where it would at how long has this member created this account for example it should say something like 4 days ago

visual island
# placid meadow

remove 1 indent level from the first 2 line inside the function

visual island
#

f"<t:{int(member.created_at.timestamp())}:R>"

placid meadow
#

how to define c?

desert heart
#

That's a database question so it belongs in #databases '

heavy folio
kindred epoch
#
while True:
            currentbid = await self.bot.wait_for("message",check=check)
            highestbid = await self.bot.pg_db.fetch("SELECT highestbid,user_id FROM auctions WHERE card_id = $1 AND card_set_name = $2",pokemon[0]['card_id'],pokemon[0]['card_set_name'])
            print(highestbid)
            if currentbid.content.isdigit() == False:
                await currentbid.reply("Please refain from using text messages when an auction is going on.",delete_after=5)
            elif int(currentbid.content) < 1000:
                await currentbid.reply("Bid amount cannot be under 1,000 cardcoins.")
            if currentbid.content.isdigit() == True and int(currentbid.content) > highestbid[0]['highestbid']:
                await self.bot.pg_db.execute("UPDATE auctions SET highestbid = $1,user_id = $2 WHERE card_id = $3 AND card_set_name = $4",int(currentbid.content),currentbid.author.id,pokemon[0]['card_id'],pokemon[0]['card_set_name'])
                await currentbid.reply(f"{currentbid.author.name} has the highest bid at the moment.")
``` for some reason this is sending the "has the highest big" message 2 times
#

any idea why? no errors.

slate swan
#

is it possible to trigger a link using a select option/dropdown?

#
    @commands.command()
    async def verc(self, ctx):
        configured = var.execute("SELECT * FROM verification WHERE guildid = ?", (str(ctx.guild.id), )).fetchone()
        print(configured[0])
        print(configured[1])
        print(configured[2])```
using this i got these values

821722608767598663
863016275613319209
864368495952396309
The Aether
✔・verification
Member```
now using the following command id like to put it to work

    @commands.command()
    async def verify(self, ctx):
        member = ctx.author
        def check(m):
            return m.author == ctx.author

        configured = var.execute("SELECT * FROM verification WHERE guildid = ?", (str(ctx.guild.id), )).fetchone()
        vguild = self.bot.get_guild(int(configured[0]))
        vrole = ctx.guild.get_role(int(configured[1]))
        vchannel = self.bot.get_channel(int(configured[2]))

        if ctx.guild.id == configured[0]:
            if ctx.channel == configured[2]:
                role = ctx.guild.get_role(int(configured[1]))
                await ctx.message.delete()``` how can i make this command work only in guilds that are in the database, whilst checking if the command is used in the proper channel, and to provide the proper role if verification is completed correctly? using just ids alone and not by reading the database this worked perfectly fine, so now im just trying to make the command read the database file for the values and use them as the ids instead of me typing them in the source manually. make sense?
#

Nope

slate swan
#

If I understood correctly

slate swan
#

If the user selects something

slate swan
heavy folio
slate swan
#

How to create on_reaction_add multiple times so that there were no errors?

lost wolf
#

`

#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: load() takes 1 positional argument but 2 were given

slate swan
#

are you loading a cog?

lost wolf
#

code:

    @commands.command(hidden=True)
    @commands.is_owner()
    async def load(self, *, module : str):
        """Loads a module."""
        try:
            self.bot.load_extension(module)
        except Exception as e:
            await self.bot.say('\N{PISTOL}')
            await self.bot.say('{}: {}'.format(type(e).__name__, e))
        else:
            await self.bot.say('\N{OK HAND SIGN}')
lost wolf
slate swan
#

you forgot ctx

#

yt tutorial lol

#

also use ctx.send

lost wolf
slate swan
#

you have to

#

.say was deprecated

#

^^^

#

so you have to use ctx

lost wolf
slate swan
#

yes

#

yes and add ctx to the arguments

slate swan
#

arguments go in the parameter

#

not really correct since it has its own term

lost wolf
#

discord.ext.commands.errors.MissingRequiredArgument: ctx is a required argument that is missing.

#
    @commands.command(hidden=True)
    @commands.is_owner()
    async def load(self, *, module : str, ctx: commands.Context):
        """Loads a module."""
        try:
            self.bot.load_extension(module)
        except Exception as e:
            await ctx.send('\N{PISTOL}')
            await ctx.send('{}: {}'.format(type(e).__name__, e))
        else:
            await ctx.send('\N{OK HAND SIGN}')
slate swan
#

ctx before module

#

its a positional arg

#

goes first

#

self goes first

lost wolf
#

self goes first

slate swan
#

ctx goes second

#

self is too access a class

#

but it still goes first ¯_(ツ)_/¯

#

wasnt talking about it

#

self isnt really an arg as its used to access variables that belongs to the class

#

but it still goes first ¯_(ツ)_/¯

#

wasnt talking about self but about arg so your stance is invalid

#

but it still goes first ¯_(ツ)_/¯

#

common sense when using a class

#

but it still goes first ¯_(ツ)_/¯

final iron
slate swan
#

yes

final iron
#

ctx will always be the first argument

slate swan
#

as i said lol

jade tartan
#
Traceback (most recent call last):
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "c:\Users\thoma\Desktop\discord.py\python\bot.py", line 92, in on_raw_reaction_remove
    guild = member.guild
AttributeError: 'NoneType' object has no attribute 'guild'```
#
async def on_raw_reaction_remove(payload):
    ourMessageID = 914720242297630750

    if ourMessageID == 914720242297630750:
        member = payload.member
        guild = member.guild

        emoji = payload.emoji.name
        if emoji == ':white_check_mark:':
            role = discord.utils.get(guild.roles, name="Unverified")
            await member.add_roles(role)```
slate swan
#

member is none

jade tartan
#

nvm i needed to restart the bot nvm

slate swan
#

alr

jade tartan
#

@slate swan every time i join the server with a different account it keeps sending me this message in DM's await member.send(f"**{member.author}**, you didnt react with a :white_check_mark: in 60 seconds.")

#

How do i prevent that?

#
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "c:\Users\thoma\Desktop\discord.py\python\bot.py", line 57, in on_member_join
    await member.send(f"**{member.author}**, you didnt react with a ✅ in 60 seconds.")
AttributeError: 'Member' object has no attribute 'author'
slate swan
#

what are you trying to do?

jade tartan
#

make it to where after a certain time if the member does react he/she gets kicked from the server

slate swan
#

just use member

jade tartan
#
async def on_member_join(member):
        guild = client.get_guild(730651046459998218)
        channel = client.get_channel(885464532959526913)
        Myembed = discord.Embed(title= f"Welcome",
        description=(f"Welcome {member.mention}, You are member {guild.member_count}. \n Please enjoy your stay here and dont forget to read the await [#904279966693355550](/guild/267624335836053506/channel/904279966693355550/)"))
        Myembed.add_field(name="Account Created at:", value=f"<t:{int(member.created_at.timestamp())}:R>" , inline=True)
        await channel.send(embed=Myembed)
        await member.send(embed=Myembed)
        roles_list = ["Unverified","•.¸¸.•:Colours:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Verification:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Age:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Gender:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Sexuality:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•",
        "•.¸¸.•:Distance:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Ethnicity:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Hobbies:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Relationship:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Location:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•",
        "•.¸¸.•::•.¸¸.•`Seeking`•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:DM:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Levels:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Games:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•"]
        for roles in roles_list:
            role = discord.utils.get(member.guild.roles, name=roles)
            await member.add_roles(role)
            await member.send(f"{member.mention}, please react with :white_check_mark: on this message in 60 seconds")

            def check(r: discord.Reaction, u: Union[discord.Member, discord.User]):
                return u.id == member.author.id and r.message.channel.id == member.channel.id and \
               str(r.emoji) in ["\U00002705"]
        try:
            reaction, user = await client.wait_for(event = 'reaction_add', check = check, timeout = 60.0)
        except asyncio.TimeoutError:
            await member.send(f"**{member.author}**, you didnt react with a ✅ in 60 seconds.")
            return  
        else:
            if str(reaction.emoji) == "\U00002705":
                return 
            await member.send(f"{member.author} reacted with a ✅")```
#

this is the whole class code

slate swan
#

put the kick function under the exception

jade tartan
slate swan
#

im not answering that

#

learn python

jade tartan
#

unless ur talking about this

#

hang on

slate swan
#

what kick func are you talking about?

jade tartan
#

After a certain time if a member hasnt verified during that. Then they will get kicked from the server.

sinful pasture
#

what could be the reason that I don't get the on_ready thing

slate swan
#

dont need it as your getting the author of nothing

jade tartan
#
async def on_member_join(member):
        guild = client.get_guild(730651046459998218)
        channel = client.get_channel(885464532959526913)
        Myembed = discord.Embed(title= f"Welcome",
        description=(f"Welcome {member.mention}, You are member {guild.member_count}. \n Please enjoy your stay here and dont forget to read the await [#904279966693355550](/guild/267624335836053506/channel/904279966693355550/)"))
        Myembed.add_field(name="Account Created at:", value=f"<t:{int(member.created_at.timestamp())}:R>" , inline=True)
        await channel.send(embed=Myembed)
        await member.send(embed=Myembed)
        roles_list = ["Unverified","•.¸¸.•:Colours:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Verification:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Age:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Gender:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Sexuality:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•",
        "•.¸¸.•:Distance:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Ethnicity:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Hobbies:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Relationship:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Location:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•",
        "•.¸¸.•::•.¸¸.•`Seeking`•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:DM:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Levels:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Games:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•"]
        for roles in roles_list:
            role = discord.utils.get(member.guild.roles, name=roles)
            await member.add_roles(role)
            await member.send(f"{member.mention}, please react with :white_check_mark: on this message in 60 seconds")

            def check(r: discord.Reaction, u: Union[discord.Member, discord.User]):
                return u.id == member.mention.id and r.message.channel.id == member.channel.id and \
               str(r.emoji) in ["\U00002705"]
        try:
            reaction, user = await client.wait_for(event = 'reaction_add', check = check, timeout = 60.0)
        except asyncio.TimeoutError:
            await member.send(f"**{member.mention}**, you didnt react with a ✅ in 60 seconds.")
            return  
        else:
            if str(reaction.emoji) == "\U00002705":
                return 
            await member.send(f"{member.mention} reacted with a ✅")```
#

still the same

#

It keeps sending me multiple message of await member.send(f"{member.mention}, please react with ✅ on this message in 60 seconds")

slate swan
#

u didnt even do as i said lmfao

jade tartan
slate swan
slate swan
final iron
slate swan
#

he said he wants the user to be kicked if they dont respond

#

hed have to put it under the timeout error

#

basic python

#

wasnt his error?

jade tartan
#

Well first fix this thing where it keeps sending me multiple messages of await member.send(f"{member.mention}, please react with ✅ on this message in 60 seconds")

#

and then get on the kick function

slate swan
#

im not fixing anything for you, im telling you what you can do to get what you want

jade tartan
slate swan
#

answer that before you open your mouth again 🖐️

#

can you be respectful?

#

i think you need to learn basic respect

#

i was trying to help him, hes looking for free code

#

how.....

jade tartan
jade tartan
slate swan
#

its skid-hour again 😜😜

#

😮‍💨

#

please stay respectful

jade tartan
slate swan
#

ok

jade tartan
daring olive
jade tartan
#

@daring olive thank you

daring olive
#

no problem... if you feel like you're not receiving a lot of help or if the help doesn't seem easy to follow, don't despair. discord bots aren't an easy first project as far as i know. doable, but you'll have to learn a lot with a steep learning curve

slate swan
#

is it possible to send an embed within an embed :()

daring olive
#

but if that's what you want to do, you should go for it

slate swan
jade tartan
slate swan
#

hm

slate swan
# slate swan explain

say i wanted to have an invite link command, and when raised, the bot would send an embed with the link inside as a field value, would it be possible to have the invite link embed instead of just stay as a link?

#

hope that makes sense :d

#

links get turn into embeds?

#

uh hang on

final iron
slate swan
#

something like this i suppose

slate swan
#

to be able to get the invite link to do its embed thing within the sent embed

final iron
#

That's what they're talking about I think

slate swan
#

doesnt discord make them embeds?

#

hmm lemme rephrase

#

say... youtube links

#

normally when you send one in chat, youll be able to see the embed with the title, creator and video player

#

you want to send a invite link in a embed without it being the invite default embed?

#

without it just appearing as the link yes

sage otter
slate swan
#

alright then

slate swan
#

understood

#

thanks

sage otter
#

As far as guild invites though you can process that your self. And do whatever with inside an embed ig?

slate swan
#

ill compromise

sage otter
#

Just use Client.fetch_invite() and it will return a PartialInviteGuild in which you can get icon and name and whatnot

mild birch
slate swan
#

great thankyou :)

mild birch
#

discord.Embed(title="[Hello](https://google.com/)")

slate swan
#

thats a hyperlink

sage otter
#

You’re actually shit posting

mild birch
#

masked embed

mild birch
#

discord.Embed(title="[Invite Me](ur bot invite link)")

sage otter
#

That’s not what he asked for

sage otter
patent lark
boreal ravine
mild birch
sage otter
#

what I just pulled replied to.

boreal ravine
sage otter
#

Can you even hyper link titles?

mild birch
slate swan
patent lark
#

"blue link"

slate swan
#

afaik no

boreal ravine
slate swan
#

no i think they want to make a embed and then have the default embed you get with a invite url within the embed

sage otter
#

I honestly think that not everyone here is even on the same page.

slate swan
#

yeah

sage otter
#

Probably just me. AMshrug

slate swan
#

hang on, do we have embed perms?

sage otter
#

Normal discord users can’t use embeds

slate swan
#

no like

#

if i sent a youtube link rn

#

would it embed the video player

#

yes

#

the thumbnail will pop up

#

within a embed right?

#

yeah so the question was whether i could get this ^ to show up within an embed

#

yea

boreal ravine
mild birch
sage otter
#

That’s still not what he wanted either way.

#

Hyper links have no relevance to what he said.

boreal ravine
sinful pasture
#
import os
import discord 
import dadjokes 
import time 
from dadjokes import Dadjoke

client = discord.Client()

client.event
async def on_ready():
  print('Dad jokes are ready')


client.event
async def on_message(message):
  if message.content.startswith('infinite_dadjokes'):
    await message.channel.send('Yessiree')
  if message.author == client.user():
    await message.channel.send(Dadjoke())
    time.sleep(25)

It's a very basic and kinda gimmicky code, but I don't get any output

sinful pasture
#

;-;

patent lark
#

why use discord.Client()

sinful pasture
#

why not

boreal ravine
sage otter
#

Honestly if this is the only feature the bot has. And the only thing it’s meant for it doesn’t even matter that he’s using a blocking sleep.

boreal ravine
slate swan
#

yo dadjokes is an actual module?

slate swan
sinful pasture
#

Alright

sage otter
#

That’s true but like

slate swan
#

And they miss @ for the decorators

slate swan
sinful pasture
#

I feel dumb asf pithink

boreal ravine
#

very

slate swan
#

are you new to this?

boreal ravine
sinful pasture
slate swan
#

you learn from your mistakes i suppose

sinful pasture
#

Sooo I just put the contents of the var into the send thing

boreal ravine
#

o

slate swan
#

use random?

sinful pasture
#

random.choice?

slate swan
#

yeah

sinful pasture
#

that works on that? pithink

boreal ravine
#

it works on every iterable

slate swan
#

yeah it should work

sinful pasture
#

O ok

#

Ty

slate swan
#

no worries

mild birch
#

ok

boreal ravine
#

didn't work for me

mild birch
#

cool

boreal ravine
mild birch
#

noo XD

slate swan
#

class :')

boreal ravine
#

what

slate swan
#
await ctx.send(embed=embed, components=[
            [Button(style=ButtonStyle.grey, label="Refresh", emoji=bot.get_emoji(919622656049967164))]])
#

there's a refresh button but no refresh emoji

mild birch
#

ok

boreal ravine
#

try fetching it

mild birch
tough lance
#

I'd prefer disnake

slate swan
slate swan
slate swan
boreal ravine
unkempt canyonBOT
#
Not gonna happen.

No documentation found for the requested symbol.

boreal ravine
#

h

slate swan
#

theres no fetch emoji

boreal ravine
#

!d discord.Guild.fetch_emoji <=

#

fk why did i

slate swan
#

dont you just do forward slash:emoji: to get the thing

#

needs id i think

#

yesh do that

slate swan
#

lemme try

slate swan
#

yeah no try \:emoji:

slate swan
#

yesh use that

#

15 erros pog

#

;-;

boreal ravine
#

show code

#

also did u try fetching the emoji like i said earlier

tough lance
#

I think you didn't put the emoji in a string

boreal ravine
#

bruh

#

@slate swan did it work

mild birch
boreal ravine
#

it's my bot

mild birch
#

ohh

#

k

slate swan
#

lmao

mild birch
#

🟥🟥🟥
🟥🟥🟦🟦
🟥🟥🟥🟥
🟥🟥🟥🟥
🟥 🟥

slate swan
#

amogus

#

AmogOS

#

AMOSUS

#

:0 sus

#

!ot

unkempt canyonBOT
slate swan
#

amogOS :trollmask:

mild birch
slate swan
#

🚶

#

🍞

tough lance
#

Weirdest channel in the whole python server

slate swan
#

agreed

boreal ravine
#

people are shitposting

#

its normally not like this here

slate swan
#

well i mean if ppl have questions, we do our best to answer

#

a little shitposting cant hurt

daring olive
#

less shit posting please

slate swan
#

:d okay

#

shipit was about to ssay "until a mod asks to stop"

#

mina is always watching lol

small igloo
#

eh.. how to make bot kinda give coin or wmth when voted?

slate swan
#

Use the botlist's api

#

if you were to make a currency bot, would it be wiser to use a json file to store data or a sql database

#

db

small igloo
slate swan
#

json isnt a db or ment to store data

slate swan
small igloo
slate swan
small igloo
small igloo
slate swan
#

the more time you put into it, theoretically, the more you get out of it

#

hang in there man

small igloo
#

k

slate swan
small igloo
slate swan
#

Yw

#

If you want to use something json-ish , go for mongodb , it's a noSQL database

#

ive learnt some mysql so i think that would be my go to but thanks for the recommendation

slate swan
untold token
#

SQL is the language used by databases like postgresql/ mysql, SQL itself isn't a db and yes you should use postgres, it's not very hard, very reliable and advanced

#

Oh

#

Why did you delete the msg

upbeat otter
slate swan
upbeat otter
#

M

#

E

slate swan
#

oh

untold token
#

Was referring to eevee and the OP

upbeat otter
#

OP?

untold token
#

The person who asked the question

slate swan
#

whos the OP

upbeat otter
slate swan
upbeat otter
#

Beggars*

sick birch
#

databases can store almost any type of data if you're clever with it

upbeat otter
#

@slate swan where do you usually host the bot?

slate swan
#

im just that good

#

lmao

#

you self host.

upbeat otter
slate swan
#

lol

#

i cant afford any actual hosting services

upbeat otter
#

yert resource wastage

slate swan
#

ill just have my laptop running 24/7

#

LMAO

upbeat otter
slate swan
#

only thing you need to pay is your electricity bills

#

lmao

#

pretty sure my laptop is unbreakable (not a bluff)

slate swan
slate swan
#

🚶‍♂️

slate swan
#

lmao

upbeat otter
slate swan
#

me when

upbeat otter
slate swan
upbeat otter
slate swan
#

no

upbeat otter
#

And

slate swan
#

all

upbeat otter
#

!o

#

!ot

unkempt canyonBOT
slate swan
#

!ot

#

youve failed lol

upbeat otter
#

My superfast phone

slate swan
pliant gulch
slate swan
#

🤣

upbeat otter
slate swan
slate swan
pliant gulch
#

It just depends how we'll you maintain it

#

E.g proper cooling

pliant gulch
#

And where is the proof of that?

untold token
#

Huh?

slate swan
untold token
#

Bruh !ot

pliant gulch
#

Does that mean every vps hosting discord bots are being damaged because they are hosting discord bots???

upbeat otter
#

Why not

pliant gulch
#

🤔

upbeat otter
#

Lol

slate swan
#

run your bot on a fridge and youll be good

slate swan
upbeat otter
slate swan
untold token
# upbeat otter It will

It doesn't, you can run perfectly run discord bots in laptops and keep it running, why do you think some people use RPI to host their bot

pliant gulch
untold token
#

Also this talk about fridge, go in off topic channels please

slate swan
#

yesh go back to discord bots

slate swan
#

:0

#

clearly you dont own an air fryer 😔

untold token
#

Unlike some others

slate swan
boreal ravine
#

give command ideas

slate swan
#

latency command

tiny ibex
slate swan
tiny ibex
#

Once made share the code with me

sullen shoal
boreal ravine
boreal ravine
untold token
#

Something like that

sage otter
untold token
sullen shoal
#

isnt that what selenium does tho

sage otter
slate swan
boreal ravine
sage otter
#

A bot in the actual dpy server has that feature. It’s constantly used.

#

Well think of the possibilities with the command

boreal ravine
sullen shoal
#

i use it to see what's trending in their country's that kind of sites

#

its useful

sage otter
#

The bot in I was talking about allows you to pass in a website url and takes a ss and sends it. And if it’s a website that takes a bit to load you can pass a delay too.

#

I though it was hella cool when I saw it.

boreal ravine
#
  1. i've never used selenium before, so I have no idea how i'd make it
  2. doesnt look like it has any benefits
tiny ibex
sullen shoal
#

i wanted to use replit for the api but it can either run selenium or a web server idk if theres any workaround to that tho

sullen shoal
sage otter
#

No actual benefits but it’s more a feature that users would like.

tiny ibex
untold token
#

It literally says

untold token
#

without chromedrivers

tiny ibex
#

Ah thanks

upbeat otter
untold token
sage otter
#

AMshrug bots are all about automation

untold token
#

It will install chromedrivers for you

#

Its 150 mb

sage otter
#

You could simply ban someone using discord but people still make ban commands

upbeat otter
#

No point but fine

sullen shoal
sage otter
#

And you gotta use your mouse to click on links

upbeat otter
sullen shoal
slate swan
sage otter
#

Save time is subjective.

untold token
#

This is getting offtopic

slate swan
#

simplifying tasks is objective

untold token
#

!ot

unkempt canyonBOT
slate swan
#

now on with it

sage otter
#

It’s really not.

#

Talking about the point of discord bots.

#

Not sure what’s with the mouse shit tho.

upbeat otter
#

Lol

slate swan
#

make the bot eye-tracker activated

tiny ibex
#

So will it work on heroku?

sullen shoal
#

/shrug

untold token
#

Depends upon the space you get

#

How much is it

#

1 gig?

tiny ibex
#

512 mb

untold token
#

You could

tiny ibex
#

Ig I will make an api for myself

sullen shoal
#

its like some 10 lines of code tbh

tiny ibex
#

And host it on another heroku app

tiny ibex
upbeat otter
sullen shoal
tiny ibex
boreal ravine
#

guys give command ideas that dont require me to use something i dont have any experience with

slate swan
#

discord snek

sage otter
#

What commands you already got

boreal ravine
#

snek? wut

tiny ibex
#

Wait I am gonna do that

boreal ravine
tiny ibex
#

Good idea actually

untold token
sage otter
upbeat otter
pliant gulch
#

Make chess

tiny ibex
upbeat otter
tiny ibex
#

Sounds good

sage otter
#

Reaction roles

untold token
#

Uh

sage otter
#

But instead of reactions you got buttons

upbeat otter
zenith hare
#

hi, is it possible to ignore an argument in a command?

upbeat otter
tiny ibex
tiny ibex
#

I was talking bout my other idea

boreal ravine
slate swan
boreal ravine
#

you can set the parameter to None to make it optional

tiny ibex
#

Then everyone can use it

untold token
sage otter
upbeat otter
tiny ibex
untold token
#

In here, if you don't pass anything in the user argument, it will take None as default

sage otter
#

Depends on how detailed you make it.

boreal ravine
tiny ibex
sage otter
#

Ofc you did death

untold token
#

smh

upbeat otter
#

!pypi google

tiny ibex
#

Wtf

upbeat otter
#

!pypi google

unkempt canyonBOT
upbeat otter
tiny ibex
upbeat otter
vast gale
#

@untold token oh I know you

sage otter
#

I was thinking of doing without using another module so he wouldn’t have to install anything but ok

#

Let’s just have everything done for us

untold token
tiny ibex
upbeat otter
zenith hare
untold token
#

The user is not an optional argument

#

Pag is

zenith hare
vast gale
#

yes

jade tartan
#

So how would i do the kick thing ?

upbeat otter
unkempt canyonBOT
#

await kick(*, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Kicks this member. Equivalent to [`Guild.kick()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.kick "discord.Guild.kick").
untold token
#
@bot.command()
async def func(ctx: commands.Context, *, user: str  = None, pag: str = None):
   await _ctx.send(f"{user}, {pag}")

In here both, pag and user arguments are optional, this means if you don't pass a value, it will take None as default

#

@zenith hare

sage otter
# boreal ravine sure, i stole the one in the github

honestly I don’t really know. When making command ideas I try to avoid making shit that’s been made on other bots but some times that’s inevitable but it’s always good to be original. Gives your bot uniqueness.

untold token
jade tartan
zenith hare
upbeat otter
jade tartan
#

i mean reacting to this

sage otter
jade tartan
slate swan
#

wait so if they dont react, they get kicked?

jade tartan
#
async def on_member_join(member):
        guild = client.get_guild(730651046459998218)
        channel = client.get_channel(885464532959526913)
        Myembed = discord.Embed(title= f"Welcome",
        description=(f"Welcome {member.mention}, You are member {guild.member_count}. \n Please enjoy your stay here and dont forget to read the await [#904279966693355550](/guild/267624335836053506/channel/904279966693355550/)"))
        Myembed.add_field(name="Account Created at:", value=f"<t:{int(member.created_at.timestamp())}:R>" , inline=True)
        await channel.send(embed=Myembed)
        await member.send(embed=Myembed)
        roles_list = ["Unverified","•.¸¸.•:Colours:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Verification:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Age:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Gender:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Sexuality:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•",
        "•.¸¸.•:Distance:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Ethnicity:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Hobbies:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Relationship:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Location:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•",
        "•.¸¸.•::•.¸¸.•`Seeking`•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:DM:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Levels:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Games:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•"]
        for roles in roles_list:
            role = discord.utils.get(member.guild.roles, name=roles)
            await member.add_roles(role)
            def check(r: discord.Reaction, u: Union[discord.Member, discord.User]):
                return u.id == member.mention.id and r.message.channel.id == member.channel.id and \
               str(r.emoji) in ["\U00002705"]
        try:
            reaction, user = await client.wait_for(event = 'reaction_add', check = check, timeout = 45.0)
        except asyncio.TimeoutError:
            await member.send(f"{member.mention}, please react with :white_check_mark: on this message in 45 seconds")
            return
        else:
            if str(reaction.emoji) == "\U00002705":
                return 
            await member.send(f"**{member.mention}**, you didnt react with a ✅ in 45 seconds.")
            await member.send(f"**{member.mention}** reacted with a ✅")```
upbeat otter
jade tartan
slate swan
#

so you want them kicked if they dont react in time

jade tartan
#

yes

slate swan
#

just add a kick statement under your exception for the timeout

jade tartan
#

How?

slate swan
#

you do know what a kick statement is right

untold token
#

!e

import typing

def func(a: typing.Optional[str]):
    print(a)

func("1")
unkempt canyonBOT
#

@untold token :white_check_mark: Your eval job has completed with return code 0.

1
slate swan
#

!d discord.Member.kick

sage otter
#

typing stuff in your function signature allows your bot to differentiate bad input vs good.

patent lark
#

member.kick()

sage otter
#

Why do you think commands.BadArgument exist

untold token
#

!e

import typing

def func(a: typing.Optional[str]):
    print(a)

func(1)
unkempt canyonBOT
#

@untold token :white_check_mark: Your eval job has completed with return code 0.

1
untold token
#

It's just an example

vast gale
slate swan
#
        var.execute("CREATE TABLE IF NOT EXISTS verification(guildid TEXT, roleid TEXT, channelid TEXT)")
##
        var.execute("INSERT INTO verification(guildid, roleid, channelid) VALUES (?, ?, ?)",
                   (str(ctx.guild.id), str(role.id), str(channel.id)))
##
    @commands.command()
    async def verify(self, ctx):
        member = ctx.author
        def check(m):
            return m.author == ctx.author

        configured = var.execute("SELECT * FROM verification WHERE guildid = ?", (str(ctx.guild.id), )).fetchone()
        vguild = self.bot.get_guild(int(configured[0]))
        vrole = ctx.guild.get_role(int(configured[1]))
        vchannel = self.bot.get_channel(int(configured[2]))
        print(f'{configured[0]} guild')
        print(f'{configured[1]} role')
        print(f'{configured[2]} channel')
        print('--------------------------')
        if ctx.guild.id == int(configured[0]):
            if ctx.channel == int(configured[2]):
                role = configured[1]
                await ctx.message.delete()
                print(role)
##
        if role in member.roles: #error here
            alr = discord.Embed(title='Verification', description=f'You are already verified!', color=0x2f3136)
            await ctx.send(embed=alr, delete_after=5)
            return``` 'role' is not defined, anyone know why this happens? the table values exist so
vast gale
patent lark
jade tartan
#

Like this?

slate swan
untold token
patent lark
#

i told you to set a default value to role at the top

#

(under the function definition)

slate swan
jade tartan
#

Yes bro

patent lark
slate swan
slate swan
#

.......

jade tartan
#

!d discord.Member.kick

unkempt canyonBOT
#

await kick(*, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Kicks this member. Equivalent to [`Guild.kick()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.kick "discord.Guild.kick").
slate swan
#

thats SO basic

patent lark
slate swan
jade tartan
untold token
patent lark
#

yeah clearly

boreal ravine
#

guys give command ideas

slate swan
untold token
slate swan
sage otter
#

Connections?

slate swan
#

yes

boreal ravine
slate swan
#

discord connections

boreal ravine
slate swan
#

yk those little names on someones profile?

sullen shoal
sage otter
#

Those aren’t accessible

untold token
#

That's an user endpoint iirc

#

Bots cannot access it

slate swan
jade tartan
slate swan
#

it was common in selfbots a while back

patent lark
#

this isnt self-bots.

untold token
#

No one is talking about self bots here

slate swan
upbeat otter
#

Guys, i've a really dumb question ,-,

slate swan
patent lark
#

doesnt matter. those arent accessible

slate swan
#

im sure with a lot of hard core coding u can find a way to access that information with requests

untold token
upbeat otter
#

Why is discord developer portal asking me for a redirect and not adding the bot to the server when I authorize it instead it takes me to the specified redirect

jade tartan
#

But if the member has not reacted to the emoji within a timeframe wouldnt that go under await member.send(f"**{member.mention}**, you didnt react with a :white_check_mark: in 45 seconds.")

untold token
slate swan
untold token
#

Its deprecated

patent lark
#

^

slate swan
#

true

patent lark
#

self bots are also against tos

untold token
#

It won't work

#

That too

slate swan
#

anyways, back to my problem snow. are you saying something like this?

        role = self.bot.get_role(863016275613319209)
        if ctx.guild.id == int(configured[0]):
            if ctx.channel == int(configured[2]):
                role = configured[1]
#```
patent lark
#

the bot object doesnt have a get_role method

slate swan
#

oh wtf

#

OH right

#

ctx.guild.get_...

untold token
#

It's a Guild method

boreal ravine
untold token
#

!d discord.Guild.get_role

unkempt canyonBOT
slate swan
#

well, ya, that. is that what u meant

patent lark
#

if role is declared and used in the same scope. then you're fine

untold token
sullen shoal
slate swan
barren oxide
#

hi

slate swan
#

its VERY similar to what i have now

patent lark
#

doesnt matter

untold token
#

This

patent lark
#

if you use role outside of that if scope. it will be undefined

sage otter
sullen shoal
upbeat otter