#discord-bots

1 messages · Page 9 of 1

slate swan
#

just use aiohttp to make an HTTP request

#

Idk how i need help

cold tide
#

Yes.

smoky cedar
cold tide
#

to the person who executes the cmd

slate swan
cold tide
#

Pls @ me when ur done :)

slate swan
#

Outdated videos,codes

smoky cedar
#

Seems too general and beyond the scope of this channel, this isn't really a discord question

#

First, create a command

#

Then in what the command does make the request

slate swan
#

I cant really get help from that I need an example

cold tide
smoky cedar
#

session = aiohttp.ClientSession()
response = session.get(API_ENDPOINT)

#

then what are you trying to do? outpuut the response data to the discord channel? @slate swan

slate swan
#

use context managers

smoky cedar
slate swan
#
Client.command():
async def main(): 
async with aiohttp.ClientSession() as session: async with session.get('http://httpbin.org/get') as resp: print(resp.status) print(await resp.text()) 
smoky cedar
#

Does it close the session auto at the end?

slate swan
#

Will this work

smoky cedar
slate swan
slate swan
cold tide
#

@slate swan can u show me??

slate swan
#

How

smoky cedar
slate swan
#

@slate swan can y make an example pls

smoky cedar
#

Look up how to send a message in a discord channel with a bot command

#

Then pass in the response to that

slate swan
#

Bro I tried i cant

slate swan
slate swan
#

!pep 484

unkempt canyonBOT
#
**PEP 484 - Type Hints**
Status

Final

Python-Version

3.5

Created

29-Sep-2014

Type

Standards Track

slate swan
#

a return annotation, it shows the return value of the function

slate swan
cold tide
#

Ah okay

slate swan
#

y9 sorry i havent responded 😭

#

kinda like a comment

slate swan
cold tide
#

What does the | and -> mean

#

I dont need anotations just a example.

#

quite new tbh

slate swan
slate swan
#

same thing pretty sure, i only use -> so you'd have to ask okimii

slate swan
#

If they're confusing so much this is the same thing without the annotations,

@bot.command()
async def addrole(ctx: commands.Context):
    if ctx.guild is None:
        return await ctx.send("Cannot invoke command in a DM")
    await ctx.author.add_roles(id)
slate swan
slate swan
slate swan
cold tide
#

@slate swan not working.

