#discord-bots

1 messages ยท Page 650 of 1

tiny ibex
#

BRUH

sweet geyser
#

Tos

maiden fable
#

No help in this server sorry

sweet geyser
#

Tos?

#

What does that mean?

tiny ibex
sweet geyser
#

How???

maiden fable
# sweet geyser Tos?

Terms of Service. How u should use a service/platform and the rules for using the same

maiden fable
maiden fable
sweet geyser
#

As youtube is being a

slate swan
verbal cairn
#

anyone know why this doesnt pop up choices

@bot.slash_command(description='Pulls a list of up to 30 or more current orders in bazaar!')
async def bazaar(inter, item: str, orders: str = commands.Param(choices=['Both', 'Sell', 'Buy'])):
#

item pops up and allows u to enter a string, but orders doesnt

maiden fable
#

Sorry bruv never used choices

verbal cairn
#

INFO:disnake.ext.commands.common_bot_base:WATCHDOG: Watching extensions

#

anyone know what this means

verbal cairn
#

disnake

slate swan
#

Disnake ofc

verbal cairn
#

it did and was working

verbal cairn
#

I think its supposed to be going to my logging file but idk its not

#

wait might be bc I set reload=True

#
async def bazaar(inter,
                 item: str,
                 orders: str = commands.Param(choices=['Both', 'Sell', 'Buy'])):

how do I make orders optional wtf

boreal ravine
#

or just make it none

verbal cairn
#

orders: str = 'Both'

#

both is what I want default to be

velvet tinsel
maiden fable
#

Hmm

slate swan
#
temp_list_4 = ["Please enter your paypal address in the following format: +paypal example@gmail.com", "Please enter your cashapp address in the following format: +cashapp $123example", "Please enter your cashapp address in the following format: +cashapp @exampleman123"]

@bot.event
async def on_reaction_add(reaction, user): 
    if reaction.emoji == "๐Ÿค‘":
        if user == bot.user:
            return
        roleid = 915953012818726953
        roleobj = user.guild.get_role(roleid)
        await user.add_roles(roleobj)
        for i in range(0,len(Json_Items)): #It doesn't exist
            for x in Json_Items[i]:
                if int(x) == int(user.id):
                    Json_Items[i][x]['Payment Method'].append("Venmo")
                    json.dump(Json_Items, open("./all_user_rep.json", "w"), indent=1)
        await reaction.message.channel.send(temp_list_4[0])
@bot.event
async def on_reaction_remove(reaction, user):
    if reaction.emoji == "๐Ÿค‘":
        roleid = 915952966022856725
        roleobj = user.guild.get_role(roleid)
        await user.remove_roles(roleobj)
        for i in range(0,len(Json_Items)): #It doesn't exist
            for x in Json_Items[i]:
                if int(x) == int(user.id):
                    Json_Items[i][x]['Payment Method'].remove("Paypal")
                    json.dump(Json_Items, open("./all_user_rep.json", "w"), indent=1)
        await bot.delete_message(temp_list_4[0])```

Is there any way for this to work, or is it not possible?
maiden fable
#

This just an information log that the cog watchdog has started. That watchdog sees if there has been any change in the cog's code and if it was there, the cog would be reloaded automatically

slate swan
#

await bot.delete_message(temp_list_4[0])

#

I'm pretty sure it's not possible

maiden fable
#

Wait

#

U r tryna delete a message or what?

slate swan
#

yeah tryna delete a message that was sent in a different function

#

so like you react to a message:
it prints("Hi")

Then when you unreact:
It removes the ("hi") message

maiden fable
#

U sure u ain't looking for bot.wait_for?

slate swan
#

perhaps

maiden fable
#

!d discord.ext.commands.Bot.wait_for

unkempt canyonBOT
#

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

Waits for a WebSocket event to be dispatched.

This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.

The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.

In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.

This function returns the **first event that meets the requirements**...
maiden fable
#

This can be used in a command and with this the bot waits for anyone to do something like send a message or react to a message or something

slate swan
#

ok but can I delete an original message that has already been sent

maiden fable
#

U can do

msg = await.ctx.send(...) 
await msg.delete() 
tiny ibex
#
2021-12-04T06:54:55.987733+00:00 app[worker.1]: aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host lava.link:80 ssl:default [Network is unreachable]
2021-12-04T06:54:55.987744+00:00 app[worker.1]: 
2021-12-04T06:54:55.987744+00:00 app[worker.1]: The above exception was the direct cause of the following exception:
2021-12-04T06:54:55.987744+00:00 app[worker.1]: 
2021-12-04T06:54:55.987754+00:00 app[worker.1]: Traceback (most recent call last):
2021-12-04T06:54:55.987788+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/disnake/client.py", line 505, in _run_event
2021-12-04T06:54:55.987789+00:00 app[worker.1]:     await coro(*args, **kwargs)
2021-12-04T06:54:55.987792+00:00 app[worker.1]:   File "/app/main.py", line 72, in on_command_error
2021-12-04T06:54:55.987792+00:00 app[worker.1]:     raise(error)
2021-12-04T06:54:55.987793+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/disnake/ext/commands/bot_base.py", line 560, in invoke
2021-12-04T06:54:55.987793+00:00 app[worker.1]:     await ctx.command.invoke(ctx)
2021-12-04T06:54:55.987804+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/disnake/ext/commands/core.py", line 929, in invoke
2021-12-04T06:54:55.987804+00:00 app[worker.1]:     await injected(*ctx.args, **ctx.kwargs)
2021-12-04T06:54:55.987813+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/disnake/ext/commands/core.py", line 184, in wrapped
2021-12-04T06:54:55.987813+00:00 app[worker.1]:     raise CommandInvokeError(exc) from exc
2021-12-04T06:54:55.987831+00:00 app[worker.1]: disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: ClientConnectorError: Cannot connect to host lava.link:80 ssl:default [Network is unreachable]โ€Š
#

Can someone please help

#

I am not trying to download youtube videos so it's not against ToS

velvet tinsel
#

Ok

#

What module is this again?

#

As in the YouTube thing?

#

Ok

tiny ibex
#

Please ping me on reply

tiny ibex
#

I am using SoundCloud

slate swan
#

according to the error , ill assume your lavalink server aint running yet

#

did you start it , sky lover

velvet tinsel
slate swan
#

how do I send DM to a user using their ID
(user isnt in my guild or anything i just have its ID)

maiden fable
#

It's not running?

#

Do u have a client.run()?

#

Yea

#

!d discord.Client.run

unkempt canyonBOT
#

run(*args, **kwargs)```
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/master/api.html#discord.Client.start "discord.Client.start") coroutine or [`connect()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client.connect "discord.Client.connect") + [`login()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client.login "discord.Client.login").

