#discord-bots

1 messages · Page 951 of 1

bitter perch
#

so the answer is no

lone hare
#

i dont care lol

maiden fable
#

Then don't expect getting help here

lone hare
#

whyy

maiden fable
#

Cz it's against ToS (:

lone hare
#

i want to interact with other bot

#

what is the issue

bitter perch
#

go reverse engineer the interactions api

#

don't expect help here

sonic lintel
sonic lintel
#

@bitter perch Can you please help me still with the code in my main.py

lone hare
#

see like this bot is having 2 buttons

#

<- and ->

#

i wanna click that thing with bot

bitter perch
#

yeah that's cool, click it yourself

lone hare
#

no

#

wanna do in bulk

maiden fable
#

That's known as s p a m

lone hare
#

i want to use some code for it

lone hare
maiden fable
#

Stop it, u won't get help here anyways lemon_pensive

bitter perch
#

because it's against discord tos

lone hare
#

it is not

bitter perch
#

it literally is

maiden fable
#

How many times we gotta tell u dude

bitter perch
#

automating the api in any way is against terms of service

lone hare
#

i dont have any issues with bot token

maiden fable
#

Using a user token in anything is against ToS

bitter perch
#

<@&831776746206265384>

lone hare
#

?

#

but i have a lot of bot tokens

maiden fable
#

We have told u multiple times but u dont want to hear it, so Mods will tell u themselves in their way 🤷‍♂️

lone hare
#

discord gives

#

what do you mean

sonic lintel
#

@slate swan helped me with the code but there is a new error

" File "/Users/alanabeaton/Avery Bot/main.py", line 25, in <module>
bot = MyBot(command_prefix='avery ', case_insensitive=True, help_command=None)
File "/Users/alanabeaton/Avery Bot/main.py", line 10, in init
super().init(*args, *kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 167, in init
self.__tree: app_commands.CommandTree[Self] = tree_cls(self) # type: ignore
TypeError: 'str' object is not callable"

maiden fable
#

In short, stop asking for help related to user tokens

lone hare
#

bot tokens

sonic lintel
#

from curses.panel import bottom_panel
from distutils import command
import discord
import os
from discord.ext import commands,tasks
from discord.ext.commands import has_permissions, CheckFailure

class MyBot(commands.Bot):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, *kwargs)

    async def setup_hook(self):
            for ext in ['cogs.ModerationCog', 'cogs.CommandEvents', 'cogs.HelpCommandCog', 'cogs.UtilitiesCog', 'cogs.FunCog']:
                await self.load_extension(ext)

    async def on_command_error(self, ctx, error):
        if isinstance(error, commands.MissingRequiredArgument):
            await ctx.send('**Please type in the full command ** ')
        if isinstance(error, commands.MissingPermissions):
            await ctx.send("**You dont have all the requirements necessary to run this command :angry:**")

    def run(self):
        super().run("Your token!")
    
bot = MyBot(command_prefix='avery ', case_insensitive=True, help_command=None)```
tall dust
#

@lone hare please don't ask for help with botting user accounts, that breaks discord's TOS

lone hare
sonic lintel
sonic lintel
maiden fable
#

Weird, I don't see any issue

slate swan
#

weird error tbh it seems like it was raised internally

sonic lintel
#

yeah

#

How should we fix it?

maiden fable
bitter perch
#

do you have the full traceback

maiden fable
#

Stop with yr weird emojis

sonic lintel
#

/usr/local/bin/python3 "/Users/alanabeaton/Avery Bot/main.py"
alanabeaton@sonic lintels-Air Avery Bot % /usr/local/bin/python3 "/Users/alanabeaton/Avery Bot/main.py"
Traceback (most recent call last):
File "/Users/alanabeaton/Avery Bot/main.py", line 25, in <module>
bot = MyBot(command_prefix='avery ', case_insensitive=True, help_command=None)
File "/Users/alanabeaton/Avery Bot/main.py", line 10, in init
super().init(*args, *kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 167, in init
self.__tree: app_commands.CommandTree[Self] = tree_cls(self) # type: ignore
TypeError: 'str' object is not callable

bitter perch
#

but tree_cls is somehow a string

maiden fable
#

Also, remove the init method since u ain't really doing anything in it

slate swan
#

shes passing all the arguments lol

bitter perch
#

no

maiden fable
#

w h a t

#

bruh 😐

bitter perch
#

it's literally just calling the parent init

slate swan
#

with the arguments getting passed?

sonic lintel
#

when I removed it this was the error

#

/usr/local/bin/python3 "/Users/alanabeaton/Avery Bot/main.py"
alanabeaton@sonic lintels-Air Avery Bot % /usr/local/bin/python3 "/Users/alanabeaton/Avery Bot/main.py"
Traceback (most recent call last):
File "/Users/alanabeaton/Avery Bot/main.py", line 24, in <module>
bot.run('token removed')
TypeError: run() takes 1 positional argument but 2 were given

bitter perch
sonic lintel
slate swan
#

in the subclass i only added one param

bitter perch
#

and how are you calling the eventual run

sonic lintel
slate swan
#

the overwritting run method doesnt 2 positional arguments only self

sonic lintel
#

bot.run('thebotstoken')

slate swan
#

you needed to pass the token in the method of the subclass lol

slate swan
bitter perch
#

yes you just downgraded versions

sonic lintel
#

How do I update versions then?

slate swan
slate swan
unkempt canyonBOT
#

discord/ext/commands/bot.py line 159

tree_cls: Type[app_commands.CommandTree[Any]] = app_commands.CommandTree,```
sonic lintel
slate swan
#

and I don't see them doing that in their code

maiden fable
#

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

sonic lintel
#

still the same error

slate swan
#

great, so not it's updated

#

*now

maiden fable
#

Yea

maiden fable
#

Just do bot.run() now, don't do bot.run(token)

sullen pewter
#

can someone pls help me?

sonic lintel
#

/usr/local/bin/python3 "/Users/alanabeaton/Avery Bot/main.py"
alanabeaton@sonic lintels-Air Avery Bot % /usr/local/bin/python3 "/Users/alanabeaton/Avery Bot/main.py"
Traceback (most recent call last):
File "/Users/alanabeaton/Avery Bot/main.py", line 25, in <module>
bot = MyBot(command_prefix='avery ', case_insensitive=True, help_command=None)
File "/Users/alanabeaton/Avery Bot/main.py", line 10, in init
super().init(*args, *kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 167, in init
self.__tree: app_commands.CommandTree[Self] = tree_cls(self) # type: ignore
TypeError: 'str' object is not callable

slate swan
#

i would check src on how the error was raised but i turned off my pcnotlikeduck

sonic lintel
#
from curses.panel import bottom_panel
from distutils import command
import discord
import os
from discord.ext import commands,tasks
from discord.ext.commands import has_permissions, CheckFailure

class MyBot(commands.Bot):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, *kwargs)

    async def setup_hook(self):
            for ext in ['cogs.ModerationCog', 'cogs.CommandEvents', 'cogs.HelpCommandCog', 'cogs.UtilitiesCog', 'cogs.FunCog']:
                await self.load_extension(ext)

    async def on_command_error(self, ctx, error):
        if isinstance(error, commands.MissingRequiredArgument):
            await ctx.send('**Please type in the full command ** ')
        if isinstance(error, commands.MissingPermissions):
            await ctx.send("**You dont have all the requirements necessary to run this command :angry:**")

    def run(self):
        super().run("my bots token")

