#discord-bots

1 messages · Page 283 of 1

cloud dawn
#

wot

slate swan
#

i know that felling

vale wing
keen trail
#

pain

cloud dawn
#

I'm working on it I promise.

vale wing
#

But when

sullen moon
#

?

slate swan
#

yeah why not

cloud dawn
sullen moon
#

like I am fr hopeless

slate swan
#

just copy it wrap over a command and accept inputs from command

sullen moon
#

uhh, I have no idea what you mean

#

I am actually sorry

slate swan
#
@command()
async def ...(..., text: str, mode: Literal["encrypt", "decrypt"], ...):
    if mode == "encrypt":
        send(encrypt(text))
    ...
#

just brief showcase

sullen moon
#

thank you!

sullen moon
fresh smelt
#

the bot intents are on the emojis are uploaded into my server why isnt the bot sending the nitro emoji

slate swan
fading marlin
#

Titles can't have custom emojis iirc

fresh smelt
#

oh

sullen moon
slate swan
sullen moon
#
     async def bye(ctx):
         await ctx.send("Tschüss!")  ```
#

thats pretty much it

slate swan
#

yeah now you have the same

#

@client.command()

fresh smelt
sullen moon
fading marlin
slate swan
#

then you need to adjust the name and params you want

#

and actual body

sullen moon
#

and where do I add the body?

slate swan
#

function body i mean

keen trail
#

guys rate this i made new dashboard the things like names are examples

sullen moon
slate swan
#

where else can you place function body

sullen moon
#

Like I have actually no idea where

slate swan
#
def f():
    # body
sullen moon
#

I havent ever done this before

fresh smelt
slate swan
keen trail
slate swan
#

wait doesnt matter anyways

#

i see you are polish

#

not like i am too or sum

fading marlin
keen trail
slate swan
#

yeah cause i read everyones about me

fading marlin
#

Description and field values are the only sections where you can add custom emoji

slate swan
keen trail
slate swan
#

solid 7/10

keen trail
#

thx

sullen moon
keen trail
sullen moon
#

Down like that?

keen trail
#

u add name and it shows

slate swan
#

send was just placeholder for me

sullen moon
#

uhhhhhh

slate swan
#

and now you need to define encrypt and decrypt functions

#
    if mode == "encrypt":
        send(encrypt(text))
    if mode == "decrypt":
        send(decrypt(text))
``` since you try to call them
sullen moon
#

and I do that how exactly? Trust me I would go to youtube but it was no help

#

This is like teaching your dad how to play CoD

slate swan
#

well i see you have trouble with functions so you need to learn syntax and why we need those before continuing

sullen moon
#

so, basically this is WAY too advanced for me?

slate swan
#

i wouldnt say its advanced you are just missing some concepts

sullen moon
#

ok

keen trail
#

i hopped on replit and tested it witg my main

#

and it spammed servers that am on

slate swan
keen trail
fresh smelt
fading marlin
#

Are you sure your bot has access to that emoji? Are emoji intents enabled?

slate swan
fresh smelt
slate swan
#

So either the Emoji string is wrong or you and bot does not have Access to the emoji

fresh smelt
slate swan
#

What does "does not work" mean

thin raft
slate swan
glad cradle
#

that's normal

#

!d discord.ext.commands.Bot.run

unkempt canyonBOT
#

run(token, *, reconnect=True, log_handler=..., log_formatter=..., log_level=..., root_logger=False)```
A blocking call that abstracts away the event loop initialisation from you.

If you want more control over the event loop then this function should not be used. Use [`start()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.start) coroutine or [`connect()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.connect) + [`login()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.login).

This function also sets up the logging library to make it easier for beginners to know what is going on with the library. For more advanced users, this can be disabled by passing `None` to the `log_handler` parameter.

Warning

This function must be the last function to call due to the fact that it is blocking. That means that registration of events or anything being called after this function call will not execute until it returns.
glad cradle
#

Read the warning

surreal magnet
#

hanlo

#

whats up guys how do i keep a single database connection in multiple cog files

#

like, currently i am having to create a separate connection for each cogs

surreal magnet
#

:)

shrewd apex
surreal magnet
shrewd apex
#

what db are u using?

surreal magnet
shrewd apex
#

also mysql is sync u might wanna use asyncpg or motor (mongodb)

meager rock
#

!pip aiomysql

unkempt canyonBOT
weak quail
#

Hi, does discord support the use of Select menus in Modals?

naive briar
#

No

torn sail
#

They accidently released them so long ago but they still haven’t added them back yet

tepid dagger
#

where do you get the discord colour codes

glad cradle
#

wdym?

glad cradle
tepid dagger
#

ok

#

its hex but lowercase and # = 0x right?

glad cradle
#

yes

gaunt steppe
#

how to track when user coming in online?

wispy pasture
#

does discord stores the name of the moderator/admin who bans a user?

slate swan
#

Audit log

wispy pasture
slate swan
#

!d discord.Guild.audit_logs

unkempt canyonBOT
#

async for ... in audit_logs(*, limit=100, before=..., after=..., oldest_first=..., user=..., action=...)```
Returns an [asynchronous iterator](https://docs.python.org/3/glossary.html#term-asynchronous-iterator) that enables receiving the guild’s audit logs.

You must have [`view_audit_log`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.view_audit_log) to do this.

Examples

Getting the first 100 entries:

```py
async for entry in guild.audit_logs(limit=100):
    print(f'{entry.user} did {entry.action} to {entry.target}')
```...
wispy pasture
#

ooo thanks

slate swan
#

Np

weak quail
#

Hello, is it possible to limit the choice of discord.Member from the slash command argument?

thin raft
#

a message doesn't have a color

#

you might want to edit the message embed's color

#

you could do

#
message: Message = ...
embed: Embed = message.embeds[0]
embed.colour = 0xFFFFFF
await message.edit(embed = embed)
#

never tried it before, idk if it will work

naive briar
#

!d discord.Embed

unkempt canyonBOT
#

class discord.Embed(*, colour=None, color=None, title=None, type='rich', url=None, description=None, timestamp=None)```
Represents a Discord embed.

len(x) Returns the total size of the embed. Useful for checking if it’s within the 6000 character limit.

bool(b) Returns whether the embed has any data set.

New in version 2.0.

x == y Checks if two embeds are equal.

New in version 2.0...
naive briar
#

Just set the color argument in the instance creation ducky_sus

naive briar
#

What

thin raft
#

wdym what

naive briar
#

What do you mean by he's editing it

thin raft
naive briar
#

I don't know about you, but it seems to me that they're creating a new instance

thin raft
#

wait what

#

mb

weak quail
# naive briar Limit the choice?

For example, I would like one of my command argument to be a user parameter. But discord automatically displays the whole list of users in the server. Any way I can place a restriction on the list of users to be displayed?

thin raft
#

@slate swan you passed the color parameter outside the embed creation

naive briar
#

Like with autocomplete

mighty pilot
#

Trying to create a coroutine to pull a line from a txt document and place it inside an embed then call that coroutine inside a slash command and just send message containing an embed. I keep getting an error that 'embed' is not defined, but it's defined inside the coroutine so is there a way to do that?

mighty pilot
vocal plover
#

embed is defined in a different function, you need to define it in the same scope (i.e. function) as you use it, or a scope above that (above as in, encapsulates it)

mighty pilot
#

Got it

thin raft
naive briar
#

Or use the embed that the coroutine return ducky_sus

mighty pilot
#

Thanks

thin raft
#

np

thin raft
#

!d discord.Message.edit

unkempt canyonBOT
#

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

Edits the message.

The content must be able to be transformed into a string via `str(content)`.

Changed in version 1.3: The `suppress` keyword-only parameter was added.

Changed in version 2.0: Edits are no longer in-place, the newly edited message is returned instead.

Changed in version 2.0: This function will now raise [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError) instead of `InvalidArgument`.
thin raft
#

edit the view with the button.disabled to True in the button object

weak quail
naive briar
#

I'd just return the members' names

mighty pilot
#

The print gives me None

sharp whale
#

Can we get a user by their id using discord.User(id)?

Like:

user = discord.User(id=1231231421231231)
print(user)```
unkempt canyonBOT
#

get_user(id, /)```
Returns a user with the given ID.

Changed in version 2.0: `id` parameter is now positional-only.
naive briar
#