Roughly Equivalent to...
maiden fable
#

Hmm

slate swan
#

No, you need to use .login and .connect

maiden fable
slate swan
#

Opposite order though

#

But it's not the same as just .login

maiden fable
#

@slate swan can u show me where u r calling client.run()?

slate swan
#

So not the same as what they have right now

maiden fable
#

Can i see?

slate swan
maiden fable
#

Hide your token tho

maiden fable
slate swan
#

And I'm comparing .run and .login

#

Which doesn't do the same at all

maiden fable
#

Yea

slate swan
#

how do I send dm to a user using their ID?
the user isnt in my guild or any other guilds

slate swan
#

Then you can't

maiden fable
#

Ah

#

Move it outside the on_message

slate swan
#

Indent the run outside of the event

maiden fable
unkempt canyonBOT
maiden fable
#

If this returns None, then u can't DM else u cam

slate swan
maiden fable
#
bot.get_user(id).send(...) 
#

If that raises an AttributeError, then the person ain't there in any of the guilds

slate swan
#

Why do you type hint a Discord user

#

But you still use get_user

lament mesa
#

^^^

lucid prism
#

im getting this error how to fix it ??

maiden fable
#

No

#

Don't use replit. You got ratelimited cz shared ip

#

U can't fix it

boreal ravine
#

i've never gotten rate limited using replit before

#

just my luck

maiden fable
boreal ravine
#

lmao

lucid prism
boreal ravine
maiden fable
lucid prism
#

bot also got offline

maiden fable
#

Yea

verbal cairn
#

slash commands are so garbo bro

slate swan
#

does anyone know the code to get something sent to a webhook

unkempt canyonBOT
#

Hey @maiden fable! I noticed you posted a seemingly valid Discord API token in your message and have removed your message. This means that your token has been compromised. Please change your token immediately at: https://discordapp.com/developers/applications/me

Feel free to re-post it with the token removed. If you believe this was a mistake, please let us know!

maiden fable
#

Hmm thought so

#

!d discord.Webhook.send

unkempt canyonBOT
#

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

Sends a message using the webhook.

The content must be a type that can convert to a string through `str(content)`.

To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") object.