bot = MyBot(command_prefix='avery ', case_insensitive=True, help_command=None)    
bot.run()```
maiden fable
#

Did u try asking in dpy server?

sonic lintel
#

no

maiden fable
#

Prolly a bug

sonic lintel
#

probably

#

thank you all

slate swan
light violet
#

I need helps in cogs i connected it btw still noy getting any response from it how to solve this

wide thunder
#

what you want

sonic lintel
maiden fable
#

Huh?

thorn field
#

@cool.command(name='unban')
async def unban(ctx, *, member):
banned_users - await ctx.guild.bans()
member_name, member_discrimnator - member.split('#')

for ban_entry in banned_users:
    user = ban_entry.user
    if (user.name, user.discriminator) == (member_name, member_discriminator):
        await ctx.guild.unban(user)
        await ctx.send(f"Unbanned {user}")
        return

NameError: name 'banned_users' is not defined

light violet
#

Hey i am having cogs prob pls help

maiden fable
#

Code

thorn field
#

what

maiden fable
#

U copied that from Lucas?

thorn field
#

no

maiden fable
#

Then

thorn field
#

web

maiden fable
thorn field
#

i prob couldve made myself but i was too lazy lol

maiden fable
#

Just do await ctx.guild.unban(discord.Object(user_id))

#

It's that easy

thorn field
#

ok

slate swan
dusky pine
#

in the definition of banned_users

light violet
#

I hav loaded cogs btw it is not working. Why?

gaunt ice
light violet
#

Its too long lawl w8

gaunt ice
#

!pastebin

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.

spice adder
#

I'm trying to set up slash commands, but nothing was showing up. So to make sure I wasn't doing anything wrong, I tried the template:

@tree.command(guild=discord.Object(id=507364684924452896))
async def slash(interaction: discord.Interaction, number: int, string: str):
    await interaction.response.send_message(f'{number=} {string=}', ephemeral=True)

But nothing is showing up. No errors, no nothing

light violet
#

H

maiden fable
#

Sad

granite parcel
#

Can I Make this User Banned But Message not sent

lament mesa
granite parcel
heavy folio
supple thorn
sonic lintel
#

Im having an issue with cogs with disnake. The cogs don't seem to be loading at all or something because I'm getting no messages in the terminal at all and its just not working.

sonic lintel
#
from curses.panel import bottom_panel
from distutils import command
import disnake
import os
from disnake.ext import commands,tasks
from disnake.ext.commands import has_permissions, CheckFailure


bot = commands.Bot(command_prefix='avery ', case_insensitive=True, help_command=None)
bot.remove_command('help')

@bot.event
async def on_command_error(ctx, error):
    if isinstance(error, commands.MissingRequiredArgument):
        await ctx.send('**Please type in the full command ** ')
    if isinstance(error, commands.MissingPermissions):
        await ctx.send("**You dont have all the requirements necessary to run this command :angry:**")


extensions = ['cogs.ModerationCog', 'cogs.CommandEvents', 'cogs.HelpCommandCog', 'cogs.UtilitiesCog', 'cogs.FunCog']

if __name__ == '__main__':
    for ext in extensions:
       bot.load_extension(ext)

bot.run('')```
granite parcel
#

is there any way to make unbanall comand

sonic lintel
#

Just doesn't do anything

granite parcel
#

? how

light violet
maiden fable
#

@sonic lintel was that issue fixed?

light violet
#

How to fix

slate swan
maiden fable
slate swan
#

^

light violet
#

Ok ok

slate swan
#

nvmd

granite parcel
light violet
#

@slate swan cant await @maiden fable out side

vale wing
#

Make your setup functions async as well

#

Not sure how to load extensions without subclassing the bot now

vale wing
#

And yeah forth

#

Add this to your error handler

else:
    raise error```
#

That's why you aren't getting any errors

lyric apex
#

!d

maiden fable
#

I got a ghost ping

boreal ravine
# granite parcel ? how

Iterate through discord.Guild.bans using async for and unban them by doing await guild.unban(discord.Object(id=...)) ```py
async for entry in guild.bans():
...

light violet
#

How to fix this then@vale wing

boreal ravine
light violet
#

Using disnake

light violet
boreal ravine
light violet
#

No

#

Only disnake

boreal ravine
#

show me the cog

light violet
#

Its too large

#

Its of an antinuke

boreal ravine
#

doesn't only d.py do that

light violet
#

I tried without awaiting cogs

#

What should i do to fix them

#

In disnake

boreal ravine
#

show me the start of the class

light violet
#

Ok antinuke?

boreal ravine
#

yes?

light violet
#

@boreal ravine

boreal ravine
light violet
#

Ok

#

Btw i imported discord there@boreal ravine

boreal ravine
#

you don't need to ping me everytime

light violet
#

Ok

#

Should i import disnake there too?

boreal ravine
#

no

#

just show me your imports

light violet
#

Ok

#

Pls reply so that i can know that you're reading

boreal ravine
#

??

light violet
#

I imported so that i can add there buttonsto cmds

#

Buttons*

boreal ravine
#

d.py already has buttons

light violet
#

No replit doesnt identify discord.ui module as discord is of 1.7.3 version and if i install dpy v2 also after sometimes idk why replit dels all the imported packaged its replit problem and then again i have to manually install dpy v2

#

I cant run the bot till i installed dpy v2 for 10 mins

#

@boreal ravine cant i import cogs from disnake?

boreal ravine
boreal ravine
light violet
#

Load*

boreal ravine
#

yes

slate swan
#

is there a way i can use with open and open 2 files (not at once) then read both and do an if statement like this:

if ctx.author.id not in first_file and second_file:

boreal ravine
light violet
#

No i would host it on heroku

#

Btw for experiments i am using replit

boreal ravine
light violet
#

How to solve this error of cogs wuth disnake

gilded gust
#

Hi, I'm making a discord bot and I need a way to edit a text channel so that only a specific user will be able to see it. I would give the user a role which can access the channel, but I need it such that other users are unable to tell which channel every user has access to

slate swan
#

obviously the second line is wrong, but what are the correct words for it? and what would i have to add

boreal ravine
boreal ravine
slate swan
#

