#discord-bots

1 messages · Page 978 of 1

maiden fable
#

Or just use db explorer

lofty pecan
#

its easy as that

placid skiff
#

bro just easy as this:

CREATE TABLE IF NOT EXISTS table_name (
  column_1 INT NOT NULL
  column_2 CHAR (255) 
  PRIMARY KEY(column_1)
slate swan
#

well, you could, the faster the better

slate swan
lofty pecan
#

would you mind to elaborate ?

maiden fable
#

And also load the whole db contents into memory when starting up

slate swan
placid skiff
maiden fable
#

Idk, I don't like dbs

placid skiff
#

Oh morning hunter

lofty pecan
#

nice pfp hunter

slate swan
placid skiff
maiden fable
maiden fable
slate swan
lofty pecan
#

so whenever I'm looking for a guild_id and element of that family it will be faster ?

#

nice!

maiden fable
placid skiff
maiden fable
#

Oh, hmm. I'm UTC +5:30

slate swan
supple thorn
#

I'm utc +8

lofty pecan
slate swan
#

skev lives in the future

lofty pecan
#

many thanks

placid skiff
lofty pecan
#

omg trees

maiden fable
#

@placid skiff check DMs lol

lofty pecan
#

not this again

slate swan
maiden fable
#

He's on a call

#

Understandable. I can't chat properly while being on a call too

slate swan
maiden fable
#

Ok

slate swan
#

no lmao

#

lmao

supple thorn
slate swan
supple thorn
#

I still don't understand what indexing does

#

Coming from using mongodb as a database

maiden fable
slate swan
#

hi

tidal hawk
#

Can the bot see the message, user has replied to in textchannel?

tidal hawk
#

How

#

I know bot can check if the user has replied to message, with message.type.reply

#

to_reference?

supple thorn
#

!d discord.Message.reference

unkempt canyonBOT
#

The message that this message references. This is only applicable to messages of type MessageType.pins_add, crossposted messages created by a followed channel integration, or message replies.

New in version 1.5.

visual island
supple thorn
#

Fuck i don't remember the doc name

velvet haven
#

Do I have to enable application.commands for my discord bot to use commands?

#

Commands are not working for some reason even though my code is right

visual island
#

For your bot to have slash commands yes, for normal commands E.g !help, no.

velvet haven
#

I just copied the same code from my 1st bot but it doesn't work

visual island
velvet haven
#

Ok thanks

#

Btw is it because discord.py got a new update or something?

inner wing
#

hi my bot allways get Cloudflare Access denied

visual island
surreal ruin
#

How to fix this

supple thorn
visual island
# inner wing hi my bot allways get Cloudflare Access denied

How do I prevent my bot from being global ratelimited?
Currently there are multiple solutions for that:

  1. Do not use IP-sharing services E.g. Replit.
  2. Do not use too many fetch_x methods.
  3. Use buttons, dropdowns, or any other components, this is because components callback responses don’t count towards your bot’s global ratelimit.
  4. Avoid doing x every y seconds. E.g. Changing a guild’s name every 2 seconds
  5. If you believe that your bot is ratelimited within normal operations of your bot and you've tried the 4 solutions above, you can contact Discord to raise your bot’s global ratelimit here: https://dis.gd/contact.
visual island
# surreal ruin How to fix this

To run a python file, you can use the command: python3 filename.py or just python filename.py is fine. But I believe replit has a run button that you could use to run your main file.

visual island
vale raft
surreal ruin
#

I don't have linux

visual island
nova stag
#

how do i make it so that it deletes the message of the user where user used the command

boreal ravine
#

use ctx.message.delete, it's an awaitable

nova stag
boreal ravine
#

no

nova stag
#

then?

boreal ravine
#

use ctx.message.delete, it's an awaitable

paper sluice
#

obv

#
@(bot:=__import__('importlib').import_module('discord.ext.commands').Bot(command_prefix='^',intents=__import__('discord').Intents.all())).command(name='okimi')
async def okimii(ctx): [await ctx.send('hail okimi') for _ in iter(int, 1)]
bot.run('token')
boreal ravine
#

so thats what importlib is for

paper sluice
#

u can't import submodules from __import__

#

and .ext and commands are submodules

#

i mean u can, it will just try to make a relative import and will fail

supple thorn
paper sluice
grim oar
#

Add async lambda to cpython already. 🥺

paper sluice
#

🥺

maiden fable
#

Tell there

grim oar
#

Can't tell there bor

#

need to make a pep

maiden fable
#

Call Guido

#

On his number

grim oar
#

no he is powerless.

boreal ravine
#

cpython = python?

paper sluice
#

ya

grim oar
#

cpython is the most used distribution so yeah.

maiden fable
# boreal ravine cpython = python?

There are different implementations of Python in different languages. CPython is the mainstream which is implemented in C, hence the name

#

There's cython and jython and so on

grim oar
#

nopython

#

(This is a joke don't bring numba here)

supple thorn
#

#ython

grim oar
#

py*hon

lyric apex
#

How to get user key Permission#?

placid skiff
#

why tf i wrote "anni" D_D

brave forge
#

tell me please. When you write discord bot in python. Is it better to write it in one file or split it into several ?
it's just that when I was making bots on js, it was worth separating evets and commands there for the best work of the bot.

boreal ravine
#

writing all your bots code is gonna get a little messy

rain olive
supple thorn
rain olive
brave forge
supple thorn
#

It isn't a extension for vscode

#

It's a extension for hikari lib users

supple thorn
#

And doesn't use a different library

rain olive
#

im aware yes

slate swan
#

ctx.message will delete the message/text sent by the user

#

text is a arg

#

that means, your bot cannot delete a argument

#

if it was possible for args to be "deleted" then it'd look something like !test i! to !test

cold sonnet
slate swan
#

what is your issue, could you tell me?

#

@cold sonnet

cold sonnet
#

issueless

slate swan
cold sonnet
#

and what happened to okimii

#

why can't I ping him

#

@okimii
my homie is gone

slate swan
#

your homie lost the existence pass

cold sonnet
#

@slate swan

#

hello

maiden fable
#

Well, many of them*

cold sonnet
#

so it's almost always cpython

maiden fable
slate swan
#

hey i wanted to create a command like da(donation add)
upon running this cmd the bot should write the donation amount in donations.txt file and save it
and another command for checking the users donation, if this is possible reply with ping

supple thorn
boreal ravine
#

How do I make an eval command?

supple thorn
slate swan
supple thorn
#

Compared to an actual database

supple thorn
winged bone
# boreal ravine How do I make an eval command?

I honestly wouldn't recommend it, because there are many safety pitfalls. Even if you restricted the eval command to your account only, someone could take over your account and execute arbitrary code on the computer where your bot is running. i.e retrieve your bot token

#

If you really want one, you could use the one from this server as a guide

reef trail
#

Traceback (most recent call last):
  File "/home/ubuntu/.local/lib/python3.9/site-packages/discord/ext/commands/core.py", line 191, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/ubuntu/LunarDev/AGB/Cogs/guild.py", line 679, in checkvote
    if idkwhattocallthis["voted"] == 1:
KeyError: 'voted'
    @permissions.dynamic_ownerbypass_cooldown(1, 10, commands.BucketType.user)
    @commands.bot_has_permissions(embed_links=True)
    @commands.command(help="Check if a user has voted or not!")
    async def checkvote(self, ctx, user: Union[discord.Member, discord.User] = None):
        """Check if you or someone else has voted for AGB in the last 12 hours"""
        user = user or ctx.author
        async with aiohttp.ClientSession() as s:
            async with s.get(
                f"https://top.gg/api/bots/723726581864071178/check?userid={user.id}",
                headers={"Authorization": TOP_GG_TOKEN},
            ) as r:
                idkwhattocallthis = await r.json()
                if idkwhattocallthis["voted"] == 1:
                    voted = True
                else:
                    voted = False
                if voted:
                    title = "Poggers!"
                    description = "You have voted in the last **12** hours."
                    embed = success_embed(title, description)
                else:
                    title = "Not pog!"
                    description = f"You haven't voted in the last **12** hours.\nClick **[here]({Vote})** to vote!"
                    embed = error_embed(title, description)
                return await ctx.send(embed=embed)``` why am i getting this error? `voted` exists..
the token isnt invalid i just checked
slate swan
#

Use jishaku....

#

or you can just take some idea from the jishaku Library

slate swan
#

completely new to it

supple thorn
boreal ravine
supple thorn
reef trail
supple thorn
#

And checking what it actually contains

reef trail
#

lemme do that

supple thorn
reef trail
#

one second

reef trail
boreal ravine
#

userId

reef trail
#

oh the i in id should be capitalized

slate swan
#

Hi skev

#

Ur always on chat

#

When i come

supple thorn
supple thorn
#

I just lurk here

slate swan
#

Wow

boreal ravine
slate swan
#

Ye?

reef trail
slate swan
#

Wo theme?

supple thorn
#

👀

cloud dawn
#

@reef trailLooked into the new system btw, you can just keep it the same.

reef trail
cloud dawn
#

Tough they have a new setup_hook in the master what's pretty interested

reef trail
supple thorn
slate swan
#

Verified bot developer incident_actioned

supple thorn
#

Your ex girlfriend sounds like a undercover cop wtf

slate swan
#

..

reef trail
supple thorn
#

Lmfao she wanted you to get caught lacking

cloud dawn
#

...?

reef trail
#

hes talking about my github profile

slate swan
#

..

reef trail
#

i have a passive aggressive fun fact about an ex

boreal ravine
#

!ot

unkempt canyonBOT
reef trail
#

though, there was no reason for you to bring that up @supple thorn

slate swan
cloud dawn
supple thorn
boreal ravine
#

JSON files are not a database

slate swan
#

Hmm

#

k ig Amma go checkout db

cloud dawn
slate swan
#

Json can be used to store 🙄..

cloud dawn
spring flax
#

is playing music from spotify against the spotify's ToS, if anyone knows?

cloud dawn
reef trail
cloud dawn
#

For good reasons.

reef trail
#

yep, we cant have nice things

slate swan
#

Id

nova stag
#

i am trying to import the db by typing
from ..db import db
but its not working

oblique adder
#

what is the char limit for dropdown description ?

reef trail
#

no need for the dots

nova stag
reef trail
#

have you rebooted

nova stag
reef trail
#

try that

nova stag
#

ok

reef trail
#

rebooted as in rebooted the bot, not your pc

nova stag
boreal ravine
reef trail
#

rename the py file in the db folder to something else for continuity

#

@nova stagdid that fix it

nova stag
reef trail
#

show me how you're importing the file

nova stag
reef trail
#

again

#

just do from db import database

#

you do not need the dots.

nova stag
#

but still getting error

reef trail
#

hm

#

okay, try doing from .db import database

#

i dont use dots when importing files from another file so im not sure why you have to

cloud dawn
#

What file do you execute?

nova stag
reef trail
#

single dot is allowed

cloud dawn
reef trail
#

yeah

#

im not sure why you need to have dots

nova stag
reef trail
#

do you have a python package called db?

cloud dawn
#

Also root __init__ doesn't run here since the init will be the file you run.

nova stag
reef trail
cloud dawn
nova stag
cloud dawn
reef trail
nova stag
reef trail
#

your mom ! ! ! !!

paper sluice
maiden fable
cloud dawn
reef trail
#

:D

#

anyway

#

typically when i use dots to import from a file, its to import something from the file the current file is in, so in my cog ill do from .file import func, but thats the only time i use dots when importing

nova stag
reef trail
nova stag
#

yeh i dont

reef trail
reef trail
#

whats your python version

cloud dawn
nova stag
nova stag
cloud dawn
reef trail
#

cheese hm, well im all out of ideas, i dont know why your python is behaving like that, panda probably knows

nova stag
nova stag
cloud dawn
nova stag
cloud dawn
nova stag
#

outside of it in parent folder

cloud dawn
#

then it's from lib.db import database

#

You structure it from where you execute the py in a dotted path.

inner epoch
#

Is there a way to know if the bot was removed from a server?

nova stag
#

does this mean i have imported it right and just need to do some error solving

nova stag
slate swan
#

Hey so I wanna do like
If I run the command gping
And if the command is ran in a guild with id 123456.....
So the ping should be (giveaway ping)
But if the same command is ran in another guild with id 987654321
The bot should ping (+ Giveaway Ping +)
Is this possible?

#

Or in simple ways to set different ping for different guilds

slate swan
sullen pewter
#

How can I flatten in discord.py v2?py users = await new_message.reactions[0].users().flatten() users.pop(users.index(client.user)) winner = random.choice(users)

#

I want to pick a winner with this code

sullen pewter
#

How can I pick a winner then?

sullen pewter
slate swan
slate swan
slate swan
#

oh well, its a 3.10 thing

dull terrace
#

it's always better to do try except statements when you need something only to happen if something exists in a dictionary?

maiden fable
dull terrace
#

example:

try:
    while (player.x * tile_w,) in player.dugout[player.y + 1]:
        total_down += 1
        player.y += 1
        try:
            ene_x, direc = player.enemies[player.y][0]
            if direc and player.x >= ene_x or not direc and player.x <= ene_x:
                break
        except:
            pass
        try:
            if any(x[0] == player.x * 50 for x in player.objects[player.y]):
                total_down += 1
                player.y += 1
                break
        except:
            pass
except:
    pass```
#

try, except is better than first looking if there is the player.y in the dict right? froggy_chill

slate swan
sullen pewter
#

How to find a winner?

dull terrace
sullen pewter
dull terrace
#

what structure does it have?

#

list of lists?

sullen pewter
#

No

#

I don't think so

dull terrace
#

take off flatten and print users and see

winged bone
#

!d discord.Message.reactions

unkempt canyonBOT
sullen pewter
#

I tried

paper sluice
#

remove the last .users()

winged bone
#
  1. Example
winged bone
winged bone
#

oh ok. I saw bohemian rhapsody with Rami Malek

#

But I didn't recognize him on your pfp

brave flare
lofty pecan
#

Hello there, it concerns Database and Discordbot so I'm asking here. That's my code;

@commands.command()
    @commands.cooldown(rate=1, per=60, type=commands.BucketType.user)
    async def ocadd(self, ctx):
        """ Add OC to the database of the user """
        id = ctx.guild.id
        id_user = ctx.message.author.id
        if (ctx.message.author.guild_permissions.administrator) or checkrole(ctx, 'rolesid', id):
            def check(m):
                return m.author == ctx.author
            await ctx.send('Enter the name of the character: ')
            name = await self.bot.wait_for('message', check=check, timeout=30)
            await ctx.send('Enter the age of the character: ')
            age = await self.bot.wait_for('message', check=check, timeout=30)
            await ctx.send('Enter the gender of the character: ')
            gender = await self.bot.wait_for('message', check=check, timeout=30)
            await ctx.send('Enter the picture url of the character: ')
            picture = await self.bot.wait_for('message', check=check, timeout=60)
            await ctx.send("Enter the hex code of the character (without the `#`): ")
            color = await self.bot.wait_for('message', check=check, timeout=60)
            await ctx.send('Enter the description of the character: ')
            desc = await self.bot.wait_for('message', check=check, timeout=60)   
            await ctx.send('Enter the universe the character belongs to: ')
            universe = await self.bot.wait_for('message', check=check, timeout=30)

            values = (id, id_user, age.content, gender.content, picture.content, f'0x{color.content}', desc.content, universe.content)
            self.cursor.execute('INSERT INTO main VALUES ?', values)        
            
            await ctx.send(f'Character successfuly added to the file of <@{id_user}>!')
       
            self.db.commit()```
For some reason it doesn't update in my database
regal pulsar
#

tryna give every member on a server every single role

#

do i just do

#
for member in guild.members:
        for role in guild.roles:
            try:
                member.add_roles(role)
#

with an except statement ofc

lofty pecan
regal pulsar
#

add this decorator

#
@commands.has_permissions(administator=True)
lofty pecan
# regal pulsar if you only want admins to use the cmd

No that's not my issue and I know that one, I just want to also allow certain role to access that command and it's stored in a list. My issue is that the database doesn't update and the process goes through until the addition of the row in the db, and the message to confirm doesn't show, additionally there is no error message in the terminal

winged bone
#

@sullen pewter Did it work?

lofty pecan
#

that's what I just did haha

winged bone
sullen pewter
#

What's that yellow underline?

winged bone
#

does it show something when you hover?

slate swan
#

reaction is not defiend

sullen pewter
surreal ruin
sullen pewter
surreal ruin
slate swan
#

name the file you want to run as main.py

surreal ruin
#

I already did

#

Wait

winged bone
#

@sullen pewter replace reaction with what you had before

sullen pewter
#

Ok

dull terrace
#
channel = client.get_channel(your_channel_id)
message = await channel.fetch_message(message_id)
users = []
for reaction in message.reactions:
    async for user in reaction.users():
        users.append(user.id)
print(users)```
sullen pewter
dull terrace
#

list of user ids at the end

lofty pecan
visual island
lofty pecan
#

hooooo

regal pulsar
#

lmao

lofty pecan
#

I have to do that everywhere for UPDATE or other cursor.execute then?

regal pulsar
#
for member in guild.members:
    for role in guild.roles:
        try:
            member.add_roles(role)
        except:
            pass
#

why wont this work

#

removed try/except and got no error

loud junco
#

@bot.command(name='hunt')

@commands.cooldown(1, 60, commands.BucketType.user)
async def hunt(ctx):
  stats = Stats(ctx)

  num1 = random.randint(0, 100)
  num2 = random.randint(0, 100)
  loot = 'nothing'
  mobselected = 'error'
  mobdef = 0
  mobatk = 0
  mobxp = 0

  if stats.area == 1:
    mobxp = 5
    if num1 <= 50:
      mobselected = 'pig'
      mobdef = 1
      mobatk = 0
    elif num1 <= 75:
      mobselected = 'angrypig'
      mobdef = 10
      mobatk = 5
    elif num1 <= 100:
      mobselected = 'zombie'
      mobdef = 15
      mobatk = 7

  if mobselected in ['pig', 'angrypig']:
    if num2 <= 25:
      loot = 'nothing'
    elif num2 <= 75:
      loot = '5 pogchop'
      db[stats.userid + 'pogchop'] += 5
    elif num2 <= 100:
      loot = '10 pogchop'
      db[stats.userid + 'pogchop'] += 10

mobatktotal = mobdef / stats.atk
  damage = (mobatk - stats.defend) * round(mobatktotal)
  if damage < 0:
    damage = 0
  newhp = stats.hp - damage
  db[stats.userid + 'hp'] = newhp

  if newhp < 1: #dies
    db[stats.userid + 'hp'] = 100
    await ctx.send(f'**{ctx.author.name}** died found a **{mobselected}**, but lost fighting\nRoses are red and violets are blue, you just died and lost some levels too')
    if stats.level > 5:
      db[stats.userid + 'level'] = stats.level - 5
    else:
      db[stats.userid + 'level'] = 1
      db[stats.userid + 'xp'] = 0
  else:
    await ctx.send(f'''
**{ctx.author.name}** found and killed **{mobselected}**
Lost {damage} HP, remaining HP is {newhp}/100
Earned {mobxp} XP and got **{loot}**''')
    newxp = mobxp + db[stats.userid + 'xp']
    maxxp = stats.level * 250
    if newxp > maxxp:
      newxp = maxxp - newxp
      db[stats.userid + 'level'] = stats.level + 1
      db[stats.userid + 'xp'] = newxp
      await ctx.send(f'@{ctx.author.name} just up a level!')
    else:
      db[stats.userid + 'xp'] = newxp
  
  return damage, loot
regal pulsar
#

just doesnt add the roles

loud junco
#

i have no idea why isnt it working

visual island
lofty pecan
maiden fable
#

No

visual island
#

No, it is better if you close it before the program ended, closing them frequently is quite useless.

lofty pecan
#

because i'm using self.cursor and self.db in my __init__

maiden fable
#

Yea, and can also cause errors sometimes

lofty pecan
#

so I don't have to close it then? at all?

torn sail
regal pulsar
#

yeah

#
async def role_edit(member: disnake.Member, role: disnake.Role):
        try:
            member.add_roles(role)
        except:
            pass
    for member in guild.members:
        for role in guild.roles:
            role_edit(member, role)
#

ill try this instead

dull terrace
loud junco
regal pulsar
#

nope still doesnt work

#

wont add the role to me or anyone

loud junco
#

its working but not as expected

dull terrace
#

so it's returning 0 for hp and xp

lofty pecan
regal pulsar
#

never mind

#

forgot to await it

loud junco
#

i set the value as that so i know it is having error

#

just like the
mobselected = 'error'

dull terrace
#

skimming it, i would assume there is some problem with the stats class

loud junco
#

lemme show u stats class

#
from replit import db

class Stats():
  def __init__(self, ctx):
    self.userid = str(ctx.author.id)
    self.helmet = db[self.userid  +'helmet']
    self.chestplate = db[self.userid + 'chestplate' ]
    self.leggings = db[self.userid + 'leggings']
    self.boots = db[self.userid + 'boots']
    self.sword = db[self.userid + 'sword']  
    self.hp = db[self.userid + 'hp']  
    self.level = db[self.userid + 'level']
    self.highestArea = db[self.userid + 'highestArea']
    self.atk = db[self.userid + 'atk']
    self.defend = db[self.userid + 'defend']
    self.xp = db[self.userid + 'xp']
    self.maxxp = self.level * 200
    self.area = db[self.userid + 'area']
lofty pecan
dull terrace
# loud junco lemme show u stats class

not sure. you need to print at various points in the code to figure out where it's going wrong. if you're not getting a division by 0 error then itll be whatever is not being divided.

#

if the damage is always 0 doesn't it mean that (mobatk - stats.defend) are both zero

#

unless you're always getting a negative number

loud junco
#

if damage is less then 0 i will set it to 0

#

if not the user will regen

dull terrace
#

like i said, the easiest way would be to print variables values throughout the code to see where a number doesn't make sense

loud junco
#

ok

#

i will try

nova stag
#

can ya explain this everything is working fine but this poped up so i am curious

loud junco
#

some ads

#

jkjk

#

not sure

sullen pewter
#

What's wrong with mention?

#

It says that it doesn't have attribute mention

full lily
sullen pewter
#

Winner of the giveaway

#

I didn't define

#

It

full lily
#

But it has to be defined somewhere

sullen pewter
#

Does it have to be users?

#

Cuz The winner is now users

#

I originally wanted to make it this way but it didn't work in dpy 2.0

lofty pecan
full lily
sullen pewter
#

The code?

full lily
#

the error

sullen pewter
full lily
#

yeah look, winner is a list

#

so did you want to choose a random user from that list?

sullen pewter
#

Yes

full lily
#

just 1?

sullen pewter
#

Oh wait

full lily
#
winner = random.choice(users)
sullen pewter
#

I think I found an inaccuracy

#

But didn't fix the problem

full lily
#

users is also a list

sullen pewter
#

No forget about users

#

Users = winners

full lily
#

why did you do that?

sullen pewter
#

Cuz I forgot to delete unwanted line of code

full lily
#

users is a list. You want a member object

sullen pewter
#

No forget about winners

full lily
sullen pewter
#

@full lily

lofty pecan
#

what is that indentation

sullen pewter
lofty pecan
# maiden fable ?

It still doesn't update my database despite using the self.db.commit()

maiden fable
#

Weird

lofty pecan
sullen pewter
#

It still doesnt have an attribute mention

#
winning_announcement = discord.Embed(color=0xff2424)
winning_announcement.set_author(name=f'THE GIVEAWAY HAS ENDED!', icon_url='https://i.imgur.com/DDric14.png')
winning_announcement.add_field(name=f'🎉 Prize: {prize}',
                                   value=f'🥳 **Winner**: {winner.mention}\n 🎫 **Number of Entrants**: {len(users)}',
                                   inline=False)
winning_announcement.set_footer(text='Thanks for entering!')
await channel.send(embed=winning_announcement)```
slate swan
sullen pewter
slate swan
sullen pewter
#

Ok

sullen pewter
slate swan
unkempt canyonBOT
#

get_member(user_id, /)```
Returns a member with the given ID.

Changed in version 2.0: `user_id` parameter is now positional-only.
slate swan
#

!d discord.Guild.fetch_member

unkempt canyonBOT
#

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

Retrieves a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") from a guild ID, and a member ID.

Note

This method is an API call. If you have [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") and member cache enabled, consider [`get_member()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.get_member "discord.Guild.get_member") instead.

Changed in version 2.0: `member_id` parameter is now positional-only.
slate swan
#

fetch makes an api call, get searches the bot's cache

#

for the Member, and may return None

full lily
#

append the user object and you won't have to fetch anything

sullen pewter
full lily
#

what is User_object

#

just user. You have that in there already

sullen pewter
#

Then what is the error

prisma spoke
sullen pewter
#

There's an error

sullen pewter
sweet pilot
#

in winner.mention

sullen pewter
#

Here

sweet pilot
#

append user

sullen pewter
#

Why

#

Ok

sullen pewter
sweet pilot
#

because fetching gives the user object u get when u append the user

sweet pilot
sullen pewter
#

Yes, tysm

ember harbor
ember harbor
earnest gorge
#

DOBERMAN

sweet pilot
# sullen pewter

maybe u could just

users = [user for reac in new_msg.reactions
        async for user in reac.users()]
winner = random.choice(users)
sullen pewter
#

Ok, let me try

earnest gorge
#

Doberman style

nova stag
#

i am trying to get the cogs in but getting error that path not defined

sullen pewter
velvet haven
#

What's the meaning of
memberCount = len(set(client.get_all_members()))

earnest gorge
sullen pewter
# earnest gorge doberman is dog

A German named Louis Dobermann is credited with developing the Doberman pinscher breed in the late 1800s. I thought you were talking about him. That's a nice dog

earnest gorge
#

dobraman

#

dobier

regal flame
#

is there a way to make a string that contains the run console for the python bot?

final iron
#

What

full lily
#

the run console??

final iron
#

Are you trying to catch anything that gets printed to console?

lofty pecan
#
async def ocinfo(self, ctx, name: str, creator: str):
        """ Gives information about a specific oc created by a user (id)"""
        id = ctx.guild.id
        id_a = int(creator)
        cursor = self.db.cursor()
        cursor.execute('SELECT ? FROM main WHERE artist_id = ? AND oc_name = ?', (id, id_a, name))
        result = cursor.fetchone()

        if result is None:
            await ctx.send(f'OC with name {name} or creator with id {creator} was not found')

        else:
            label = ('age', 'gender', 'url', 'color', 'desc', 'universe')

            dic = dict(zip(label,result))
            
            embed = discord.Embed(title=name, color=dic['color'], description=['desc'])
            embed.set_thumbnail(url=dic['url'])
            embed.add_field(name="Age", value=dic['age'], inline=False)
            embed.add_field(name="Gender", value=dic['gender'], inline=False)
            embed.add_field(name="Universe", value=dic['universe'], inline=False)
            embed.set_footer(text=f'This OC belongs to {await self.bot.fetch_user(id_a)}')

            await ctx.send(embed=embed)

        cursor.close()``` I hate it when there is no error message and the command doesn't work for some reason. Anyone would know why this doesn't work?
lofty pecan
slate swan
#

placeholders work only for values

lofty pecan
#

ho wait

#

bruh of course

slate swan
#
'SELECT {} FROM main WHERE artist_id = ? AND oc_name = ?'.format(id)``` or ```py
f'SELECT {id} FROM main WHERE artist_id = ? AND oc_name = ?'```
#

and what about this-

slate swan
#

idk why they did that but they are fine until they provide a integer value

slate swan
lofty pecan
slate swan
slate swan
#

what if the column name varies

#

pfffttt

#

like what if they have guild ids as column names, idk

#

no comments then

lofty pecan
#

here is an example

#

and the command is still not working btw lmao

#

...

#

I know why

#

welp still not working lol

slate swan
#

because you're choosing wrong data type

#

thats a row, not a column

lofty pecan
#

o_O

#

sorry my SQL skills are gone for 3 years now

#

cursor.execute('SELECT guild_id FROM main WHERE artist_id = ? AND oc_name = ?', (id_a, name)) I don't understand why this isn't working

maiden fable
#

O

#

Should work tho

#

Wait, u need to do cursor.execute(...).fetchall()

lofty pecan
#

I did fetchone , doen't it take only one row ?

#

!d sqlite3 fetchall

#

but of course

#

!d sqlite3 cursor.fetchall

lofty pecan
#

if only I had an error message but there is nothing happening at all

slate swan
#

!paste

unkempt canyonBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

lofty pecan
#

use ` not "

maiden fable
lofty pecan
#

mine?

lofty pecan
# maiden fable show yr code
id = ctx.guild.id
        id_a = int(creator)
        cursor = self.db.cursor()
        cursor.execute('SELECT guild_id FROM main WHERE artist_id = ? AND oc_name = ?', (id_a, name))
        result = cursor.fetchall()

        if result is None:
            await ctx.send(f'OC with name {name} or creator with id {creator} was not found')

        else:
            label = ('age', 'gender', 'url', 'color', 'desc', 'universe')

            dic = dict(zip(label,result))
            
            embed = discord.Embed(title=name, color=dic['color'], description=['desc'])
            embed.set_thumbnail(url=dic['url'])
            embed.add_field(name="Age", value=dic['age'], inline=False)
            embed.add_field(name="Gender", value=dic['gender'], inline=False)
            embed.add_field(name="Universe", value=dic['universe'], inline=False)
            embed.set_footer(text=f'This OC belongs to {await self.bot.fetch_user(id_a)}')

            await ctx.send(embed=embed)

        cursor.close()```
weak pumice
#

Hi, I'm trying to create a points bot for my friend but it doesn't work and I'm a noob of python so can someone help me.

async def on_member_join(member):
    with open("users.json", "r") as f:
        users = json.load(f)
    
    await update_data(users, member)

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

@client.command()
async def cg(ctx):
    with open("users.json", "r") as f:
        users = json.load(f)
    await ctx.send("*cg")    

async def update_data(users, user):
    if not user.id in users:
        users[user.id] = {}
        users[user.id]["points"] = 0

async def add_points(ctx, users, user, point):
    if point >= "2000":
        await ctx.send("You are taking too many points") 
    else:
        users[user.id]["points"] += point
        await ctx.send(f"{user} you got {point}!") 

@client.command()
async def g(ctx, add_points):
    with open("users.json", "r+") as f:
        users = json.load(f)
    await ctx.send("*g")    

async def update_data(users, user):
    if not user.id in users:
        users[user.id] = {}
        users[user.id]["points"] = 0

async def add_points(ctx, users, user, point):
    if point >= "500":
        await ctx.send("You are taking too many points") 
    else:
        users[user.id]["points"] += point
        await ctx.send(f"{user} you got {point}!")```
maiden fable
#

Wait, is it returning None?

#

Is the result None?

lofty pecan
#

No idea

maiden fable
#

Print it 😐

lofty pecan
#

one sec

#

[(464553751030661120,)]

#

lol what

maiden fable
#

Well

lofty pecan
#

it's the guild_id not the row

maiden fable
#

🤷

#

Idk what u tryna do and yr db structure sooo

lofty pecan
#

basically

#

I want to get the value of the different columns when I use this command

slate swan
#

Imagine installing apps to visualize sqlite data 😔

lofty pecan
#

so I want this to be my values to display

maiden fable
lofty pecan
#

it's cool to see what it looks like to verify it's correct

slate swan
#

you could do that, easy as that

lofty pecan
#

it's the reverse haa

slate swan
#

anyways, hunter will give you a better solution so i might just go away from here

maiden fable
#

SELECT * FROM table WHERE guild_id = ?

#

That also works iirc

lofty pecan
#

ye

slate swan
maiden fable
#

Use that then

lofty pecan
#

I litteraly did the opposite lol

maiden fable
lofty pecan
#

it is

slate swan
#

whats the way for your bot to not get flagged for anti-spam when you want it to DM users upon joining your server

maiden fable
#

Ah okay

slate swan
slate swan
maiden fable
#

That too

#

Eh, ngl members hate it

#

Well, most of them do

paper sluice
slate swan
final iron
#

I hate it when I join a server and a bot dms me

lofty pecan
#

so true

slate swan
#

just put your dms off from privacy settings ¯_(ツ)_/¯

#

!ot

unkempt canyonBOT
maiden fable
#

What

paper sluice
#

I muted so many bots just because they dmed me in the start

maiden fable
#

Eh, I don't really mute bots but I feel it annoying whenever bots DM me when I join a new server

#

A ping in the server is better ngl, but your wish

#

!d discord.on_member_join is the event u need

unkempt canyonBOT
#

discord.on_member_join(member)``````py

discord.on_member_remove(member)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") join or leaves a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").

This requires [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") to be enabled.
slate swan
#

i want to know what certain conditions to add in for it to not get flagged for anti-spam

maiden fable
#

Well, idk on what criteria Discord flags a user/bot for spam

lofty pecan
#

Okay so now it works, except that the embed is not sent in the channel for no reason

slate swan
#

@maiden fable @slate swan

maiden fable
lofty pecan
#
id = ctx.guild.id
        id_a = int(creator)
        cursor = self.db.cursor()
        cursor.execute('SELECT oc_age, oc_gender, oc_url, oc_color, oc_desc, oc_universe FROM main WHERE guild_id = ? AND artist_id = ? AND oc_name = ?', (id, id_a, name))
        result = cursor.fetchall()
        #print(result)
        #if result == []:
        #    await ctx.send(f'OC with name {name} or creator with id {creator} was not found')

        #else:
        label = ('age', 'gender', 'url', 'color', 'desc', 'universe')

        dic = dict(zip(label,result[0]))
        print(dic)    
        embed = discord.Embed(title=name, color=dic['color'], description=['desc'])
        embed.set_thumbnail(url=dic['url'])
        embed.add_field(name="Age", value=dic['age'], inline=False)
        embed.add_field(name="Gender", value=dic['gender'], inline=False)
        embed.add_field(name="Universe", value=dic['universe'], inline=False)
        #embed.set_footer(text=f'This OC belongs to {await self.bot.fetch_user(id_a)}')

        await ctx.send(embed=embed)

        cursor.close() ``` I've removed temporarly the condition
slate swan
#

@slate swan many popular verified bots does that though
i wonder how they do it?

#

it really depends guys

maiden fable
#

Meh, discord doesn't care @slate swan
Dw u won't get flagged

slate swan
maiden fable
#

Token alert

slate swan
#

yeah you wont get flagged

#

put your token in strings

#

and delete that image asap

#

and regen it!

slate swan
#

and thanks for the token

maiden fable
#

I never got that tho

slate swan
slate swan
#

😭

lofty pecan
maiden fable
#

Ignore her acting like a kid

lofty pecan
#

I have added a print to see what the dic was and it's correct

slate swan
#

💀

maiden fable
#

can u print embed?

maiden fable
lofty pecan
#

sure hunter

slate swan
#

you store the executed sql in a variable and use fetchone on that

maiden fable
#

@lofty pecan do u have an error handler?

slate swan
slate swan
maiden fable
#

Mind showing that?

maiden fable
#

😐

lofty pecan
#

that's the thing there is 0 error message

maiden fable
#

I asked for an error handler not an error lol

lofty pecan
#

nani

lofty pecan
maiden fable
#

!d discord.ext.commands.Bot.on_command_error this

unkempt canyonBOT
#

await on_command_error(context, exception, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

The default command error handler provided by the bot.

By default this prints to [`sys.stderr`](https://docs.python.org/3/library/sys.html#sys.stderr "(in Python v3.10)") however it could be overridden to have a different implementation.

This only fires if you do not specify any listeners for command error.

Changed in version 2.0: `context` and `exception` parameters are now positional-only.
lofty pecan
#
@commands.Cog.listener()
    async def on_command_error(self, ctx, error):
        if isinstance(error, commands.CommandOnCooldown):
            retry = error.retry_after
            remaining_time = str(datetime.timedelta(seconds=int(retry)))
            embed = discord.Embed(title=":clock1: Slow Down!!", description=f'{ctx.author.mention}, you can use this command again in ' + str(remaining_time), color=0xE74C3C)
            await ctx.send(embed=embed)
maiden fable
#

Got the issue

#

Add this:

else:
    raise error
maiden fable
#

Well u got it

oak warren
#

whats the char limit for slash command description ?

maiden fable
#

120 or smth

oak warren
#

cool ty

#

you didnt install dpy 2.0

#

github

#

install from here

lofty pecan
#

well @maiden fable thanks a lot !

#

it works just fine now!!!

maiden fable
#

(:

regal flame
#

i want to make a bot that sends the user a message if the time is a specific value. How can I do this?

placid skiff
dull terrace
regal flame
#

ty

magic stump
#
    zakazane_znaki = ["!", "@", "#", "$", "%", "^", "&", "*", "(",")","-","=", "+", "[", "{", "]", "}", ";", ":", "'", '"', "", "\\", "|", "<", ",", ".", ">", "/", "?"]

    if zakazane_znaki in nick:
        embed=discord.Embed(title="**Nie możesz użyć tego nicku!**", color=0xff0000)
        embed.set_footer(text=f"Wywołano przez: {ctx.author}")
        await ctx.send(embed=embed)``` how can i do ?
#

v

#

'in <string>' requires string as left operand, not list****

#

with for ?

sick birch
#

!e

import string
print(string.punctuation)
unkempt canyonBOT
#

@sick birch :white_check_mark: Your eval job has completed with return code 0.

!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
magic stump
#

o

#

geniuss

#

thanks bro

sick birch
#

Or if you want to extend it

#

!e

import string
print([*string.punctuation, "i", "extended", "the list"])
unkempt canyonBOT
#

@sick birch :white_check_mark: Your eval job has completed with return code 0.

['!', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '_', '`', '{', '|', '}', '~', 'i', 'extended', 'the list']
sick birch
#

If you want to add characters that aren't necessarily in that list you can do that

magic stump
#

okey thanks

sick birch
#

The spread operator is very versatile

#

!e

import string
print(["before the list", *string.punctuation, "after the list"])
unkempt canyonBOT
#

@sick birch :white_check_mark: Your eval job has completed with return code 0.

['before the list', '!', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '_', '`', '{', '|', '}', '~', 'after the list']
magic stump
#

but how can i delete etc. _

sick birch
#

Deleting is a bit harder

#

You can use .remove()

winged bone
#
if string.punctuation in nick:```wont work, it will check if the entire `!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~` is in the nick
sick birch
#

You'll have to loop through each letter of someone's nickname

#

or you can use set operations

#

set(string.punctuation) & set(author.name)

sullen pewter
#

How can I not allow the bot to win the giveaway?

sick birch
sullen pewter
# sick birch `if not user == bot.user`
users = [user for reactions in new_message.reactions
   async for user in reactions.users()
   if not user == bot.user]
winner = random.choice(users)
print(users)```
sick birch
#

No, add it into your list comp

#

[user for user in message.reactions if not user == bot.user]

maiden fable
#

or u can also do if not user.bot

#

Since u don't want to pick bots as winners

sullen pewter
#

Oh ok

paper sluice
#

[:punc:]

paper sluice
sick birch
#

yeah that works too

sullen pewter
sick birch
#

there's always many ways to do something so pick which one you like

sullen pewter
#

The one I picked was the easiest but there is yellow underline

#

And error

#

User is not defined

pliant gulch
stable leaf
#

user = client.get_user(user id)

sick birch
#

Unless message.reactions -> List[discord.Member]?

pliant gulch
#

You could just check the ID

#

Which does the comparison even faster

sick birch
#

Isn't that what discord.Member and discord.User implement under the hood with __eq__? at least I'm guessing

sullen pewter
pliant gulch
cloud dawn
#

.config

pliant gulch
#

It doesn’t really matter whether or not you use is or == IN this case, but normally in python it’s always a good thing to use is when comparing objects

#

Except of course for string literals and integer literals

cloud dawn
#

it's a json

#

...pithink

sullen pewter
paper sluice
stable leaf
#

try to put user = client.get_user(user id) above the commands and replace user id in brackets with id of ur bot

paper sluice
#
pip install -U git+https://github.com/Rapptz/discord.py
stable leaf
paper sluice
stable leaf
#

without ?

paper sluice
#

install git

stable leaf
paper sluice
stable leaf
#

huh?

paper sluice
#

its in beta so u will have to clone the git repo

sick birch
stable leaf
#

then u have it

sullen pewter
#

There's an error in this command

paper sluice
#

i already told u

#

pip install -U git+https://github.com/Rapptz/discord.py , if u dont have git u will have to install it from https://git-scm.com/

sullen pewter
#

pip install -U git+https://github.com/Rapptz/discord.py

#

Download git

#

Then copy this line to git terminal
pip install -U git+https://github.com/Rapptz/discord.py

#

How can I fix this error?

#
@client.command()
@commands.has_permissions(administrator=True)
async def reroll(ctx, channel: discord.TextChannel, id_: int):
    # Reroll command requires the user to have a "Giveaway Host" role to function properly
    try:
        new_message = await channel.fetch_message(id_)
    except:
        await ctx.send("Incorrect id.")
        return

    # Picks a new winner
    users = [user for reactions in new_message.reactions
        async for user in reactions.users()
        if user != client.user]
    winner = random.choice(users)
    print(users)

    # Announces the new winner to the server
    reroll_announcement = discord.Embed(color=0xff2424)
    reroll_announcement.set_author(name=f'The giveaway was re-rolled by the host!',
                                   icon_url='https://i.imgur.com/DDric14.png')
    reroll_announcement.add_field(name=f'🥳 New Winner:', value=f'{winner.mention}', inline=False)
    await channel.send(embed=reroll_announcement)
slate swan
stable leaf
#

channel = client.get_channel(channel id) will fix it

slate swan
sullen pewter
#

Ok

#

Do you need to enable intents to use buttons

paper sluice
#

type pip show discord.py and send the result

sullen pewter
paper sluice
#

in ur terminal

paper sluice
#

hmm, run ur code

#

it should be fine

sullen pewter
#

@slate swan

#

Here?

slate swan
#

hello.......?

sullen pewter
slate swan
#

idk hunter is here uhh

maiden fable
#

Nvm

#

I thought it was a user id

sullen pewter
#

I think its user id

#

Bc it send incorrect id

#

But in other cases it send error in terminal

maiden fable
#

did u install from github?

stable leaf
#

did u install it?

scarlet aurora
#

can anyone help me with deploying my bot on heroku.com ??

maiden fable
#

What is the error u getting?

#

NO I mean

#

Did u do

scarlet aurora
maiden fable
#

pip install git+https://github.com/Rapptz/discord.py

maiden fable
sullen pewter
scarlet aurora
#

there is no error or anything

#

i deploy it but the bot doesn't come online

maiden fable
#

u run that command in the command prompt

sullen pewter
#

You already installed

#

Bruh ;-;

scarlet aurora
maiden fable
#

Restart yr IDE

maiden fable
scarlet aurora
#

alr ty doe

slate swan
#

which algorithm sum all the numbers in the array?

paper sluice
#

u want the algorithm or the function?

unkempt canyonBOT
#
sum

sum(iterable, /, start=0)```
Sums *start* and the items of an *iterable* from left to right and returns the total. The *iterable*’s items are normally numbers, and the start value is not allowed to be a string.

For some use cases, there are good alternatives to [`sum()`](https://docs.python.org/3/library/functions.html#sum "sum"). The preferred, fast way to concatenate a sequence of strings is by calling `''.join(sequence)`. To add floating point values with extended precision, see [`math.fsum()`](https://docs.python.org/3/library/math.html#math.fsum "math.fsum"). To concatenate a series of iterables, consider using [`itertools.chain()`](https://docs.python.org/3/library/itertools.html#itertools.chain "itertools.chain").

Changed in version 3.8: The *start* parameter can be specified as a keyword argument.
slate swan
#

the sum function?

slate swan
sick birch
#

might anyone know time complexity of sum function? or is it just O(n)

slate swan
slate swan
#

maybe worst case O(n)

paper sluice
#

wait what

sick birch
#

I wonder how it does it with O(1)

#

that's interesting

paper sluice
slate swan
#

editor

slate swan
paper sluice
#

👍

slate swan
#

!e print(sum((1,2)))

unkempt canyonBOT
#

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

3
maiden fable
#

Yea

slate swan
#

!e print(sum(((1,2),(1,2)), ()))

unkempt canyonBOT
#

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

(1, 2, 1, 2)
slate swan
#

😳

maiden fable
#

I mean

slate swan
#

no but you summed the 2 tuples

maiden fable
#

It did sum the tuples into one

#

And that was the intended behaviour

#

Nah

slate swan
#

!e print(sum([[1,2],[1,2]], []))

unkempt canyonBOT
#

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

[1, 2, 1, 2]
slate swan
#

!e print((1,2)+(1,2))

unkempt canyonBOT
#

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

(1, 2, 1, 2)
slate swan
#

it iterates through it probably

#

!e print(sum(str))

unkempt canyonBOT
#

@slate swan :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | TypeError: 'type' object is not iterable
slate swan
#

yep

#

it iterates through the tuple

paper sluice
#

it creates a new tuple

slate swan
#

ik

#

discord coding is hard😔

#

:'/

#

notepad better

#

i agree

#

it is better than vsc or pycharm

#

:'/

#

microsoft word takes time to open, notepad doesn't

#

plus.. u get automatic indentation.. and typing hint & everything. autocomplete

paper sluice
#

use pen and paper and compile the code with ur eyes

slate swan
#

notepad has github copilot

maiden fable
slate swan
#

woahh how was the experience? 😳

maiden fable
#

It was good. Coded a discord bot

slate swan
#

damnn

maiden fable
#

I have sent a pic here

#

Idk like 2-3 months ago

slate swan
#

OwO

#

in this channel?

maiden fable
#

mhm

slate swan
#

you guys dont use microsoft power point?

paper sluice
#

penpaper gang

maiden fable
slate swan
#

lmao

formal basin
#

How can I do a if a person has a certain permissions

e.g if ctx.author has administrator=True
pass

slate swan
#

r u using cogs?

formal basin
slate swan
#

anyways

#

commands.has_permissions is your thing

#

read about it, it in docs

#

:")

formal basin
slate swan
#

💀 message event?

formal basin
formal basin
formal basin
slate swan
#

then

formal basin
slate swan
#

r u using ctx as your message argument?

formal basin
slate swan
#

then

formal basin
#

I’m using message

slate swan
formal basin
#

I didn’t mean to say ctx

slate swan
#

use, message.author

formal basin
slate swan
formal basin
formal basin
slate swan
#

but

#

do u ever read docs?

maiden fable
#
if message.author.guild_permissions.administrator:
    pass
frozen patio
#

My host is running but my bot is not 😶. Why?

slate swan
slate swan
#

bruh

slate swan
frozen patio
slate swan
#

ok never used it lmao

#

well see if there is command line or shell like thingy

frozen patio
#

There is nothing that would kill the bot

slate swan
slate swan
maiden fable
#

That isn't how pterodactyl works

slate swan
#

owo

frozen patio
maiden fable
#

@frozen patio mind giving me the website of the host?

maiden fable
#

Oh hmm

frozen patio
#

So you will not be able to access it

formal basin
formal basin
#

But it’s not working

#

It says I don’t have the permissions when I do

frozen patio
maiden fable
#

What deco

frozen patio
#

@commands.has_permissions(administrator=True)

maiden fable
#

You cannot, in an event

slate swan
#

some people like to do things if the condition is false

formal basin
slate swan
frozen patio
frozen patio
eager bough
#

omg

#

can someone help me

frozen patio
#

What do you need help with?

eager bough
# frozen patio What do you need help with?
#-------------------------------------------------------
import discord
from discord.ext import commands
(__import__("config").TOKEN)
bot = commands.Bot(command_prefix='!')
#-------------------------------------------------------

logged_in_admins = []
VALID_ADMIN_CODES = ["Administrator0001"]

#--------------------on_ready event---------------------
@bot.event
async def on_ready():
    print("Logged in as")
    print(f"Username:  {bot.user.name}")
    print(f"User ID:  {bot.user.id}")
    print("---------------------------------")
    await bot.change_presence(activity=discord.Activity(
        type=discord.ActivityType.streaming,
        name="Use !verify To Verify And Use Commands"),
                              status=discord.Status.dnd)

@commands.command()
async def kick(ctx, member : discord.Member, *, reason='None.'):
  await member.ban(reason=reason)

My kick command no work ):

frozen patio
#

Hmm

eager bough
#

member.kick() not member.ban()

frozen patio
eager bough
#

ik can help

#

350 lines of code

#

plus more files

frozen patio
#

Don't you want a confirm message if they were kicked?

#

Oh I know why

#

Do not put '' around None

eager bough
#
except:
ctx.send("cant kick that user")
eager bough
hushed galleon
#

more importantly that command should have a permission check

frozen patio
#

Yeah

#

That could be abused easily

eager bough
#

oh

#

is_owner()

#

administrator=True

frozen patio
hushed galleon
#

no not that check, that is for the bot owner only (referring to is_owner)

eager bough
#

):

frozen patio
#

Capitalize none

#

to None

eager bough
#

done

hushed galleon
#

you didnt necessarily need to change 'None.'

frozen patio
#

and why is there a . at the end?

eager bough
hushed galleon
#

because they wanted a default string

eager bough
#

):

frozen patio
#

I never add a .

sick birch
eager bough
sick birch
#

Don’t mean to be blunt

frozen patio
#

Yeah

#

VS Code

sick birch
#

But replit ratelimited you too often

eager bough
#

vs code

frozen patio
#

Yes

eager bough
#

i have vs code dont know how use it tho

#

(the app)

eager bough
velvet haven
#

async def on_member_join(member):
channel = discord.utils.get(member.guild.text_channels, name='recording')
embed = discord.Embed(description='Welcome to our guild!', color=random.choice(client.color_list))
embed.set_thumbnail(url=member.avatar_url)
embed.set_author(name=member.name, icon_url=member.avatar_url)
embed.set_footer(text=member.guild, icon_url=member.guild.icon_url)
embed.timestamp = datetime.datetime.utcnow()

        await channel.send(embed=embed)