#discord-bots

1 messages · Page 907 of 1

quaint epoch
#

what are we even talking about here

#

problem?

wheat heart
#

ya and what

quaint epoch
#

cut it out

wheat heart
#

lmao

sick birch
#

Okay that’s enough

wheat heart
#

ooooo

quaint epoch
#

<@&831776746206265384>

sick birch
#

<@&831776746206265384>

daring olive
#

!mute 874731032639848488 incident_investigating

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied mute to @lilac eagle until <t:1647366626:f> (59 minutes and 59 seconds).

daring olive
#

handling it

sick birch
#

Thank you

wheat heart
#

gj

quaint epoch
#

anyone need any real help with discord bots now?

sick birch
#

.topic

lament depotBOT
#
**Do you think there's a way in which Discord could handle bots better?**

Suggest more topics here!

quaint epoch
sick birch
#

I don’t really like the slash commands to be honest

#

That part could’ve been handled better

quaint epoch
#

if migrating to slash commands would've provided free hosting/db, i would've flown over

#

because it seems like a good incentive

sick birch
#

Yeah it’s just bots have always functioned the old way for years and out of nowhere they change it

#

That was probably the last straw for dpy so the entire ecosystem was on fire for a bit after that

quaint epoch
sick birch
#

Bots in general

#

Since the de facto at the time was dpy and forks weren’t really mainstream

manic wing
sick birch
#

Perhaps

slate swan
#

the heck happend

quaint epoch
#

i wish i knew

#

yo

#

i don't think so

slate swan
#
async def paraver(ctx,user:discord.Member, para):

how can I get the user's id ?

slate swan
#

hm

#

then my problem in somewhere different okay thanks

sick birch
slate swan
#

okay I will

quaint epoch
slate swan
#

should have a base exception which then gets subclased by other exceptions

tidal hawk
#

Has anyone had a issue, where slash commands disappear after using one of the slash commands..?

tidal hawk
#

Because I want?

sick birch
quaint epoch
manic wing
tidal hawk
#

disnake

slate swan
#

thats like making paint without base colors

quaint epoch
#

i think they are called primary colors

slate swan
quaint epoch
#

or colours

slate swan
quaint epoch
slate swan
#

color == colour

manic wing
quaint epoch
unkempt canyonBOT
#

@quaint epoch :white_check_mark: Your eval job has completed with return code 0.

False
quaint epoch
#

!e print('color' < 'colour')

unkempt canyonBOT
#

@quaint epoch :white_check_mark: Your eval job has completed with return code 0.

True
slate swan
quaint epoch
#

colour superiority

slate swan
#

ha no

quaint epoch
unkempt canyonBOT
#

@quaint epoch :white_check_mark: Your eval job has completed with return code 0.

False
quaint epoch
#

python never lies

slate swan
#

its probably comparing the amount of chars in a string lol

quaint epoch
#

!ot btw

unkempt canyonBOT
slate swan
#

guessed it loll

slate swan
tidal hawk
# sick birch What fork are you using?

Just figured that after using slash commands, the bot wants to start upserting all of the slash commands which results them disappearing, but the funny thing is that I'm not registering them globally...

cold sonnet
unkempt canyonBOT
#

@cold sonnet :white_check_mark: Your eval job has completed with return code 0.

False
quaint epoch
#

!e print((0.1 + 0.2) == 0.3)

unkempt canyonBOT
#

@quaint epoch :white_check_mark: Your eval job has completed with return code 0.

False
quaint epoch
#

😅

cold sonnet
#

"python never lies"

slate swan
#

lmao

quaint epoch
honest vessel
#

!e
print(0.1+0.2)

unkempt canyonBOT
#

@honest vessel :white_check_mark: Your eval job has completed with return code 0.

0.30000000000000004
cold sonnet
#

#bot-commands

honest vessel
#

why 00000000004 tho?

cold sonnet
#

it's because of some binary code impossibilities

honest vessel
#

python needs to learn math brah

cold sonnet
honest vessel
#

ah

slate swan
#

if youre getting the total of 0.1 plus 0.2 and then comparing it to 0.3

#

'ApplicationCommandInteraction' object has no attribute 'command'

honest vessel
#

!e
print(round(0.1+0.2, 1))

unkempt canyonBOT
#

@honest vessel :white_check_mark: Your eval job has completed with return code 0.

0.3
slate swan
#

is it possible to only let a command be usable in the bot dms? and ignore if its used in a server?

slate swan
#

@commands.dm_only

honest vessel
#

@cold sonnetif not knowing imagine confusion 😄

slate swan
#

uh maybe

#

i read that only lol

honest vessel
#

"i give up coding its too hard for me i change class"

slate swan
regal cove
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.

regal cove
#

this is the error i get: Traceback (most recent call last): File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke await ctx.command.invoke(ctx) File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke await injected(*ctx.args, **ctx.kwargs) File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped raise CommandInvokeError(exc) from exc discord.ext.commands.errors.CommandInvokeError: Command raised an exception: OperationalError: no such column: getter_id

cold sonnet
honest vessel
#

no such colum exists

regal cove
final iron
regal cove
honest vessel
#

well does that column exists in ur db???

cold sonnet
#

table

honest vessel
#

cause it sais it dosnt but u still try use it

cold sonnet
#

dbs don't have columns, tables in dbs do

faint arrow
#

hey guys i want to make discord.js and py docs thx need help

regal cove
#

i have tables in dbs

honest vessel
regal cove
#

well

#

wait let me show u another piece of code

slate swan
honest vessel
#

True

cold sonnet
#

I woke up and chose to be a bitch

honest vessel
#

😄 fair enough

regal cove
#
  await cursor.execute("SELECT user_id FROM money_data WHERE user_name = ?", (USER_NAME,))
  
  result_userID = await cursor.fetchone()


  if result_userID == None:
    await cursor.execute("INSERT INTO money_data(user_name, balance, user_id)values(?,?,?)",(USER_NAME, START_BAL, USER_ID))
    await db.commit()

    await ctx.send("Hi, you're a new user and you need to register. \nTo register execute the command one more time!")```
#

this is the code i use to register users

honest vessel
#

your code dosnt help us

regal cove
#

why not?

slate swan
#

read the error lol

honest vessel
#

cause its related to your database -> table -> column

regal cove
#

it uses the discord tag too

#

wait

#

it uses the id too

#

yes

#

and it worked

faint arrow
cold sonnet
honest vessel
#

atleast not vuln for sqlinjections

cold sonnet
#

and this channel @faint arrow

regal cove
#

hmmm

#

thats true

honest vessel
regal cove
#

i could just use ctx.message.author instead to get their username

honest vessel
#

kek

#

and you should consider use a sql with async support

slate swan
#

What did i do wrong? The bot is in the same server as the emoji

regal cove
honest vessel
#

@slate swantry add a infront like <a:name:id>

regal cove
#

and i would really like to know how to see what columns i have

slate swan
slate swan
honest vessel
regal cove
slate swan
#

sqlite has a browser

#

which is a ui to view data

#

^

regal cove
#

thank u

honest vessel
#

i use that easy n slim

slate swan
#

yup

honest vessel
#

and has both winblows and linux

slate swan
honest vessel
#

@slate swandid u do as i said?

slate swan
honest vessel
#

oh

#

@slate swanconfirmed id and/or name? any errors?

slate swan
#

yup

honest vessel
#

it should work - aslong he did put correct id and name

#

does it have perms? extern emojis?

slate swan
#

yes

#

let me check

#

it has the permission so its maybe the id?

honest vessel
#

lol why ask himi just go check

#

its them 3 possibilites most likley, name, id, permissions

#

@slate swanalso check the channels permissions

#

there is both external emojis perms in roles n each channel

slate swan
#

Yes it was the id, I just found out that i can do \:emoji-name: and then it just shows you the id 💀

honest vessel
#

yes

#

u can do backslash on most things like channels users etc to get ID

#

@slate swan

slate swan
#

thats cool

honest vessel
#

yes its good to know

#

otherwise u need to enable developersmode in discord to get Grab ID thing

honest vessel
#

PRIMETIME and so quiet today is the ww3 on already or what?

somber sky
#

anyone know how to add the chose option, on my bot i have the whole embed i just need the select menu idk how to do it

cold sonnet
#

which lib?

#

here's an example for the first go

slate swan
#

How to make that when I ban a member my bot sends a mp to the person to announce him that he was banned ?

cold sonnet
#

await member.send("something")
BEFORE he gets banned in the command

forest beacon
#

Is there a different wrapper for interactions than interactions-py?

cold sonnet
forest beacon
cold sonnet
#

resumed

forest beacon
#

Oh. What happened?

cold sonnet
#

realised he can do it

forest beacon
#

Does it have slash commands now? And can I use it with discord new requirements?

slate swan
#

py.cord for slash commands

#

main has slash commands so why use pycord?

cold sonnet
#

pycord has nothing new....

slate swan
#

How can i get the cooldown with get_bucket (inside the command)

dense swallow
rocky trench
#

pov: you switch from slash_util to dpy 2.0 slash commands

#

luckily managed to fix it fast by using ctrl f and ctrl h

#

is there a way to respond to 1 message twice? (buttons), button can be used multiple times

junior verge
#

I really need to switch.

junior verge
#

Do I need to change a lot? I work in cogs.

rocky trench
# junior verge Yeah so how do I?
@app_commands.command(description = "test")
async def test(self, interaction : discord.Interaction):
  await interaction.response.send_message("test")```