are u sure the str must be there at the start?

#

youre making a.read() a string

boreal ravine
#

yes

slate swan
#

why so?

boreal ravine
#

i think it returns a string though so no need to cast

boreal ravine
slate swan
#

alright ill try this

slate swan
#

idk if variable is the correct word for it

#
with open("file1.txt", "r") as a, with open("file2.txt", "r") as b:
#

something like this? maybe

boreal ravine
slate swan
#

that still uses with open() right?

boreal ravine
#

no

slate swan
#

oh.

#

i need to choose the modes tho, like append, write, read

boreal ravine
#

then specify them, open(PATH, "r")

slate swan
#

alright

slate swan
boreal ravine
#

yes

slate swan
#

ok thx

boreal ravine
#

👍

boreal ravine
#

try it and see

somber sky
#

for some reason, to run the command the User needs to have permissions

#

shouldn't it be the person who executes the command?

slate swan
#

the command author needs the permission to run the command

slate swan
somber sky
#

nahh i realized why

#

i was trying to give a role thats above me

slate swan
#

but, well if your bot doesnt even have the permissions to give a role then it wont work

somber sky
#

so it didnt work

somber sky
#

lmfao

slate swan
#

and if i do 5: then it lets there be 6 until it doesnt allow me to

boreal ravine
#

whats 4:

slate swan
#
if str(a.read()).count(str(ctx.author)) > 4:
boreal ravine
#

use >=, it checks if x is bigger or equal to y

slate swan
#

alright, ima try that

slate swan
#

honestly youre probably the person that has helped me the most here everyone else started telling me to use json, databases and dictionaries and other stuff

hot cobalt
slate swan
#

yeah, i used that it worked fine for me

somber sky
#

is it possible to make every command on a bot use slash commands? pretty much every command on ur bot has a slash command to it to

vale wing
#

Just add different decorators

#

Context and Interaction share most of their attributes besides some so I'd suggest creating separate commands instead of doing multiple decorators on a single function

somber sky
hoary cargo
#

Just take the message and store it into a variable
Then send it to another channel

light violet
#

What is the defination of async function

rain flame
#
app = FastAPI()
bot = discord.Client()
bot = commands.Bot(command_prefix='!')

@app.on_event("startup")
async def startup_event(): 
    asyncio.create_task(bot.start(discordTOKEN))
    await asyncio.sleep(4) 
    print(f"{bot.user} has connected to Discord!")


for filename in os.listdir('./cogs'):
    if filename.endswith('.py'):
        bot.load_extension(f'cogs.{filename[:-3]}')


@app.get("/")
async def hello():
    return "Welcome to Pikachu Pricer. Made by @Johnny Black#6363"``` anyone here knows why !ping doesnt work here?
somber sky
#

is there another way to make a slash command only visible to you other then ephemeral=true

rain flame
#
    async def ping(self, ctx: commands.Context):
        print("Checking the bot's current websocket latency.")
        embed=discord.Embed(title=":ping_pong: Pong! :ping_pong:", description=f"{round(self.bot.latency * 1000)}ms", colour=000000)
        await ctx.message.delete()
        await ctx.send(embed=embed)
        print("Sent the bot's current websocket latency.")```
somber sky
#

is there another way to make a slash command only visible to you other then ephemeral=true

somber sky
#

breh i used one before, i just forgot what it was

rain flame
spring flax
somber sky
rain flame
spring flax
#

That's not what hidden does

spring flax
somber sky
rain flame
spring flax
rain flame
#

yep

spring flax
rain flame
# spring flax You don't have the `@bot.command()` decorater
    def __init__(self, bot: commands.Bot):
        self.bot = bot


    @commands.command()
    @commands.cooldown(rate=1, per=3)
    async def ping(self, ctx: commands.Context):
        print("Checking the bot's current websocket latency.")
        embed=discord.Embed(title=":ping_pong: Pong! :ping_pong:", description=f"{round(self.bot.latency * 1000)}ms", colour=000000)
        await ctx.message.delete()
        await ctx.send(embed=embed)
        print("Sent the bot's current websocket latency.")
``` u mean this?
#

nvm Im gonna split them into 2 program

#

much easier

spring flax
#

and the cooldown decorator should be @commands.cooldown(1, 3, commands.BucketType.member)

rain flame
#

alright thanks dude

spring flax
slate swan
#
client.get_guild(953173697886302268)
  print(guild.members)
``` this returns
#

[<Member id=853195733205123072 name='Monkeu' discriminator='1696' bot=False nick=None guild=<Guild id=953173697886302268 name='Legit Rewards' shard_id=None chunked=False member_count=437>>]

#

i want to get members

spring flax
desert halo
#

fetch guild?

#

check docs instead of asking here

slate swan
#

for member in guild.members
if member.name == "something":
members.send("hi")

#

something like that

spring flax
spring flax
desert halo
#

this is one of the most important developer skill

#

isn't it mate?thinkmon

spring flax
#

!d discord.ext.commands.Bot.get_guild

unkempt canyonBOT
desert halo
#

isn't this channel consider to show the right way to fix your problem and not do whole code for someone

#

I think people should find the right way by many attempts

#

Yup, smart way is ask someone how faced with this problem

#

but its discord py

#

its like a lego bricks

alpine furnace
#

Also, like, the “whole code” is small enough because their question is small, so I wouldn’t say it’s inappropriate if they wanted it

slate swan
slate swan
# desert halo check docs instead of asking here

you do know that this channel is here for people who are new to discord bots. And the PURPOSE of this channel is to help them with simple examples and direct them towards the right docs if they fail to do so

spring flax
#

Ashley

slate swan
#

Raven

spring flax
#

Do you know how I can take a screenshot of messages with a bot

slate swan
#

yes, you cant

#

thats horrible first of all

supple thorn
#

Oh wait i read that wrong

#

I thought you said you could

slate swan
#

lmao

spring flax
supple thorn
#

I was excited for new sniping possibilities

#

😔

spring flax
#

I've seen a bot with a google command that shows an image of the search result

#

so wanted to see if I can replicate it

slate swan
spring flax
#

I can't remember lol

#

neither can I find it now, unfortunately

supple thorn
#

🗿

slate swan
#

pfftt lemme check out

supple thorn
#

You probably should of

#

I mean the sniping possibilities are still possible

#

Using pillow

slate swan
#

@spring flax what you could do is, host the bot on a computer of yours and use os or webbrowser module to query with your preferred search engine, take a snip of the page using PIL and close the webpage and save the image and send the image via your bot

spring flax
supple thorn
#

Thought it was a image

#

Isn't that just text

spring flax
#

you have to press the button

supple thorn
#

Can you press it

#

Or is that an old screenshot

slate swan
#
channel = bot.get_channel(channelid)

in this case, if channelid a str or int?

slate swan
#

ok