#
@bot.command()
async def verify(ctx: commands.Context):
    await ctx.reply(f"{ctx.author} successfully verifed ✅")
    if ctx.guild is None:
        return await ctx.send("Cannot invoke command in a DM")
    await ctx.author.add_roles("989994149954592798"")
#

im new tbh

slate swan
#

because the id has to be an int

cold tide
#

how?

slate swan
#

remove the quotes

cold tide
#

I tried that too

#

It didnt work

slate swan
#
@client.command()
async def request(ctx) -> None:
    async with aiohttp.ClientSession() as cs:
        async with cs.get("https://account.fyremc.hu/api/player/Zoli") as r:
            res = await r.json()
            username = res["data"]["username"]
            print(username)
            

@slate swan, note you should probably make one single session locally

slate swan
cold tide
#

why double ""?

slate swan
pliant gulch
#

You can either get the role representation, or use discord.Object

#

Which is much simpler

slate swan
#
@client.command()
@commands.has_permissions(administrator=True)
async def addrole(ctx, role: discord.Role, user: discord.Member):
    await user.add_roles(role)
    embed = discord.Embed(color=0xff0000)
    embed.add_field(name="Role added to user",
                    value=f"Role: {role.mention} User: {user.mention}",
                    inline=True)
    embed.set_author(name=ctx.author.display_name,
                     icon_url=ctx.author.avatar_url)
    embed.set_footer(text=f"Popsmoke")
    await ctx.send(embed=embed)
#

@cold tide

slate swan
cold tide
#

where do i define the role id? @slate swan

slate swan
#

the argument naming😔

cold tide
#

Im confused

#

😭😭

#

989994149954592798 thats the id

#

Someone add that into a example 🙏

slate swan
#

Isn't it response.status_code?

cold tide
#

Someone help??

#
@bot.command()
async def verify(ctx, user: discord.Member, role: discord.Role):
 	 await user.add_roles("989994149954592798") 
 	 await ctx.send(f"Successfully verifed ✅ {ctx.author.name}, has been giving a role called: {role.name}")
slate swan
#

@slate swan when I typed the command it didnt respond in channel and it said only the name in console "Zoli" it didnt say the other things

cold tide
#

someone help 🙏

slate swan
slate swan
spice carbon
#

how can i manage the permissions of a channel, so a user can't send messages?
i've tried:

        overwrites = { 
            ctx.guild.default_role: discord.PermissionOverwrite(view_channel=False),

            ctx.author: discord.PermissionOverwrite(
                view_channel=True, 
                read_messages=True,
                send_messages=False 
            ) 
        }

        await ctx.channel.edit(overwrites=overwrites, topic=f"{ctx.author.id} - (CLOSED)")```
but this isn't working for some reason
slate swan
slate swan
slate swan
cold tide
#

@slate swan still says missing user

slate swan
#

What

#

I need some context

cold tide
#

@slate swan

dapper cobalt
cold tide
dapper cobalt
#

How do you use the command?

slate swan
#

@slate swan i managed to do it one by one but how can I do it so it sends all the data in 1 command

slate swan
#

What about those

#

!resources

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

slate swan
#

I'm not convinced you understand basic python.

#

this is pretty basic stuff your asking for help on.

#

Do I put every data below each other ?

#

Like username =
Rank =
Etc

#

You can define new variables which return different information yes.

serene badger
#

!resources

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

smoky cedar
# slate swan Do I put every data below each other ?

Dude, for your own sake go learn python and programming before trying to interact with an api or library like discord. You're shooting yourself in the foot here. If you don't understand variables, parameters, types, classes, objects, etc it is going to be very hard to help you with a library that assumes you know basic programming

compact torrent
#

Whenevery i try and run a function inside a on_submit it just can't start the bot. Any ideas or similar errors why?

thorn grove
#

How can i make a event that runs every frame?

sick birch
maiden fable
thorn grove
#

@paper sluice i kinda fixed the dict thing but some ppl with that role see it

#

I wonder whats the prob

thorn grove
#

Anyone?

#

ಥ‿ಥ

shrewd apex
#

do they have roles higher than the edited role u assigned with the bot?

shrewd apex
#

or have some perms like manage channel server etc

#

oh ic

thorn grove
shrewd apex
#

hmm wait a sec lemme check the docs

thorn grove
slate swan
#

Bro python problem

#

Code = 1

smoky cedar
#

I'm trying to add a role to all members of my server, but doing guild.members only returns a list with the bot as the only member

smoky cedar
# shrewd apex members intent?
@bot.event
async def on_ready():
    logging.info('We have logged in as {0.user}'.format(bot))

    guild = bot.get_guild(277684407806984194)
    role_one = guild.get_role(1002344541724094524)
    role_two = guild.get_role(1002344976975417395)
    role_three = guild.get_role(1002346994460786708)
    role_four = guild.get_role(1002346309296083037)

    for member in guild.members:
        await member.add_roles(role_one, role_two, role_three, role_four)
#

my code

#

Bot has administrator privileges

shrewd apex
#

no intent from dev page

smoky cedar
#

What intent do I set to?

shrewd apex
#

iirc it was intent.member = True

#

member or members not sure

smoky cedar
#

intents=discord.Intents.default()

sick birch
smoky cedar
shrewd apex
#

yes so intents which are needed is members and message intent

smoky cedar
#

Using a real bot so I don't have to readd to my server lol

shrewd apex
#

so enable them in dev page and in code

smoky cedar
#

intents=discord.Intents.members is a no go since that's a flag

sick birch
#

!intents

unkempt canyonBOT
#

Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default discord.py has all intents enabled except for Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, and to get members' statuses.

To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.

Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:

from discord import Intents
from discord.ext import commands

intents = Intents.default()
intents.members = True

bot = commands.Bot(command_prefix="!", intents=intents)

For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.

sick birch
#

@smoky cedar this

smoky cedar
#

Thank you sir

thorn grove
#

Guys help

#

How do i put roles as the argument?

slate swan
#

Send your whole code...

thorn grove
#

@slate swan

slate swan
#

Paste it..

#

!code

unkempt canyonBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

thorn grove
slate swan
pastel aspen
#

I'm trying to set up my bot on heroku but it isn't showing in the site. When I do git push heroku master it works fine but it says "Procfile declares types -> (none)" in the middle. Anyone know the solution?

thorn grove
slate swan
thorn grove
#

Wait

#
@bot.command()
async def CreateTeam(ctx):
   if f"{ctx.author.display_name}'s team" not in [roles.name
   for roles in ctx.author.roles]:
       roles= await ctx.guild.create_role(name=f"{ctx.author.                   display_name}'s team", reason=None)
       embed = discord.Embed(title="Team Succesfully Created!", description=("Use $AddMember @User to add a member"), colour = 0xb0305c)
       await ctx.author.add_roles(roles)
       #authorPerm = discord.utils.get(ctx.guild.roles, name =f"{ctx.author.display_name}'s team")
       #overwrites = {ctx.author: discord.PermissionOverwrite(view_channel=True), guild.user: discord.PermissionOverwrite(view_channel=False)}
       channel = await ctx.guild.create_text_channel(name=f"{ctx.author.display_name}'s team", reason=None, overwrites =None)
       await channel.set_permissions(f"{ctx.author.display_name}'s team", view_channel=True,overwrites=None)
       await ctx.channel.send(embed=embed)
   if f"{ctx.author.display_name}'s team" in [roles.name
   for roles in ctx.author.roles]:
       await ctx.channel.send("You Already Have A Team!")
slate swan
#

What error do you get?

#

@thorn grove

thorn grove
#

How do i put roles as the target parameter

slate swan
#

@slate swan ..

thorn grove
slate swan
#

the error quite says it all, types dont match😅 🤷‍♂️

thorn grove
slate swan
#

im pretty sure its not a callable....

#

!d discord.Member.roles

unkempt canyonBOT
#

property roles```
A [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role") that the member belongs to. Note that the first element of this list is always the default [‘@everyone](mailto:'%40everyone)’ role.

These roles are sorted by their position in the role hierarchy.
slate swan
#

yeah, its not...

pastel aspen
#

anyone with experience on hosting bots on heroku?

thorn grove
pastel aspen
#

did your bot appear on the site the first time?

thorn grove
pastel aspen
slate swan
#

!d discord.TextChannel.set_permissions @slate swan

unkempt canyonBOT
#

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

Sets the channel specific permission overwrites for a target in the channel.

The `target` parameter should either be a [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role") that belongs to guild.

The `overwrite` parameter, if given, must either be `None` or [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/latest/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite"). For convenience, you can pass in keyword arguments denoting [`Permissions`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions "discord.Permissions") attributes. If this is done, then you cannot mix the keyword arguments with the `overwrite` parameter.

If the `overwrite` parameter is `None`, then the permission overwrites are deleted.

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this...
slate swan
#

dont forget about ClassNaming which is in UpperWord

thorn grove
slate swan
#

docs are layed out by classes and attributes!

#

@slate swan Can't he set the target as the role ID?

#

has to be an object

#

and i got to go, i need to work on something😭

#

Okay see ya later

#

👋

mild lava
#

whats the best way to implement per-server and per-user settings for a discord bot?

thorn grove
#

Okay wait

#

Isnt that the same?

slate swan
#

No

#

I changed something, try it out..

thorn grove
#

Okay

#

@slate swan yeah

#

Line 25 wrong

sharp isle
#

i'm trying to run my bot on a macos but i get this: Cannot connect to host discord.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')] Does anyone know why?

slate swan
#

@thorn grove try this

#

@thorn grove try this actually

#
@bot.command()
async def CreateTeam(ctx) -> None:
    
    if f"{ctx.author.display_name}'s team" not in [roles.name for roles in ctx.author.roles]:
        
        roles= await ctx.guild.create_role(name=f"{ctx.author.display_name}'s team", reason=None)
        embed = discord.Embed(title="Team Succesfully Created!", description="Use $AddMember @User to add a member", colour = 0xb0305c)
        await ctx.author.add_roles(roles)
        #authorPerm = discord.utils.get(ctx.guild.roles, name =f"{ctx.author.display_name}'s team")
        #overwrites = {ctx.author: discord.PermissionOverwrite(view_channel=True), guild.user: discord.PermissionOverwrite(view_channel=False)}
        channel = await ctx.guild.create_text_channel(name=f"{ctx.author.display_name}'s team", reason=None, overwrites=None)
        channel = discord.utils.get(ctx.guild.channels, name=f"{ctx.author.display_name})
        channel_id = channel.id

        await channel.set_permissions(bot.get_channel(channel.id), view_channel=True, overwrites=None)
        await ctx.channel.send(embed=embed)

    if f"{ctx.author.display_name}'s team" in [roles.name for roles in ctx.author.roles]:
        await ctx.channel.send("You Already Have A Team!")
thorn grove
#

Okay

slate swan
#

try that instead

thorn grove
#

@slate swan

slate swan
#

paste your code

thorn grove
#

Wydm

#

Okay

slate swan
#

actually

#

wait

#
channel = discord.utils.get(ctx.guild.channels, name=f"{ctx.author.display_name}")

replace that line with this

thorn grove
#

@slate swan yeah you forgor "

slate swan
#

that was my bad, I forgot the last quotation mark

slate swan
#

you sure the channel was created?

thorn grove
#

Yes

#

The channel was created but the error shower up

slate swan
#

invite me to the server

thorn grove
slate swan
#

yeah

#

Fix it

thorn grove
#

Still shows error

slate swan
#

what error

thorn grove
slate swan
#

Idk your code is really sloppy but just get the channel object and put it instead of what I put

slate swan
#

again...

#

!resources

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

thorn grove
#

@slate swan isnt the target a role or member

slate swan
#

I didn't even check

#

I assumed it would be a channel

#

and yeah I just confused myslef

#

It is role object

thorn grove
slate swan
#
rolename = discord.utils.get(ctx.guild.roles, name="ROLENAME")
thorn grove
slate swan
#

I made a batch file that would automatically activate my bot but now I can't close it???

#

I tried Ctrl + C on the CMD but it's still online

slate swan
#

for the batch?

thorn grove
slate swan
slate swan
slate swan
slate swan
thorn grove
slate swan
slate swan
slate swan
slate swan
#

it gives me that Y/N option and if I press Y then it goes out

#

oh wait

#

...the bot's off

#

lmao I think it just lagged for a long time

#

sorry

thorn grove
shrewd apex
slate swan
#

so when I see "invalid permission" I just assume it has to do with intents

slate swan
thorn grove
#

Oh wut

#

Hmm

#

Maybe ill just scrap the channel making idea

slate swan
#

if it doesn't work then you might have to enable privileged intents on Discord Developer Portal

thorn grove
#

Sedಥ_ಥ

slate swan
thorn grove
thorn grove
#

General permissions

slate swan
thorn grove
#

Oh wait

#

@slate swan its on

#

Still shows error

#

ಥ╭╮ಥ ill just scrap this idea

#

Sed

dapper geyser
#

can some one help me when i put my code together some of the scripts dont work cause on_message is blocking them i puted on_message as last script and then it worked but then i codet somthing new and its not working anymore

#

idk if its cause of on_message ore idk if i run it solo it works just not if i put it in the same file

vocal snow
#

devastating

indigo pilot
#

Hey, can someone help me rq?

@app_commands.checks.has_role(requiredrole)
@app_commands.guilds(999122105281036319)
async def sendticketmessage(interaction: discord.Interaction):
    view = TicketButtons()
    embedd=discord.Embed(title=":tickets: Tickets", description="To create a ticket, please click one of the buttons below..\n\n**:art: Commissions**\n\n**:writing_hand: Applications**\n\n:envelope: **Support**", colour=0x33ECFF)
    await interaction.response.send_message(embed=embedd, view=view)

@sendticketmessage.error
async def sendticketmessage_error(interaction: discord.Interaction, error: app_commands.AppCommandError):
    if isinstance(error, app_commands.MissingRole):
        embed=discord.Embed(title=":no_entry: No permission", description="You do not have the required permission to run this command!", colour=0xff1100)
        embed.add_field(name="Role required:", value=requiredrolemention)
        await interaction.response.send_message(embed=embed)
        return
    raise error```
The cog is loading yet this cmd wont load
shrewd apex
#

sed

indigo pilot
#

Super confused now lmao, been messing with it for a while. It worked fine in another server but i just moved it and now it wont. Other cmds work fine

shrewd apex
#

@app_commands.command(name="sendticketmessage", description="ADMIN | Send ticket message.") #View added
@app_commands.checks.has_role(requiredrole)
@app_commands.guilds(999122105281036319)
async def sendticketmessage(interaction: discord.Interaction):
    view = TicketButtons()
    embedd=discord.Embed(title="🎟️ Tickets", description="To create a ticket, please click one of the buttons below..\n\n**🎨 Commissions**\n\n**✍️ Applications**\n\n✉️ **Support**", colour=0x33ECFF)
    await interaction.response.send_message(embed=embedd, view=view)

@sendticketmessage.error
async def sendticketmessage_error(interaction: discord.Interaction, error: app_commands.AppCommandError):
    if isinstance(error, app_commands.MissingRole):
        embed=discord.Embed(title="⛔ No permission", description="You do not have the required permission to run this command!", colour=0xff1100)
        embed.add_field(name="Role required:", value=requiredrolemention)
        await interaction.response.send_message(embed=embed)
        return
    raise error
indigo pilot
#

Oh sorry i forgot py

indigo pilot
#

Yep

#

Rebooted and synced, every cmd other then that gets synced

shrewd apex
#

also if it's in a cog where is ur self?

#

it's in a class right self is first arg

indigo pilot
#

I didnt send all the code as theres 1k+ lines

#

Just the cmd, rest is views

#

Cog is loaded tho

shrewd apex
indigo pilot
#

Wdym

shrewd apex
#

have u used classes before?

indigo pilot
#

Yea, u dont need self for that

shrewd apex
#

🗿

silk fulcrum
#

🗿

#

is that a static method?

#

why does it not ned self

shrewd apex
#

!e

class A:
    x = 7
    def foo(self):
       print(self.x)
b = A()
b.foo()
unkempt canyonBOT
#

@shrewd apex :white_check_mark: Your 3.11 eval job has completed with return code 0.

7
shrewd apex
indigo pilot
#

Letme just

# Imports
import asyncio

import discord
from discord.ext import commands
from discord import app_commands
import json

# Cog subclass
class TicketCore(commands.Cog):
    def __init__(self, bot):
        self.bot = bot # Allows us to use the bot outside of the __init__ function
        self.bot.tree.add_command(sendticketmessage) # Register the slash command in our bot

        global botglobal
        botglobal = bot

configjson = open("config.json")
# config should be file name, () gotta be var above
config = json.load(configjson)
serverid = int(config["serverid"])
requiredrole=int(config["roles"]["ticketstaffrole"])
requiredrolemention = "<@&" + str(config["roles"]["ticketstaffrole"]) + ">"
commissioncategory = int(config["channels"]["ticketcategorys"]['commissions'])
applicationcategory = int(config["channels"]["ticketcategorys"]['applications'])
supportcategory = int(config["channels"]["ticketcategorys"]['support'])
artpostchannel = int(config["channels"]["artpostchannel"])
fursuitpostchannel = int(config["channels"]["fursuitpostchannel"])
layoutartistdict = config['artistdict']

configjson.close()



@app_commands.command(name="sendticketmessage", description="ADMIN | Send ticket message.") #View added
@app_commands.checks.has_role(requiredrole)
@app_commands.guilds(999122105281036319)
async def sendticketmessage(interaction: discord.Interaction):
    view = TicketButtons()
    embedd=discord.Embed(title="🎟️ Tickets", description="To create a ticket, please click one of the buttons below..\n\n**🎨 Commissions**\n\n**✍ Applications**\n\n✉ **Support**", colour=0x33ECFF)
    await interaction.response.send_message(embed=embedd, view=view)

@sendticketmessage.error
async def sendticketmessage_error(interaction: discord.Interaction, error: app_commands.AppCommandError):
    if isinstance(error, app_commands.MissingRole):
        embed=discord.Embed(title="⛔ No permission", description="You do not have the required permission to run this command!", colour=0xff1100)
        embed.add_field(name="Role required:", value=requiredrolemention)
        await interaction.response.send_message(embed=embed)
        return
    raise error

async def setup(bot):
    bot.add_view(TicketButtons())
    bot.add_view(UserQuoteView(channelvar=None, options=[]))
    bot.add_view(ArtistReplyButtonDisabled())
    bot.add_view(UserReplyButtonDisabled())
    bot.add_view(UserQuoteButtonDisabled())
    bot.add_view(ArtistReplyButton(channelvar=None))
    bot.add_view(UserReplyButton(channelvar=None, artist=None))
    bot.add_view(ArtButtons(channelvar=None))

cold tide
#

How to open a file thru py??

silk fulcrum
indigo pilot
#

Again, its the same code and this worked

shrewd apex
#

and what happens now is interaction becomes the new self

cold tide
#

just wanna know lol

indigo pilot
#

In another server

#

Only broke once i moved it to the new server

#

Where @app_commands.checks.has_role(requiredrole)
should be fine, i use it in other cmds

silk fulcrum
#

ohkay

indigo pilot
#

And the guild is right

silk fulcrum
#

i see what

shrewd apex
#

if that's ur indentation in ur code that command is not even in a cog

indigo pilot
#

Yea it is?.. lol

shrewd apex
#

and it's the first time i am seeing someone need global while in a class

indigo pilot
#
# Imports
import discord
from discord.ext import commands
from discord import app_commands
import platform
import psutil
import json


# Cog subclass
class BotInfo(commands.Cog):
    def __init__(self, bot):
        self.bot = bot  # Allows us to use the bot outside of the __init__ function
        self.bot.tree.add_command(botinfo)  # Register the slash command in our bot


configjson = open("config.json")
# config should be file name, () gotta be var above
config = json.load(configjson)
serverid = int(config["serverid"])
configjson.close()


# note!! need to change to cmd groups
@app_commands.command(name="botinfo", description="Get infomation about the bot.")
@app_commands.guilds(serverid)
async def botinfo(interaction: discord.Interaction):
    # code

    commands = [cmd.name for cmd in interaction.client.tree.walk_commands(guild=discord.Object(id=811284392156725339))]
    embed = discord.Embed(title=f":tools: {interaction.client.user.name} bot details", colour=0x33ECFF)
    embed.add_field(name="• Bot details:",
                    value=f"> Uptime: <t:{interaction.client.uptime.timestamp():.0f}:R>\n> Commands loaded: ``{len(commands)}``\n> Cogs: ``{str(len(interaction.client.cogs))}``")
    embed.add_field(name="• Softwere details:",
                    value=f"> Python version: ``{platform.python_version()}``\n> Discord version: ``{discord.__version__}``")
    embed.add_field(name="• Server details:",
                    value=f"> CPU: ``{psutil.cpu_percent()}%``\n> RAM: ``{round(psutil.virtual_memory().available * 100 / psutil.virtual_memory().total)}%``")
    embed.add_field(name="• Developers:", value="> @indigo pilot\n> @west estuary")
    await interaction.response.send_message(embed=embed)


# Sets up the cog
async def setup(bot):
    await bot.add_cog(BotInfo(bot))```

same indentation as this and this cmd loads fine
indigo pilot
#

Im litterly so confused, the cog is loaded but this single cmd wont sync

shrewd apex
#

at start i thought maybe its due to discord mobile but the command is not in the cog ur indentations is wrong

indigo pilot
shrewd apex
#

just adding stuff inside a class keyword without care about indentation dosent add the command in the cog

#

self.bot.tree.add_command(botinfo)

#

its this line which is adding the command in the cog

#

the command itself is not in the class

indigo pilot
#

Oh wait i fixed it

#

await bot.add_cog(TicketCore(bot))
some how this got deleted

shrewd apex
#

and thats not even the way to use cogs

shrewd apex
#

nvm when u actually have time read up on how to use classes and oop

indigo pilot
#

Anyways thanks 4 trying

cya

glossy shore
#

what service or technologies do bots like MEE6 Bot use to generate customized images for each guild/server & users ?

silk fulcrum
#

images for each guild/server & users?

#

what does this mean

glossy shore
#

wait i'll show you

shrewd apex
#

if they are coded in python only best choices are pillow and opencv

glossy shore
silk fulcrum
glossy shore
#

ok thank you (:

limber bison
#

Hii

silk fulcrum
#

iiH

limber bison
#

Like i want command work on every possible case in small and capital letters, if command name is ban , or aliases is the only option 🤔

#

Like it work on Ban , BAN. , bAN , BaN

#

Etc....

shrewd apex
#

there is a case insensitive kwarg use that

silk fulcrum
#

you could do that to all commands by doing case_insensitive=True in Bot definition

shrewd apex
#

^^

#

!d discord.ext.commands.Bot

unkempt canyonBOT
#

class discord.ext.commands.Bot(command_prefix, *, help_command=<default-help-command>, tree_cls=<class 'discord.app_commands.tree.CommandTree'>, description=None, intents, **options)```
Represents a Discord bot.

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

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

Unlike [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client"), this class does not require manually setting a [`CommandTree`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CommandTree "discord.app_commands.CommandTree") and is automatically set upon instantiating the class.

async with x Asynchronously initialises the bot and automatically cleans up.

New in version 2.0.
limber bison
silk fulcrum
#

all commands

limber bison
silk fulcrum
#

idk, usually noone types !mUtE

#

maybe phone users...

#

but idk

#

i dont use that

hazy oxide
#

mostly use lower case

limber bison
#

Okk i will use aliases instead of this

#

Thanksssss

silk fulcrum
#

:lemao: I have to use 2 more tables in db because those 2 are lists

limber bison
silk fulcrum
#

okok application commands

limber bison
#

Ohhh k k 👀 👀

thorn grove
#

Anyonw know what the prob is

silk fulcrum
#

how much useless stuff

#

oh now i see

#

it's not view_messages

#

it's read_messages

pastel aspen
#

is it worth using discord.py 1.x or should I use 2.0?

silk fulcrum
thorn grove
silk fulcrum
pastel aspen
#

I'm hosting my bot on heroku so idk if the 2.0 will work there

silk fulcrum
#

it should

#

that's just same pip install, but instead of discord, it's git+https://github.com/Rapptz/discord.py

thorn grove
silk fulcrum
#

it's read_messages

#

not view_messages

thorn grove
#

I dont see view_messages

#

View_channel only

silk fulcrum
#

oops

#

yeah, it's view channel

#

in your code

pastel aspen
#

are there any major changes between 1 and 2.0?

silk fulcrum
#

hmm

#

but there is permission view_channel

slate swan
#

@silk fulcrum did you help out melon

silk fulcrum
#

no i dont understand whats wrong

slate swan
#

can someone help with this

thorn grove
shrewd apex
#

also by default overwrite is set to role everyone so there is no way u can have overwrite=None

slate swan
#

I love asher they know everything in d.py

silk fulcrum
#

noone loves me(

slate swan
shrewd apex
silk fulcrum
#

no one knows who are kwargs :lemao:

slate swan
silk fulcrum
#

heeey

shrewd apex
#

it had basically the code written down 🗿

silk fulcrum
#

that was the biggest secret

slate swan
thorn grove
#

Lemme check again

shrewd apex
#

so which part of it did u not understand?pithink

thorn grove
slate swan
#

asher how print hello world?

thorn grove
#

I cant see it

hazy oxide
#
import __hello__```
slate swan
#
print(__import__("random").choice(["project1", "project2"]))

😳 one liner python project chooser

shrewd apex
# slate swan asher how print hello world?

!e

p = lambda x: ( -13214 * x**11 + 956318 * x**10 - 30516585 * x**9 + 564961485 * x**8 
                - 6717043212 * x**7 + 53614486464 * x**6 - 291627605005 * x**5 
                + 1074222731065 * x**4 - 2606048429424 * x**3 + 3927289106268 * x**2 
                - 3265905357360 * x + 1116073728000 ) // 19958400 
 
print(bytearray(map(p, range(1, 13))))
unkempt canyonBOT
#

@shrewd apex :white_check_mark: Your 3.11 eval job has completed with return code 0.

bytearray(b'Hello World!')
shrewd apex
#

simply

thorn grove
shrewd apex
thorn grove
#

Okay thanks

slate swan
thorn grove
#

Oh

#

How cab i change it then?

slate swan
#

you can't edit the default role

#

The target parameter should either be a Member or a Role that belongs to guild.

thorn grove
#

I mean the role

#

Not yhe default

thorn grove
#

Change it to a specific role?

#

ctx.guild.roles("role name")?

slate swan
#
discord.utils.get(ctx.guild.roles, name="ROLENAME")

I assume

thorn grove
#

Didnt work

#

Last time

slate swan
#

@shrewd apex clarify for them

slate swan
thorn grove
dapper cobalt
slate swan
#

Idk how to help you man... you don't really have any basic knowledge here

thorn grove
slate swan
dapper cobalt
#

I think my Discord is having a problem

slate swan
shrewd apex
#
role = discord.utils.get(guild.roles, name='idk')
overwrites = {
    guild.default_role: discord.PermissionOverwrite(read_messages=False),
    user: discord.PermissionOverwrite(read_messages=True),
    support_role: discord.PermissionOverwrite(read_messages=True) # or whatever permissions the role should have
}
category = guild.get_channel(id).category
await category.create_text_channel(name=f'{user.display_name}', topic=f"{user.display_name}'s Support Channel", overwrites=overwrites)
slate swan
#

no ones gonna talk about the name of the function and how return annotations are being uses but argument annotations arent?

slate swan
#

🗿

dapper cobalt
#

Looks like I missed a lot

#

And I cannot get back to it, like at all

slate swan
thorn grove
silk fulcrum
# slate swan asher how print hello world?
from __future__ import annotations

import logging
import asyncio

log = logging.getLogger(__name__)


def rest(endup: Hellofier):
    asyncio.run(endup.cursed(bruh=False, coolity='hello world'))


class Hellofier:
    def __init__(self, *args, **kwargs):
        log.info(args)
        log.info(kwargs)

    @staticmethod
    async def cursed(bruh: bool = True, coolity=None):
        if bruh:
            return 'not cursed'
        print(coolity)


if __name__ == '__main__':
    var = Hellofier(['boop'], {1: 'beep'})
    rest(var)

slate swan
thorn grove
#

Just asked who it is for

silk fulcrum
slate swan
silk fulcrum
slate swan
#

I think okimii can do a harder one 😳

silk fulcrum
#

it works, also

slate swan
#

Pause

#

wait you guys dont get the byte version of your text and then encode it in utf-8 and then print it?

silk fulcrum
#

oh bruh

slate swan
#

get out of the house and say hello to the world better

slate swan
slate swan
slate swan
#

you guys are making me wanna learn java

shrewd apex
slate swan
dapper cobalt
#

You can still be a programmer and go outside, just take your computer with you tehee

slate swan
dapper cobalt
#

Benefits of having a laptop instead of a PC setup

shrewd apex
paper sluice
shrewd apex
#

go revise

slate swan
slate swan
dapper cobalt
#

Why is it that everytime I come into this chat it just goes off topic

slate swan
#

try Haskell

paper sluice
slate swan
silk fulcrum
#

why is everyone here from codejam, i know they're so smart, and i feel me is too dumb

slate swan
silk fulcrum
#

and no one loves me

dapper cobalt
#

So you're not alone

slate swan
shrewd apex
#

a team challenge

slate swan
#

it's like a jam but you need to code it iykwim

#

Exactly

swift pumice
#

.topic

lament depotBOT
#
**What unique features does your bot contain, if any?**

Suggest more topics here!

shrewd apex
#

codejam is a jam where u code best explanation

slate swan
silk fulcrum
slate swan
thorn grove
#

Shows an error noe

slate swan
silk fulcrum
shrewd apex
#

no i don't like jam in general

thorn grove
shrewd apex
#

Nutella or peanut butter so much better

limber bison
#

can i disable and enable a single comand

#

@commands.command

slate swan
thorn grove
#

Lemme just re do my code

dapper cobalt
slate swan
#

!paste

unkempt canyonBOT
#

Pasting large amounts of code

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

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

dapper cobalt
slate swan
dapper cobalt
#

Right?

limber bison
#

can i disable and enable a single comand
@commands.command?

slate swan
#

@dapper cobalt you code html, css?

silk fulcrum
dapper cobalt
slate swan
#

I wanna learn html and css but idk

silk fulcrum
#

learn html is kinda nothing

dapper cobalt
shrewd apex
#

!d discord.ext.commands.Command

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.
dapper cobalt
#

But not

shrewd apex
#

!d discord.ext.commands.Command.update

unkempt canyonBOT
#

update(**kwargs)```
Updates [`Command`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") instance with updated attribute.

This works similarly to the [`command()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.command "discord.ext.commands.command") decorator in terms of parameters in that they are passed to the [`Command`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") or subclass constructors, sans the name and callback.
slate swan
# slate swan I do

!e

print("".join([chr(int(binary, 2)) for binary in "01001000 01100101 01101100 01101100 01101111 00100000 01010111 01101111 01110010 01101100 01100100 00100001".split(" ")]))
unkempt canyonBOT
#

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

Hello World!
shrewd apex
#

just do enabled=False

dapper cobalt
unkempt canyonBOT
slate swan
#

oh no our table, its broken😔

thorn grove
#

@slate swan

slate swan
#

yours uses bytes, mines uses bits😳

limber bison
shrewd apex
#

bits and bytes go well together😳

dapper cobalt
limber bison
#

which decorator ?

thorn grove
shrewd apex
#

👀

slate swan
shrewd apex
#

yes indeed

slate swan
dapper cobalt
thorn grove
thorn grove
dapper cobalt
shrewd apex
thorn grove
thorn grove
dapper cobalt
thorn grove
limber bison
# shrewd apex fetch the command object then do .update(enabled=False)

cant understand

import discord
from discord.ext import commands

class modcommand(commands.Cog):

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

    @commands.command()
    @commands.has_permissions(manage_messages=True)
    async def sm(self , ctx, seconds: int = 0):
         await ctx.channel.edit(slowmode_delay=seconds)
         await ctx.reply(f"Set the slowmode delay in this channel to {seconds} seconds!")

    @sm.error
    async def sm_error(self,ctx , error):
        await ctx.send('use correctly' , delete_after = 2)  

def setup(client):
   client.add_cog(modcommand(client))```

in this command where ?
shrewd apex
#
import discord
from discord.ext import commands

class modcommand(commands.Cog):

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

    @commands.command()
    @commands.has_permissions(manage_messages=True)
    async def sm(self , ctx, seconds: int = 0):
         await ctx.channel.edit(slowmode_delay=seconds)
         await ctx.reply(f"Set the slowmode delay in this channel to {seconds} seconds!")

    @sm.error
    async def sm_error(self,ctx , error):
        await ctx.send('use correctly' , delete_after = 2)  
    
    @commands.command()
    @commands.is_owner()
    async def disable(self, command: commands.Command):
        await command.update(enabled=False)
        await ctx.send(f'Disabled {command.name}')

def setup(client):
   client.add_cog(modcommand(client))
thorn grove
#

@shrewd apex

slate swan
# slate swan kinda cheating imo

!e

print(type("Hello World", (), {"__str__": lambda a:
"".join([chr(int(binary, 2)) for binary in "01001000 01100101 01101100 01101100 01101111 00100000 01010111 01101111 01110010 01101100 01100100 00100001".split(" ")])})())
```👁️ 👁️
unkempt canyonBOT
#

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

Hello World!
slate swan
#

wouldnt it be slower lol

shrewd apex
#

it should be roughlt the same

#

roughly*

slate swan
#

i think my method is faster not sure

shrewd apex
#

also spilt splits at space by default right?

slate swan
#

yeah

shrewd apex
#

.split(" ") u wrote 3 chars extra 🗿

slate swan
#

it returns a list which then you would iterate through each string and convert it to a binary number with the int class with base 2 which then i use char to return the unicode form lol

#

wait does split have a default?

slate swan
shrewd apex
slate swan
#

more chars > better code😳

shrewd apex
slate swan
#
b = "0110100001100101011011000110110001101111001000000111011101101111011100100110110001100100"; a = "".join([chr(int(b[i:i+8],2)) for i in range(0,len(b),8)]); print(a)

@slate swan best I could do..

paper sluice
#

print('Hello World!') golfed

slate swan
#

overrated

slate swan
shrewd apex
#

!e

print("".join(list(map(lambda i: chr(int(i, 2)), "01001000 01100101 01101100 01101100 01101111 00100000 01010111 01101111 01110010 01101100 01100100 00100001".split()))))
unkempt canyonBOT
#

@shrewd apex :white_check_mark: Your 3.11 eval job has completed with return code 0.

Hello World!
shrewd apex
#

lets timeit

#

!timeit

print("".join(list(map(lambda i: chr(int(i, 2)), "01001000 01100101 01101100 01101100 01101111 00100000 01010111 01101111 01110010 01101100 01100100 00100001".split()))))
unkempt canyonBOT
#

@shrewd apex :white_check_mark: Your 3.11 timeit job has completed with return code 0.

50000 loops, best of 5: 4.5 usec per loop
slate swan
#

!timeit

b = "0110100001100101011011000110110001101111001000000111011101101111011100100110110001100100"; a = "".join([chr(int(b[i:i+8],2)) for i in range(0,len(b),8)]); print(a)
unkempt canyonBOT
#

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

50000 loops, best of 5: 5.01 usec per loop
slate swan
#

!timeit

print("Hello World")
unkempt canyonBOT
#

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

500000 loops, best of 5: 522 nsec per loop
slate swan
#

I win.

shrewd apex
#

!timeit

print("".join([chr(int(i, 2)) for i in "01001000 01100101 01101100 01101100 01101111 00100000 01010111 01101111 01110010 01101100 01100100 00100001".split()]))
unkempt canyonBOT
#

@shrewd apex :white_check_mark: Your 3.11 timeit job has completed with return code 0.

50000 loops, best of 5: 4.05 usec per loop
slate swan
#

no walrus operator 😔

shrewd apex
#

list comp won wow

slate swan
#

!timeit
!e

print(type("Hello World", (), {"__str__": lambda a:
"".join([chr(int(binary, 2)) for binary in "01001000 01100101 01101100 01101100 01101111 00100000 01010111 01101111 01110010 01101100 01100100 00100001".split(" ")])})())
unkempt canyonBOT
#

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

10000 loops, best of 5: 13.7 usec per loop
slate swan
#

yeah maps with lambdas are slower than just calling using or calling a function or method

shrewd apex
#

hmm rip

slate swan
#

hmm any other ways

#

!e

print([[[[[[[[[["Hello World!"]]]]]]]]]][0][0][0][0][0][0][0][0][0][0])
unkempt canyonBOT
#

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

Hello World!
slate swan
#

What the lmao

#

🧍

limber bison
shrewd apex
#

!d discord.ext.commands.Command.update

unkempt canyonBOT
#

update(**kwargs)```
Updates [`Command`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") instance with updated attribute.

This works similarly to the [`command()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.command "discord.ext.commands.command") decorator in terms of parameters in that they are passed to the [`Command`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") or subclass constructors, sans the name and callback.
shrewd apex
#

¯_(ツ)_/¯

#

just do .enabled=False then

#

!d discord.ext.commands.Command.enabled

unkempt canyonBOT
limber bison
#

raise BadArgument('Converting to "{}" failed for parameter "{}".'.format(name, param.name)) from exc
discord.ext.commands.errors.BadArgument: Converting to "Command" failed for parameter "command".

#

🤔

#
import discord
from discord.ext import commands

class modcommand(commands.Cog):

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

    @commands.command()
    @commands.has_permissions(manage_messages=True)
    async def sm(self , ctx, seconds: int = 0):
         await ctx.channel.edit(slowmode_delay=seconds)
         await ctx.reply(f"Set the slowmode delay in this channel to {seconds} seconds!")

    @sm.error
    async def sm_error(self,ctx , error):
        await ctx.send('use correctly' , delete_after = 2)  

    @commands.command()
    @commands.is_owner()
    async def disable(self,ctx , command:commands.Command):
        await command.update(enabled=False)
        await ctx.send(f'Disabled {command.name}')    

def setup(client):
   client.add_cog(modcommand(client))```
#

you can create a json for that

#

there is event funtion

#

named

#

on_leave

#

i think

#

just like on_ready

slate swan
#

!d discord.on_member_remove

unkempt canyonBOT
#

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

If the guild or member could not be found in the internal cache this event will not be called, you may use [`on_raw_member_remove()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.on_raw_member_remove "discord.on_raw_member_remove") instead.

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

i talking about bot itself

#

not about members

slate swan
#

!d discord.on_guild_remove

unkempt canyonBOT
#

discord.on_guild_remove(guild)```
Called when a [`Guild`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild "discord.Guild") is removed from the [`Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client").

This happens through, but not limited to, these circumstances...
limber bison
thorn grove
#

Guys

#

Nvm

vale chasm
#

?

limber bison
#

explain me in 1 line

#

is it normal cooldown

scarlet sorrel
#

How do you do that thing where it tries to do get_user and if it cant it moves to fetch_user

robust fulcrum
#

Is there any way to make a html comamnd
Which runs my html code and shows me preview of website?

paper sluice
scarlet sorrel
#

Mmm

slate swan
dapper cobalt
#

!d discord.on_guild_remove

unkempt canyonBOT
#

discord.on_guild_remove(guild)```
Called when a [`Guild`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild "discord.Guild") is removed from the [`Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client").

This happens through, but not limited to, these circumstances...
dapper cobalt
#

It's the same as dpy

#
@bot.event
async def on_guild_remove(guild):
  print(f"I got kicked from {guild.name}!")
errant citrus
#
@bot.event
async def on_guild_join(guild):
  ...
#

!d discord.on_guild_join

unkempt canyonBOT
#

discord.on_guild_join(guild)```
Called when a [`Guild`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild "discord.Guild") is either created by the [`Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") or when the [`Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") joins a guild.

This requires [`Intents.guilds`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Intents.guilds "discord.Intents.guilds") to be enabled.
glossy flame
#
keywords = ["when", "my", "poo", "cash", "eat", "scam"]
keywords_found = 0
@bot.event
async def on_message(message):
  content = message.content
  print(content)
  for word in content:
    if word in keywords:
      global keywords_found
      keywords_found += 1
  if keywords >= 3:
    await message.channel.send("Please refrain from using those words")
  await bot.process_commands(message)

How to detect multiple keywords in a single message and send a message if a certain number of keywords are found?

grim oar
#

use filter

vocal snow
#

turn the keywords to a set and get the intersection with message.content.split()

grim oar
#

filter(lambda x: x in keywords, message.content.split())

vocal snow
#
keywords = {"when", "my", "poo", "cash", "eat", "scam"}

found = keywords & set(message.content.split())
dapper geyser
#

hey

#

can some one show me how i can code a bot that delete bad words but without on_message

vocal snow
#

thats not possible

errant citrus
dapper geyser
vocal snow
#

that makes no sense, lol

eternal fox
#

oh well you'd just need to add

await bot.process_commands(message)
eternal fox
# dapper geyser wait thats all ?

ye after the on message thingy like this:

@bot.event
async def on_message(message):
 print(message)
 await bot.process_commands(message)
dapper geyser
#

lemme try it

eternal fox
#

okok

dapper geyser
#

if it works u are a angel from heaven

eternal fox
#

you'd need to put it in every on_message tho

dapper geyser
#

ik but its the only on_message comand that i have in my code

eternal fox
#

okok

dapper geyser
#

wait idk why but now a other code is not working sorry

vocal snow
#

it would be useful if you sent your full code

#

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

swift pumice
#

hi zeffopy_strong

swift pumice
vocal snow
#

what pithink

swift pumice
#

yes

#

nvm

#

idk

#

.topic

lament depotBOT
#
**What's one feature you wish more developers had in their bots?**

Suggest more topics here!

swift pumice
vocal snow
#

with slash commands that wont be necessary

slate swan
#

Message commands still exist

#

and nor does every bot have slash commands

swift pumice
hardy yoke
#

one thing a lot of ppl don't seem aware of is mention prefixes will continue to work

vocal snow
swift pumice
hardy yoke
#

not if they use mentions

hardy yoke
swift pumice
#

NOOO

vocal snow
swift pumice
#

bro :(

hardy yoke
# vocal snow how so? mentions don't seem to trigger any interactions

mention prefix can be used to trigger message commands (not slash). Discord isn't disabling using @mentions as a prefix.

interactions are slash only, but you can have both slash (with / as prefix) + message commands (with a mention as prefix). I imagine most bots won't do this (double the code) but it's possible

swift pumice
hardy yoke
slate swan
hardy yoke
#

of disabling them

slate swan
#

what

#

no

hardy yoke
#

yes

#

only exception is if you aren't verified ofc but then you can't join > 100 servers or if you manage to apply for message intents successfully (most bots can't)

maiden fable
#

Meh, just add an antispam to yr bot and u get access to message content

slate swan
#

one could be what Hunter suggested

hybrid fjord
hardy yoke
#

Meh I'm not adding random stuff to my bot just to get an intent
Just use mentions instead 😎

slate swan
#

skill issue

#

How to make commands and event with a database of bad words so that new words can be added to the database using a command

slate swan
#

sqlite3

slate swan
hybrid fjord
slate swan
#

!rule 4

unkempt canyonBOT
#

4. Use English to the best of your ability. Be polite if someone speaks English imperfectly.

slate swan
#

sorry

#

How to make commands and event with a database of bad words so that new words can be added to the database using a command. I'm using sqlite3

hybrid fjord
slate swan
#

qpi issue

#

api*

hybrid fjord
#

oh

slate swan
#

@slate swan Accidentally

slate swan
limber bison
#

how can i resolve discord.ext.commands.errors.CommandNotFound: Command "pping" is not found error

#

?

#

command.error ?

slate swan
#

it says the command pping is not found

limber bison
#

i know

slate swan
#

wait show code

limber bison
#

how can i stop it

#

command.error ?

slate swan
#

by making the command “pping”

limber bison
#

lol

slate swan
#

if u already have a command called pping show

limber bison
#

apke bs ka nhi h

limber bison
slate swan
hardy yoke
slate swan
#

^

limber bison
#

error handler for ?

#

CommandNotFound

limber bison
#
@bot.error
if isCommandNotFound(ctx):
       pass```
??
hardy yoke
#

read the gist

slate swan
#

How to fetch a user by id?

limber bison
vale wing
#

Afaik you can only get them

#

Nvm fetch_user exists as well

#

!d discord.Client.fetch_user

unkempt canyonBOT
#

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

Retrieves a [`User`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User "discord.User") based on their ID. You do not have to share any guilds with the user to get this information, however many operations do require that you do.

Note

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

Changed in version 2.0: `user_id` parameter is now positional-only.
bronze lark
#

hi im using replit but i have massive error...

vagrant brook
#

probably ip blocked

#

which is replit thing

bronze lark
#

what i have to do?

vagrant brook
#

i don't think you can do anything about it

#

repl.it shouldn't be used for hosting

eternal fox
#

or terminal

honest shoal
limber bison
#

how can i create globle error handler ?

#

on terminal

paper sluice
limber bison
#

i know i dont have ok command , i want bot ignore this

#

due to this cant able to find tha errors i want to find

#

@paper sluicesorry for ping

paper sluice
#

add an event listerner for on_command_error

limber bison
#
@commands.Cog.listener()
async def on_command_error(ctx, error):
 if isinstance(error, CommandNotFound):
    return 
#

this not working , wots wrong in this

slate swan
limber bison
paper sluice
limber bison
#

got it

slate swan
limber bison
#

thanks

limber bison
slate swan
#

you would only put "self" if you were in a cog

#

I thought you were using cogs when I said that

#

and sorry for my english, i'm from Portugal

limber bison
#
@client.command()
@commands.is_owner()
async def enabled(ctx , command: commands.Command):
    await command.update(enabled=True)
    await ctx.send(f'enabled {command.name}') ```
#

is it ok ?

cloud dawn
#

Bots can't read custom status or about me right?

#

Just making sure

slate swan
#

!slash command

#

@paper sluice Can I have documentation with slash commands ??

hardy yoke
#

because it doesnt have a bank key

slate swan
#

@robust fulcrum what ?

hardy yoke
#

literally no way for us to know

hardy yoke
#

there's nothing in that code where you create this dictionary
it appears to be pointing towards another function, so check whatever get_bank_data is

#

or print users, maybe the key exists but you aren't navigating to it correctly

swift pumice
#

how to get about me?

#

from a user

cloud dawn
swift pumice
#

:(

slate swan
swift pumice
#

why

robust fulcrum
#

How can I add check in a button?

slate swan
#

no works

slate swan
# swift pumice why

because that's the users privacy and there's no reason for bots to access about me

robust fulcrum
slate swan
#

"no works" doesnt help, either state your issue properly or dont at all

slate swan
slate swan
robust fulcrum
#

I not understood :(

slate swan
# slate swan what
  File "C:\Users\ToxicPenguin\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\cog.py", line 684, in _load_from_module_spec
    spec.loader.exec_module(lib)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "c:\Users\ToxicPenguin\Desktop\проекты на Python\disocrd bot python\cogs\slash.py", line 5, in <module>
    class SlashBot(discord.bot):
TypeError: module() takes at most 2 arguments (3 given)

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

Traceback (most recent call last):
  File "c:\Users\ToxicPenguin\Desktop\проекты на Python\disocrd bot python\index.py", line 19, in <module>
    bot.load_extension(f"cogs.{filename[:-3]}")
  File "C:\Users\ToxicPenguin\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\cog.py", line 756, in load_extension
    self._load_from_module_spec(spec, name)
  File "C:\Users\ToxicPenguin\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\cog.py", line 687, in _load_from_module_spec
    raise errors.ExtensionFailed(key, e) from e
discord.errors.ExtensionFailed: Extension 'cogs.slash' raised an error: TypeError: module() takes at most 2 arguments (3 given)```
#

uh?

robust fulcrum
#

I making fight command so i want that like first user1 can use button and then user2

slate swan
#

you do know what you are subclassing

#

ASakashrug so?

#

@slate swan
which module do I need to install for slash command to work ?

slate swan
#

because if you did not, I'm not helping either

slate swan
robust fulcrum
#

That's dpy 2.0

slate swan
#

@slate swan I remember trying to install a git link discord.py 2.0 and nothing happened. And I had to install it differently

#

I think the content on the walkthrough is pretty straightforward and easy to understand ASakashrug install dpy 2.0, what do you even mean by nothing happened

robust fulcrum
#

Ashley can you tell again about check in button?

slate swan
#

@slate swan is there any more documentation with slash command?

hardy yoke
slate swan
robust fulcrum
#

Hmmm

slate swan
robust fulcrum
#

Bruh

slate swan
robust fulcrum
#

Whats fr?

slate swan
slate swan
slate swan
slate swan
robust fulcrum
#

Ok

shrewd apex
robust fulcrum
#

Hmmm i not insulting

shrewd apex
#

correct sentence should be ur docs are clear and succint

robust fulcrum
#

Ye

shrewd apex
#

👍

shrewd apex
#

don't worry abt me i am just trolling trying to pass time

robust fulcrum
#

I not getting time to pass

shrewd apex
#

sed time left u behind then

robust fulcrum
shrewd apex
#

it does i think in the dpy lib repo itself

#

it's under an examples folder under views

slate swan
#

me omw to argue on the dpy server

cold sonnet
#

she actually has

slate swan
hybrid fjord
limber bison
#

command: commands.Command , its not converting !!

hybrid fjord
limber bison
#

any solution

#
@client.command()
@commands.is_owner()
async def disable(ctx ,command: commands.Command):
    await command.update(enabled=False)
    await ctx.send(f'Disabled {command.name}')```
#

?

slate swan
#

wait

#

weird, try unsyncing and syncing again

hybrid fjord
#

its not coming up at all though

hybrid fjord
slate swan
# hybrid fjord how lol

comment out all the slash commands and run the bot once, it'll refresh the commands, then you can sync them again

hybrid fjord
#

ah

hybrid fjord
#

still doesnt work @slate swan

slate swan
gilded gust
#

Hey, I'm using py-cord and need to disable all buttons in a view with the click of a single button. How do I do this?

solar pine
#

Trying to make a basic test loop, discord.py

@tasks.loop(seconds=5)
async def test(self):
  channel = self.bot.get_channel(channel id)
  await channel.send("Hello")

I put the self.test.start() in the init. Traceback is AttributeError: NoneType object has no attribute send

#

I'm pretty sure I'm getting the channel correctly though, and yes it's an int

unkempt canyonBOT
slate swan
#

!d discord.ui.Button.disabled

gilded gust
unkempt canyonBOT
gilded gust
#

tysm

slate swan
#

👍

gilded gust
slate swan
#

yeah he can do something like

await (self.bot.get_channel(id) or await self.bot.fetch_channel(id)).send("Hello World!")
solar pine
#

Okay, will do

#

Yeah, fetch channel works. But it's prob bcs I forgot to await it 😆

#

Thanks guys

#

By the way, is there a way I can enter a time, maybe a module, so it sends the message at a specific time every day?

slate swan
#

nah you used get channel, all get channels are cache lookups and arent coroutines so if the method returns None/the object isnt in cache you would just fetch channel to make a request

slate swan
#

you'd require a database and an on_guild_join event, check if the guild id exists within the blacklisted db and if it does use Guild.leave() to leave the guild

#

if it is for multiple servers

#

A single server won't require a db

robust fulcrum
slate swan
#

yes

glossy flame
vocal snow
#

Sets are essentially value-less dictionaries,
set1 & set2 is shorthand for set1.intersection(set2) and it gives you the common elements of both sets

solar pine
#

Can't seem to comprehend the doc

silk fulcrum
#

It's funny, how my bot slowly dies, I left it without any development for already 3 months and my friend is saying step by step smth like ban doesn't work properly, nuke doesn't work, e.t.c

vocal snow
#

Sad

silk fulcrum
#

Bruh

glossy flame
vocal snow
#

!d discord.ext.tasks.loop

unkempt canyonBOT
#

discord.ext.tasks.loop(*, seconds=..., minutes=..., hours=..., time=..., count=None, reconnect=True)```
A decorator that schedules a task in the background for you with optional reconnect logic. The decorator returns a [`Loop`](https://discordpy.readthedocs.io/en/latest/ext/tasks/index.html#discord.ext.tasks.Loop "discord.ext.tasks.Loop").
silk fulcrum
#

Without commands ofc

vocal snow
#

Just change the square brackets to {}

silk fulcrum
#

I still don't get how sets are different from lists

glossy flame
solar pine
#

It says TypeError: loop() got an unexpected keyword argument 'time'

vocal snow
silk fulcrum
#

No time

vocal snow
glossy flame
solar pine
glossy flame
vocal snow
#

what do you get when you print message.content

solar pine
#

I just went straight to the time parameter to specify the time

vocal snow
glossy flame
silk fulcrum
#

Wtf is discord.Option

vocal snow
solar pine
vocal snow
#

Yes

solar pine
#

Okay, the time parameter is above it, so I assume it's included in the old version

vocal snow
solar pine
#

Can I paste part of the doc here?

glossy flame
solar pine
#

Have no exp with the datetime module

slate swan
glossy flame
#

wait