#

this is an example, it came from:

@slash_util.slash_command(description = "test")
async def test(self, ctx):
  await ctx.channel.send("test")```
junior verge
#

What's the good one?

rocky trench
#

before: py @slash_util.slash_command(description = "test") async def test(self, ctx): await ctx.channel.send("test")
after: py @app_commands.command(description = "test") async def test(self, interaction : discord.Interaction): await interaction.response.send_message("test")

junior verge
#

so ctx is changed to interaction.response

rocky trench
#

yeah

junior verge
#

No clue how I gotta do that lmao

#

What do I import and install etc

rocky trench
#

from discord import app_commands

junior verge
#

Can you maybe go dms?

rocky trench
#

thats all u need to change

haughty quartz
#

how do I respond privately to disnake slash? (i want only the author to see the reponse)

junior verge
#
import discord
from discord.ext import commands
from discord import app_commands

class Ping(commands.Cog):

    def __init__(self, client):
        self.client = client

    @app_commands.command()
    async def ping(self, interaction : discord.Interaction):
        await interaction.response.send_message(f'Pong! **{round(self.client.latency * 1000)}**ms')

def setup(client):
    client.add_cog(Ping(client))
``` Anything wrong here?
ornate aspen
#

How does the versioning even work now, I fixed my bot to accommodate for the breaking changes that was made a day or two ago, currently in my requirements file I have mentioned git+https://github.com/Rapptz/discord.py how do I pin it to a version such that breaking changes aren't experienced but bugfixes are?

final iron
unkempt canyonBOT
#