#
search("query") 
snippet = Snip((location))
snippet.save("test.png")
close("web browser")
send(file="test.png")

@spring flax this is what you will have to do

spring flax
#

okay nevermind then

slate swan
#

it seems hard

spring flax
#

what about channel messages

paper sluice
#
    @discord.ui.button(label='Quit', style=ButtonStyle.red)
    async def quit(self, interaction: discord.Interaction, button: Button):
        """
        Go back to `select-view`
        
        Needs to be implemented in a subclass.
        """
        pass

i got that in the parent class, im trying to overwrite and interact with that button

    async def quit(self, interaction: discord.Interaction, button: discord.Button):
        """ Go back to `select-view` """
        await interaction.response.edit_message(embed=self.cls.wiki['about'], view=self.cls)
        super().quit(interaction, button)

this doesn't work, it just sends an interaction error
how can i fix this?

spring flax
#

and not because it's hard, because it seems a waste I can do something else

slate swan
#

it seems like a waste of time ngl

slate swan
paper sluice
#

nah i dont want to overwrite the one in view, im making my own, i want it to do diff things for diff commands

paper sluice
#

implementing the button in the subclass, puts the button in the end, i want it in the middle, thats why it has to be implemented in the parentclass

slate swan
#

I'll have a stroke trying to understand, goodluck

supple thorn
#

Same

slate swan
#

lmao

scarlet aurora
#

Hey, I'm hosting my Discord Bot on my PC and in the console Ignoring exception in command None: discord.ext.commands.errors.CommandNotFound: Command "helps" is not found is often found there when someone puts an incorrect command, how can I make a logging system for error commands that look a lot cleaner?

supple thorn
#

Specifically on_command_error

#

Hello ashley

scarlet aurora
#

could i use a cog listner for it?

supple thorn
#

Yes

#

Just use isinstance to check the error and if it's commands.CommandNotFound

scarlet aurora
#

alright

scarlet aurora
#

what about something like this?

slate swan
# scarlet aurora Hey, I'm hosting my Discord Bot on my PC and in the console ``Ignoring exception...

You can use error handlers to send responses in return of errors

the first example is a global error handler and will work for every cog no matter in what cog it is

@commands.Cog.listener("on_command_error")
async def error_h(self, ctx: commands.Context, exc):
  if isinstance(exc, ErrorClass): #dont subclass
    ...
  elif isinstance(exc, ErrorClass):
    ...

or you can use individual error handlers for every command

@commands.command()
async def ping(self, ctx: commands.Context):
  await ctx.send("pong")

@ping.error
async def ping_error_h(self, ctx: commands.Context, exc):
  if isinstance(exc, ErrorClass): #dont subclass
    ...
  elif isinstance(exc, ErrorClass):
    ...
supple thorn
scarlet aurora
#

ok

#

i am

slate swan
scarlet aurora
#

@slate swan

#

how do i define errorclass

supple thorn
#

Find one

#

in your case

#

It's commands.CommandNotFound

#

Or if you import it

#

It's CommandNotFound

scarlet aurora
#

from discord import CommandNotFound

supple thorn
#

No

slate swan
unkempt canyonBOT
#

exception discord.ext.commands.CommandError(message=None, *args)```
The base exception type for all command related errors.

This inherits from [`discord.DiscordException`](https://discordpy.readthedocs.io/en/master/api.html#discord.DiscordException "discord.DiscordException").

This exception and exceptions inherited from it are handled in a special way as they are caught and passed into a special event from [`Bot`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot "discord.ext.commands.Bot"), [`on_command_error()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.discord.ext.commands.on_command_error "discord.discord.ext.commands.on_command_error").
slate swan
#

you can use the ones listed under this section

supple thorn
scarlet aurora
#

import discord.ext.commands

slate swan
#

just use commands.CommandNotFound

supple thorn
#

Ashley help

slate swan
supple thorn
#

Rather than importing everything you need

slate swan
#
if isinstance(exc, commands.CommandNotFound):  
  pass
supple thorn
#

I like how disnake's docs has the source link besides what you're looking for

tacit token
#

hi guys, how can i make this command say the channel?

    @commands.Cog.listener()
    async def on_message_delete(self, message):
            if not message.author.bot and 'server_log' in server_config[message.guild.id].keys():
                channel = self.bot.get_channel(server_config[message.guild.id]['server_log'])
                if channel:
                    embed = discord.Embed(title = get_lang(message.guild, 'ADMINISTRATION_serverlog_msgdelete'), description = message.content, color = 0xFFFF00, timestamp = datetime.datetime.utcnow())
                    embed.set_footer(icon_url = message.author.avatar_url_as(size = 128), text = str(message.author) + ' (' + str(message.author.id) + ')')
                    await channel.send(embed = embed)
paper sluice
#

try message.author.user

tacit token
#

what

paper sluice
#

oh channel name

#

mb

tacit token
#

i try check the channel

paper sluice
#

message.channel.name

cold sonnet
#

s

noble geyser
#

anyone here know how to integrate rich presnce?

maiden fable
unkempt canyonBOT
#

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

Changes the client’s presence.

Example

```py
game = discord.Game("with the API")
await client.change_presence(status=discord.Status.idle, activity=game)
```   Changed in version 2.0: Removed the `afk` keyword-only parameter...
noble geyser
#

from scratch or smtg , im making the game on renpy

tacit token
maiden fable
unkempt canyonBOT
noble geyser
#

it needs python 3.8 , i'm working on 2.7 , idk if renpy can update it tho

vale wing
#

What

#

Real python 2 user

#

😳

supple thorn
#

Was that a link

#

I saw

vale wing
#

Where

boreal ravine
noble geyser
#

idont know how to code so im just using it cuz its simple

vale wing
#

Nope

#

We typically help with code issues not with game engines

noble geyser
supple thorn
#

Probably by @unkempt canyon

slate swan
#

..

#

can someone help?

with open("/root/Textfiles/example.txt", "r") as a, open("/root/Textfiles/example2.txt", "r") as b:
    if token not in a.read() and b.read():
        await ctx.send("Token does not exist")
    else:
        await ctx.send("Token exists")
#

This is my code, if the token is the first file (example.txt), then it works fine (says if it exists or does exist), but if the token is in the second file (example2.txt) it always says token does not exist

#

am i doing something wrong?

#

@boreal ravine maybe u know

paper sluice
#

!or-gotcha

unkempt canyonBOT
#

When checking if something is equal to one thing or another, you might think that this is possible:

if favorite_fruit == 'grapefruit' or 'lemon':
    print("That's a weird favorite fruit to have.")

While this makes sense in English, it may not behave the way you would expect. In Python, you should have complete instructions on both sides of the logical operator.

So, if you want to check if something is equal to one thing or another, there are two common ways:

# Like this...
if favorite_fruit == 'grapefruit' or favorite_fruit == 'lemon':
    print("That's a weird favorite fruit to have.")