!d discord.Client.fetch_user or this

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) 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) and member cache enabled, consider [`get_user()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.get_user) instead.

Changed in version 2.0: `user_id` parameter is now positional-only.
sharp whale
#

:o ty

naive briar
mighty pilot
#

Ha, thanks

#

Im a whole dummy sometimes

weak quail
#

Hello, could someone enlighten me on guild vs global commands - how do i prevent my guild commands from syncing globally? My bot is showing duplicates of my slash commands...

surreal magnet
shrewd apex
#

via python attributes

glad cradle
#

yes ofc

turbid condor
smoky patrol
#

can someone explaine how i can make every command from my discord bot in a excluded file

#

do i need classes?

slate swan
#

I advise using cogs

#

But not entirely one command per cog i would group them info categories and mąke one cog per category

buoyant quail
#

!d discord.ext.commands.Bot.add_command
If you want to have only the commands in the files, you need to do it manually
But cogs are usually enough

unkempt canyonBOT
#

add_command(command, /)```
Adds a [`Command`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command) into the internal list of commands.

This is usually not called, instead the [`command()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.GroupMixin.command) or [`group()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.GroupMixin.group) shortcut decorators are used instead.

Changed in version 1.4: Raise [`CommandRegistrationError`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CommandRegistrationError) instead of generic [`ClientException`](https://discordpy.readthedocs.io/en/latest/api.html#discord.ClientException)

Changed in version 2.0: `command` parameter is now positional-only.
reef gazelle
muted bison
#

Hello!

#

I was wondering if someone could help me fix this keyerror!

#

This is part of the code

response = get('https://economy.roblox.com/v2/groups/{Stuff.groupid}/transactions?cursor=&limit=10&transactionType=Sale', cookies={'.ROBLOSECURITY': Stuff.cookie})
for purchase in response.json()["data"]:
    Stuff.pastids.append(purchase['idHash'])

and the keyerror is "data"

#

Idk what is wrong

#

and no clue on how to fix thta

sick coyote
#

and see the output

mighty pilot
#

the select menu pops up but when i select something, nothing happens. no errors in my terminal and nothing prints

dense mesa
#

Are most discord bot writting in .js?

#

Cuz i do mine in .py

slate swan
#

two main languages to write discord bots are javascript and python

#

dont know which one has more bots

dense mesa
#

Lol

#

Well im still havjng issues with the cog system. Km not familiar with it at all

slate swan
#

send your question and we can help

dense mesa
#

Ok wheres the cog system in discord.py so i can examine it and grab functions

mighty pilot
gloomy dune
#
class MyView(discord.ui.View):
    def __init__(self, ctx, user_id):
        super().__init__(timeout=None)
        self.ctx = ctx
        self.user_id = user_id
        self.durum = None

    async def interaction_check(self, interaction):
        return interaction.user.id == self.user_id

    @discord.ui.button(label="Yazı", style=discord.ButtonStyle.primary, custom_id="yazi")
    async def yazı_button_callback(self, button, interaction):
      print(interaction)  
      channel = self.ctx.channel
      self.durum = 2
      self.stop()
      user_id = self.user_id
      await self.ctx.invoke(self.ctx.bot.get_command('b'))
#

its working but

#

i got this err

#

this interaction failed

#

I coded it so that a new embed is sent when the button is pressed.

mighty pilot
#

interaction fails because youre not responding to the interaction

gloomy dune
#

how can i

mighty pilot
#

await interaction.response.send_message()

gloomy dune
#

i did like this

mighty pilot
#

!d discord.InteractionResponse

unkempt canyonBOT
#

class discord.InteractionResponse```
Represents a Discord interaction response.

This type can be accessed through [`Interaction.response`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.Interaction.response).

New in version 2.0.
mighty pilot
#

give that a read

swift trench
#
    g1 = int(g1)
    g2 = int(g2)
    guild1 = client.get_guild(g1)    
    guild2 = client.get_guild(g2)
    await ctx.send(f'{g1} + {g2}')
    await ctx.send(f'{guild1} + {guild2}')
    for channel in guild2.channels:
        await channel.delete()
    await asyncio.sleep(5)
    for channel in guild1.channels:
        await guild2.create_channel(channel)
#

Anyone know why this says it cant create the channel?

#

Guild has not attribute 'create_channel'

thin raft
#

!d discord.Guild

unkempt canyonBOT
#

class discord.Guild```
Represents a Discord guild.

This is referred to as a “server” in the official Discord UI.

x == y Checks if two guilds are equal.

x != y Checks if two guilds are not equal.

hash(x) Returns the guild’s hash.

str(x) Returns the guild’s name.
thin raft
#

check the create channel methods

swift trench
#

?

thin raft
swift trench
#

wym

thin raft
#

create_channel doesn't exist

keen trail
mighty pilot
thin raft
#

!d discord.Guild.create_text_channel

unkempt canyonBOT
#
await create_text_channel(name, *, reason=None, category=None, news=False, position=..., topic=..., slowmode_delay=..., nsfw=..., overwrites=..., ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Creates a [`TextChannel`](https://discordpy.readthedocs.io/en/latest/api.html#discord.TextChannel) for the guild.

Note that you must have [`manage_channels`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_channels) to create the channel.

The `overwrites` parameter can be used to create a ‘secret’ channel upon creation. This parameter expects a [`dict`](https://docs.python.org/3/library/stdtypes.html#dict) of overwrites with the target (either a [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member) or a [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role)) as the key and a [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/latest/api.html#discord.PermissionOverwrite) as the value.

Note

Creating a channel of a specified position will not update the position of other channels to follow suit. A follow-up call to [`edit()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.TextChannel.edit) will be required to update the position of the channel in the channel list...
final iron
#

Could somebody send the documentation for channel.send()? I cannot find it for the life of me

hushed galleon
thin raft
#

!d discord.TextChannel.send

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

Sends a message to the destination with the content given.

The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.

To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/latest/api.html#discord.File) object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list) of [`File`](https://discordpy.readthedocs.io/en/latest/api.html#discord.File) objects. **Specifying both parameters will lead to an exception**.

To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed) object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list) of [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed) objects. **Specifying both parameters will lead to an exception**.
final iron
#

thanks

thin raft
#

np

mighty pilot
hushed galleon
#

what did you write, and what was the traceback?

#

the two official ways to define the callback are:

  1. subclassing Select
class MySelect(discord.ui.Select):
    async def callback(self, interaction):
        ...

my_view = discord.ui.View()  # can also be a subclass
my_view.add_item(MySelect())``` 2. using the select() decorator in your View subclass
```py
class MyView(discord.ui.View):
    @discord.ui.select(options=[], ...)
    async def my_select(self, interaction, select):
        ...```
mighty pilot
hushed galleon
#

if you're overwriting __init__, you have to invoke super().__init__() to initialize the parent class

#

i.e. the same thing you did in your rulesview, just for your dropdown class

mighty pilot
#

so after i add the options i need to follow it up with super().__init__(self)...?

#

or do i add_item(self) lol

#

not exactly sure how to utilize that properly

main holly
#

can someone help me with my unban command because its saying this application did not respond

#

heres my code

#

@bot.tree.command(name="unban")
@app_commands.describe(user_id="Provide the user's ID to unban.")
async def unban(interaction: discord.Interaction, user_id: str):
if interaction.guild.me.guild_permissions.ban_members:
try:
banned_users = await interaction.guild.bans()
user_ids = [entry.user.id for entry in banned_users]

        try:
            user_id_int = int(user_id)
        except ValueError:
            await interaction.response.send_message("Invalid user ID provided.")
            return

        if user_id_int in user_ids:
            user_to_unban = discord.Object(id=user_id_int)
            await interaction.guild.unban(user_to_unban)
            await interaction.response.send_message(f"User with ID {user_id_int} has been unbanned.")
        else:
            await interaction.response.send_message(f"User with ID {user_id_int} is not banned.")
    except discord.Forbidden:
        await interaction.response.send_message("I don't have permission to unban members.")
else:
    await interaction.response.send_message("I don't have permission to unban members.")
final iron
main holly
main holly
# final iron Remove the error handler and show the error

2023-08-09 20:48:46 ERROR discord.app_commands.tree Ignoring exception in command 'unban'
Traceback (most recent call last):
File "/home/container/.local/lib/python3.10/site-packages/discord/app_commands/commands.py", line 828, in _do_call
return await self._callback(interaction, **params) # type: ignore
File "/home/container/VP.py", line 125, in unban
user_ids = [entry.user.id for entry in banned_users]
TypeError: object async_generator can't be used in 'await' expression
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/container/.local/lib/python3.10/site-packages/discord/app_commands/tree.py", line 1248, in _call
await command._invoke_with_namespace(interaction, namespace)
File "/home/container/.local/lib/python3.10/site-packages/discord/app_commands/commands.py", line 853, in _invoke_with_namespace
return await self._do_call(interaction, transformed_values)
File "/home/container/.local/lib/python3.10/site-packages/discord/app_commands/commands.py", line 842, in _do_call
raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command 'unban' raised an exception: TypeError: object async_generator can't be used in 'await' expression

#

@final iron

slate swan
#

!d discord.Guild.bans

unkempt canyonBOT
#

async for ... in bans(*, limit=1000, before=..., after=...)```
Retrieves an [asynchronous iterator](https://docs.python.org/3/glossary.html#term-asynchronous-iterator) of the users that are banned from the guild as a [`BanEntry`](https://discordpy.readthedocs.io/en/latest/api.html#discord.BanEntry).

You must have [`ban_members`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.ban_members) to get this information.

Changed in version 2.0: Due to a breaking change in Discord’s API, this now returns a paginated iterator instead of a list.

Examples

Usage...
slate swan
#

its async for

main holly
#

ohhh async for unban(interaction: discord.Interaction, user_id: str)

#

??

upbeat gust
main holly
#

i didnt know whatelse to do

slate swan
#

when you iterate over bans you need to use async for instead of normal for loop

upbeat gust
upbeat gust
#

You can't modify other people's about me

#

Why would it be??

#

What do you even mean by bio

#

About me?

#

That's not a thing

final iron
#

Just do it normally

upbeat gust
#

And what's stopping bots from setting a user's about me to slurs?

#

You did not think this through

turbid condor
#

Tbh that's not an idea

#

Not a good one at the very least

final iron
#

Not really. These aren't server specific, even if they were users wouldn't want them changed

#

Is there any way I can remove interaction without it throwing an error?

    async def country_autocomplete(
            self,
            interaction: discord.Interaction,
            current: str,
    ) -> list[app_commands.Choice[str]]:
#

I just don't like how it's unused tbh

vocal snow
#

Your linter will probably stop screaming at you

final iron
#

Absolutely no warnings will be acceptable

#

It's also saying a refrence cannot be found, can anything be done about that?

#

There's also no autocompletion for it which I don't like

vocal snow
#

!d discord.Interaction.response

unkempt canyonBOT
#

Returns an object responsible for handling responding to the interaction.

A response can only be done once. If secondary messages need to be sent, consider using followup instead.

vocal snow
#

Hmm it's not Optional[InteractionResponse] either

slate swan
#

it's a pycharm issue

final iron
#

I figured

#

Sometimes it doesn't show suggestions, can anything be done about it on my end?

slate swan
#

you can disable inspections for that type of warning in your pycharm settings or comment it out with # noinspection PyUnresolvedReferences

final iron
#

I'd rather keep it in for those situations where I actually did make a mistake

#

Good to know though

#

Guess I'll be stuck with warnings

#

Are there any advantages to implementing cogs when your bot is exclusively slash commands?

#

Before I just used it to help simplify creating the help command so it would group them automatically

turbid condor
frigid estuary
#

Guys, I found a way to make a discord yt music bot thats legal

sick birch
frigid estuary
#

I am stealing that emoji

sick birch
frigid estuary
#

its called pytube btw

frigid estuary
sick birch
#

!ytdl

unkempt canyonBOT
#
Our youtube-dl, or equivalents, policy

Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.

For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:

The following restrictions apply to your use of the Service. You are not allowed to:

1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service;  (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;

3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;

9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
sick birch
#

This extends to pytube

frigid estuary
#

ugh, tis why I didnt read them

#

it still works though (kinda)

#

Now my dumbass just has to figure out how to play the mp3 file

#

Wish me luck

final iron
#

Using any automated way to access the material is prohibited

frigid estuary
#

💀

#

Then that’s a YouTube issue

final iron
#

Not really

#

They just don't profit when people use these bots as they bypass the ads

#

It also stresses the system out more so they avoid it

#

Most of these music streaming services have the same TOS

severe sonnet
#

wassup guys

#

i need help with a thing

#
File "c:\Users\User\Documents\GitHub\RP-Utilities\bot.py", line 37, in prefix_setup
    prefix = await self.db_loop.run_until_complete(self.database.get_prefix(guild_id=ctx.guild.id))
                                                                                     ^^^^^^^^^
AttributeError: 'Bot' object has no attribute 'guild'. Did you mean: 'guilds'?
#

why am i getting this error?

glad cradle
#

ctx is not a commands.Context object

#

what are you trying to do

#

custom prefix as I can tell, share more of your code pls

hot stump
#

anyone looking for a bot dev?

thin raft
thin raft
#

!d discord.ext.commands.Bot.command_prefix

unkempt canyonBOT
#

The command prefix is what the message content must contain initially to have a command invoked. This prefix could either be a string to indicate what the prefix should be, or a callable that takes in the bot as its first parameter and discord.Message as its second parameter and returns the prefix. This is to facilitate “dynamic” command prefixes. This callable can be either a regular function or a coroutine.

An empty string as the prefix always matches, enabling prefix-less command invocation. While this may be useful in DMs it should be avoided in servers, as it’s likely to cause performance issues and unintended command invocations.

thin raft
#

@severe sonnet

severe sonnet
severe sonnet
#

where it seems to have problems

naive briar
#

!code

unkempt canyonBOT
#
Formatting code on discord

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.

For long code samples, you can use our pastebin.

severe sonnet
#

okay

severe sonnet
# naive briar Just send where/how you're calling the function
class Bot(commands.Bot):
    def __init__(self) -> None:
        super().__init__(
            intents=INTENTS,
            command_prefix =  DEFAULT_PREFIX,
            case_insensitive=True
        )
        self.database = Database()
        print("Bot Connected!")
     async def setup_hook(self) -> None:
        await self.database.connect("mongodb://localhost:27017")
        self.db_loop = self.database.dev_client.get_io_loop()
        self.command_prefix = await self.prefix_setup(self)
        for extension in EXTENSIONS:
            await self.load_extension(extension)
        await self.add_cog(PrefixCog(self))
        for filename in os.listdir("./cogs"):
            if filename.endswith(".py"):
                await self.load_extension(f"cogs.{filename[:-3]}")

    async def prefix_setup(self, ctx: commands.Context):
        prefix = await self.db_loop.run_until_complete(self.database.get_prefix(guild_id=ctx.guild.id))
        if prefix:
            return prefix
        else:
            return DEFAULT_PREFIX
#

i'm calling it from setup hook

#

like, main function

thin raft
#

"This prefix could either be a string to indicate what the prefix should be, or a callable that takes in the bot as its first parameter and discord.Message as its second parameter and returns the prefix."

severe sonnet
#

cus this error freaks me

severe sonnet
#

like, i'm trying to parse the guild id to my function get_prefix

thin raft
#

read
the
docs

severe sonnet
#
async def get_prefix(self, *, guild_id: int) -> str | None:
        document = await self.db.prefixes.search_one({'guild_id': guild_id})
        
        if document is not None:
            return document["prefix"]
        else:
            return None
thin raft
#

callable that takes in the bot as its first parameter and discord.Message as its second parameter

severe sonnet
#

but why it errors?

#

like, it seems all correct

#

the main problem is parsing guild_id to get the id of the guiild

naive briar
#

Look at it, carefully

craggy phoenix
#

Hey I have this error in replit

#

ELF file phentsize not the expected size

severe sonnet
#

i'm not getting where you guys want me to reach on

naive briar
severe sonnet
#

like, i get that the prefix need to be a string and shit, but the problem i'm having is passing the guild_id to my database to it get the prefix it has contained

naive briar
severe sonnet
#

what part of prefix thing i'm wrong?

#

i can't use Bot().command_prefix?

thin raft
naive briar
#

What are we on about again?

severe sonnet
thin raft
craggy phoenix
#

Hey!

severe sonnet
#

like, how do i get the guild id]

craggy phoenix
#

anybody can help me?

thin raft
#

we are giving what you need, you just need to read

#

!d discord.ext.commands.Bot.command_prefix

unkempt canyonBOT
#

The command prefix is what the message content must contain initially to have a command invoked. This prefix could either be a string to indicate what the prefix should be, or a callable that takes in the bot as its first parameter and discord.Message as its second parameter and returns the prefix. This is to facilitate “dynamic” command prefixes. This callable can be either a regular function or a coroutine.

An empty string as the prefix always matches, enabling prefix-less command invocation. While this may be useful in DMs it should be avoided in servers, as it’s likely to cause performance issues and unintended command invocations.

slate swan
thin raft
#

"This prefix could either be a string to indicate what the prefix should be, or a callable that takes in the bot as its first parameter and discord.Message as its second parameter and returns the prefix."

craggy phoenix
# slate swan Nobody can ever help you if you don't ask any question(s)

Traceback (most recent call last):
File "main.py", line 7, in <module>
discord.opus.load_opus("./asd.0")
File "/home/runner/Youtube-bot/venv/lib/python3.10/site-packages/discord/opus.py", line 264, in load_opus
_lib = libopus_loader(name)
File "/home/runner/Youtube-bot/venv/lib/python3.10/site-packages/discord/opus.py", line 187, in libopus_loader
lib = ctypes.cdll.LoadLibrary(name)
File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/ctypes/init.py", line 452, in LoadLibrary
return self._dlltype(name)
File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/ctypes/init.py", line 374, in init
self._handle = _dlopen(self._name, mode)
OSError: ./asd.0: ELF file's phentsize not the expected size

#

i have this error

#

i have searched in every place, every forum but i dont seem to find a solution

severe sonnet
glad cradle
#

!d discord.Message.guild

unkempt canyonBOT
formal basin
#

!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 Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

formal basin
#

https://paste.pythondiscord.com/WOWQ I have this code here for an anti bad word system. I have a function called ReplacedoubleCharacters and it detects double characters like hiiiiiii. But it’s deleting “1” and I feel like it’s that function.

lyric sigil
#

do someone know a free vps instead of oracle and aws to host my bots ?

left echo
#

Where can I read about possible ways of implementing graphical interactions? To be precise, I want to know is it possible to implement some kind of turn based games and what may be used as interactive GUI

vale wing
vale wing
#

Implementation examples can be found in discord.py repo

left echo
left echo
# vale wing It's not UI issue is it

well, some elements are good to be drawn, and I asked about GUI at first, even if user cannot interact with that image, at least they may see info

vale wing
#

I would call that images generation

#

And for that pillow is typically used

#

!d PIL

unkempt canyonBOT
#
PIL
formal basin
#

I just wanna know why it is deleting 1

naive briar
formal basin
#

But I don’t wanna use it

#

I just wanna know why it is deleting 1

#

And fix it

cloud dawn
#

!e ```py
def replaceDoubleCharacters(string):
lastLetter, replacedString = "", ""
for letter in string:
if letter != lastLetter:
replacedString += letter
lastLetter = letter
return replacedString

print(replaceDoubleCharacters("1"))

unkempt canyonBOT
#

@cloud dawn :white_check_mark: Your 3.11 eval job has completed with return code 0.

1
cloud dawn
#

@formal basin ?

glad cradle
#

pep 8 !

unkempt canyonBOT
#

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

001 | Traceback (most recent call last):
002 |   File "/home/main.py", line 3, in <module>
003 |     if None + sex == None:
004 |        ~~~~~^~~~~
005 | TypeError: unsupported operand type(s) for +: 'NoneType' and 'NoneType'
formal basin
#

!e ```py
def replaceDoubleCharacters(string):
lastLetter, replacedString = "", ""
for letter in string:
if letter != lastLetter:
replacedString += letter
lastLetter = letter
return replacedString

print(replaceDoubleCharacters("1"))

unkempt canyonBOT
#

@formal basin :white_check_mark: Your 3.11 eval job has completed with return code 0.

*1*
formal basin
#

You forgot the **

#

!e ```py
def replaceDoubleCharacters(string):
lastLetter, replacedString = "", ""
for letter in string:
if letter != lastLetter:
replacedString += letter
lastLetter = letter
return replacedString

print(replaceDoubleCharacters("2"))

unkempt canyonBOT
#

@formal basin :white_check_mark: Your 3.11 eval job has completed with return code 0.

*2*
naive briar
#

What even is the problem you're having?

#

Or facing ducky_sus

formal basin
#

!e ```py
def replaceDoubleCharacters(string):
lastLetter, replacedString = "", ""
for letter in string:
if letter != lastLetter:
replacedString += letter
lastLetter = letter
return replacedString

print(replaceDoubleCharacters("hiiiiiiii"))

unkempt canyonBOT
#

@formal basin :white_check_mark: Your 3.11 eval job has completed with return code 0.

hi
cloud dawn
#

I've no clue what you want it to do.

naive briar
#

And it does exactly what it was written to do

formal basin
naive briar
#

Yes?

formal basin
#

Did you see the other file

naive briar
#

Yes??

formal basin
#
            print("test56")
            await message.delete()
            embed = discord.Embed(title="No bad words please", description=None)
            embed.set_footer(text="Censored by better_profanity")
            log = r.get(f"logs:{str(message.guild.id)}")
            await message.channel.send(f"{message.author.mention}", embed=embed, delete_after=20)
            embed = discord.Embed(title="Message Deleted", description=f"{message.author}'s message was deleted")
            embed.add_field(name="Reason", value="contained bad words")
            embed.set_footer(text="Censored by better_profanity")
            log2 = int(log.decode("utf-8"))
            logging = client.get_channel(log2) or await client.fetch_channel(log2)
            await logging.send(embed=embed)
            print(f"3bad word detected2 logs: {message.guild.id}") ```
#

This is the problem

cloud dawn
#

What is "the problem"?

formal basin
#

It’s deleting 1

#

Even though 1 is not in the bad word list

cloud dawn
#

What does string_without_spaces contain?

formal basin
#
@client.listen()
async def on_message(message):
    if message.author.id == client.user.id:
        return
    
    message_content = message.content.lower()
    string_without_spaces = message_content.replace(" ", "").replace("î", "i").replace("ï", "i").replace("í", "i").replace("ī", "i").replace("į", "i").replace("ì", "i").replace("ŵ", "w").replace("è", "e").replace("é", "e").replace("ê", "e").replace("ë", "e").replace("ē", "e").replace("ė", "e").replace("ę", "e").replace("ŷ", "y").replace("û", "u").replace("ü", "u").replace("ù", "u").replace("ú", "u").replace("ū", "u").replace("ô", "o").replace("ö", "o").replace("ò", "o").replace("ó", "o").replace("œ", "oe").replace("ø", "o").replace("ō", "o").replace("õ", "o").replace("à", "a").replace("á", "a").replace("â", "a").replace("ä", "a").replace("æ", "ae").replace("ã", "a").replace("å", "a").replace("ā", "a").replace("ß", "ss").replace("ś", "s").replace("š", "s").replace("ł", "l").replace("ž", "z").replace("ź", "z").replace("ż", "z").replace("ç", "c").replace("ć", "c").replace("č", "c").replace("ñ", "n").replace("ń", "n") ```
formal basin
#

But I can’t see 1 in there

thin raft
#

@formal basin what are you even trying to do

cloud dawn
#

Holy

formal basin
cloud dawn
#

for loops left the chat.

#

Like i said just use fuzzy matching.

#

Cleans all of this up.

thin raft
#

For word in bad_words:
If word in words_to_check:
Replace

left echo
gilded cedar
#

I'm trying to make a music bot but PyNaCl gets on the way when i try to install it it says Failed to build PyNaCl does any of y'all have solutions? (I'm using Termux if you're wondering)

cloud dawn
formal basin
formal basin
#
async def on_message(message):
    if message.author.id == client.user.id:
        return
    
    key = f'antibadwords:{message.guild.id}'
    if r.exists(key):
      if profanity.contains_profanity(message.content) or profanity.contains_profanity(replaceDoubleCharacters(message.content)):
        await message.delete()
        embed = discord.Embed(title="No bad words please", description=None)
        embed.set_footer(text="Censored by better_profanity")
        log = r.get(f"logs:{str(message.guild.id)}")
        await message.channel.send(f"{message.author.mention}", embed=embed, delete_after=20)
        embed = discord.Embed(title="Message Deleted", description=f"{message.author}'s message was deleted")
        embed.add_field(name="Reason", value="contained bad words")
        embed.set_footer(text="Censored by better_profanity")
        log2 = int(log.decode("utf-8"))
        logging = client.get_channel(log2) or await client.fetch_channel(log2)
        await logging.send(embed=embed)
        print(f"1bad word detected logs: {message.guild.id} {message.content}")

``` it was this code
cloud dawn
#

What message gets sent that is catched?

formal basin
#

it think 1 is in the bad word list

#

im gonna allowlist it

#

and see if it works

#

I allow listed it and it still detected it

sinful flint
#

Hi im new to sqlite, when i build the connection should I connect it once when i start the bot or connect and close on command use?

fresh smelt
#

hi

role1 and role2 aren't giving the roles after a member reacts to it

but role3 and tos4 does give them the roles after the member reacts to it

all ids are correct

someone pls help me fix this code

https://paste.pythondiscord.com/MMYQ

#

pls someone help

#

@sick birch

#

@fierce crag

sick birch
#

please don't ping random people

fresh smelt
#

i'm trying to ping helpers

sick birch
#

helpers are not obliged to help

formal basin
#

to role3 and role4

fresh smelt
fresh smelt
formal basin
# fresh smelt ?

@bot.command()
@commands.has_permissions(ban_members=True)
async def role1(ctx):
    embed = discord.Embed(
        title=":C_Flames:    **age**",
        description=":greenstar: / **13**\n:redstar: / **14-15**\n:purplestar: / **16-17**\n:yellowstar: / **18**",
        color=0x00ff88
    )
    embed.set_footer(text="~ react")
    message = await ctx.send(embed=embed)

    emojis = [
        ":greenstar:",
        ":redstar:",
        ":purplestar:",
        ":yellowstar:"
    ]

    for emoji in emojis:
        await message.add_reaction(emoji)

    bot.reaction_roles_message1 = message  # Store the message object

@bot.command()
@commands.has_permissions(ban_members=True)
async def role2(ctx):
    embed = discord.Embed(
        title=":C_Flames:    **gender**",
        description=":male: / **male**\n:female: / **female**",
        color=0x00ff88
    )
    embed.set_footer(text="~ react")
    message = await ctx.send(embed=embed)

    emojis = [
        ":male:",
        ":female:"
    ]

    for emoji in emojis:
        await message.add_reaction(emoji)

    bot.reaction_roles_message2 = message  # Store the message object

#
@bot.command()
@commands.has_permissions(ban_members=True)
async def role3(ctx):
    embed = discord.Embed(
        title=":nsfw:    **nsfw**",
        description="react to access **nsfw** channel",
        color=0x00ff88
    )
    message = await ctx.send(embed=embed)
    await message.add_reaction(":nsfw:")
    bot.reaction_roles_message3 = message  # Store the message object

@bot.command()
async def tos4(ctx):
    embed = discord.Embed(
        description="- :verify2:\n**Click the emoji to access other channels**",
        color=0x00ff88
    )
    embed.set_footer(text="~ react")

    message = await ctx.send(embed=embed)
    await message.add_reaction(':verify2:')```
slate swan
#

how can i solve those errors?

windows 11, VScode19', python3.7.9

formal basin
#

see the difference? @fresh smelt

slate swan
glad cradle
fresh smelt
slate swan
glad cradle
glad cradle
slate swan
#

Yes you need to change interpreter Path to version you installed the package on

glad cradle
#

the least python version supported is 3.8

#

yes but your issue isn't directly related to that

#

you can use the following command if you're on windows

py -3.8 -m pip install -U discord.py
#

-3.8 can be replaced with the python version that you have installed

frigid estuary
#

(╯°□°)╯︵ ┻━┻

slate swan
glad cradle
formal basin
#

!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 Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

slate swan
glad cradle
#

what python version are you using now

slate swan
#

3.10.4

formal basin
glad cradle
slate swan
unkempt canyonBOT
#
Install packages with `python -m pip`

When trying to install a package via pip, it's recommended to invoke pip as a module: python -m pip install your_package.

Why would we use python -m pip instead of pip?
Invoking pip as a module ensures you know which pip you're using. This is helpful if you have multiple Python versions. You always know which Python version you're installing packages to.

Note
The exact python command you invoke can vary. It may be python3 or py, ensure it's correct for your system.

severe sonnet
#

guys, what discord.py documentation is better for me that always miss something?

#

like, a doc that i can use it with more easiness?

slate swan
# slate swan yes

And set interpreter in vscode to point to this version you are using

slate swan
severe sonnet
#

and don't get lost?

glad cradle
slate swan
glad cradle
slate swan
#

already

#

And what you got

slate swan
#

I mean what you selected

#

And what was in the list

glad cradle
#

(that's why I always use virtual environments)

slate swan
slate swan
#

Its the same thing i belive

#

3.10 indeed

glad cradle
slate swan
#

How about you do python --version

slate swan
slate swan
slate swan
#

What package you trying to install?

#

Discodpy?

slate swan
slate swan
glad cradle
#

I mean it should work

slate swan
glad cradle
#

try python -m pip install -U discord.py this time

slate swan
#

all of suden there is no module named pip 💀 a few minutes ago there was but now not

#

downloaded pygame i discord.py and now there's no such module

#

pip install pip

glad cradle
#

😨

slate swan
glad cradle
#

python 3.11

#

!

slate swan
#

Many python versions is making him lost

glad cradle
#

ggs how to fix this now

slate swan
#

Well cant you use 3.11 for this project

#

And install libraries here

slate swan
glad cradle
#

maybe a virtual environment would help but heh

surreal magnet
#

i get this error after a while when running bot:

Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/discord/ext/commands/core.py", line 190, in wrapped
ret = await coro(*args, **kwargs)
File "bank.py", line 140, in balance
mycursor = db.cursor()
File "/home/container/.local/lib/python3.8/site-packages/mysql/connector/connection.py", line 809, in cursor
raise errors.OperationalError("MySQL Connection not available.")
mysql.connector.errors.OperationalError: MySQL Connection not available.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/discord/ext/commands/bot.py", line 1347, in invoke
await ctx.command.invoke(ctx)
File "/usr/local/lib/python3.8/dist-packages/discord/ext/commands/core.py", line 986, in invoke
await injected(*ctx.args, **ctx.kwargs)  # type: ignore
File "/usr/local/lib/python3.8/dist-packages/discord/ext/commands/core.py", line 199, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: OperationalError: MySQL Connection not available.```
#

Like, for half an hour or so the database connection is normal but then it shuts down

slate swan
#

And how do you connect to it

surreal magnet
#

mysql.connector

glad cradle
#

isn't mysql a blocking library?

slate swan
#

Also for discord bot i would suggest using async lib

glad cradle
#

!pypi aiosql

unkempt canyonBOT
surreal magnet
#

hmmm

slate swan
#

!blocking

unkempt canyonBOT
#
Asynchronous programming

Imagine that you're coding a Discord bot and every time somebody uses a command, you need to get some information from a database. But there's a catch: the database servers are acting up today and take a whole 10 seconds to respond. If you do not use asynchronous methods, your whole bot will stop running until it gets a response from the database. How do you fix this? Asynchronous programming.

What is asynchronous programming?
An asynchronous program utilises the async and await keywords. An asynchronous program pauses what it's doing and does something else whilst it waits for some third-party service to complete whatever it's supposed to do. Any code within an async context manager or function marked with the await keyword indicates to Python, that whilst this operation is being completed, it can do something else. For example:

import discord

# Bunch of bot code

async def ping(ctx):
    await ctx.send("Pong!")

What does the term "blocking" mean?
A blocking operation is wherever you do something without awaiting it. This tells Python that this step must be completed before it can do anything else. Common examples of blocking operations, as simple as they may seem, include: outputting text, adding two numbers and appending an item onto a list. Most common Python libraries have an asynchronous version available to use in asynchronous contexts.

async libraries
The standard async library - asyncio
Asynchronous web requests - aiohttp
Talking to PostgreSQL asynchronously - asyncpg
MongoDB interactions asynchronously - motor
Check out this list for even more!

slate swan
#

Dam they only provided library for postrges and mongo

glad cradle
#

not sure why the connection is not available though

surreal magnet
#

yeah i dont either

glad cradle
surreal magnet
#

ye mysql uses .sql file

glad cradle
surreal magnet
#

i think both have very different structure

#

might need to rework most of the code

#

ok thanks bros lemme give it a shot

glad cradle
#

nah

slate swan
#

Well you will need to await most of the database calls

surreal magnet
#

hmm

hasty coral
#

Is it possible, in the same way you can do it on your own profile, to set a status emoji for a bot?

unkempt canyonBOT
slate swan
#

i belive this should be it

hasty coral
frigid estuary
#

anyone willing to help me with my music module?
it downloads files as .webm succesfully and isnt giving me any errors but for some reason still wont play in the vc.

https://paste.pythondiscord.com/BUEA

Theres the code

#

Help would be greatly appreciated as I have been trying to figure it out for hours

slate swan
#

!ytdl

unkempt canyonBOT
#
Our youtube-dl, or equivalents, policy

Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.

For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:

The following restrictions apply to your use of the Service. You are not allowed to:

1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service;  (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;

3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;

9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
sullen moon
#

Any pro tips on how to get a command that can run my script? I have tried to learn basics of python

copper turret
#

im trying to make a code where u import roblox cookies in cookies.txt and it makes a game on roblox with a template like template.rbxl and it makes it and publishes it to roblox and it shares it in a server in discord

#

i need help

#

so can anyone help me

frigid estuary
#

and potentially ffmpeg

slate swan
frigid estuary
#

smh

slate swan
#

!pypi jishaku

unkempt canyonBOT
frigid estuary
#

well, if someone actually wants to help, dm me

copper turret
#

someone help me please

upbeat gust
thin raft
slate swan
#

is it possible to make a discord bot to give me roles in a discord server thorugh terminal

#

and if so is it gonna be hard

#

In your server it’s possible but not hard afaik, in another server kinda hard

slate swan
#

aslong as the bot has perms

#

‘d say so 🤔

slate swan
#

cause its easy to do just via discord bot command

#

but not entirely sure how to approach it with a terminal command

hushed galleon
final iron
#

wait

#

nvm im so dumb'

turbid condor
#

You can check this out

#

I think this bot can retrieve info of a server not sure about this but you can send messages to a server via terminal

copper turret
#

im trying to make a code where u import roblox cookies in cookies.txt and it makes a game on roblox with a template like template.rbxl and it makes it and publishes it to roblox and it shares it in a server in discord

#

can someone help me

copper turret
# thin raft with¿

im trying to make a code where u import roblox cookies in cookies.txt and it makes a game on roblox with a template like template.rbxl and it makes it and publishes it to roblox and it shares it in a server in discord

copper turret
#

please help though

mint forum
#

was wondering if anyone knows how a code for discord bots for twitch and if they could assist me.

mint forum
#

im trying to make it where when any user listed in the code goes live on twitch, it sends a message in a guild

copper turret
#

is anyone gonna helo me

mint forum
copper turret
#

can anyone help me code a bot using py

#

dm me if u can

slate swan
#

That's what this channel is for uhhh

austere vale
#
0|main     | Ignoring exception in on_message
0|main     | Traceback (most recent call last):
0|main     |   File "/usr/local/lib/python3.8/dist-packages/nextcord/client.py", line 512, in _run_event
0|main     |     await coro(*args, **kwargs)
0|main     |   File "/home/Runa/bot/cogs/leveling.py", line 82, in on_message
0|main     |     await cursor.execute('UPDATE levels SET xp = ? WHERE user = ? AND guild = ?', (xp, author.id, guild.id))
0|main     |   File "/usr/local/lib/python3.8/dist-packages/aiosqlite/cursor.py", line 37, in execute
0|main     |     await self._execute(self._cursor.execute, sql, parameters)
0|main     |   File "/usr/local/lib/python3.8/dist-packages/aiosqlite/cursor.py", line 31, in _execute
0|main     |     return await self._conn._execute(fn, *args, **kwargs)
0|main     |   File "/usr/local/lib/python3.8/dist-packages/aiosqlite/core.py", line 129, in _execute
0|main     |     return await future
0|main     |   File "/usr/local/lib/python3.8/dist-packages/aiosqlite/core.py", line 102, in run
0|main     |     result = function()
0|main     | sqlite3.OperationalError: database is locked
    @commands.Cog.listener()
    async def on_message(self, message):
        if message.author.bot or message.guild is None:
            return
        author = message.author
        guild = message.guild
        async with self.bot.db1.cursor() as cursor:
            await cursor.execute('SELECT levelsys FROM levelSettings WHERE guild = ?', (guild.id,))
            levelsys = await cursor.fetchone()
            if levelsys and not levelsys[0]:
                return
            await cursor.execute('SELECT xp FROM levels WHERE user = ? AND guild = ?', (author.id, guild.id))
            xp = await cursor.fetchone()
            await cursor.execute('SELECT level FROM levels WHERE user = ? AND guild = ?', (author.id, guild.id))
            level = await cursor.fetchone()
            if not xp or not level:
                await cursor.execute('INSERT INTO levels (level, xp, user, guild) VALUES (?,?,?,?)', (0, 0, author.id, guild.id))
            try:
                xp = xp[0]
                level = level[0]
            except TypeError:
                xp = 0
                level = 0
            if level < 5:
                xp += random.randint(1, 3)
                await cursor.execute('UPDATE levels SET xp = ? WHERE user = ? AND guild = ?', (xp, author.id, guild.id))
            else:
                rand = random.randint(1, (level//4))
                if rand == 1:
                    xp += random.randint(1, 3)
                    await cursor.execute('UPDATE levels SET xp = ? WHERE user = ? AND guild = ?', (xp, author.id, guild.id))
            if xp >= 100:
                level += 1
                await cursor.execute("UPDATE levels SET level = ? WHERE user = ? AND guild = ?", (level, author.id, guild.id))
                await cursor.execute("UPDATE levels SET xp = ? WHERE user = ? AND guild = ?", (0, author.id, guild.id))
                async with self.bot.db1.cursor() as cursor:
                    await cursor.execute('SELECT levelChannel FROM levelchannel WHERE guild = ?', (guild.id,))
                    channelID = await cursor.fetchone()
                    if not channelID:
                        return
                    channelID = channelID[0]
                    channel = guild.get_channel(channelID)
                    if not channel:
                        return await message.channel.send(f'{author.name} has leveled up to level {level}!')
                    await channel.send(f'{author.name} has leveled up to level {level}!')            
                await self.bot.db1.commit()

Does anyone know what is wrong?

upbeat gust
upbeat gust
austere vale
upbeat gust
#

Consider using asqlite instead of aiosqlite, it automatically turns this on and does a few more things to work smoother

austere vale
#

thank you!

slate swan
#

python slowly drives me crazy with it's capital sensitivity 💀

unkempt canyonBOT
#
Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. Various features of discord.py rely on having particular intents enabled, further detailed in its documentation. Since discord.py v2.0.0, it has become mandatory for developers to explicitly define the values of these intents in their code.

There are standard and privileged intents. To use privileged intents like Presences, Server Members, and Message Content, you have to first enable them in the Discord Developer Portal. In there, go to the Bot page of your application, scroll down to the Privileged Gateway Intents section, and enable the privileged intents that you need. Standard intents can be used without any changes in the developer portal.

Afterwards in your code, 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

# Enable all standard intents and message content
# (prefix commands generally require message content)
intents = Intents.default()
intents.message_content = True

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

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

coral flicker
#

I don't know of any mainstream language that is insensitive to capitalisation.

turbid condor
#

I'd say try C or C++

#

XD

mint forum
cloud dawn
mint forum
#

absolutely nothing

#

well shouldnt say nothing

#

i followed a tutorial on yt and have a code but from what i can tell its just errors

cloud dawn
mint forum
#

(deleted link) this is the template code that i got from the video

cloud dawn
#

Don't use this

naive briar
#

That looks both like ChatGPT generated and youtube tutorial code at the same time

mint forum
#

lovely

#

i know crap about coding and im attempting to learn it so i wouldnt really know tbh

mint forum
cloud dawn
# mint forum ill read that tho, ty

This is to get started with bots, doesn't have anything regarding working with twitch. But when you are finished with that and have a running bot I'd be happy to explain the event that triggers the twitch part in Discord.

mint forum
#

ok thank you

gloomy dune
#

guyssssss i need hlpp

#
import discord
import os
from discord import Option
my_secret = os.environ['token']

bot_guilds = ["528480878100348928"]
bot = discord.Bot()


@bot.event
async def on_ready():
  print("ready")


@bot.slash_command(guild_ids=bot_guilds)
async def sex(ctx, member:
              Option(discord.Member,
                    "aaa",
                    required = True)
             ):

  await ctx.respond("aaa: {} ".format(member))
  
  
  
  
bot.run(my_secret)

i want the guild id part not to be

#

someone can help me

slate swan
gloomy dune
slate swan
gloomy dune
#

yes yes

slate swan
#

the command will be global

gloomy dune
#

how

slate swan
gloomy dune
#

yes its should be

slate swan
#

what must be

gloomy dune
#

global

slate swan
#

and im telling you that if you want the command to be global

#

dont pass guild ids

gloomy dune
#

how can i

slate swan
#

remove the guild_ids=bot_guilds?

#

you know any of python

gloomy dune
#

hehe

#

oky oky ty

gloomy dune
#

its doesnt work rn

slate swan
#

what library is that?

gloomy dune
#

typing-extensions or py-cord idk i was installed

#

these

slate swan
#

in py-cord the Interaction does not have .respond method

#

if it would be prefixed command it would be .reply but its a slash command so you get Interaction

severe sonnet
#

okay guys so, i'm having a problem with the Database has no such attribute db, even thought i setted it up at beginning

#
  File "c:\Users\User\Documents\GitHub\RP-Utilities\rpu_database.py", line 70, in search_default_character
    documents =  await self.db.characters.find_many([{'user_id': user_id}])
                       ^^^^^^^
AttributeError: type object 'Database' has no attribute 'db'
#

thought i setted it at the beggining of the code

#
    async def connect(self, connection_uri: str, /) -> None:
        self.dev_client = motor.motor_asyncio.AsyncIOMotorClient(connection_uri)
        if self.dev_client is not None:
            self.db = self.dev_client.rpu_database
            print("Database connected!")
        else:
            self.db = None
            print("Cannot connect to Database!")

    async def close(self) -> None:
        self.dev_client.close()
#

but here when i declare from cog the things get like the error:

async def search_default_character(self, *, user_id: int, name: str | None, prompt_prefix: str | None) -> None:
        documents = {}
        if name:
            documents =  await self.db.characters.find_many([{'user_id': user_id, 'name': name}])
        elif prompt_prefix:
            documents =  await self.db.characters.find_many([{'user_id': user_id, 'prompt_prefix': prompt_prefix}])
        elif name and prompt_prefix:
            documents =  await self.db.characters.find_many([{'user_id': user_id, 'name': name,'prompt_prefix': prompt_prefix}])
        else:
            documents =  await self.db.characters.find_many([{'user_id': user_id}])
        
        return documents if documents else None
#

it erroers in the cog

#

but don't error in the db

#

at least it's what i think

shrewd fjord
severe sonnet
shrewd fjord
ornate sapphire
#

anyone know how to make 0auth2 for my bot

#

ive invited him to one server and I cant invite him to another

glacial pawn
#

like i create invite to invite my bot to servers from discord developer portal

severe sonnet
# shrewd fjord can you show?
class Bot(commands.Bot):
    def __init__(self) -> None:
        super().__init__(
            intents=INTENTS,
            command_prefix = prefix_setup,
            case_insensitive=True
        )
        self.database = Database()
        print("Bot Connected!")

    async def setup_hook(self) -> None:
        await self.database.connect("mongodb://localhost:27017")
        self.db_loop = self.database.dev_client.get_io_loop()
        for extension in EXTENSIONS:
            await self.load_extension(extension)
        await self.add_cog(PrefixCog(self))
        for filename in os.listdir("./cogs"):
            if filename.endswith(".py"):
                await self.load_extension(f"cogs.{filename[:-3]}")
#

here

shrewd fjord
#

did it print "connected" or something

severe sonnet
#

it print "Database connected"

shrewd fjord
#

probably make it property instead

severe sonnet
#

property...uhmm

#

that is new

shrewd fjord
#
@property
async def db(self):
  # same logic here
  return db
severe sonnet
#

oh okay

#

so connect part i consider property... uhmm

shrewd fjord
severe sonnet
#

like this?

class Database:
    def __init__(self) -> None:
        self.dev_client: motor.motor_asyncio.AsyncIOMotorClient | None = None

    async def connect(self, connection_uri: str, /) -> None:
        self.dev_client = motor.motor_asyncio.AsyncIOMotorClient(connection_uri)
        if self.dev_client is not None:
            self.db = self.dev_client.rpu_database
            print("Database connected!")
        else:
            self.db = None
            print("Cannot connect to Database!")

    @property
    async def db(self):
        return self.db
shrewd fjord
#

but maybe it gonna raise attr error again tho

#

sec lemme run some tests

shrewd fjord
# severe sonnet like this? ```py class Database: def __init__(self) -> None: self.de...

ok dont initialize it.
do this instead

class Database:
    dev_client: motor.motor_asyncio.AsyncIOMotorClient | None = None

    async def connect(self, connection_uri: str, /) -> None:
        self.dev_client = motor.motor_asyncio.AsyncIOMotorClient(connection_uri)
        if self.dev_client is not None:
            print("Database connected!")
        else:
            print("Cannot connect to Database!")

    @property
    async def db(self):
        if self.dev_client is not None:
            db = self.dev_client.rpu_database
            return db
        return None
slate swan
ornate sapphire
#

it doesnt work

shrewd fjord
slate swan
shrewd fjord
sick birch
shrewd fjord
sick birch
#

helo

severe sonnet
#

and if i parse the client of the database as property

#

actually

#

my bot needs the database

#

so guess i could pass the database class as property

shrewd fjord
severe sonnet
#

like it's a mongodb

#

so my system generally use Database as object

#

but not directly database

copper turret
#

i need help with a discord bot, i'm willing to pay for it

#

dm me if your intresed

unkempt canyonBOT
#

9. Do not offer or ask for paid work of any kind.

naive briar
#

Just ask your question

copper turret
#

ok

#

i need a python discord bot, that uses roblox to make a condo generator in roblox

final iron
#

Is is possible to have 2 autocomplete fields for different parameters in 1 command?

final iron
#

If you want to be given a bot you'd need to find a different server. People would be very helpful to you if you decide to create the bot yourself

#

I would suggest you do so, even just a little practice with coding will help open a lot of doors in the future

#

You'll also be able to fix bugs/add new features to your bot without having to pay for them

copper turret
#

what server

final iron
#

I dunno

#

Maybe try fiverr or smth

copper turret
#

okay

lyric sigil
#

hey guys i have this error trying running my bot on my ubuntu server but my code works very well in local

final iron
lyric sigil
#

And I have my pc that I use to connect to the laptop

final iron
#

Sorry, I meant the versions

lyric sigil
#

Yes they are

#

I checked

final iron
#

I know you said it works well in local but I just want to doublecheck

lyric sigil
#

Just a question

final iron
#

uh

lyric sigil
#

Cuz I’m in France and it’s almost 2am so it’s not very an option to start my pc 💀

final iron
#

Why does it matter

lyric sigil
#

later I’ll send you the entire code if u want

mighty pilot
#

Yea it'll be better to ask again later when you can give more info to help troubleshoot

loud junco
loud junco
lyric sigil
#

Why

#

Requirements only for like if you need a certain version of the module

loud junco
#

its basically a file that tells the server that u need these library (or module idk) to work

lyric sigil
#

But for me just installing via pip works well

loud junco
lyric sigil
#

Bruh

#

It’s a Ubuntu server

#

You can literally tell him what to do

loud junco
lyric sigil
#

I have another that works very well

loud junco
#
Railway

Railway is an infrastructure platform where you can provision infrastructure, develop with that infrastructure locally, and then deploy to the cloud.

lyric sigil
#

Wth is this

loud junco
#

u can host for 21 days every month for free (so there will be one week rest for ur exhausted bot)

#

and it comes with a database

lyric sigil
#

Can host 1 year free w/ aws

#

Look three bots with one server

#

And for answer your question yes you can pip install on a server

#

Wait Comin back I’ll show u

loud junco
#

alright apparently railway faked me

#

bro told me its free for 21 days every month

lyric sigil
#

Look

#

I can pip install

#

On this bad boy 😎

#

And for making my bot running 24/7 I just used nohup

lyric sigil
final iron
#

How would I hide a slash command to only certain users? (ID specific)

#

I tried creating a check and it works, it just doesn't hide the command

#

Is it possible?

sick birch
meager rock
loud junco
#

the moment i came back to do some stuff bro changed policy 🥹

meager rock
#

pithink localhost

final iron
sick birch
final iron
#

Perfect

#

Thanks

mighty pilot
shrewd fjord
final iron
#

I was already shown the solution though

shrewd fjord
shrewd fjord
#

while check.has_permissions doesnt

#

complicated

final iron
#

Docs doesn't say anything about hiding it

shrewd fjord
shrewd fjord
final iron
#

I can try

hushed galleon
#

!d discord.app_commands.default_permissions is the correct decorator, but yeah it will hide based on whatever permissions are given once its synced

unkempt canyonBOT
#

@discord.app_commands.default_permissions(**perms)```
A decorator that sets the default permissions needed to execute this command.

When this decorator is used, by default users must have these permissions to execute the command. However, an administrator can change the permissions needed to execute this command using the official client. Therefore, this only serves as a hint.

Setting an empty permissions field, including via calling this with no arguments, will disallow anyone except server administrators from using the command in a guild.

This is sent to Discord server side, and is not a [`check()`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.check). Therefore, error handlers are not called.

Due to a Discord limitation, this decorator does nothing in subcommands and is ignored.
mighty pilot
#

im definitely going to be using that if it does that

shrewd fjord
#

isnt it default member permissions or something? did they change the name? lol

hushed galleon
#

its always been like that afaik

#

no equivalent for members/channels tho

shrewd fjord
hushed galleon
#

huh i cant recall seeing that attribute despite having looked at AppCommand a few times before

shrewd fjord
#

oh wait

shrewd fjord
#

its attr not checks

#

i think they changed it on some versions

final iron
#

Is there any way to do it by user ID though, where I can choose specific users? Or would I have to do that through the server settings

hushed galleon
mighty pilot
final iron
#

Isn't going to work

#

I only want me and the servers owner to have access to the command

shrewd fjord
#

and urself

final iron
#

There are other people with Admin roles I don't want using it

shrewd fjord
mighty pilot
#

that defeats the purpose of admin roles lol

hushed galleon
#

shrug, you've hit a limitation of slash commands

shrewd fjord
#

@discord.app_commands.checks.has_any_role(*items)

#

use ig.

final iron
#

Yeah, they can just do it through the server though

shrewd fjord
#

or use has_role

final iron
turbid condor
shrewd fjord
#

He also want that slash command to be hidden.

final iron
turbid condor
#

Yeah slash commands are not hidden like prefix i think

#

U need to do that from server settings

turbid condor
final iron
#

The bot is for a singular server so it doesn’t really matter to me ngl

#

I also might add more people to the list so I’m trying to keep track of it all

turbid condor
#

Hmm i see

#

For that u could have use has_role

#

Just give the role to the user who can use the commands

#

Well in the end it's up to you how u want to do it

final iron
#

Look, there’s a ton of reasons it has to be by ID only

hushed galleon
#

oh yeah cant the other admins change the override anyway?

digital magnet
#

anyone active right now?

slate swan
#

Just ask your question and when someone is available they will answer

digital magnet
#

someone tell me how to delete all previous messages in a specifiq channel before bot arriaved

#

i want it like a event

digital magnet
#

i want to clear an entire channel messages

formal basin
#

wdym before the bot arrived?

formal basin
digital magnet
#

i meant every messages that was sent in that channel before bot arriaved, i want them to get deleted after my bot arraived

formal basin
#

wdym arrived?

dusk flicker
#

Hello, everyone.

formal basin
#

Hi

digital magnet
digital magnet
formal basin
digital magnet
dusk flicker
#

I feel like if I ask my question, I'll be talking out of turn.

digital magnet
formal basin
# digital magnet ye

well you have to do it with your bot. You cant just do it if the bot is not in your server

digital magnet
dusk flicker
#

I'm fairly new to Python as a whole. I've created my chatbot and I have it listening to the channel I was testing in, but the message.content is always coming up empty. I know that the on_message event is getting called.

naive briar
unkempt canyonBOT
#

Whether message content, attachments, embeds and components will be available in messages which do not meet the following criteria:

• The message was sent by the client

• The message was sent in direct messages

• The message mentions the client

This applies to the following events...

naive briar
#

You need this intent to read messages

formal basin
dusk flicker
#

That's what I thought I did with this:python intents = discord.Intents(messages=True, guilds=True) bot = discord.Client(intents=intents)

digital magnet
#

let me use that and see if that work ( after edit

naive briar
dusk flicker
#

That's a separate intent?

naive briar
#

Yes? That's why it has a separate variable name

dusk flicker
#

🤦

#

That did the trick

#

This was the first time I've ever had to deal with this API stuff and that sea of text was just so overwhelming.

formal basin
digital magnet
#

nope

formal basin
#

and show your code

digital magnet
#
import discord
from discord.ext import commands

intents = discord.Intents.default()
intents.message_content = True  # Enable message content intent

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

@bot.event
async def on_ready():
    print(f'Logged in as {bot.user.name}')

@bot.event
async def on_guild_join(guild):
    if guild.id == 1035803076491214902:
        print("working")
        channel = bot.get_channel(1082691739183239258)
        print("working")
        await channel.purge(limit=100)
        print('working')


# Run the bot using your bot token
bot.run(bot_token)```
#

it didn't even showed the first working

slate swan
#

did you debug it a little?

digital magnet
#

haven't tried yet

slate swan
#

print out what guild.id is for example

#

or guild.name

#

will be more readable

digital magnet
#

let me see

#

so my programming skills saying

formal basin
#

?

digital magnet
#

this

async def on_guild_join(guild):
    if guild.id == 1035803076491214902:
        print("working")
        channel = bot.get_channel(1082691739183239258)
        print("working")
        await channel.purge(limit=100)
        print('working')```

is not even being executed
digital magnet
formal basin
digital magnet
#

nothing ;-;

formal basin
#
@bot.event
async def on_guild_join(guild):
    print(f"guild id == {guild.id}")
    if guild.id == 1035803076491214902:
        print("working")
        channel = bot.get_channel(1082691739183239258)
        print("working")
        await channel.purge(limit=100)
        print('working')```
digital magnet
#

hey how is your code is so colorful....

naive briar
#

!code

unkempt canyonBOT
#
Formatting code on discord

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.

For long code samples, you can use our pastebin.

formal basin
#

try and print something before the if statement

digital magnet
#

i already tryed it

#

tried*

formal basin
#

hmm

digital magnet
#
@bot.event
async def on_guild_join(guild):
    print("IS THIS EVEN WORKING?")
    if guild.id == 1035803076491214902:
        print("Working")
        channel = bot.get_channel(1082691739183239258)
        print("Working")
        await channel.purge(limit=100)
        print('Working')```
#

didn't even print that ;-;

formal basin
#

very weird

digital magnet
#

pretty weird ik

formal basin
#

i dont know why its not working

digital magnet
#

hmm let me convert it to a command then

formal basin
#

ok

near coral
#

AttributeError: 'NoneType' object has no attribute 'change_presence'

#

when i try to change my bot's status

#

i get this error

#

anyone knows ?

slate swan
naive briar
unkempt canyonBOT
#

@naive briar :x: Your 3.11 eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "/home/main.py", line 1, in <module>
003 |     None.change_presence
004 | AttributeError: 'NoneType' object has no attribute 'change_presence'
digital magnet
#

fianally the bot is working

#

it is deleting the messages

digital magnet
slate swan
#

well show your code then

digital magnet
#

let me run the code one last time then i show?

#
import discord
from discord.ext import commands
import asyncio

intents = discord.Intents.default()
intents.message_content = True  # Enable message content intent

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

@bot.event
async def on_ready():
    print(f'Logged in as {bot.user.name}')

@bot.command()
async def delete_messages(ctx, channel_id: int):
    channel = bot.get_channel(channel_id)
    if channel is None:
        await ctx.send("Channel not found.")
        return
    
    while True:
        try:
            await channel.purge(limit=None)
            await ctx.send(f'Deleted all messages in {channel.mention}.')
            break
        except discord.HTTPException as e:
            if e.status == 429:
                print("Rate limited, waiting and retrying...")
                await asyncio.sleep(5)  # Adjust the sleep duration as needed
            else:
                raise  # Re-raise other exceptions

near coral
slate swan
near coral
#

how can i fix it

#

can u help

slate swan
#

no idea you never showed code

near coral
#

i can show

#

w8

slate swan
digital magnet
#

i removed that command because i thought normal people wont find out what that means

#

that command name*

slate swan
#

?

#

im asking about the event you have trouble with?

unkempt canyonBOT
#
Formatting code on discord

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.

For long code samples, you can use our pastebin.

digital magnet
slate swan
near coral
#

import discord
import responses 
from discord.ext import commands
from discord import app_commands


# Send messages
async def send_message(message, user_message, is_private):
    try:
        response = responses.handle_response(user_message)
        await message.author.send(response) if is_private else await message.channel.send(response)

    except Exception as e:
        print(e)
        
        

def run_discord_bot():
    TOKEN = 'Your Token'
    intents = discord.Intents.default()
    intents.message_content = True
    client = discord.Client(intents=intents)
    bot = commands.Bot(command_prefix="!", intents=discord.Intents.all())



    @bot.event
    async def on_ready():
        game = discord.Game("with the API")
        await bot.change_presence(status=discord.Status.idle, activity=game)


    @client.event
    async def on_message(message):
        # Make sure bot doesn't get stuck in an infinite loop
        if message.author == client.user:
            return

        # Get data about the user
        username = str(message.author)
        user_message = str(message.content)
        channel = str(message.channel)

        # Debug printing
        print(f"{username} said: '{user_message}' ({channel})")

        # If the user message contains a '?' in front of the text, it becomes a private message
        if user_message[0] == '?':
            user_message = user_message[1:]  # [1:] Removes the '?'
            await send_message(message, user_message, is_private=True)
        else:
            await send_message(message, user_message, is_private=False)

    # Remember to run your bot with your personal TOKEN
    client.run(TOKEN)

#

here it is

slate swan
near coral
#

u are right

digital magnet
slate swan
#

its just a command now

near coral
#

fixed that duplication @slate swan

digital magnet
slate swan
digital magnet
#

ok now gtg to make that command into event bye

near coral
slate swan
#

answer why you have it in a function

near coral
#

dont even know yk

#

its my friends code

#

i write games not bots, he is new at this and im tryna help

#

you get me right ?

crisp helm
#

does anyone know how to solve the 'no module named discord' error when I import discord

crisp helm
#

yes

slate swan
#

dont install discord

#

pip uninstall discord

tepid dagger
#

why do i get a
discord.errors.Forbidden: 403 Forbidden (error code: 50001): Missing Access
in my reaction role, does it just mean my bot doens't have the perms to add a role to a user