await send(content=None, *, embed=..., embeds=..., file=..., files=..., allowed_mentions=..., view=..., components=..., tts=False, ephemeral=False, delete_after=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Sends a message using either [`response.send_message`](https://docs.disnake.dev/en/latest/api.html#disnake.InteractionResponse.send_message "disnake.InteractionResponse.send_message") or [`followup.send`](https://docs.disnake.dev/en/latest/api.html#disnake.Webhook.send "disnake.Webhook.send").

If the interaction hasn’t been responded to yet, this method will call [`response.send_message`](https://docs.disnake.dev/en/latest/api.html#disnake.InteractionResponse.send_message "disnake.InteractionResponse.send_message"). Otherwise, it will call [`followup.send`](https://docs.disnake.dev/en/latest/api.html#disnake.Webhook.send "disnake.Webhook.send").

Note

This method does not return a [`Message`](https://docs.disnake.dev/en/latest/api.html#disnake.Message "disnake.Message") object. If you need a message object, use [`original_message()`](https://docs.disnake.dev/en/latest/api.html#disnake.MessageInteraction.original_message "disnake.MessageInteraction.original_message") to fetch it, or use [`followup.send`](https://docs.disnake.dev/en/latest/api.html#disnake.Webhook.send "disnake.Webhook.send") directly instead of this method if you’re sending a followup message.
final iron
#

ephemeral kwarg

haughty quartz
#

aight!

slate swan
#

how can i get the current cooldown for a command using commands.Cooldown.Mapping

tardy atlas
#
warning = cursor.execute('SELECT * FROM banwords WHERE userid = ?', (message.author.id,)).fetchone()
2022-03-15T20:51:22.447042+00:00 app[worker.1]: psycopg2.errors.SyntaxError: syntax error at end of input
2022-03-15T20:51:22.447042+00:00 app[worker.1]: LINE 1: SELECT * FROM banwords WHERE userid = ?
2022-03-15T20:51:22.447042+00:00 app[worker.1]:                                                ^ 
#

How to fix

haughty quartz
#
channel = channel object
await inter.channel.send_message("lol")```
#

that's what i came up with

#

would that work ?

slate swan
junior verge
#

What's the easiest way to switch to slash commands if you got normal commands sad

slate swan
#

didnt use dpy 2 but i believe that u need to get it from something called tree?

tardy atlas
last moss
#

ah never used that

junior verge
junior verge
#

To switch to slash

viral wolf
#

Is there a command to get the author of the message's id?

sonic flax
#
@bot.command()
@commands.is_owner()
async def alts(ctx, *, ign):
  while True:
    altFinder = requests.get(f"http://api.antisniper.net/altfinder?key={akey}&name={ign}")
    altjson = json.loads(altFinder.text)
    for x in altjson['results']:
      alist.append(x['ign'])
    await ctx.send(alist)```
How do I end the loop, so the bot doesn’t spam the message?
buoyant plover
#

Why are you looping at all

#

__
__When I joined with an alt I was DM'ed after accepting the rules, what event is that?

modest plover
#
    
    @commands.slash_command()   
    async def purge(self, inter, messages: int = None, author: disnake.Member = None):
        channel = inter.channel
        await channel.purge(limit = messages, check = author)
        successEmbed = disnake.Embed(
            name = "Successful!",
            description = f"{inter.author.mention} has purged messages."
        ) 

I have this and it results in this error:

Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/disnake/ext/commands/interaction_bot_base.py", line 1332, in process_application_commands
    await app_command.invoke(interaction)
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/disnake/ext/commands/slash_core.py", line 606, in invoke
    raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'Member' object is not callable
#

I'm using Disnake.

buoyant plover
#

You're providing author as the check

#

You need to provide a callable function checking if the message author id is equal to your author id

modest plover
#

Basically I want it so that if author has a value, then it makes the bot delete their messages. If it doesn't have a value, it deletes all the messages in that limit

slate swan
#
@client.slash_command(description = "Test command", guild_ids = [])
async def test(inter):
   await inter.send("...")```
flat solstice
#

Hi I'm getting this error```py
The provided arg time is not recognize
The provided arg time is not recognize
Ignoring exception in command user permissions:
Traceback (most recent call last):
File "C:\Users\Teagan\Documents\Coding\Zupie\env\lib\site-packages\discord\ext\commands\core.py", line 185, in wrapped
ret = await coro(*args, **kwargs)
File "C:\Users\Teagan\Documents\Coding\Zupie\bot\cogs\users.py", line 88, in permissions_legacy
await Users(self).permissions_func(ctx, member, channel)
File "C:\Users\Teagan\Documents\Coding\Zupie\bot\utils\helpers.py", line 139, in permissions_func
permissions = channel.permissions_for(member)
AttributeError: 'NoneType' object has no attribute 'permissions_for'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Users\Teagan\Documents\Coding\Zupie\env\lib\site-packages\discord\ext\commands\bot.py", line 1182, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Teagan\Documents\Coding\Zupie\env\lib\site-packages\discord\ext\commands\core.py", line 1495, in invoke
await ctx.invoked_subcommand.invoke(ctx)
File "C:\Users\Teagan\Documents\Coding\Zupie\env\lib\site-packages\discord\ext\commands\core.py", line 904, in invoke
await injected(*ctx.args, **ctx.kwargs) # type: ignore
File "C:\Users\Teagan\Documents\Coding\Zupie\env\lib\site-packages\discord\ext\commands\core.py", line 194, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'permissions_for'```in this command https://github.com/SnowyJaguar1034/Zupie/blob/5246e279f16e3aa4cde7adf77f380f4fcd62e0a7/bot/cogs/users.py#L87and I'm not sure why

unkempt canyonBOT
#

bot/cogs/users.py line 87

async def permissions_legacy(self, ctx, member: Member = None, channel: Union[TextChannel, VoiceChannel, StageChannel, CategoryChannel] = None):```
slate swan
#

but for interactions

junior verge
#

can you send a link of the library and how to install etc

slate swan
fierce sonnet
#

could you please help me with something?

quaint epoch
#

can a command be a slash and text command? like py @commands.slash_command() @commands.command() async def foo(ctx): pass

modest plover
#

I think so

#

Try it I guess

slate swan
#

but i dont think that'll work

unkempt canyonBOT
#

bot/utils/helpers.py line 70

elif isinstance(object_arg, TextChannel): # == "channel"```
`bot/utils/helpers.py` line 138
```py
channel = await interaction_or_context(transaction, channel_arg)```
buoyant plover
#

@quaint epoch

async def callback(*args, **kwargs):
    ...

@commands.slash_command()
async def foo(...):
    return await callback(...)


@commands.command()
async def bar(...):
    return await callback(...)
#

If you want different functionality for each command, abstract the common functionality into it's own function instead of the entire thing

buoyant plover
fierce sonnet
#

ah wrong channel sorry

buoyant plover
#

Guys, what event did this come from?

#

What even can I wait for to see when users are accepting server rules

fierce sonnet
#

you get verified its just to check if you are a real user or a bot

buoyant plover
#

Ok but what event is dispatched when we submit this?

#

They must have listened to a specific event

fierce sonnet
buoyant plover
#

Ok but what websocket event did the python bot listen for that

fierce sonnet
#

there are two i think they really want to make sure that there are no bot or something

buoyant plover
#

When submitting, you get a DM from the Python bot.
What websocket event is that?

haughty quartz
#

hey uh how do i send a message to another channel when using slash commands? (disnake)

buoyant plover
#

I understand what it's there for, but what event is it?

fierce sonnet
buoyant plover
#

It's neither

#

I'll go ask in dev-contrib instead

flat solstice
#

ik i'v seen docs for it before, just can't find them now

fierce sonnet
# buoyant plover It's neither

intents = discord.Intents.all() @bot.event async def on_member_join(member): await member.send('')
something like this

buoyant plover
#

Ohh it's on_member_update

fierce sonnet
#

could i make something to send a message throught the terminal?

haughty quartz
#

hey uh how do i send a message to another channel when using slash commands? (disnake)

junior verge
#
import disnake

from disnake.ext import commands


class Ping(commands.Cog):

    def __init__(self, client):
        self.client = client

    @client.slash_command(name='Ping',description='Test ')
    @commands.command()
    async def ping(self, inter):
        await inter.response(f'Pong! **{round(self.client.latency * 1000)}**ms')

def setup(client):
    client.add_cog(Ping(client))
``` Would this work?
slate swan
#

await inter.response.send_message

cloud dawn
compact sky
#

is there a better way to make commands in a bot

#

this is my first bot

cloud dawn
unkempt canyonBOT
#

class discord.ext.commands.Bot(command_prefix, help_command=<default-help-command>, description=None, **options)```
Represents a discord bot.

This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") you can do with this bot.

This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.
compact sky
#

i just do "if message.content.startswith("thing")"

compact sky
cloud dawn
#

bot != client, client is for events only and bot is for commands and events.

cloud dawn
compact sky
#

oh, my bot doesnt have any of that

cloud dawn
#

Those have build-in command structure

#

!d discord.ext.commands.Bot.command

unkempt canyonBOT
#

@command(*args, **kwargs)```
A shortcut decorator that invokes [`command()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.command "discord.ext.commands.command") and adds it to the internal command list via [`add_command()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin.add_command "discord.ext.commands.GroupMixin.add_command").
compact sky
#

it just goes right in

compact sky
#

or substitute it for the "if message.content.startswith(a):"

tame nymph
#

how do I decode permissions value

slate swan
compact sky
#

help

cloud dawn
compact sky
#

it says invalid syntax

compact sky
#

can i just turn intents off like this:
intents=false

#
bot = commands.Bot(command_prefix='>', description="idk", intents=False)```
#

now what?

left crater
#

delete client

final iron
compact sky
manic wing
#

hence why its called default

quaint epoch
buoyant plover
quaint epoch
buoyant plover
#

no

quaint epoch
#

oh\

#

then what?

buoyant plover
#

If you read my convo there you'll understand it

#

I already found my answer, thank you

unkempt canyonBOT
#

discord/state.py line 216

intents = options.get('intents', None)```
slate swan
#
warning = cursor.execute('SELECT * FROM banwords WHERE userid = ?', (message.author.id,)).fetchone()
2022-03-15T20:51:22.447042+00:00 app[worker.1]: psycopg2.errors.SyntaxError: syntax error at end of input
2022-03-15T20:51:22.447042+00:00 app[worker.1]: LINE 1: SELECT * FROM banwords WHERE userid = ?
2022-03-15T20:51:22.447042+00:00 app[worker.1]:                                                ^  

postgresql
Hot to fix?

terse blade
#
async def react(ctx):    
  await ctx.message.add_reaction(":soccer:")```

this does nothing
#

this does nothing

buoyant plover
#

Try using \⚽

buoyant plover
slate swan
#

Ok

flat solstice
buoyant plover
cloud dawn
#

psycopg2 has async options but asyncpg is better overall and more used.

flat solstice
# buoyant plover It's asyncronous

well from what I've read so is psycopg2? I see a lot of bots use asyncpg but whenever I google postgres python packages i only get psycopg2 results so I was under the impression asyncpg was discontinued or something

buoyant plover
#

Oh I haven't seen async side of psycopg2

#

Always used asyncpg, never seen anything better 🤷‍♀️

flat solstice
cloud dawn
flat solstice
#

again, weird. that'll be google search for you I guess, musta searched psycopg2 sometime in the past and now it loves showing me those results

cloud dawn
#

afaik google searches are always the same when it comes to ranking

#

Since incognito has the same results

sick birch
#

I think when it comes to deciding on what libraries to use it's best to ask other people than to rely on google searches, as often the sturdiest and best libraries will be loved by many and recommended, I think this is a perfect demonstration of that

buoyant plover
flat solstice
#

okay so I have this command which can take a optional member argpy @legacy_user_group.command(name ="info", description=info_description, usage="[member]", aliases=["whois", "ui"]) async def info_legacy(self, ctx: commands.Context, member: Union[Member, User] = None): await Users(self).info_func(ctx, member)I then pass the inputs into this function in a custom classpy async def info_func(self, transaction, member_arg): member = await interaction_or_context("MEMBER", transaction, member_arg) member_status = "No status" if member.activity is None else member.activity.name embed = Embed(title = f"{member}", description = f"Status: **{member.status}**\n*{member_status}*", colour = member.colour) embed.set_author(name = f"{member.id}", icon_url = member.avatar.url) embed.set_thumbnail(url = member.avatar.url) await self.timestamps_func(member, embed, True) roles = [f"{role.mention}" for role in member.roles] if len(roles) == 0: roles.append("No roles") has_key = [perm for perm in bot_var.config.key_perms if getattr(member.guild_permissions, perm)] if len(has_key) == 0: has_key.append('No permissions') embed.add_field(name = f"Roles: {len(roles)}",value = f"{len(roles)} roles" if len(" ".join(roles)) > 1000 else " ".join(roles), inline = False) embed.add_field(name =f'Key permissions', value = ", ".join(has_key).replace("_"," ").title(), inline = False) await interaction_or_context(transaction, embed)at this point member_arg should be either a member or None (I think). This function then calls another function and sets the member var equal to the result of the function. As the code shows I am passing in three arguments to this second func, those being "MEMBER, transaction and member_arg, this function ispy async def interaction_or_context(arg_type, transaction, object_arg): if arg_type == "MEMBER": if isinstance(transaction, Interaction): member = transaction.user if object_arg is None else object_arg elif isinstance(transaction, Context): member = transaction.author if object_arg is None else object_arg else: print("ERROR: interaction_or_context : Hit ele statemnt in 'MEMBER' check") return memberbut for some reason i get an error saying the object_arg param is missing, is that bc it's None?py Ignoring exception in command user info: Traceback (most recent call last): await injected(*ctx.args, **ctx.kwargs) # type: ignore File "C:\Users\Teagan\Documents\Coding\Zupie\env\lib\site-packages\discord\ext\commands\core.py", line 194, in wrapped raise CommandInvokeError(exc) from exc discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: interaction_or_context() missing 1 required positional argument: 'object_arg'

buoyant plover
#

No, you're just not passing it

#

see: await interaction_or_context(transaction, embed)

flat solstice
cloud dawn
flat solstice
terse blade
#

How do you make it use slash commands

flat solstice
flat solstice
terse blade
#

import discord
from discord.ext import commands

#

this?

flat solstice
terse blade
#

so what do i do

hardy yoke
flat solstice
# terse blade so what do i do

if you want to continue using discord.py then you can download the latest master branch like thisshell pip install -U git+https://github.com/Rapptz/discord.pybut as madbard said you could switch to a different fork. Disnake is the one I would recommend based on what I've read of it's docs but I've never actually used it bc I made the decision to move to hikari a week before d.py got revived so I just moved back to d.py

flat solstice
slate swan
#
  customRole = await find_by_name(role, ctx.message.guild.roles)
  emoji = await find_by_name(customRole.name, ctx.message.guild.emojis)

    embed = discord.Embed(title=f'Role {customRole.name} Roster', description=f"{emoji.name}{customRole.mention}" , color=customRole.colour)
    embed.add_field(name=f'Team Staff:', value=f">>> FO:{', '.join(FO)}\n GM:{', '.join(GM)}\nHC: {', '.join(HC)} ", inline=False)
    embed.add_field(name="Players", value=f"{customRole.name} Players: \n >>> {', '.join(CUSTOM)} ", inline=True)
    embed.set_author(name=f"{ctx.guild}", icon_url=str(ctx.guild.icon_url))
    embed.set_thumbnail(url=str(emoji.url))
    embed.set_footer(text=f"Roster Count:\n {len(CUSTOM)}/30 \n")
    await ctx.send(embed=embed)
``` error emoji object is not Subscriptable
flat solstice
#

anyone got a example of autocomplete I could look at (I mean autocompletes in use not the code for it)

flat solstice
terse blade
#

Nvm it was me being dumb

slate swan
#

! DiscordUtils

modest plover
#

How do I make a check where if a member is mentioned in author, it'll delete messages from only that user and if there's nothing there, it deletes however many messages?

    
    @commands.slash_command()   
    async def purge(self, inter, messages: int = None, author: disnake.Member = None):
        channel = inter.channel
        await channel.purge(limit = messages, check = author)
        successEmbed = disnake.Embed(
            name = "Successful!",
            description = f"{inter.author.mention} has purged messages."
        ) 
slim ibex
#

if author should do the job

modest plover
#

Literally that's all the check is?

#

check = if author?

slim ibex
#
if author is not None:
  # do something
else:
  # do something else
modest plover
#

Ok, ty

#
async def purge(self, inter, messages: int, author: disnake.Member = None):
        channel = inter.channel
        
        def checks():
            if author != None:
                return message.author = author 
            else:
                return None
        deleted = await channel.purge(limit = messages, check = checks, bulk = True)
        successEmbed = disnake.Embed(
            name = "Successful!",
            description = f"{inter.author.mention} has purged {len(deleted)} messages."
        ) 

@slim ibex this doesn't work, I think I fucked it, like 100% defo fucked it. Any help?

#
Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/disnake/ext/commands/interaction_bot_base.py", line 1332, in process_application_commands
    await app_command.invoke(interaction)
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/disnake/ext/commands/slash_core.py", line 606, in invoke
    raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: Purge.purge.<locals>.checks() takes 0 positional arguments but 1 was given

I get this error when I run the command:
/purge messages: 1

slim ibex
#

that isn't what you do ...

modest plover
#

I figured

#

I haven't done anything to do with checks before

slim ibex
#

this has nothing to do iwth check()

#

its literally an if statement

#

you should be able to implement your logic by checking if author is None or not

modest plover
#

Yeah, and I've put
if author != None:

flat solstice
#

How do I use the traceback module? someone suggested I print the full traceback of an error rather than just saying an error occurred and its destination. I have this so farpy print(f"\nFailed to Load Extension {extension}\n{traceback.print_exc()}\n")but it just prints outpy Failed to Load Extension cogs.help None

slim ibex
#

!= isn't the same as is not

modest plover
#

That's not what my computer science teacher taught me lmao

slim ibex
#

!= checks for equality. is not checks for identity

worldly bane
slim ibex
#

^

modest plover
#
Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/disnake/ext/commands/interaction_bot_base.py", line 1332, in process_application_commands
    await app_command.invoke(interaction)
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/disnake/ext/commands/slash_core.py", line 606, in invoke
    raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: Purge.purge.<locals>.checks() takes 0 positional arguments but 1 was given

I keep getting this.

slim ibex
#

i told you, you don't need check()

#

master okimii is here'

slate swan
#

pretty cool thing in py iirc 256 and 257 arent the same entities so comparing them with is would be false and if you compare a number with a lowerr thrn that range it returns true

modest plover
worldly bane
#

lemme check the docs since I never used this lemon_sweat

modest plover
#

(I'm using Disnake btw)

worldly bane
#

!d discord.TextChannel.purge

unkempt canyonBOT
#

await purge(*, limit=100, check=..., before=None, after=None, around=None, oldest_first=False, bulk=True, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Purges a list of messages that meet the criteria given by the predicate `check`. If a `check` is not provided then all messages are deleted without discrimination.

You must have the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission to delete messages even if they are your own. The [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission is also needed to retrieve message history.

Changed in version 2.0: The `reason` keyword-only parameter was added.

Examples

Deleting bot’s messages...
slate swan
#

can someone help me out? My code isnt working and I am new to discord.py ```python
import discord
from discord.ext import commands

#server_id = "922146486840590367"

def read_token():
with open("token.txt", "r") as f:
lines = f.readlines()
return lines[0].strip()

token = read_token()
bot = commands.Bot(command_prefix='?')
client = discord.Client()

@bot.command()
async def ping(ctx):
await ctx.send("working")

@client.event
async def on_member_join(member):
for channel in member.server.channels:
if str(channel) == "general":
await client.send_message(f"""Welcome to the server {member.mention}""")

@client.event
async def on_message(message):
id = client.get_guild(922146486840590367)
channels = ["bot-command-channel"]

if str(message.channel) in channels:
    if message.content == "?hello" and message.content != -1:
        await message.channel.send("HELLO!")

    if message.content == "?total_users" and message.content != -1:
        await message.channel.send(f"""Number of Members: {id.member_count}""")

bot.add_command(ping)
client.run(token)this is the error
Traceback (most recent call last):
File "C:/Users/joelj/PycharmProjects/UndBot/BotMain.py", line 38, in <module>
bot.add_command(ping)
File "C:\Users\joelj\anaconda3\envs\undbot\lib\site-packages\discord\ext\commands\core.py", line 1149, in add_command
raise CommandRegistrationError(command.name)
discord.ext.commands.errors.CommandRegistrationError: The command ping is already an existing command or alias.```

modest plover
#

Remove bot.add_command

worldly bane
slate swan
worldly bane
slate swan
modest plover
#

It's trying to register the command twice

slate swan
#

ahhh

modest plover
worldly bane
modest plover
#
    @commands.slash_command()   
    async def purge(self, inter, messages: int, author: disnake.Member = None):
        channel = inter.channel
        
        def checks():
            if not author:
                return message.author == author
            else:
                return None
        deleted = await channel.purge(limit = messages, check = checks, bulk = True)
        successEmbed = disnake.Embed(
            name = "Successful!",
            description = f"{inter.author.mention} has purged {len(deleted)} messages."
        ) 
#

That's the code, I haven't implemented any new checks yet

slate swan
#

it says this now Traceback (most recent call last): File "C:/Users/joelj/PycharmProjects/UndBot/BotMain.py", line 19, in <module> @client.listen AttributeError: 'Client' object has no attribute 'listen'

worldly bane
#

for your case try:

def checks(m):
  if not author:
     return m.author == author
  else:
    return None
#

not sure if this'll work tho @modest plover

modest plover
#

Ok, well, it's sending the message but it isn't deleting messages if I don't have the author option with a value

#

Or in general

#

It doesn't delete messages.

worldly bane
modest plover
#
    @commands.slash_command()   
    async def purge(self, inter, messages: int, author: disnake.Member = None):
        channel = inter.channel
        
        def checks(message):
            if not author:
                return message.author == author
            else:
                return None
        deleted = await channel.purge(limit = messages, check = checks, bulk = True)
        successEmbed = disnake.Embed(
            title = "Successful!",
            description = f"{inter.author.mention} has purged {len(deleted)} messages."
        )
        await inter.response.send_message(embed = successEmbed)
worldly bane
#

hmmm

#

I'm having a headache rn 💀

modest plover
#

Same

#

It's like 12:40rn and I'm watching breaking bad

worldly bane
#

!d discord.TextChannel.purge

unkempt canyonBOT
#

await purge(*, limit=100, check=..., before=None, after=None, around=None, oldest_first=False, bulk=True, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Purges a list of messages that meet the criteria given by the predicate `check`. If a `check` is not provided then all messages are deleted without discrimination.

You must have the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission to delete messages even if they are your own. The [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission is also needed to retrieve message history.

Changed in version 2.0: The `reason` keyword-only parameter was added.

Examples

Deleting bot’s messages...
worldly bane
#

try this^

#

Man I got confused 🤦‍♂️

slim ibex
worldly bane
#

🗿

#

Imma take a break

slim ibex
#

you need to check for author’s identity and put your logic in the statements

worldly bane
#

\🗿

slim ibex
#

In this situation I think doing *, author: Member = None would be useful so all arguments after messages are related to the member to delete messages for, if author is not None

slim ibex
#

not sure if a List[Member] typehint would be warranted here. It could be though as you could interpret it as a list of members, but since * makes all arguments after it correspond to the parameter after, it probably isn’t needed

worldly bane
slate swan
#

kek

#

can you have subclases for commands.Cog?

#

thats how you make a cog lol

slim ibex
#

^

slate swan
#

you subclass the Cog class

slate swan
# slate swan you subclass the Cog class

i have

@commands.command()
    @commands.has_permissions(ban_members = True)
    @commands.cooldown(1, 2, commands.BucketType.user)
    async def unban(self, ctx, member: BannedMember):
        user = discord.user
        await ctx.guild.unban(member.user)
        unbanmsg = discord.Embed(color = 0x2ecc71, description = f":msuccess: {member.user} has been successfully unbanned by {ctx.message.author.mention}")
        await ctx.send(embed = unbanmsg)

and also

class BannedMember(commands.Converter):
    async def convert(self, ctx, argument):
        if argument.isdigit():
            member_id = int(argument)
            try:
                return await ctx.guild.fetch_ban(discord.Object(id = member_id))
            except discord.NotFound:
                raise commands.BadArgument("This member has not been banned before.") from None

        ban_list = await ctx.guild.bans()
        entity = discord.utils.find(lambda u: str(u.user) == argument, ban_list)

        if entity is None:
            raise commands.BadArgument("This member has not been banned before.") from None
        return entity
#

the command doesn't work

#

you subclassed Converter bro

#

and you need an initiate in the Cog so you can pass the Bot instance

#

i tried it inside the commands.Cog and outside next to the imports

#

i do have intiate

pine lava
#
  bot.load_extension(f'Data.Commands.{filename[:-3]}')
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
C:\Users\acali\OneDrive\Desktop\discord.py bots\Wordy\main.py:31: RuntimeWarning: coroutine 'BotBase.load_extension' was never awaited
  bot.load_extension(f'Data.Events.{filename[:-3]}')
RuntimeWarning: Enable tracemalloc to get the object allocation traceback```
#

how come im getting this error

#
for filename in os.listdir('Data/Commands/'):
    if filename.endswith('.py'):
        try:
            bot.load_extension(f'Data.Commands.{filename[:-3]}')
        except Exception as e:
            print(e)

for filename in os.listdir('Data/Events/'):
    if filename.endswith('.py'):
        try:
            bot.load_extension(f'Data.Events.{filename[:-3]}')
        except Exception as e:
            print(e)``` this is my code
slate swan
#

mains method is now a coroutine

pine lava
#

so i'd await it right

worldly bane
#

yes

pine lava
#

but its not a function so how would i do it

slate swan
#

Did you override the bot.load_extension

pine lava
slate swan
#

is it a coroutine in main?

pine lava
#

yeah

slate swan
#

because in main adding a cog is a coroutine now

pine lava
#
async def main():
    
    async with bot:
        await bot.start("token")
slate swan
#

Ah

#

await it

pine lava
#

not an async function

worldly bane
pine lava
#
  File "C:\Users\acali\OneDrive\Desktop\discord.py bots\Wordy\main.py", line 24
    await bot.load_extension(f'Data.Commands.{filename[:-3]}')
    ^
SyntaxError: 'await' outside function```
slate swan
slate swan
pine lava
#

alr i got it

#

cool

slim ibex
#

imagine if python supported top level await like JS

slate swan
slim ibex
#

outside of async functuons

#

but still not in sync functions

#

you could use await in the global scope (top-level)

worldly bane
slate swan
slim ibex
#

promises*

slate swan
#

pardon?

slim ibex
#
let foo = await fetch("...");
slim ibex
slate swan
#

i cant keep promises but i can keep coroutines 👁️ 👁️

worldly bane
#

"hey man you need to use a promise"

slate swan
#

kek

slim ibex
#
let foo = await fetch("...");

async function bar() {
  await fetch("...");
}

well the foo declaration works because JS supports top level await

slate swan
#

so youre calling pythons await low level, i find that offensive AG_Angry

slim ibex
#

top-level isn't related to high or low level langs lol

#

the top level of any language is the global scope

slate swan
#

well get it in 4.10🗿

worldly bane
#

!ot

unkempt canyonBOT
slim ibex
#

dont be that guy'

worldly bane
slate swan
#

smh

sly hamlet
#
Traceback (most recent call last):
  File "C:\Users\culan\OneDrive\Desktop\echo slash\echo.py", line 40, in <module>
    asyncio.run(new())
  File "C:\Users\culan\AppData\Local\Programs\Python\Python39\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Users\culan\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 642, in run_until_complete
    return future.result()
  File "C:\Users\culan\OneDrive\Desktop\echo slash\echo.py", line 36, in new
    await bot.tree.sync(guild=discord.Object(479997589790523405))
  File "C:\Users\culan\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\app_commands\tree.py", line 861, in sync
    raise ClientException(APP_ID_NOT_FOUND)
discord.errors.ClientException: Client does not have an application_id set. Either the function was called before on_ready was called or application_id was not passed to the Client constructor.``` I'm struggling to figure out how to fix this issue I'm running the new version of discord.py
slate swan
#

the error is so specified 😔

slate swan
sly hamlet
#

Never encountered something like this

maiden fable
slate swan
slate swan
#

for

#

bannedmember

#

wut

#

like

sly hamlet
slate swan
#
class BannedMember(commands.Converter):
    async def convert(self, ctx, argument):
        if argument.isdigit():
            member_id = int(argument)
            try:
                return await ctx.guild.fetch_ban(discord.Object(id = member_id))
            except discord.NotFound:
                raise commands.BadArgument("This member has not been banned before.") from None

        ban_list = await ctx.guild.bans()
        entity = discord.utils.find(lambda u: str(u.user) == argument, ban_list)

        if entity is None:
            raise commands.BadArgument("This member has not been banned before.") from None
        return entity
``` how am i supposed to get this to work inside my cog
maiden fable
slate swan
#
class Moderation(commands.Cog):
  
    __slots__ = ('bot')
  
    def __init__(self, bot):
        self.bot = bot
#

ah yeah you could

#
@commands.command()
    @commands.has_permissions(ban_members = True)
    @commands.cooldown(1, 2, commands.BucketType.user)
    async def unban(self, ctx, member: BannedMember):
        user = discord.user
        await ctx.guild.unban(member.user)
        unbanmsg = discord.Embed(color = 0x2ecc71, description = f":msuccess: {member.user} has been successfully unbanned by {ctx.message.author.mention}")
        await ctx.send(embed = unbanmsg)
sly hamlet
sly hamlet
sly hamlet
maiden fable
#

Hmm i have an idea

#

Copy yr bot's ID

#

User ID

sly hamlet
#

So yeah it wants to buy ID but how and where and why it's never required this before

worldly bane
#

it takes a guild id if given

#

if not then it'll take an hour or so to sync it to all the bot's server's

sly hamlet
#

It's got the id of it though but it's asking for a bot ID in that error isn't it

worldly bane
#

but its optional

sly hamlet
worldly bane
#

oh wait

#

lemme find the part in the docs

final iron
#

They told you what to do

worldly bane
#

lol

sly hamlet
#

That's why I'm still here asking for help

final iron
#

It's pretty clear

hushed galleon
#

application_id is automatically fetched after your bot connects, so i believe you can alternatively do a startup task that waits until the bot is ready and then sync then

sly hamlet
#

Conveniently all the examples that were put out are missing that 😐

slate swan
#
user = discord.user
        await ctx.guild.unban(bannedMember.user)
        unbanmsg = discord.Embed(color = 0x2ecc71, description = f":msuccess: {member.user} has been successfully unbanned by {ctx.message.author.mention}")
        await ctx.send(embed = unbanmsg)

why is the embed never sent?

#

member is unbanned, but the embed is never sent, if you can help ping me please

tranquil hamlet
#

is this the right place to get help with webhooks

hushed galleon
slate swan
#

its supposed to be bannedMember.mention, member was the string input

hushed galleon
#

hm but you didnt see an AttributeError in your terminal?

slate swan
#

nope i suppressed all errors lol

hushed galleon
#

those tracebacks are pretty helpful at debugging code

slate swan
#

i deployed it to heroku

#

i don't check heroku logs lol

#

i didn't test run in pycharm

hushed galleon
#

sounds like a good workflow

slate swan
#

if you mean the webhooks in discord

tranquil hamlet
# slate swan yeah

im trying to set up a weebhook with my Nolt page (i have no idea how to use webhooks)

in Nolt you are given the following options:
Endpoint URL
Verify Token (optional)
Singing Secret (optional)

everything I try returns error 400

slate swan
tranquil hamlet
#

this is the closest place i could think of

slate swan
sly hamlet
#

I'm still unable to get my game/status to change as well as my commands to sync
Upon further inspection it does not seem to be running that part of the code

async def main():
    async with bot:
        await bot.load_extension('cogs.botut')
        async with bot:
            await bot.start("")

async def new():
    print("test3")
    async with bot:
        print("test2")
        await bot.tree.sync(guild=discord.Object(479997589790523405))
        print("test1")
        await bot.change_presence(status = discord.Status.dnd, activity = discord.Game('/help | echobot.xyz/testing'))
        print("test")


asyncio.run(main())
asyncio.run(new())
hushed galleon
#

you cant have two asyncio.run() calls since bot.start() is supposed to never return, so it doesnt reach new()

#

also weird that you have two nested async with bot:

maiden fable
#

Indeed

vocal snow
#

Since when does Bot implement _aenter_ thinkmon

midnight gorge
#

!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.

sly hamlet
reef trail
#
Ignoring exception in command tree:
Traceback (most recent call last):
  File "/home/ubuntu/.local/lib/python3.9/site-packages/discord/app_commands/tree.py", line 693, in wrapper
    await self.call(interaction)
  File "/home/ubuntu/.local/lib/python3.9/site-packages/discord/app_commands/tree.py", line 773, in call
    raise CommandNotFound(name, parents)
discord.app_commands.errors.CommandNotFound: Application command 'wallpaper' not found``` i keep getting this error even when the slash command exists and works fine, im not running my bot twice or anything it just errors, even though the slash command works and responds fine
hushed galleon
vocal snow
#

Oh i see

midnight gorge
hushed galleon
sly hamlet
#

what about my sync tho

hushed galleon
#

that can go in an async task that waits until the bot is ready, like i mentioned before

#

e.g. ```py
async def sync_commands(bot):
await bot.wait_until_ready()

# Sync global commands
await bot.tree.sync()

# Sync guild commands (note: can make a lot of API calls)
for guild in bot.guilds:
    await bot.tree.sync(guild=guild)

async def main():
# run sync_commands in the background
asyncio.create_task(sync_commands(bot))

async with bot:
    await bot.start(...)```
#

you can also put the syncing inside setup_hook(self) if you subclassed bot

sly hamlet
# hushed galleon that can go in an async task that waits until the bot is ready, like i mentioned...
bot = commands.Bot(command_prefix='!',
                   status=discord.Status.dnd,
                   activity=discord.Game(...))
bot.remove_command('help')

@bot.event
async def on_ready():
    print("-------------Bot-------------")
    print('The bot is ready!')
    print(bot.user.name)
    print(bot.user.id)

async def sync_commands(bot):
    await bot.wait_until_ready()
    await bot.tree.sync()
    for guild in bot.guilds:
        await bot.tree.sync(guild=guild)

async def main():
    async with bot:
        await bot.load_extension('cogs.botut')
        asyncio.create_task(sync_commands(bot))
        async with bot:
            await bot.start("")``` so all togethr this?
hushed galleon
#

you dont need the nested async with

#

also ig you dont need the bot parameter for sync_commands since you've defined it as a global variable

shell wing
#
Ignoring exception in command continents:
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/runner/new-server/continent.py", line 24, in continents
    continent = discord.Embed(
NameError: name 'embed' is not defined

code :-

 @commands.command()
    async def continents(self, ctx):
        continent = discord.Embed(
            title=f'Get your continent role here',
            color=0x530101,
            description=
            " ![1one](https://cdn.discordapp.com/emojis/938060649215459379.webp?size=128 "1one") <@&934015812203855933> \n  ![2two](https://cdn.discordapp.com/emojis/938060706731946015.webp?size=128 "2two") <@&934016254472224809> \n   ![3three](https://cdn.discordapp.com/emojis/938060801154117662.webp?size=128 "3three") <@&934016343995473920> \n  ![4four](https://cdn.discordapp.com/emojis/938061487841349654.webp?size=128 "4four") <@&934016472391483412>"
        )
.................
hushed galleon
#

and also i assume you intended to pass a name for your activity?

dense vortex
#

who wants tictactoe code for bot

sly hamlet
hushed galleon
hushed galleon
sly hamlet
#
bot = commands.Bot(command_prefix='!',
                   status=discord.Status.dnd,
                   activity=discord.Game('/help | echobot.xyz/testing'))
bot.remove_command('help')

@bot.event
async def on_ready():
    print("-------------Bot-------------")
    print('The bot is ready!')
    print(bot.user.name)
    print(bot.user.id)

async def sync_commands(bot):
    await bot.wait_until_ready()
    await bot.tree.sync()
    for guild in bot.guilds:
        await bot.tree.sync(guild=guild)

async def main():
    await bot.load_extension('cogs.botut')
    asyncio.create_task(sync_commands(bot))
    async with bot:
        await bot.start("")```
sly hamlet
# hushed galleon yeah
future: <Task finished name='Task-2' coro=<sync_commands() done, defined at C:\Users\culan\OneDrive\Desktop\echo slash\echo.py:28> exception=Forbidden('403 Forbidden (error code: 50001): Missing Access')>
Traceback (most recent call last):
  File "C:\Users\culan\OneDrive\Desktop\echo slash\echo.py", line 32, in sync_commands
    await bot.tree.sync(guild=guild)
  File "C:\Users\culan\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\app_commands\tree.py", line 868, in sync
    data = await self._http.bulk_upsert_guild_commands(self.client.application_id, guild.id, payload=payload)
  File "C:\Users\culan\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\http.py", line 496, in request
    raise Forbidden(response, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50001): Missing Access``` i get this tho
hushed galleon
#

uhh, did you invite your bot with the application.commands scope?

sly hamlet
#

🤦 I forgot I am using a test bot

hushed galleon
#

also i would suggest doing this sync in some command so it isnt being called whenever you're just restarting the bot for hotfixes

sly hamlet
#

What do you mean

cosmic agate
#

hey guys

#

im back

hushed galleon
#

you'll probably find a time where you're restarting the bot several times, and discord may ratelimit you if you keep trying to sync your slash commands, even if you havent added any new ones

sly hamlet
#

And how do you fix that?

hushed galleon
#

doing this sync in some command

vital steeple
#

Hey Guys, My !gen1 isnt working here is my code

`@client.command()

async def pop_random_line():
''' picks a random line from a file, then deletes the line '''
with open("keys.txt", "r") as file:
lines = file.readlines()

chosen_index, chosen_line = random.randrange(0, len(lines))

with open("keys.txt", "w") as file:
del lines[chosen_index]
file.writelines(lines)

return chosen_line

@client.command()

async def gen1(ctx):
line = random.choice(lines)
await ctx.send(line)
`

hushed galleon
#

i.e. on demand, whenever you want to sync it

sly hamlet
#

So just adding the sync to the command?

dense vortex
#

@sly hamlet u new with python?

hushed galleon
vital steeple
#

my command dosent work

sly hamlet
# dense vortex <@!443181357246447617> u new with python?

Nope normally only develop small games in it been doing my Discord but for a while now but I stopped doing it when they announced that discord.py would not be updating any more some of it out of practice I also like asking a lot of questions for clarification also with my learning and reading disability it's not always easy for me

sly hamlet
vital steeple
shrewd condor
# vital steeple when i type !gen1 nothing happens
@client.command()

async def pop_random_line():
  ''' picks a random line from a file, then deletes the line '''
  with open("keys.txt", "r") as file:
    lines = file.readlines()
  
  chosen_index = random.randrange(0, len(lines))
  chosen_line = lines[chosen_index]

  with open("keys.txt", "w") as file:
    del lines[chosen_index]
    file.writelines(lines)
  
  return chosen_line

@client.command()

async def gen1(ctx):
    line = pop_random_line()
    await ctx.send(line)

Try with this exact code, your code you posted there has errors

#

And even if it doesn’t work like this, the other code still isn’t correct and you shouldn’t revert back to it

shrewd condor
shell wing
#
@commands.command()
    async def continents(self, ctx):
        continent = discord.Embed(
            title=f'Get your continent role here',
            color=0x530101,
            description=
            " ![1one](https://cdn.discordapp.com/emojis/938060649215459379.webp?size=128 "1one") <@&934015812203855933> \n  ![2two](https://cdn.discordapp.com/emojis/938060706731946015.webp?size=128 "2two") <@&934016254472224809> \n   ![3three](https://cdn.discordapp.com/emojis/938060801154117662.webp?size=128 "3three") <@&934016343995473920> \n  ![4four](https://cdn.discordapp.com/emojis/938061487841349654.webp?size=128 "4four") <@&934016472391483412>"
        )
.......

Error

Ignoring exception in command continents:
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/runner/new-server/continent.py", line 52, in continents
    await ctx.send(embed=continent, components=continent)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord_slash/dpy_overrides.py", line 323, in send_override
    return await send(channel, *args, **kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord_slash/dpy_overrides.py", line 234, in send
    embed = embed.to_dict()
AttributeError: 'list' object has no attribute 'to_dict'
vital steeple
#

my !gen1 doesnt work at all when you type it nothing happens
`@client.command()

async def pop_random_line():
''' picks a random line from a file, then deletes the line '''
with open("keys.txt", "r") as file:
lines = file.readlines()

chosen_index = random.randrange(0, len(lines))
chosen_line = lines[chosen_index]

with open("keys.txt", "w") as file:
del lines[chosen_index]
file.writelines(lines)

return chosen_line

@client.command()

async def gen1(ctx):
line = pop_random_line()
await ctx.send(line)`

dense vortex
vital steeple
#

my code runs fine but when you type the command it doest work

tough trellis
#

how would i get a guilds set vanity url with the id?

sick birch
worldly bane
misty ridge
#

is it possible to format text in RichEmbed description?

#

like making it bold or underline

worldly bane
misty ridge
#

just use normal discord formatting?

worldly bane
#

yes

misty ridge
#

like "`"

worldly bane
#

like this
*like this*

rancid stump
#

how to take ss of a website using python ???

just like alpha bot which is available in different crypto discord server which take ss of trading view i want thing

can anyone guide me how it can be possible ?

misty ridge
quick gust
#

just google it

worldly bane
rancid stump
#

i want a portion of it

sudden laurel
#

Crop the image

slate swan
#

What's this?

stone beacon
#

🤣 what the

#

I'd conclude that discord doesn't want anyone screenshotting anything using an api

#

Given the ban in the <p>tag

slate swan
#

Can we see our bot's dms for who dmed it what?

alpine furnace
#

Yes

worldly bane
slate swan
#

How?

worldly bane
alpine furnace
#

!d discord.Client.private_channels

unkempt canyonBOT
#

property private_channels```
The private channels that the connected client is participating on.

Note

This returns only up to 128 most recent private channels due to an internal working on how Discord deals with private channels.
slate swan
slate swan
slate swan
#

I can't host my bot

worldly bane
slate swan
#

Ok

alpine furnace
worldly bane
alpine furnace
#

Ip ratelimited easily

slate swan
#

Ok thanks

slate swan
slate swan
slate swan
cosmic agate
#

2022-03-16T06:20:52.541813+00:00 app[worker.1]: Traceback (most recent call last):
2022-03-16T06:20:52.541840+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/nextcord/ext/commands/bot.py", line 1052, in invoke
2022-03-16T06:20:52.541841+00:00 app[worker.1]: await ctx.command.invoke(ctx)
2022-03-16T06:20:52.541855+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/nextcord/ext/commands/core.py", line 933, in invoke
2022-03-16T06:20:52.541856+00:00 app[worker.1]: await injected(*ctx.args, **ctx.kwargs)
2022-03-16T06:20:52.541870+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/nextcord/ext/commands/core.py", line 177, in wrapped
2022-03-16T06:20:52.541870+00:00 app[worker.1]: raise CommandInvokeError(exc) from exc

#
embed.add_field(f"Giveaway ends in {time}")
#

help

#

@worldly bane sorry for ping

#

👋🏼

worldly bane
#

wait

cosmic agate
#

ok

slate swan
#

how to make prefix so it works in both uppercase and lowercase

cosmic agate
worldly bane
slate swan
worldly bane
worldly bane
#

^

#

the embeds tho 💀

alpine furnace
#

That shit's too expensive, go on lowendtalk

#

$10/year vps

worldly bane
#

go to core hosting its free 🤷‍♂️

#

just low stats

alpine furnace
#

Link?

#

Put <> around each link

boreal ravine
worldly bane
upbeat otter
#

Imagine making a bot just to set users up....

cosmic agate
#

guys

alpine furnace
#

.cf

worldly bane
boreal ravine
worldly bane
#

I just used it for my personal bot

worldly bane
cosmic agate
#

2022-03-16T06:38:49.473976+00:00 app[worker.1]: Traceback (most recent call last):
2022-03-16T06:38:49.473994+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/nextcord/ext/commands/core.py", line 168, in wrapped
2022-03-16T06:38:49.473994+00:00 app[worker.1]: ret = await coro(*args, **kwargs)
2022-03-16T06:38:49.474003+00:00 app[worker.1]: File "/app/main.py", line 506, in gcreate
2022-03-16T06:38:49.474004+00:00 app[worker.1]: users = await gaw_msg.reactions[0].users().flatten()
2022-03-16T06:38:49.474025+00:00 app[worker.1]: IndexError: list index out of range
2022-03-16T06:38:49.474038+00:00 app[worker.1]:

    gaw_msg = await ctx.send(embed=embed)
    await gaw_msg.add_reaction("🎉")
    await asyncio.sleep(gaw_time)

    new_gaw_msg = await ctx.channel.fetch_message(gaw_msg.id)

    users = await gaw_msg.reactions[0].users().flatten()
alpine furnace
#

Probably just some random kid running a hosting service on his gaming pc that his parents bought

cosmic agate
#

who me?

alpine furnace
upbeat otter
boreal ravine
#

the message doesn't have any reactions

cosmic agate
#

it had 3

upbeat otter
#

asyncio.sleep 😔

worldly bane
#

😔

cosmic agate
#

??

worldly bane
cosmic agate
#

wait ill try again

upbeat otter
worldly bane
#

kek

boreal ravine
upbeat otter
boreal ravine
maiden fable
boreal ravine
#

I use time.sleep for a mute command

upbeat otter
#

😔

raven matrix
#

How to make Discord bot on python IDLE?

maiden fable
maiden fable
cosmic agate
#

XD

cosmic agate
boreal ravine
raven matrix
#

Yes but how to import Discord module?

boreal ravine
raven matrix
#

Ok thanks

boreal ravine
#

\🙂

upbeat otter
maiden fable
tawdry perch
#

discord bots are just too boring

flat solstice
#

Is there a way to check if a member is in cache?
Is the help command stored in cache? I'm thinking of making a func for my website which fills in my help command based on the results of the help command in the bot, saves me writing out by hand and needing to update it each time something changes

slate swan
#

Guild.get_member will get you a member object if it's in Cache, else it would be None

#

and for the help command thing , consider making a dynamic help command using commands.HelpCommand instead of manually creating it

#

And implementation something similar in your web

raven matrix
flat solstice
slate swan
#

help command is nothing related to the API , so it's not an API call

flat solstice
#

what about slash commands? since they get registered with discord

boreal ravine
flat solstice
raven matrix
green veldt
#

im getting this in my bot's repl

   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.```
boreal ravine
#

or you could do ```py
member = guild.get_member(...) or await guild.fetch_member(...)

green veldt
boreal ravine
#

well read the warning

green veldt
#

i didnt understand what that means ;/

flat solstice
# green veldt i didnt understand what that means ;/
green veldt
#

ok thanks

final shard
#

how do u get authors guild icon

dense swallow
#

authors icon or guild icon?

final shard
#

guild icon

#

url btw

dense swallow
#

ctx.guild.icon.url if ur using 2.0 or forks icon_url if ur using dpy 1.7.3

cloud dawn
#

!d discord.Guild.icon

unkempt canyonBOT
final shard
#

i see

cloud dawn
#

icon_url seems to return an asset tough

dense swallow
#

thats in 1.7.3

#

it was changed in 2.0

rocky hornet
#

i have a small design question.

ctx.respond.success("No problems")
ctx.success("No problems")
ctx.respond("No problems", "success")
ctx.respond("No problems", Color.SUCCESS)

in all examples success solely defines embed color. what is a better approach?

cloud dawn
dense swallow
#

how do i get the channel where the msg was edited using the event:

async def on_message_edit(msg)
dense swallow
#

oh yeah.. but how do i get the channel

cloud dawn
dense swallow
#

example: msg was edited in {channel}

cloud dawn
dense swallow
#

so for on_message_delete(msg), ig its just msg.channel?

cloud dawn
#

It's ```py
async def on_message_edit(before, after)

dense swallow
#

also how do i get the modlogs channel id from this?

    async def get_logs_channel(self, guild_id, channel_id):
        data = self.bot.db.execute("SELECT channel_id FROM modlogs WHERE guild_id=$1, channel_id=$2", guild_id, channel_id)
slate swan
#

!d discord.Message.author

unkempt canyonBOT
slate swan
final shard
#

tru'

upbeat otter
maiden fable
hoary cargo
hoary cargo
#

It's possible though to do a workaround for infinite buffgleep

boreal ravine
slate swan
#

I was making a bot but got invalid syntax what have i done wrong

            for i in range(amount):
                rand = random.randint(1, 2)
                print(rand)
                print("A")
                if rand == 1:
                    print("fourtune")
                    whatugot.append(random.choice(pickaxes)
                    pickaxesadd += 1
                    


                if rand == 2:
                    whatugot.append(random.choice(fourtunes)
                     fourtunesadd += 1
                    
            print(whatugot)
boreal ravine
slate swan
#

ohhhhh

fluid spindle
#

at both appends

slate swan
#

ty

fluid spindle
oblique adder
#

How do I make a handler for BotMissingPermissions in try except /
//nextcord

dense swallow
#

how do i get person who banned and who got banned names/avatars using on_member_ban?

cold oyster
#

How do I send a message to a member

dense swallow
#

member.send

cold oyster
#

Ah Im still UwU

#

I cant change

cold oyster
dense swallow
#

it takes in guild and user

cold oyster
#

Idk

sage otter
#

When that event fires you can see who got banned and iterate through audit log entires until you see the latest banentry for that user and break

dense swallow
dense swallow
#

this doesnt take in ctx

cold oyster
dense swallow
#

!d discord.on_member_ban

unkempt canyonBOT
#

discord.on_member_ban(guild, user)```
Called when user gets banned from a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").

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

Oh actually nvm then. You can’t by doing that.

rocky hornet
cold oyster
#

If It was my case I would use

@client.command()
async def ban(ctx, member : discord.Member, *, reason=None):
    await member.send(f"You have been banned in {ctx.guild.name} for {reason}")
    await member.ban(reason=reason)
    await ctx.send(f"{member.mention} has been banned by {ctx.author.mention} for {reason}")```
dense swallow
#

so what about getting timestamp of that?

dense swallow
maiden fable
#

😔 I will just go away

cold oyster
maiden fable
# cold oyster Wa happen

Eh, someone has used yr name a bit too much with me that I have started to hate that word 🤣

cold oyster
maiden fable
#

Not talking about u

#

Some friend hehe

dense swallow
#

he said he dont like the word "uwu"

#

am i right?

cold oyster
#

Reee

maiden fable
dense swallow
#

uhh

cold oyster
#

I cannot change my name

maiden fable
#

I don't hate him/her or smth, I don't even know them hahaha

cold oyster
#

Sorry to say this but-

#

!rule 7

unkempt canyonBOT
#

7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.

maiden fable
#

I was going to play Apex anyways ¯_(ツ)_/¯

terse blade
#

user.mention dosent mention user and sends phat error

supple thorn
terse blade
#
Traceback (most recent call last):
  File "C:\Users\hustl\AppData\Local\Programs\Python\Python39\lib\site-packages\disnake\ext\commands\slash_core.py", line 597, in invoke
    await call_param_func(self.callback, inter, self.cog, **kwargs)
  File "C:\Users\hustl\AppData\Local\Programs\Python\Python39\lib\site-packages\disnake\ext\commands\params.py", line 778, in call_param_func
    return await maybe_coroutine(safe_call, function, **kwargs)
  File "C:\Users\hustl\AppData\Local\Programs\Python\Python39\lib\site-packages\disnake\utils.py", line 561, in maybe_coroutine
    return await value
  File "D:/Discord BOT/main.py", line 18, in slap
    await ctx.send(f'{ctx.author.mention} slaps {user.mention}!')
AttributeError: 'str' object has no attribute 'mention'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\hustl\AppData\Local\Programs\Python\Python39\lib\site-packages\disnake\ext\commands\interaction_bot_base.py", line 1332, in process_application_commands
    await app_command.invoke(interaction)
  File "C:\Users\hustl\AppData\Local\Programs\Python\Python39\lib\site-packages\disnake\ext\commands\slash_core.py", line 606, in invoke
    raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'str' object has no attribute 'mention'```
quick gust
#

typehint user to discord.Member

supple thorn
#

Or did you just

terse blade
quick gust
#

also rename your user argument to member because it's confusing otherwise since discord.User exists

supple thorn
terse blade
#

yes

supple thorn
#

Yes

#

Also listen to infernum

#

Do member

terse blade
#
  File "D:/Discord BOT/main.py", line 17, in <module>
    async def slap(ctx, user: discord.Member):
  File "C:\Users\hustl\AppData\Local\Programs\Python\Python39\lib\site-packages\disnake\ext\commands\interaction_bot_base.py", line 491, in decorator
    result = slash_command(
  File "C:\Users\hustl\AppData\Local\Programs\Python\Python39\lib\site-packages\disnake\ext\commands\slash_core.py", line 677, in decorator
    return InvokableSlashCommand(
  File "C:\Users\hustl\AppData\Local\Programs\Python\Python39\lib\site-packages\disnake\ext\commands\slash_core.py", line 367, in __init__
    options = expand_params(self)
  File "C:\Users\hustl\AppData\Local\Programs\Python\Python39\lib\site-packages\disnake\ext\commands\params.py", line 787, in expand_params
    _, inter_param, params, injections = collect_params(command.callback)
  File "C:\Users\hustl\AppData\Local\Programs\Python\Python39\lib\site-packages\disnake\ext\commands\params.py", line 699, in collect_params
    paraminfo = ParamInfo.from_param(parameter, {}, doc)
  File "C:\Users\hustl\AppData\Local\Programs\Python\Python39\lib\site-packages\disnake\ext\commands\params.py", line 385, in from_param
    self.parse_annotation(type_hints.get(param.name, param.annotation))
  File "C:\Users\hustl\AppData\Local\Programs\Python\Python39\lib\site-packages\disnake\ext\commands\params.py", line 529, in parse_annotation
    raise TypeError(f"{annotation!r} is not a valid parameter annotation")
TypeError: <class 'discord.member.Member'> is not a valid parameter annotation```
supple thorn
#

Did you do member: discord.member.Member?

placid skiff
supple thorn
quick gust
terse blade
#
  File "D:/Discord BOT/main.py", line 17, in <module>
    async def slap(ctx, member: discord.Member):
  File "C:\Users\hustl\AppData\Local\Programs\Python\Python39\lib\site-packages\disnake\ext\commands\interaction_bot_base.py", line 491, in decorator
    result = slash_command(
  File "C:\Users\hustl\AppData\Local\Programs\Python\Python39\lib\site-packages\disnake\ext\commands\slash_core.py", line 677, in decorator
    return InvokableSlashCommand(
  File "C:\Users\hustl\AppData\Local\Programs\Python\Python39\lib\site-packages\disnake\ext\commands\slash_core.py", line 367, in __init__
    options = expand_params(self)
  File "C:\Users\hustl\AppData\Local\Programs\Python\Python39\lib\site-packages\disnake\ext\commands\params.py", line 787, in expand_params
    _, inter_param, params, injections = collect_params(command.callback)
  File "C:\Users\hustl\AppData\Local\Programs\Python\Python39\lib\site-packages\disnake\ext\commands\params.py", line 699, in collect_params
    paraminfo = ParamInfo.from_param(parameter, {}, doc)
  File "C:\Users\hustl\AppData\Local\Programs\Python\Python39\lib\site-packages\disnake\ext\commands\params.py", line 385, in from_param
    self.parse_annotation(type_hints.get(param.name, param.annotation))
  File "C:\Users\hustl\AppData\Local\Programs\Python\Python39\lib\site-packages\disnake\ext\commands\params.py", line 529, in parse_annotation
    raise TypeError(f"{annotation!r} is not a valid parameter annotation")
TypeError: <class 'discord.member.Member'> is not a valid parameter annotation```

thats it type hinted
slate swan
supple thorn
placid skiff
#

bruh why discord.member.Member, just discord.Member

cold oyster
#

How do I make my bot detect if the user is a bot

timid wagon
#

The typehint is visible in the error

slate swan
#

discord.Member is fine as dpy has an initiate file for name spaces

placid skiff
supple thorn
#

Yeah it's only discord.Member

unkempt canyonBOT
timid wagon
#

And it's not discord.member.Member

cold oyster
#

ok

terse blade
#

so can i be helped?

supple thorn
cold oyster
supple thorn
#

\🗿

supple thorn
terse blade
supple thorn
#

You aren't reading

supple thorn
terse blade
#

all I read was rguments

cold oyster
#

🗿

terse blade
#

arguments about discord.member.Member

supple thorn
#

Oh

#

You're ducking disnake

supple thorn
placid skiff
terse blade
west phoenix
#

hey

supple thorn
west phoenix
#

in vds

#

It works fine on my computer.

supple thorn
#

Virtual dedicated server?

west phoenix
#

yea

#

done 👍

boreal ravine
#

show the full error

placid skiff
slate swan
#
An exception has occurred while executing command `mine`:
Traceback (most recent call last):
  File "C:\Users\turne.DESKTOP-8B1DN4C\AppData\Local\Programs\Python\Python39\lib\site-packages\discord_slash\client.py", line 1353, in invoke_command
    await func.invoke(ctx, **args)
  File "C:\Users\turne.DESKTOP-8B1DN4C\AppData\Local\Programs\Python\Python39\lib\site-packages\discord_slash\model.py", line 210, in invoke
    return await self.func(*args, **kwargs)
  File "C:\Users\turne.DESKTOP-8B1DN4C\OneDrive\Desktop\Dogeminer\main.py", line 89, in mine
    with open('storage.json', 'w') as f:
TypeError: 'BaseCommandObject' object is not callable
#
        if chance_for_rock <= chance_radius:
            users[str(ctx.author.id)]["rocksmined"] += 1
            rocksmined += 1
            
        with open('storage.json', 'w') as f:
            json.dump(users, f)
#

eh

inner epoch
#

Hey guys my bot just passed 75 servers and I got pm to verify but am facing this error

#

How to overcome it?Where should I insert the link?

#

Yea Ik but I mean where should I put the link?

#

Its asking me to put the link somewhere

#

See in the pic I sent

#

Its saying you are missing invite link....

slate swan
inner epoch
#

Nvm man I guess you aint getting what its trying to convey

slate swan
#

he means that i think

#

thats the invite link you need that to verify

inner epoch
slate swan
#
An exception has occurred while executing command `mine`:
Traceback (most recent call last):
  File "C:\Users\turne.DESKTOP-8B1DN4C\AppData\Local\Programs\Python\Python39\lib\site-packages\discord_slash\client.py", line 1353, in invoke_command
    await func.invoke(ctx, **args)
  File "C:\Users\turne.DESKTOP-8B1DN4C\AppData\Local\Programs\Python\Python39\lib\site-packages\discord_slash\model.py", line 210, in invoke
    return await self.func(*args, **kwargs)
  File "C:\Users\turne.DESKTOP-8B1DN4C\OneDrive\Desktop\Dogeminer\main.py", line 89, in mine
    with open('storage.json', 'w') as f:
TypeError: 'BaseCommandObject' object is not callable
``` how do i fix this?
#

dme me @inner epoch i got a vid for u

inner epoch
#

No I never had any bot invite link ever

#

I just shared the link by creating from oauth and from there people invited

slate swan
#

can someone help me???

gaunt ice
#

wha u need m8

slate swan
#

```An exception has occurred while executing command mine:
Traceback (most recent call last):
File "C:\Users\turne.DESKTOP-8B1DN4C\AppData\Local\Programs\Python\Python39\lib\site-packages\discord_slash\client.py", line 1353, in invoke_command
await func.invoke(ctx, **args)
File "C:\Users\turne.DESKTOP-8B1DN4C\AppData\Local\Programs\Python\Python39\lib\site-packages\discord_slash\model.py", line 210, in invoke
return await self.func(*args, **kwargs)
File "C:\Users\turne.DESKTOP-8B1DN4C\OneDrive\Desktop\Dogeminer\main.py", line 89, in mine
with open('storage.json', 'w') as f:
TypeError: 'BaseCommandObject' object is not callable

gaunt ice
#

hmm

slate swan
#

It worked before

swift monolith
#

what if i want to input something in this format
hi

#

it doesnt work and just gives the text

gaunt ice
#

hm

#

``

uncut portal
#

Could you show us your code?

swift monolith
#

its in a password generator and the special characters sometimes make it italics so i tried to append "``" to either side but it gives this

#;##@@,.(@s.;(,@.#(h:&%$%>-;_+^<(#u(%!,h>-p<i@&%#i$.,;:<;^=+(,o$^<i>%^.#$.^)!>+#&>=^<,!.#$3&.%.&>::>b^^

uncut portal
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.

swift monolith
#

oh wait the text bbroke

slate swan
#
        if chance_for_rock <= chance_radius:
            users[str(ctx.author.id)]["rocksmined"] += 1
            rocksmined += 1
            

        embed = discord.Embed(description=f"{ctx.author.mention} Mined!",color=0xf8fd08)
        embed.set_thumbnail(url="https://upload.wikimedia.org/wikipedia/en/d/d0/Dogecoin_Logo.png")
        embed.add_field(name="Amount :", value=f"{money}Ɖ" , inline=True)
        with open('storage.json', 'w') as f:
            json.dump(users, f)
        if chance_for_rock <= chance_radius:
            embed.add_field(name=f"Dude, you mined a rock! You now have {rocksmined}:rock:", value="⠀", inline=False)
            
        await ctx.send(embed=embed)
    else:
        embed = discord.Embed(description=f"Oops, cooldown! you need to wait {round(cooldown - time.perf_counter(), 2)} Seconds! WOW")
        embed.set_thumbnail(url="https://upload.wikimedia.org/wikipedia/en/d/d0/Dogecoin_Logo.png")
        await ctx.send(embed=embed)
gaunt ice
#

hm

swift monolith
#

this is how im adding it

slate swan
#

@swift monolithis that a bot?

oblique adder
#

How do I make a handler for BotMissingPermissions in try except /
//nextcord

swift monolith
#

yes it is in a bot code

slate swan
#

i helped him out

swift monolith
#

when sending in dms it doesnt put in that formatting

#

ohhh i forgot to remove it thanks

slate swan
gaunt ice
#

I'm bad with json

#

I'm sry