# ...or like this.
if favorite_fruit in ('grapefruit', 'lemon'):
    print("That's a weird favorite fruit to have.")
paper sluice
#

@slate swan ^^^

#

in ur case it would be

    if token not in (a.read(), b.read()):
slate swan
#

tysm, let me try it

#

i didnt even know it worked like that

paper sluice
#

no it wont work lmao wait

slate swan
#

oh.

#

ill try it anyway

#

oh yea it didnt, still same error

#

the token is there though

paper sluice
#
if token not in a.read() and token not in  b.read()):

this should work, i can't think of anything simpler, i need to go to bed

slate swan
#

oh crap yeah someone told me that yesterday but in another context, totally forgot

#

its actually b.read() not b.read()) xD

misty sluice
#

PS C:\Users\Micro\Downloads\Canomi> & C:/Users/Micro/AppData/Local/Programs/Python/Python310/python.exe c:/Users/Micro/Downloads/Canomi/main.py
Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "set_prefix" is not found
Ignoring exception in command setprefix:
Traceback (most recent call last):
File "C:\Users\Micro\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 181, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\Micro\Downloads\Canomi\cogs\setup.py", line 18, in set_prefix
self.bot.dbmanager.add_guild_prefix(ctx.guild.id, prefix)
AttributeError: 'Bot' object has no attribute 'dbmanager'

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

Traceback (most recent call last):
File "C:\Users\Micro\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 360, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Micro\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 927, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\Micro\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 190, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Bot' object has no attribute 'dbmanager'

#

i have a fle named dbmanager

prime ibex
#

Are there any caching examples with aioredis?

slate swan
#

is there a way of loading files instead of cogs

#

so u don't import stuff and type more useless junk to load it

little ivy
#
async def on_message(message):
     if message.content == "agree":
           role = discord.utils.get(Assign.roles, name="Member")
           await client.add_roles(message.author.id, role)
#

I dont know what to change "Assign" in

#

@iron axle

hushed galleon
#

presumably Assign is supposed to be the Guild that you want to get the Member role from

#

its not really clear what guild in particular you want though

#

also client.add_roles is years out of date

little ivy
iron axle
#

user = ctx.message.author
await user.add_roles(role)

gilded zephyr
#

Do you guys have your bots reply to the command message?

iron axle
#

That's what I got

hushed galleon
gilded zephyr
iron axle
#

O: sorry I'm not guna be much help then

modern fiber
#

How do I import slash commands?

@slash.slash(name="Ping", description="Shows bot latency")
async def pong(ctx):
await ctx.send(f'Pong! - {round(client.latency * 1000)}ms')

iron axle
gilded zephyr
#

👍

iron axle
modern fiber
iron axle
#

And the rest of that line, yes

modern fiber
#

So I should put the

bot = Client(intents=Intents.default())
slash = SlashCommand(bot)

at the place where I defined my bot?

little ivy
#

Can this work?

iron axle
#

No just the slash = slash thing

modern fiber
#

Oh okay

slate swan
# little ivy

No, i think the id should be an int? But ig u need to get_role first

little ivy
#

Euhhhhh

slate swan
#

!d discord.Member.add_roles

unkempt canyonBOT
#

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

Gives the member a number of [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s.

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the added [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
iron axle
# little ivy Can this work?

Canibilise this

import discord.utils
@client.command() async def role(ctx, * role: discord.Role): user = ctx.message.author await user.add_roles(role)

little ivy
#

Like this?

slate swan
#

And in that u dont even need the "utils" since you already have an arg as a discord.Role

modern fiber
#

How do I install discord_slash

little ivy
slate swan
#

!role @urrole

modern fiber
slate swan
hushed galleon
little ivy
#

It didnt

modern fiber
hushed galleon
#

i just sent you the examples and docs

slate swan
little ivy
#

yeah, admin perms

slate swan
gilded zephyr
#

Is there a simple way to make a command name with 2 words? For example, /nickname set [*args] where nickname set is the command name?

gilded zephyr
#

Not exactly,

#

I mean like a subcommand

slate swan
#

Idkidk

gilded zephyr
#

Wait how do I make aliases?

slim ibex
unkempt canyonBOT
#

class discord.ext.commands.Command(*args, **kwargs)```
A class that implements the protocol for a bot text command.

These are not created manually, instead they are created via the decorator or functional interface.
slim ibex
#

aliases=[] in the decorator

gilded zephyr
#

Thanks 👍

slim ibex
#

it can be a tuple too iirc

slate swan
#

yeah it can be a list or a tuple

little ivy
paper sluice
#

can someone send link of that .json reddit api, idk the name lol

little ivy
#

i do !role @stray scarab and it doesnt do anythin

slate swan
little ivy
#

Nope

slate swan
#

Add print("done") below await user.add_roles()

little ivy
#

i tried, it doesnt print

boreal ravine
little ivy
paper sluice
slate swan
little ivy
#

no

#

bc it doesnt print

slate swan
#

ohpogu

#

Can i see the code doe

little ivy
#

yeah

#
@client.command()
async def role(ctx, * role: discord.Role):
    user = ctx.message.author
    await user.add_roles(959432789164437606)
    print("Done")
boreal ravine
#

You need a role object

#

not a snowflake

little ivy
#

so role = "ID HERE"?

spring flax
#

No

slate swan
#

Use get_role or discord.utils.get

spring flax
#

await user.add_add_role(role)
Just this

slate swan
#

Addadd

spring flax
little ivy
#

and the role id in the last role?

slate swan
slate swan
little ivy
#

im sorry i am a really beginner

#

So just this?

slate swan
#

You already have an arg in ur command which is role

little ivy
#

So like this then?

slate swan
slate swan
# little ivy So just this?

No it should be something like```py
@client.command()
async def role(ctx, *, role: discord.Role):
user = ....
await user.add_roles(role)

slate swan
#

Yo

little ivy
slate swan
#

ctx.author

#

ctx.author which is the user who used the command

little ivy
#

So this should work now? :

slate swan
#

no

#

user.add_roles*

slate swan
spring flax
#

Or you can save a unnecessary variable and use ctx.author.add_roles(role).

little ivy
slate swan
#

😭😭

little ivy
slate swan
little ivy
#

this then?

slate swan
little ivy
#

Oh okay

slate swan
#

Now try it

#

imagine if role is bigger than bot role

slate swan
modern fiber
#

Somebody help pls? I can't see my cursor in pycharm..

modern fiber
#

nvm fixed

slate swan
#

bru

modern fiber
#

XD

little ivy
#

not even printed

slate swan
#

hehe

slate swan
little ivy
#

nowp

slate swan
#

Make the bot role higher than that role

slate swan
slate swan
little ivy
little ivy
slate swan
#

show how u type the command

little ivy
slate swan
#

Can we see the role location?:)

little ivy
#

yeah

slate swan
#

imagine if member is administrator

little ivy
little ivy
modern fiber
#

Uh guys?

slate swan
modern fiber
#

SlashContext in disnake is?

slate swan
gilded zephyr
#

Why wont my subcommand work?

# Base BTC Command
    @commands.group(name = "btc")
    async def btc(self, ctx, *args):
        if ctx.invoked_subcommand is None:
            await ctx.reply(embed = helpEmbed, mention_author = False)
    
    # Address Command
    @btc.command(name = "addr", aliases = ["address", "a"])
    async def btc_addr(self, ctx, *args):
        await ctx.send("Test")
little ivy
slate swan
#

ok try

little ivy
#

nothing...

slate swan
#

do u enable the intents?

modern fiber
gilded zephyr
slate swan
little ivy
slate swan
gilded zephyr
modern fiber
slate swan
#

idk

little ivy
rocky orchid
#

Hey I'm new here but any help on making embeds?

modern fiber
#

uhhh how do I do it mpw

slate swan
# little ivy whats that?

So eh idk how to explain it cuz my brain cell is kinda dead so ye, well it allows u to use extra stuff ig. U need to enable them in discord portal and in ur code

slate swan
unkempt canyonBOT
#

@discord.ext.commands.group(name=..., cls=..., **attrs)```
A decorator that transforms a function into a [`Group`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Group "discord.ext.commands.Group").

This is similar to the [`command()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.command "discord.ext.commands.command") decorator but the `cls` parameter is set to [`Group`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Group "discord.ext.commands.Group") by default.