If the `embed` parameter is provided, it must be of type [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") and it must be a rich embed type. You cannot mix the `embed` parameter with the `embeds` parameter, which must be a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects to send.
maiden fable
#

@slate swan

maiden fable
slate swan
#

await send(content=..., *, username=..., avatar_url=..., tts=False, ephemeral=False, file=..., files=..., embed=..., embeds=..., allowed_mentions=..., view=..., thread=..., wait=False)

lucid prism
#

that cant be fixed ??

slate swan
#

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

slate swan
#
print('await send(content=Hello Sussy Bakas, *, username= Da King Rio#1111, avatar_url=..., tts=False, ephemeral=False, file=..., files=..., embed=..., embeds=..., allowed_mentions=..., view=..., thread=..., wait=False)')
#

where do i put the webhook

#

@maiden fable

#

@maiden fable

shadow wraith
#

bro why is your print and every setting inside a string ๐Ÿ’€

slate swan
#

i dont know

shadow wraith
#

bruh

slate swan
#

i just started today

shadow wraith
#

it'll just print await send(content=Hello Sussy Bakas, *, username= Da King Rio#1111, avatar_url=..., tts=False, ephemeral=False, file=..., files=..., embed=..., embeds=..., allowed_mentions=..., view=..., thread=..., wait=False then

slate swan
#

please dont judge me

shadow wraith
#

im not saying your bad at coding

slate swan
#

i am bad, i just started today

#

i just need a bit of help

shadow wraith
#

started discord.py learning or python itself learning

slate swan
#

how long u beed doing this

#

been*

shadow wraith
#

wouldn't tell, it wouldn't even help anyone if i told how long i've been doing it.

slate swan
#

if u were to ask me that same question the answer would be 15 minutes

shadow wraith
#

hmm

slate swan
#

can u help me send something to a webhook

shadow wraith
#

through code or discohook?

#

check out discohook

slate swan
#

idk through code

shadow wraith
#

yeah try out discohook

#

it's a webhook sender.

#

because i have no idea how webhooks will send messages through code

#

ยฏ_(ใƒ„)_/ยฏ

slate swan
#

get the webhook using fetch_webhook ,and use the send method hunter redirected you to

#

!d discord.Client.fetch_webhook

unkempt canyonBOT
#

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

Retrieves a [`Webhook`](https://discordpy.readthedocs.io/en/master/api.html#discord.Webhook "discord.Webhook") with the specified ID.
shadow wraith
#

i didnt know webhooks had ids

maiden fable
#

Hahaha

slate swan
#

!d discord.Webhook.from_url

unkempt canyonBOT
#

classmethod from_url(url, *, session, bot_token=None)```
Creates a partial [`Webhook`](https://discordpy.readthedocs.io/en/master/api.html#discord.Webhook "discord.Webhook") from a webhook URL.
slate swan
#

Much easier

shadow wraith
#

:skjul

maiden fable
tawdry perch
#

It's there a in build method to know bots uptime

slate swan
#

No

tawdry perch
#

Damn

shadow wraith
#

is there even a way to tell how long the bot has been up for

slate swan
#

Save the current time in a bot variable upon startup, then do the maths

tawdry perch
#

Oh ok

shadow wraith
#

well crab, im ded, h.

maiden fable
# tawdry perch Damn

U can do bot.start_time = time.time() and when u invoke the command, then subtract the current time from bot.start_time and just use utils.format_dt

slate swan
tawdry perch
#

Thx

junior verge
#

import discord
from discord.ext import commands
import datetime

class Ping(commands.Cog):

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

@commands.Cog.listener()
async def on_ready(self):
    print('Bot is ready COG')

@commands.command()
async def ping(ctx):
    embed = discord.Embed(title="Pong! ๐Ÿ“")
    await client.say(embed=embed)

def setup(client):
client.add_cog(Ping(client))

slate swan
#

You miss self

junior verge
#

where?

maiden fable
junior verge
#

self, ctx?

shadow wraith
junior verge
#

thanks

shadow wraith
#

ctx.send also works too y'know?

slate swan
#

And why are you naming your Bot instance to client

shadow wraith
#

im not judging you

#

but like

junior verge
#

Oh yea

shadow wraith
#

im just suggesting

junior verge
#

I usually do ctx.reply though

#

prefer that tbh

shadow wraith
#

yea i do ctx.send because that's the first ctx thing i learned

verbal cairn
#

can u index embeds so it looks like

+      +
+      +
#

cuz i cant find a way to do it besides

+ + +
+

or

+
+
+
+
slate swan
#

You mean, embed fields

verbal cairn
#

yea

slate swan
#

Not embeds

junior verge
#

What's this now

shadow wraith
slate swan
#

ok so

junior verge
#

nvm

slate swan
#

Client.say is deprecated

shadow wraith
#

i knew it

slate swan
#

can i send a message to a webhook through just talking right here?

shadow wraith
#

use ctx.reply/ctx.send

#

dead chat

#

say "aye" if you do ctx: commands.Context and say "bru" if you do ctx

shadow wraith
slate swan
#

ok good cause i dont get that

junior verge
#
@commands.command()
    async def ping(self, ctx):
        embed = discord.Embed(title=f'Pong! {round(client.latency * 1000)}ms')
        await ctx.reply(embed=embed)

Why does this give a error

shadow wraith
#

its {bot.latency * 1000:.0f}

junior verge
#

I use client not bot though

shadow wraith
#

yea same to same client.latency and bot.latency are the same tho

junior verge
#

oh alr

shadow wraith
#

it's just variable naming

junior verge
#
@commands.command()
    async def ping(self, ctx):
        embed = discord.Embed(title=f'Pong! {round({bot.latency * 1000:.0f})}ms')
        await ctx.reply(embed=embed)
#

like that?

shadow wraith
#

no change it to client.latency

junior verge
#

oh ok

shadow wraith
#

because you use client

slate swan
#

You defined client again in the cog

junior verge
#

Yea that's what I said

slate swan
#

Did you?

junior verge
#

Ye I did

shadow wraith
#

btw remove the round it's just {client.latency * 1000:.0f}

junior verge
#

Yeah okay

slate swan
#

use ctx.bot.latency

shadow wraith
slate swan
#

and don't define the client again in cog

junior verge
#

Don't define the prefix as well?

#

in cogs

shadow wraith
#

yea no commands.Bot required

#

here's a basic example of a class cog

junior verge
#

Yeah I get that

slate swan
#

That still won't be bot

#

It's self.bot

shadow wraith
#

yea like how i did

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

class Ping(commands.Cog):

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

    @commands.Cog.listener()
    async def on_ready(self):
        print('Bot is ready COG')

    @commands.command()
    async def ping(self, ctx):
        embed = discord.Embed(title=f'Pong! {ctx.client.latency * 1000:.0f}ms')
        await ctx.reply(embed=embed)

def setup(client):
    client.add_cog(Ping(client))
slate swan
#

you didn't......

junior verge
#

got this now

junior verge
shadow wraith
slate swan
junior verge
shadow wraith
junior verge
#

and its cog

#

not pog

shadow wraith
#

the cog still works for me anyways xD

#

i dont get why sarthak circled that

slate swan
#

It doesn't change the presence and results an error anyways

slate swan
#

Try running it if you don't believe me

junior verge
slate swan
#

I said CTX.BOT

shadow wraith
#

bru

slate swan
#

Not client

junior verge
#

oop

#

my bad

#

.ping

#

oop wrong server

shadow wraith
#

๐Ÿ’€

slate swan
#

help pls, bot thinks the command doesn't exist

#

Wrong indents for the nomwb command

slate nymph
#

how to delete all the emojis in a server

slate swan
unkempt canyonBOT
slate swan
slate nymph
#

Ayt

slate swan
boreal ravine
slate swan
#

Is the cog loaded?

shadow wraith
slate swan
shadow wraith
#

atleast thatz what i think

boreal ravine
#

people not reading their code realizing they have an attribute for the bot

slate swan
#

lol i asked them to use ctx.bot and they changed it to ctx.client because they use client instead of bot

boreal ravine
#

hm

boreal ravine
slate swan
#

ctx.client does not exist , ctx.bot does

boreal ravine
#

ah

#

ok then

slate swan
#

@slate swan

verbal cairn
#

sooo anyone know how to make optional parameters in slash commands

maiden fable
verbal cairn
#

sigh

#

I mean I have choices instead of optional but idfk

slate swan
#

i'd recommend you use disnake because it's extremely easy to do it with it ๐Ÿ‘

verbal cairn
#

I am and my code is like basically done

long fog
verbal cairn
#

its just slash commands

boreal ravine
unkempt canyonBOT
#

Indentation

Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.

Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.

Example

def foo():
    bar = 'baz'  # indented one level
    if bar == 'baz':
        print('ham')  # indented two levels
    return bar  # indented one level

The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.

Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines

More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation

slate swan
#

is it possible to send a direct message to a webhook just bye using python in a normal chat?

boreal ravine
#

Webhooks are not members

#

They are a thing in a discord text channel

#

but if you mean sending a message using a webhook then its totally possible

slate swan
#

thats what i mean

slate swan
boreal ravine
unkempt canyonBOT
#

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

Sends a message using the webhook.

The content must be a type that can convert to a string through `str(content)`.

To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") object.

If the `embed` parameter is provided, it must be of type [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") and it must be a rich embed type. You cannot mix the `embed` parameter with the `embeds` parameter, which must be a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects to send.
verbal cairn
#

disnake

boreal ravine
vocal plover
#

Helo bots channel members, we now have disnake and nextcord in the !d command

boreal ravine
slate swan
#

where do i put it then

unkempt canyonBOT
#

kakashi/cogs/configs.py lines 121 to 127

@slash_command(
    name = 'prefix' ,
    description='Change prefix for the server',
    options = [
        Option(name='newprefix' , description='The new prefix for the server',type=OptionType.string , required=True)
    ]
)```
slate swan
#

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

slate swan
#
print('await send(content=..., *, username=..., avatar_url=..., tts=False, ephemeral=False, file=..., files=..., embed=..., embeds=..., allowed_mentions=..., view=..., thread=..., wait=False)
')
boreal ravine
slate swan
#



('Hello world!')
boreal ravine
#

wut

slate swan
#

i want it to be like discohook

verbal cairn
boreal ravine
slate swan
#

yes

vocal plover
#

yeah disnake has a preferred method of doing slash commands which is typehinting the function, for example

@slash_command(name="something", description="something else")
async def command(inter, newprefix: str = commands.Param(description="The new prefix"))
slate swan
#

it's a lot easier to do it now

boreal ravine
#

!d disnake.ext.commands.Bot

slate swan
#

so basically , do it again

boreal ravine
#

hm nice

vocal plover
#

though I am curious why you have a slash command to change a prefix that wouldnt be used because... its using slash commands?

boreal ravine
#

Lmao

slate swan
#

it actually has message commands too , mostly

unkempt canyonBOT
#

kakashi/cogs/configs.py line 135

description=f"{ctx.bot.my_emojis['cross']} Bot prefix Cannot contain \`โ€‹ , `โ€‹@`โ€‹ or `โ€‹#`โ€‹ characters due to discord markdown .",```
vocal plover
#

you might want to add : due to emojis

#

and / for slash commands

slate swan
#

surely , yeah

#

wont it just ignore the slash command messages?

vocal plover
#

it will, but if the prefix is / then its gonna be an awful user experience as they try to avoid the slash commands that pop up

slate swan
#

yeah true , thanks for the suggestion

verbal cairn
slate swan
#

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

trim meadow
#

Hello, i just wanted to ask if it's possible to display a message when someone boosts your server

velvet tinsel
#

Errr I think so

trim meadow
#

Wish we could have the money to try this out lol

#

Also does anyone know how do i leave spaces between lines of text in embedded messages?

visual island
#

you can use \u200b for that

trim meadow
#

Yeah but only one space, not 3. I've tried u200b before, and it left 3 spaces

verbal cairn
#

then just string + ' '?

trim meadow
#

I am kind of a beginner at coding, so..

verbal cairn
#

its allg

prisma spoke
#

that is #1

#

no errors

velvet tinsel
#

Greetings

prisma spoke
#

please help

velvet tinsel
#

Ok

#

What is your level?

#

And your friends?

prisma spoke
#

theirs is 17 and 13

wild imp
#

how to make slash commands?

slate swan
#

use some fork or dislash

unkempt canyonBOT
hazy agate
#

hi guys

#

!pip install ffmpeg

unkempt canyonBOT
#
hazy agate
#

of

verbal cairn
valid galleon
#

go to bot commands smh

hazy agate
#

s

valid galleon
#

so im using a sqlite db to store the ids of people who are afk. The part where it enters the data works fine, but im using an on_message event to check if the user is being pinged, and if he/she is, the bot will say that that person is afk. for this i need it to get the mentions in a message and check if their ids are in the db. how can i do that?

unkempt canyonBOT
#

A list of Member that were mentioned. If the message is in a private message then the list will be of User instead. For messages that are not of type MessageType.default, this array can be used to aid in system messages. For more information, see system_content.

Warning

The order of the mentions list is not in any particular order so you should not rely on it. This is a Discord limitation, not one with the library.

lament mesa
#

It will return a list of Members who were mentioned in the message

valid galleon
#

will something like this work?

        mentioned = message.mentions

        for user in mentioned:
            with sqlite3.connect(db_path) as db:
                c = db.cursor()
                c.execute(f"SELECT author FROM afks WHERE guild_id = {message.channel.guild.id}")
                result = c.fetchone()
                
                if user.id == result:
                    await message.channel.send(f'{user.display_name} is currently AFK.')
lament mesa
#

nope

#

result is a tuple

valid galleon
#

what if i convert it into an int?

#

will it work then?

raw cove
#
import requests
import discord
import json

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

client = discord.Client(intents=intents)

@client.event
async def on_message(msg):
    if msg.content.lower() == "!setwelcome":
        r = requests.get("http://localhost/add.php", headers={"server":str(msg.guild.id), "channel": str(msg.channel.id)})
        await msg.reply(r.text)
    if msg.content.lower() == "!getdata":
        if msg.author.id == 877778571748331561:
            r = requests.get("http://localhost/list.json")
            await msg.reply(str(r.json()))
        else:
            await msg.reply("Nincs jogod ehhez!")

@client.event
async def on_member_join(member):
    r = requests.get("http://localhost/list.json")
    for i in r.json():
        if member.guild.id == int(i["server"]):
            await client.get_channel(int(i["channel"])).send(f":dom: Welcome <@{member.id}> on this server!")

client.run("token")```
i don't know whats wrong with my code
it does not send a message when someone joins
shadow wraith
#

cant help but sheesh thats some complicated code

prisma spoke
shadow wraith
#

what

prisma spoke
shadow wraith
#

idk how to help

#

idk sqlsorry

prisma spoke
latent anvil
#

in the console

raw cove
latent anvil
#

in dm?

#

or in a channel

raw cove
#

in channel

#

this is the list.json:
[{"server":"904407590967054386","channel":"914925979116384306"}]

prisma spoke
raw cove
latent anvil
#

wait a second

raw cove
#

okay

prisma spoke
#

be sure to look up on indenting

prisma spoke
raw cove
#

thanks

latent anvil
#

did you printed the get_channel ?

#

to see what this return

#

if is none

prisma spoke
raw cove
#

what

raw cove
prisma spoke
#

show ur code

#

indentation

raw cove
#
import requests
import discord
import json

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

client = discord.Client(intents=intents)

@client.event
async def on_message(msg):
    if msg.content.lower() == "!setwelcome":
        r = requests.get("http://localhost/add.php", headers={"server":str(msg.guild.id), "channel": str(msg.channel.id)})
        await msg.reply(r.text)
    if msg.content.lower() == "!getdata":
        if msg.author.id == 877778571748331561:
            r = requests.get("http://localhost/list.json")
            await msg.reply(str(r.json()))
        else:
            await msg.reply("Nincs jogod ehhez!")
    await client.process_commands(msg)
    
@client.event
async def on_member_join(member):
    r = requests.get("http://localhost/list.json")
    for i in r.json():
        if member.guild.id == int(i["server"]):
            await client.get_channel(int(i["channel"])).send(f":dom: Welcome <@{member.id}> on this server!")

client.run("token")```
shadow wraith
thick sigil
#

Ye because Client has no process_commands method

prisma spoke
slate swan
#

process commands is not realated to an event

prisma spoke
thick sigil
#

It doesnt have it

#

You're using Bot

thick sigil
#

and calling it client

prisma spoke
raw cove
#

idk why ppl hate discord.Client

#

bruh

prisma spoke
#

client = commands.Bot(command_prefix="urprefixhere", intents=intents)

shadow wraith
thick sigil
#

Who said he hates it?

prisma spoke
thick sigil
#

Client just doesnt handle commands

thick sigil
prisma spoke
thick sigil
#

Nah your code gives me headache

prisma spoke
latent anvil
#

๐Ÿ˜†

thick sigil
#

The way it is coded

prisma spoke
#

there wasnt any other way dude

thick sigil
#

There are plenties, I do have a rank system myself with way less code

shadow wraith
#

my guy did 582 lines of code only to implement a leveling system damn

#

massive dedication right there

prisma spoke
thick sigil
#

It does KEKW

slate swan
#

Kai's bot is pog ( based on the top.gg description)

prisma spoke
#

please help me tho @thick sigil i beg u

thick sigil
#

I dont even remember its description

#

I be lazy finishing this bot

slate swan
#

@prisma spoke can you be specific at what point the error occurs , since it's hard for someone to figure it out without actually running it

prisma spoke
slate swan
prisma spoke
thick sigil
slate swan
slate swan
rare saddle
#

Help to make the correct condition, if one server has a channel for sending messages, then the bot sends a message, and if it is not installed on some server, then skip

prisma spoke
#

levels are..

slate swan
#

๐ŸŽ‰ I mean if you used correct logic , the rank would be determined by the levels itself and cannot be same until the levels are same ryt

prisma spoke
#

rank = result[0] + 1 this is rank as defined

#

await cursor.execute("Select Count(*) from users where xp > ? and guild_id=?", (xp, guild_id)) result = await cursor.fetchone() rank = result[0] + 1

slate swan
slate swan
#

Yea..m

slate swan
rare saddle
# slate swan Yea..m

It did not display any errors, but the message was not sent to the servers that indicated the channel either.

raw cove
#

why tf this code still runs after return?

slate swan
thick sigil
#

cuz break exits the loop before the return lol

raw cove
prisma spoke
raw cove
slate swan
# rare saddle yea

That's weird since the if : return statment does that only if the row variable does not exist or channel_id is set to none

#

can you recheck it?

rare saddle
#
  1. Code
  2. Terminal
  3. The channel to which the message was supposed to come
#

@slate swan

thick sigil
slate swan
prisma spoke
rare saddle
slate swan
prisma spoke
#

@thick sigil u please help

rare saddle
slate swan
#

try printing the row variable before the return

wild imp
#

how to give aliases in a slash command?

slate swan
#

you can't , you need to create another slash command for that

wild imp
#

oo

#

sad

slate swan
#

See , channel_id is None according to the database.

rare saddle
#

Indicates the server for which the channel is not specified

slate swan
#

oh

#

And try for the one which is specified

prisma spoke
slate swan
#

#databases would be more helpful with stuff related to databases

wild imp
#

so what to do about 8ball?

rare saddle
slate swan
#

Name = "8balls"

wild imp
#

i need it to be 8ball not _8ball in slash command so any solution?
.

slate swan
#

Bad lucas code

wild imp
#

oo ok

#

like this @slate swan ?

slate swan
slate swan
wild imp
#

ok done thx after this new message intent im working on slash cmd , first time

slate swan
#

what library are you using?

rare saddle
wild imp
rare saddle
#

More precisely, if the previous function displayed servers for which the ID was not specified, then this one should display those that have specified

rare saddle
slate swan
#

I see , and it prints only one server( with channel_id = null) right?

silver wolf
#

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

slate swan
slate swan
#

Yea

dusk dust
#

Is it possible to do web scraping in discord.py? is it the same thing as it did in normal python?

rare saddle
slate swan
#

oof , just a moment

#

@rare saddle it would be a continue

#

( I feel dumb fr )

tidal hawk
rare saddle
slate swan
#

Yea

rare saddle
#

ohhh

slate swan
# rare saddle

hmm change the condition to if row and row["channel_id"] != None

#

that should be working

slate swan
# rare saddle
            if self.collticku.count_documents({'_id': guild.id}) == 0:
                self.collticku.insert_one(tickudb)

            #channel_id = guild.get_channel(self.collticku.find_one({'_id': guild.id})['channel_id'])

            row = self.collticku.find_one({'_id': guild.id})
            if not row or row["channel_id"] == None : continue 
            channel = (self.collticku.find_one({'_id': guild.id}))['channel_id']
            channel_id = guild.get_channel(channel)``` try this
rare saddle
#

ohhh this is already in another code

slate swan
# rare saddle
@on_click.matching_condition(cancel_others = False, reset_timeout = True)``` you didnt mention a check here
#

it should be like py @on_click.matching_condition(a_check_function , cancel_others = False, reset_timeout = True) iirc

#

btw did the old issue get fixed?

rare saddle
slate swan
#

you;re welcome ;)

rare saddle
#

library dislash

slate swan
rare saddle
#

It's just that after sending a message, they work for several hours, and then everything

#

No, here is the bot sent a message to the specified channel and until the bot is restarted they did not stop working

slate swan
#

so you want the buttons to be un-usable after some time?

rare saddle
#

Didn't stop working until the bot was restarted

slate swan
#

how do I take the response from the msg and paste it into on_reaction_add?

#

i need help, how can i send a dm to a user that is in my server using python by using his id?

unkempt canyonBOT
#

class discord.DMChannel```
Represents a Discord direct message channel.

x == y Checks if two channels are equal.

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

hash(x) Returns the channelโ€™s hash.

str(x) Returns a string representation of the channel
upbeat otter
#

Just fetch the ID and do the thing

unkempt canyonBOT
maiden fable
#

!d discord.User.send

unkempt canyonBOT
#

await send(content=None, *, tts=None, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, mention_author=None, view=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/master/api.html#discord.File "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 "(in Python v3.9)") of [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "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/master/api.html#discord.Embed "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 "(in Python v3.9)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
tidal hawk
#

Can a bot read content of embed?

#

convert it into dictionary or smth

upbeat otter
#

Or from some other bot

silver wolf
unkempt canyonBOT
silver wolf
#

but the embed object has all the attributes to read contents from it

maiden fable
unkempt canyonBOT
maiden fable
#

U can do msg.embeds[0].description and stuff

slate swan
#

how do I force the bot, after sending the c#create command, then after he created the channel, bot installed it and gave permission to view the channel to the author?

@bot.command()
async def create(ctx):
    guild = ctx.message.guild
    overwrites = {
        guild.default_role: discord.PermissionOverwrite(read_messages=False),
        guild.me: discord.PermissionOverwrite(read_messages=True)
    }
    await guild.create_text_channel('easy', category = bot.get_channel(916347066882592890), overwrites=overwrites)
wanton veldt
#

Hi i get this error can someone help me?

#
@client.command()
async def restart(ctx):
    if ctx.author.is_owner():
        shutdown_embed = discord.Embed(title='Bot Update', description='I am now Restarting. See you later. BYE! :slight_smile:', color=0x8ee6dd)
        await ctx.channel.send(embed=shutdown_embed)
        await client.logout()
    if ctx.author.is_owner():
        errorperm_embed = discord.Embed(title='Access Denied!', description='This command is `OWNER` only. You are not allowed to use this. Try not to execute it another time.', color=0xFF0000)
        errorperm_embed.set_footer(text=ctx.author)
        await ctx.channel.send(embed=errorperm_embed, delete_after=10.0)```
tidal hawk
#

i guess ctx.author doesn't have attribute is_owner()?

hazy agate
#

zaaaaaaaam baggin

#

cuz i dont wanna lose u

wanton veldt
hazy agate
#

!d help

unkempt canyonBOT
#

help([object])```
Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the interactive help system starts on the interpreter console. If the argument is a string, then the string is looked up as the name of a module, function, class, method, keyword, or documentation topic, and a help page is printed on the console. If the argument is any other kind of object, a help page on the object is generated.

Note that if a slash(/) appears in the parameter list of a function when invoking [`help()`](https://docs.python.org/3/library/functions.html#help "help"), it means that the parameters prior to the slash are positional-only. For more info, see [the FAQ entry on positional-only parameters](https://docs.python.org/3/faq/programming.html#faq-positional-only-arguments).

This function is added to the built-in namespace by the [`site`](https://docs.python.org/3/library/site.html#module-site "site: Module responsible for site-specific configuration.") module.
hazy agate
#

!client.command

#

ofof

#

;

tidal hawk
#

do you want to check if the user is owner of the bot or server?

wanton veldt
#

server

tidal hawk
#

i think there's better ways to do it, but it should work

wanton veldt
#

Ok

#

Ty

tidal hawk
#

np

west juniper
#

Hello brother's and sisters

reef walrus
#

i need some help with my code

#

can someone dm me and help me pls

opal skiff
#

Please ask your question here

reef walrus
#

okay lemme take a screenshot

opal skiff
#

you could just copy and paste it into a codeblock py mypython code

reef walrus
#

so im coding my discord bot and its saying theres a cog error but theres no problem in it

opal skiff
#

cog error?

reef walrus
#

yeah but theres no errors anywhere

opal skiff
#

Dont share your discord bot Token

#

regenerate it immeaditly

reef walrus
#

my bad haha

#

anyways

#

its saying cog error when i run the code but theres no issues

opal skiff
#

if you get an error the theres an issue. Can you send the screenshot again please? just hide the token please

reef walrus
#

but when i run the code it says cog errors

opal skiff
#

why is it a string?

reef walrus
#

wdym

reef walrus
#

what string

opal skiff
#
f"cogs.{extension}"```
reef walrus
#

what about it

tidal hawk
reef walrus
#

yeah

tidal hawk
#

and what is it?

reef walrus
#

it says cog errors

#

i dont know

tidal hawk
#

only?

opal skiff
#

send the error message

tidal hawk
#

full copy paste it

quaint epoch
#

how to get all the members in a command? like py @client.command() async def all_members(ctx): members = #return all of the members in guild. await ctx.send(members.flatten())

#

what functions would get me all of the members?

reef walrus
#

okay 1 second

quaint epoch
#

because it worked before at some point but not anymore

gaunt ice
#

I get this error ;-;

  File "main.py", line 29, in <module>
    bot.load_extension("music")
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 678, in load_extension
    self._load_from_module_spec(spec, name)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 623, in _load_from_module_spec
    raise errors.ExtensionFailed(key, e) from e
discord.ext.commands.errors.ExtensionFailed: Extension 'music' raised an error: CommandRegistrationError: The alias current is already an existing command or alias```
reef walrus
#

there

quaint epoch
tidal hawk
#

guild.members

#

returns a list of them all

reef walrus
#

sink what do i do then
discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.cogs' raised an error: AttributeError: module 'discord.ext.commands.cog' has no attribute 'listener'
thats the error

quaint epoch
gaunt ice
quaint epoch
gaunt ice
#

hmm wait

gaunt ice
tidal hawk
tidal hawk
quaint epoch
reef walrus
#

@tidal hawk

quaint epoch
#

like this?

reef walrus
tidal hawk
#

the decorator should be: @commands.Cog.listener()

#

your Cog is in lowercase

reef walrus
#

oh yeah

#

damn im blind

tidal hawk
#

xD

reef walrus
#

thanks tho

tidal hawk
#

np

quaint epoch
#

how do i set intents?

gaunt ice
#

here

gaunt ice
#

how much members are there in ur server

quaint epoch
gaunt ice
tidal hawk
#

Hrlo77 what are you trying to do?

gaunt ice
#

in one cmd

tidal hawk
#

and output those member names into a chat?

gaunt ice
#

idk properly but ig a try

tidal hawk
#

well ctx.guild.members returns a list of all members

gaunt ice
#

yes

#

whos good with cogs

tidal hawk
#

and [member.name for member in ctx.guild.members] returns a list of all names, and then it into a chat

dim wing
#

I imported all my python files on a new computer, im using pycharm and when i stop my discord bot i have this error :

gaunt ice
dim wing
dim wing
gaunt ice
#

hm

dim wing
#

i mean i can start my bot

#

but when i stop the script it does that

gaunt ice
gaunt ice
quaint epoch
#

Guys how do i enable intents on my bot on the on_ready function? ```py
@client.command()
async def on_ready():

How do i set intents here?

dim wing
sweet geyser
#

specify

#

in commands

gaunt ice
#

ye

sweet geyser
#

commands.Bot(intents=intents)

quaint epoch
gaunt ice
#
intents.members = True
bot = commands.Bot(command_prefix='s.',intents=intents)```
gaunt ice
#

why is it in on_ready function?

quaint epoch
gaunt ice
#

put it in the starting of the code

#

after imports

dim wing
quaint epoch
dim wing
tidal hawk
dim wing
tidal hawk
#

hm

gaunt ice
#

did u enable intents?

dim wing
#

but idk why it works perfectly on my old computer, and it's a virtual env so the python version is the same

dim wing
dim wing
gaunt ice
#

did u specify the token correctly?

dim wing
#

just when i shutdown the srcipts it shows this error

gaunt ice
#

so its not shutting down?

dim wing
#

nope

#

just when I shutting it down

wanton veldt
#

Any help ```py
intents = discord.Intents.default()
intents.members = True
from discord.utils import get

@client.event
async def on_member_join(member):
guild = client.get_guild(768876864319389696)
welcome_channel = guild.get_channel(768876864319389696)
await welcome_channel.send(f'Welcome to the {guild.name} Discord Server, {member.mention} ! :partying_face:')
await member.send(f'We are glad to have you in the {guild.name} Discord Server, {member.name} ! :partying_face:')

@client.event
async def on_member_remove(member):
guild = client.get_guild(768876864319389696)
welcome_channel = guild.get_channel(768876864319389696)
await welcome_channel.send(f'{member.mention} has leaved the server ! :sad_face:')

gaunt ice
# dim wing just when I shutting it down
from discord.ext import commands

TOKEN = "here paste your token"

client=commands.Bot(command_prefix = '.')

@client.event
async def on_ready():
    print('Connected')

client.run(TOKEN)```
#

try putting ur token in the main

dim wing
sweet geyser
#

send the error

dim wing
sweet geyser
#

o nvm

gaunt ice
#

hmm

tacit token
#

Hello friends

opal skiff
#
slash = SlashCommand(client=client,sync_commands=True)
@slash.slash(name="help",description="Macht help embed",guild_ids=[myserverid])
async def help(ctx: SlashContext):
    await ctx.send("test")```The bot doesnt sends the message and doesnt give me an error
sweet geyser
#

Guild id must be specified

tacit token
#

i installd discord.py and discord with pip, and dsnt work

sweet geyser
#

or you gotta wait a hour

tacit token
#

' Module Not Found'

opal skiff
tacit token
#

i reinstall the python / vsc / discord.py / python and nothing.

dim wing
gaunt ice
#

hmm

tacit token
wanton veldt
#

insatall discord package

tacit token
#

PS C:\Users\gelle> & python c:/Users/gelle/Desktop/main.py
Traceback (most recent call last):
File "c:\Users\gelle\Desktop\main.py", line 2, in <module>
import discord.py
ModuleNotFoundError: No module named 'discord'
PS C:\Users\gelle>

wanton veldt
#

add this in your terminal

gaunt ice
gaunt ice
dim wing
gaunt ice
# dim wing

nnonononoononno , go to discord developer port and snip the intents u enabled

slate swan
gaunt ice
opal skiff
#
@slash.slash(
    name="help"
    ,description="Macht help embed"
    ,guild_ids=[867750507774869545]
)
async def _help(ctx: SlashContext):
    await ctx.send("test")``` So apperently _help doesnt get called how do i fix this?
gaunt ice
#

hm

opal skiff
tiny ibex
gaunt ice
dim wing
#

but it looks like a windows issue

#

because im on W11 here

gaunt ice
#

hmm

dim wing
#

maybe it's that

gaunt ice
#

ig so

#

where have u mentioned the token

#

dont show it to me

#

just tell that is it in a env or in main itself

dim wing
#

from secret.config import TOKEN

#

at the end of the main file

gaunt ice
dim wing
#

sure

slate swan
#

sure?

dim wing
#

yes

#

i have cogs

gaunt ice
#

hmm then just do it like ```
import discord
from discord.ext import commands

token="<token>"

client=commands.Bot(command_prefix = '.')

@client.event
async def on_ready():
print('ok')

client.run(token)```

#

or else try keeping it in a env file

patent lark
dim wing
#

uh but i can't keep it in my config file in secret folder?

gaunt ice
#

whatever use bot ig

dim wing
#

okay

gaunt ice
#

are u gonna stream someone this code?

dim wing
dim wing
gaunt ice
quaint epoch
#

I enabled members intents and presence intents properly, but it still says i need members intents to use fetch_members

dim wing
#

i can keep like this but it a bit annoying

patent lark
#

show me where you defined intents in your code.

quaint epoch
peak loom
#

Hey so I don't have youtube_dl imported but when the bot updates it says installing discord.py and installing youtube_dl, as long as I don't use it would it be fine?

quaint epoch
#

then i used guild.Guild.fetch_members(limit=20)

#

but it said i needed members intent enabled

unkempt canyonBOT
#

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)
lyric ibex
patent lark
# quaint epoch

if youโ€™re gonna fill the intents kwarg with intents.all() then whatโ€™s the point in even defining intents in your code ?

slate swan
lyric ibex
boreal ravine
peak loom
# forest blade !ytdl

I knw, its against tos I need to know aslong as I don't use it would I be fine? I don't even have it imported.

boreal ravine
patent lark
boreal ravine
# slate swan Lucas

Bruh, just make another file then import it, thats way safer than making a variable in the same file

#

๐Ÿ˜Œ

peak loom
lyric ibex
#

bot the clean menssagens dm fro discord?

slate swan
boreal ravine
forest blade
peak loom
opal skiff
#

how do i register slash commands?

boreal ravine
peak loom
patent lark
peak loom
patent lark
opal skiff
# boreal ravine wait 1h or use a kwarg ig (in most forks it has it)

i already have some code but _help isnt called py slash = SlashCommand(client=client,sync_commands=True) @slash.slash( name="help" ,description="Macht help embed" ,guild_ids=[867750507774869545] ) async def _help(ctx: SlashContext): print("interaction recived") await ctx.send(content="test")

opal skiff
tacit token
gaunt ice
slate swan
#

whats the package for discord slash commands?

tawdry perch
#

disnake is one iirc

tacit token
peak loom
tawdry perch
gaunt ice
slate swan
tawdry perch
#

delete your message

gaunt ice
#

it hasa ||token||

tacit token
#

the token is test bot. im not idiot guys ๐Ÿ˜„

peak loom
sweet geyser
#

crazy people will do stuff

#

with it

tawdry perch
tacit token
tawdry perch
#

then restart vsc and it should be fine after

slate swan
#
pip install discord_slash
ERROR: Could not find a version that satisfies the requirement discord_slash (from versions: none)
ERROR: No matching distribution found for discord_slash
#

uh someone pls

velvet tinsel
#

merry nearly christmas, I guess

velvet tinsel
tacit token
#

ok guys. i mean gods. The Discord.py its work! Thank u all โค๏ธ

velvet tinsel
#

gods?
we are not gods

velvet tinsel
#

we are mere programmers

velvet tinsel
tawdry perch
slate swan
velvet tinsel
#

that's why PyCharm is better

slate swan
velvet tinsel
#

try pip install discord-py-slash-command

slate swan
# velvet tinsel try `pip install discord-py-slash-command`

It works but i have and this:

from discord_slash.utils.manage_comamnds import create_choise, create_option

Error:

   pip install discord_slash.utils.manage_comamnds
ERROR: Could not find a version that satisfies the requirement discord_slash.utils.manage_comamnds (from versions: none)
ERROR: No matching distribution found for discord_slash.utils.manage_comamnds
velvet tinsel
#

which IDE are you using?

gaunt ice
#

i get this weird ass error when i load my music cog

velvet tinsel
#

discord slash is bad anyways

velvet tinsel
slate swan
velvet tinsel
#

do ctrl+f

velvet tinsel
wanton veldt
#

hi i have a problem when i did the welcome command the role on join stops working

velvet tinsel
#

?
elaborate

maiden fable
#

!d discord.ext.commands.Bot.listen use this instead

unkempt canyonBOT
#

@listen(name=None)```
A decorator that registers another function as an external event listener. Basically this allows you to listen to multiple events from different places e.g. such as [`on_ready()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_ready "discord.on_ready")

The functions being listened to must be a [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine "(in Python v3.9)").

Example...
wanton veldt
#

oh yea i am so dumb

slate swan
velvet tinsel
gaunt ice
slate swan
velvet tinsel
#

already answered

velvet tinsel
slate swan
#

...........

velvet tinsel
#

what are you using to code

slate swan
#

Oh

#

visual studio code

wanton veldt
#

how

velvet tinsel
#

ok

#

restart it

velvet tinsel
slate swan
maiden fable
slate swan
#

bc i installed discord slash once and restarted this

velvet tinsel
#

close and re-open VSC

maiden fable
#

If u specify the event name, u can name the function anything

slate swan
#

the same error

#
    from discord_slash.utils.manage_comamnds import create_choise, create_option
ModuleNotFoundError: No module named 'discord_slash.utils.manage_comamnds'
velvet tinsel
#

I never used VSC in a long time

wanton veldt
# maiden fable ```py @bot.listen("event-name") async def abc(...): ... ```
@client.event
async def on_member_join(member):
    channel = client.get_channel(768876864319389696)
    embed=discord.Embed(title="Welcome!",description=f"{member.mention} Just Joined the server.")
    ember=embed.set_thumbnail(url="https://media.discordapp.net/attachments/612746705406001213/612990390907305990/avatar.png")
    await channel.send(embed=embed)
    role = discord.utils.get(member.guild.roles, name = "ใ€Œ๐ŸŒ ใ€USER")
    await member.add_roles(role)
    print(f"{member} was given {role}")
``` i did that
#

and its working

maiden fable
#

Okay cool

slate swan
gaunt ice
#

;-;

#

halp

#

it worked before

#

but not now

manic wing
#

what

gaunt ice
#

;-;

velvet tinsel
#

what

final iron
gaunt ice
#

okk

#

same error ;-;

final iron
#

Let's see it

rare saddle
#

Is it possible to somehow transfer emb2 to the embeds file without losing channel.mention?

gaunt ice
#

CommandRegistrationError: The alias current is already an existing command or alias

final iron
#

Looks like you're loading the cog twice

gaunt ice
#

oh

#

wait i didnt

final iron
#

Go to line 29

velvet tinsel
#

use ctrl+f?

gaunt ice
#
bot.load_extension("cogs.tictactoe")
bot.load_extension("cogs.economy")
bot.load_extension("cogs.music1")
velvet tinsel
#

;-; to search through?

gaunt ice
velvet tinsel
#

what did it say?

gaunt ice
#

it had no other cog load

velvet tinsel
#

was it like 1/2

#

or like 1/1

gaunt ice
#

no it was 1/1

velvet tinsel
#

oh
weird

#

well I gtg code bye ๐Ÿ™‚

gaunt ice
#

;-;

slate swan
#

Virgo , you have 2 commands named music?

final iron
#

What's on line 29?

gaunt ice
slate swan
#

Read what I said again , do you have 2 commands named music?

gaunt ice
#

line 29 is

slate swan
#

Well , your error says the same

final iron
#

Have you restarted your bot?

gaunt ice
#

i did million times

final iron
#

The error is showing code that isn't there

gaunt ice
#

hm

#

class musicCog(commands.Cog):
    def __init__(self, bot: commands.Bot):
        self.bot = bot
<code>

def setup(bot):
    bot.add_cog(musicCog(bot))```
gentle rose
#

How can i give permission to write in channel for only for example 15 minutes?

molten cedar
gentle rose
gaunt ice
#

for just 15 mins?

#

or u wanna just adjust time?

gentle rose
gaunt ice
#

and send

gentle rose
gentle rose
gaunt ice
#

whats the name of that role ? @gentle rose

gentle rose
gaunt ice
#

umm u cant giv perms to ppl like that u need to giv them roles with perms

quaint epoch
#

How do i create a role?

gaunt ice
gentle rose
#

ah, ok. Lets name this role - Allowed

gaunt ice
gaunt ice
quaint epoch
#

i mean w/ my bot

rare saddle
#

Why a mistake?

patent lark
quaint epoch
#

How do i edit a role perms?

#

because i created a role called New Role_

#

i want to remove perms on it

#

how do i do that?

rare saddle
#

Why can't I import?

placid skiff
quaint epoch
#

How do i delete roles?

slate swan
#

!d discord.Role.delete

unkempt canyonBOT
#

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

Deletes the role.

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this.
rare saddle
fast spear
#

hi there,
How I can add spotify playlist function in bot?