Changed in version 1.1: The `cls` parameter can now be passed.
little ivy
rocky orchid
little ivy
#

np

slate swan
#

So when u make a group command btc is like a cog (im just giving example dont mind my words) so u need to do btc.command to add the command to the cog/group command

#

listen boaz

modern fiber
#

Does anybody know what's SlashContext defined as in the disnake libraby?

slate swan
unkempt canyonBOT
#
No way, José.

No documentation found for the requested symbol.

slate swan
#

huh

slate swan
#

Ig

boreal ravine
#

AppCmdInter

slate swan
gilded zephyr
modern fiber
slate swan
modern fiber
#

!d disnake.ApplicationCommandInteraction

unkempt canyonBOT
#

class disnake.ApplicationCommandInteraction```
Represents an interaction with an application command.

Current examples are slash commands, user commands and message commands.

New in version 2.1.
slate swan
modern fiber
#

Oh, thanks legends.

slate swan
#

there are others to help, I will just go away from here

formal basin
#

Is there an event where if the user has a certain role

slate swan
#

!d discord.on_member_update i mean

unkempt canyonBOT
#

discord.on_member_update(before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") updates their profile.

This is called when one or more of the following things change:

• nickname

• roles

• pending...
slate swan
#

gtg

formal basin
modern fiber
#

What's wrong here tho..?

little ivy
#

\n

slate swan
slate swan
#

column?

#

huh

formal basin
slate swan
#

or a command as you wish

slate swan
slate swan
#

is there a way of loading files instead of cogs
so u don't import stuff and type more useless junk to load it

slate swan
slate swan
modern fiber
#

Uh?

slate swan
modern fiber
hushed galleon
#

yup, unclosed parenthesis

modern fiber
#

where

slate swan
# slate swan will error
import os
[bot.load_extension(file[:-3]) for file in os.listdir("./cogs") if file.endswith('.py')]

put your cogs in a folder

hushed galleon
#

look at the first decorator, whats closing the slash_command parenthesis?

slate swan
#

!d disnake.ext.commands.Bot.load_extensions does it automatically iirc

unkempt canyonBOT
slate swan
#

that is, if you are using disnake

slate swan
#

U forgot to close options

hushed galleon
#

btw some good indentation makes it easier to tell which brackets you're missing

modern fiber
hushed galleon
#

well you've closed your parenthesis before closing the list

slate swan
modern fiber
#
@client.slash_command(name="Ping", description="Shows Bot Latency")
async def pong(ctx):
    await ctx.send(f"🏓 Pong! ``{round(client.latency * 1000)}ms``")

@client.slash_command(name="Kick", description="Kicks a Member",
                      options=[
        disnake.Option(name="user", description="The user I should kick", required=True, type=disnake.OptionType.channel),
        disnake.Option(name="reason", description="Why should I kick them?", required=False, type=disnake.OptionType.channel))
]


@has_permissions(kick_members=True)
async def kick(ctx:disnake.ApplicationCommandInteraction, user: disnake.Member, reason:str="None Given"):
    reason = str(reason)
    usr = "<@"+str(user.id)+">"
    await user.kick(reason)
    await user.send("Kicked from "+ctx.guild.name+" for "+reason)
    embed = disnake.Embed(title="Kicked a user", description="Kicked "+usr+" for reason: "+reason)
    await ctx.send(embed=embed)
    print(ctx.author.name+" used: kick")


# ERRORS
@kick.error
async def kick_error(ctx:disnake.ApplicationCommandInteraction, error):
    if isinstance(error, PermissionError):
        embed = disnake.Embed(title="Permission Error")
        embed.add_field(name="Missing:", value="Kick Members")
        await ctx.send(embed=embed)
#

Here, mind showing me please?

hushed galleon
#

what you've essentially written is this
([)]

slate swan
#
@client.slash_command(name="Ping", description="Shows Bot Latency")
async def pong(ctx):
    await ctx.send(f"🏓 Pong! ``{round(client.latency * 1000)}ms``")

@client.slash_command(name="Kick", description="Kicks a Member",
                      options=[
        disnake.Option(name="user", description="The user I should kick", required=True, type=disnake.OptionType.channel),
        disnake.Option(name="reason", description="Why should I kick them?", required=False, type=disnake.OptionType.channel)])



@has_permissions(kick_members=True)
async def kick(ctx:disnake.ApplicationCommandInteraction, user: disnake.Member, reason:str="None Given"):
    reason = str(reason)
    usr = "<@"+str(user.id)+">"
    await user.kick(reason)
    await user.send("Kicked from "+ctx.guild.name+" for "+reason)
    embed = disnake.Embed(title="Kicked a user", description="Kicked "+usr+" for reason: "+reason)
    await ctx.send(embed=embed)
    print(ctx.author.name+" used: kick")


# ERRORS
@kick.error
async def kick_error(ctx:disnake.ApplicationCommandInteraction, error):
    if isinstance(error, PermissionError):
        embed = disnake.Embed(title="Permission Error")
        embed.add_field(name="Missing:", value="Kick Members")
        await ctx.send(embed=embed)
hushed galleon
#

the list needs to stay inside the parentheses

modern fiber
#

OH

#

DAMN IM SO BLIND

#

Sorry me, young people. Im old.

#

My eyes don't serve me so well.

slate swan
modern fiber
#

What is type for the like reason?

slate swan
#

whats disnake

modern fiber
#

library..

slate swan
#

why do u use

#

disnake.Member

#

is it just discord.Member but renamed

modern fiber
#

yeah bruh

hoary cargo
slate swan
slate swan
unkempt canyonBOT
slate swan
#

what does it change?

#

there is like 3 dpy forks

slate swan
slate swan
modern fiber
slate swan
#

what does it improve

modern fiber
slate swan
#

i only know nextcord, disnake and edpy

#

3k*

modern fiber
#

thats why

slate swan
#

oh

slate swan
#

it is under development

modern fiber
#

no? it might not even work soon

slate swan
modern fiber
#

read docs, thats why most of the people changed to disnake, nextcord and others

slate swan
gilded zephyr
#

What does invoke_without_command do in command groups?

slate swan
inland mist
#

It is already working

slate swan
inland mist
#

Yeah Just wanted to say as he said otherwise

modern fiber
slate swan
#

soo... should i change my library to disnake?

slate swan
#

disnake's development is faster and has better docs

#

i mean i want slash commands

slate swan
slate swan
#

lmao

slate swan
#

though they dont have detailed docs about slashes

#

uhh

#

what am I saying

slate swan
left crater
#

cogs

slate swan
slate swan
#

oh god

#

Its ApplicationCommandInteraction

#

lmao

#

😐

hushed galleon
slate swan
#

same

#

inarguable really, the next day i lost the link to the gist ngl

#

I mean, who would do this

#

and the fact that they put the app commands into Client

#

I mean, message commands are not supported by Client, why slashes

hushed galleon
#

well the two are implemented differently, message commands are done with a Client subclass while app commands is done as an addon to the client

hushed galleon
#

yea it is an inconsistency

modern fiber
#

Dude why I get this? Isn't showing me any errors

hushed galleon
slate swan
gilded zephyr
#

Is it better to have per command, per cog, or global command handling?

#

error handling*

modern fiber
hushed galleon
slate swan
modern fiber
#

Mind showing me what I did wrong guys?

@client.slash_command(name="Kick", description="Kicks a Member",
                      options=[
        disnake.Option(name="user", description="The user I should kick", required=True, type=disnake.OptionType.user),
        disnake.Option(name="reason", description="Why should I kick them?", required=False, type=disnake.OptionType.string)])

@has_permissions(kick_members=True)
async def kick(ctx:disnake.ApplicationCommandInteraction, user: disnake.Member, reason:str="None Given"):
    reason = str(reason)
    usr = "<@"+str(user.id)+">"
    await user.kick(reason)
    await user.send("Kicked from "+ctx.guild.name+" for "+reason)
    embed = disnake.Embed(title="Kicked a user", description="Kicked "+usr+" for reason: "+reason)
    await ctx.send(embed=embed)
    print(ctx.author.name+" used: kick")


# ERRORS
@kick.error
async def kick_error(ctx:disnake.ApplicationCommandInteraction, error):
    if isinstance(error, PermissionError):
        embed = disnake.Embed(title="Permission Error")
        embed.add_field(name="Missing:", value="Kick Members")
        await ctx.send(embed=embed)```
hushed galleon
#

ah it should have given a type error since reason is supposed to be a keyword argument, i.e. user.kick(reason='abc')

gilded zephyr
#

Do you guys use per command, per cog, or global error handling?

hushed galleon
gilded zephyr
#

Or a combination of all?

gilded zephyr
modern fiber
slate swan
#

how can i make a GMT+3 timezone for a timestamp? if its possible

slate swan
modern fiber
hushed galleon
modern fiber
hushed galleon
gilded zephyr
#

Yes that makes sense

hushed galleon
#

though its weird you're not getting any errors in the console

modern fiber
slate swan
#

anyone know how to make a GMT+3 timestamp?

modern fiber
# modern fiber

Like this or what? Im dumb, my first time using slash commands.
@hushed galleon

modern fiber
hushed galleon
#

i literally wrote an example line of how the user kick should be done

modern fiber
#

Yeah but I don't understand lmfao

hushed galleon
#

a keyword argument in general python means when you call a function, you type out the full name of the parameter

#
def add(x, y):
    return x + y

# using positional arguments
>>> add(1, 2)
3
# using keyword arguments
>>> add(x=1, y=2)
3```
#

with Member.kick(), the library developers wrote the function such that the reason is required to be passed as a keyword argument

#

!d disnake.Member.kick

unkempt canyonBOT
#

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

Kicks this member. Equivalent to [`Guild.kick()`](https://docs.disnake.dev/en/latest/api.html#disnake.Guild.kick "disnake.Guild.kick").
hushed galleon
#

^as indicated by documentation with the star * just before the reason parameter

slate swan
#

ow

hushed galleon
#

hence why you must write await user.kick(reason='my reason')

maiden fable
#

Might as well link them to the resources lemon_pensive

#

!e discord.utils.format_dt ? @slate swan

slate swan
maiden fable
#

!d discord.utils.format_dt

unkempt canyonBOT
#

discord.utils.format_dt(dt, /, style=None)```
A helper function to format a [`datetime.datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "(in Python v3.10)") for presentation within Discord.

This allows for a locale-independent way of presenting data using Discord specific Markdown...
maiden fable
#

Thanks mobile

slate swan
#

cause thats my timezone

maiden fable
slate swan
maiden fable
#

Ik (:

slate swan
maiden fable
#

Huh?

slate swan
#

its like this 17/05/2016 22:57:58.38138

modern fiber
#

@hushed galleon Like this bruh?

#

I don't understand cuz you are supposed to write a reason with slash like /kick user reason not write it in the code.

maiden fable
slate swan
#

and yes, that should work

slate swan
maiden fable
#

Yup DM the user before kicking them

bleak karma
#

what causes this error?

HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In user_id: snowflake value should be less than or equal to 9223372036854775807.

im making a massban command and i tried to ban multiple users using their ids but it gives an error

modern fiber
#

.

slate swan
#

and you dont have to convert reason to string since you typehinted it as a string and arguments without typehint aare automatically converted to a string, and you can use the mention property on the Member object to ping them instead of making the same thing again and again as <@str(id)>

slate swan
bleak karma
# maiden fable Show code
@bot.command()
async def massban(ctx, members: Greedy[int], reason=None):
  if not members:
    await ctx.send("Please specify the users i need to ban.")
  else:
    list1 = members
    for i in list1:
      await ctx.guild.ban(discord.Object(id=int(i)))

    await ctx.send(f"successfully banned **{len(members)}** user(s).")
slate swan
#

thats...

modern fiber
slate swan
#

pffftt

maiden fable
maiden fable
bleak karma
maiden fable
#

Well 🤷‍♂️

gilded zephyr
#

Is there list of all errors?

bleak karma
slate swan
gilded zephyr
maiden fable
gilded zephyr
#

Can I find them on the docs?

modern fiber
#

I get this again...@slate swan

maiden fable
#

Yea

gilded zephyr
#

👍

maiden fable
#

Look for the section Exceptions Hierarchy in the docs @gilded zephyr

#

Should be at the last of the sidebar

gilded zephyr
#

Found it thanks a lot 🙂

slate swan
#

is it even possible to use gmt+3 timezone on timestamps?

#
async def kick(ctx: disnake.ApplicationCommandInteraction, member: disnake.Member, reason: str="No reason provided"):
  await ctx.response.defer(ephemeral=True)
  await member.send(f"You were kicked from *{ctx.guild.name}* for **{reason}**")
  await member.kick(reason=reason)
  embed = disnake.Embed(title=f"Kicked {member}", description=f"Reason: **{reason}**", color=member.color).set_thumbnail(url=member.display_avatar.url).add_field(name="Kicked By", value=f"{ctx.author.mention}", inline=False)
  await ctx.edit_original_message(embed=embed)

@modern fiber

#

ahem ahem will ignore any pings except lavox

maiden fable
slate swan
maiden fable
maiden fable
unkempt canyonBOT
#

discord.utils.format_dt(dt, /, style=None)```
A helper function to format a [`datetime.datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "(in Python v3.10)") for presentation within Discord.

This allows for a locale-independent way of presenting data using Discord specific Markdown...
slate swan
#

.

#

whatever then

#

lmao

maiden fable
slate swan
#

im using unix

maiden fable
#

Eh?

modern fiber
maiden fable
maiden fable
slate swan
modern fiber
#

I give up. FUCK SLASH COMMANDS

hazy oxide
#

anyone know how to add space in slash command name?

modern fiber
hazy oxide
#

like what

slate swan
modern fiber
slate swan
modern fiber
gilded zephyr
#

Why doesnt my subcommand work unless I add invoke_without_command = True to the group?

hazy oxide
slate swan
slate swan
hazy oxide
#

ouu, okay thx

modern fiber
# slate swan my internet is kinda dumb rn, try using `print` statements after every line

wdym?

@has_permissions(kick_members=True)
async def kick(ctx: disnake.ApplicationCommandInteraction, member: disnake.Member, reason: str="No reason provided"):
  await ctx.response.defer(ephemeral=True)
  await member.send(f"You were kicked from *{ctx.guild.name}* for **{reason}**")
  await member.kick(reason=reason)
  embed = disnake.Embed(title=f"Kicked {member}", description=f"Reason: **{reason}**", color=member.color).set_thumbnail(url=member.display_avatar.url).add_field(name="Kicked By", value=f"{ctx.author.mention}", inline=False)
  await ctx.edit_original_message(embed=embed)
  print(ctx.author.name+" used: kick")```
#

Anybody..?

slate swan
modern fiber
slate swan
#

remove the coroutine thats after the function signature

modern fiber
slate swan
#

bro await ctx.response.defer() this

final iron
cold sonnet
#

this is some advanced languaging

#

languagigly

final iron
#

It's probably some simple shit and okimii is just trying to make himself seem smarter 🗿

brisk zodiac
#
import discord
import os
from discord.ext import commands

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

@client.command()
async def hi(ctx):
  await ctx.send('Yo')

@client.event
async def on_ready():
    print('Yo My Creator')

client.run(os.getenv('TOKEN'))```Why is it not work?
slate swan
#

thats called and function signature

modern fiber
slate swan
#

bro

final iron
cold sonnet
final iron
cold sonnet
#

also, I'm gonna start using that word cuz function definition is weird

#

and I wanna look smarter than I am

maiden fable
#

@modern fiber r u hosting the bot on yr laptop?

slate swan
brisk zodiac
cold sonnet
#

show*

final iron
slate swan
slate swan
brisk zodiac
slate swan
#

or does it not startup at all

slate swan
#

...

slate swan
slate swan
final iron
slim ibex
#

🗿

brisk zodiac
modern fiber
slate swan
slate swan
rocky orchid
#

Sorry if I'm dropping in the middle of something but could someone help me with this?
I have this code:

import discord, os, random, time

TOKEN = os.environ["TOKEN"]

bot.run(TOKEN)

and I'm getting this error:

  File "main.py", line 6, in <module>
    bot.run(TOKEN)
NameError: name 'bot' is not defined
fading harness
modern fiber
#

uh what then? I have no payment method

slate swan
rocky orchid
#

how exactly?

slate swan
#

bro

fading harness
rocky orchid
#

:D

fading harness
#

see the example

rocky orchid
#

and please you don't need to ping me every time you answer

fading harness
slate swan
rocky orchid
slate swan
slate swan
#

nope

#

if you dont need any gateway permissions youre fine

#
print(message.mentions[0])
        except:
          await message.channel.send(embed=errorEmbed('Invalid command format', 'promote', message.author))
          return
        success = False
        gm  = False
        hc = False
        if owner == True or manager == True or coach == True:
          gmr = discord.utils.get(message.guild.roles, name='General Manager')
          hcr = discord.utils.get(message.guild.roles, name='Head Coach')
          for i in message.mentions[0].roles:
            if nname == i.name:
              success = True
            if i.name.lower() == 'general manager':
              gm = True
            if i.name.lower() == 'head coach':
              hc = True
          print(gmr, hcr)
          if gmr == None or hcr == None:
            await message.channel.send(embed = errorEmbed('Could not find the correct roles to promote this user.', 'promote', message.author))
          if success == True:
            if gm == False and hc == False:
              await message.mentions[0].add_roles(hcr)
            elif gm == True:
              await message.mentions[0].add_roles(gmr)
              await message.mentions[0].remove_roles(hcr)
              
            lst = 0
            for i in message.guild.members:
                  for b in i.roles:
                    if b.name == nname.title():
                      lst += 1
            await message.channel.send(embed = tembed(nname, ["Promotion Successful!", 
message.mentions[0].name + " has been promoted!"], message.author, ["Roster: ", str(lst) + " people are on this team!"]))
          else:
            await message.channel.send(embed = errorEmbed('You do not have premission to do this!', 'promote', message.author))
          
            
        else:
          await message.channel.send(embed = errorEmbed('You do not have premission to do this!', 'promote', message.author))```
modern fiber
#

is there any free source mod commands I can see (slash ones)?

cold sonnet
modern fiber
#

the problem is that it doesn't even give an error

slate swan
slate swan
#

what

cold sonnet
#

@final iron

slate swan
#

im hungry for spaghetti

final iron
cold sonnet
#

!ot

unkempt canyonBOT
maiden fable
slate swan
#

yes

cold sonnet
#

oh well

#

bot should've said on topic

maiden fable