#discord-bots

1 messages ยท Page 913 of 1

summer thunder
#

i had 2.0.0 installed using poetry, dw.

#

it has 2.0.0 on both machines

#

yet still i only get the error on the one

boreal ravine
#

show the error when you await it

summer thunder
#

kk

#
c:\Users\thebe\Downloads\Mecha\src\cogs\verify.py:113: RuntimeWarning: coroutine 'BotBase.add_cog' was never awaited
  bot.add_cog(verify(bot))
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Extension 'cogs.verify' raised an error: TypeError: object NoneType can't be used in 'await' expression

@boreal ravine

summer thunder
#

its the weirdest shit, do i have to go into my cogs and do await bot.add_cog(verify(bot))?

boreal ravine
#

yes

summer thunder
#

trying that now

#

"await" allowed only within async function

#
def setup(bot):
 bot.add_cog(utility(bot))
#

with await this doesnt work

#

should i not use the def setup and have the cog on its own

boreal ravine
boreal ravine
summer thunder
#

async def setup?

#

im really stupid holy shit

#

trying it bnow

#

@boreal ravine tysm

lusty sky
#

How would I make a check like this?

summer thunder
#

or any other perm like ban / kick

lusty sky
#

Well i already have it set up like

@commands.has_permissions(ban_members=True)```
summer thunder
lusty sky
#

and then use ctx to respond?

summer thunder
#

you can get the members permissions by using member.guild_permissions.<permission>

lusty sky
#
if isinstance(error, MissingPermissions):
        text = "Sorry {member.mention}, you do not have permissions to do that!".format(ctx.message.author)```
summer thunder
lusty sky
summer thunder
#

like

#
if member.guild_permissions.administrator:
  return ctx.send("nonono!!!")
#

@lusty sky

slate swan
#

how do i add a welcome message

slate swan
#

im skidding code rn, as im trying to learn python. i just installed vsc yesterday lol

slate swan
#

what do you expect from us then ๐Ÿ˜”

#

i want code for a join msg. my best bet is learning from skidding and then creating my own stuff

unkempt canyonBOT
#

discord.on_member_join(member)``````py

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

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

And yes, don't forget about the intents

slate swan
slate swan
#

im so confuse

#

ah yes, the docs

#

i get sent those everytime i ask a question lol

maiden fable
#

Czzzzzz

slate swan
#

and this requires member intent

#

i dont know how to set that up...

maiden fable
#

PoV: He dk what's an event or an intent lemon_pensive

maiden fable
unkempt canyonBOT
#

Using intents in discord.py

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

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

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

from discord import Intents
from discord.ext import commands

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

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

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

slate swan
#

i dont dude

#

are u guys making fun of me ๐Ÿ˜ฆ

maiden fable
#

No?

maiden fable
slate swan
#

i am and its still confusing me

slate swan
#

im trying

#

client = discord.Client()

@client.event
async def on_ready():
    print('We have logged in as {0.user}'.format(client))

@client.event
async def on_message(message):
    if message.author == client.user:
        return

    if message.content.startswith('$hello'):
        await message.channel.send('Hello! This is my only cmnd at the moment lol')

client.run('token')```
maiden fable
#

Hmm

slate swan
#

my code so far

maiden fable
#

Lemme guess... you got it from the docs?

slate swan
maiden fable
#

Hehe

slate swan
#

im learning doe lol

maiden fable
#

It's fine

slate swan
#

client.event if somethin happens or sum shit. client.user checks that it isnt a bot

maiden fable
#

client.event registers the function as event

#

on_member_join is also an event

slate swan
#

hm

#

so on_member_join and then

#

send hello user

maiden fable
#

It takes a single arg, the member who joined

#

Just like on_message takes the message arg

slate swan
#

whats the code for dat...?

#

the on_member_join
send msg

maiden fable
#

Try it for yourself, the same way you made the on_message

slate swan
#
async def on_member_join(member):
    await member.send('Private message')```
#

@maiden fable dis gud?

#

wait no. it doesnt specify the channel to send it in

slate swan
#

where do i edit the msg?

maiden fable
#
msg = await member.send(...) 
await msg.edit(...) 
slate swan
#

wha

maiden fable
#

Yea

#

send() returns a Message object

slate swan
#

meaning

maiden fable
slate swan
maiden fable
#

You need to have a basic understanding

slate swan
#

im just trying to get this set up for a server asap, then imma go thru it slo0w

maiden fable
#

Well

slate swan
maiden fable
slate swan
#

oh

slate swan
#

then thx for being nice ๐Ÿ™‚

#

DONT PUT AWAIT MEMBER.SEND('PRIVATE MESSAGE')

lusty sky
#
@client.event
async def on_command_error(ctx, error):
    embed=discord.Embed(timestamp = datetime.datetime.utcnow(),title='**You do not have the permission(s) to run this command.**')
    embed.set_footer(text = ctx.author.name, icon_url = ctx.author.avatar_url)
    await ctx.send(embed=embed)
    if isinstance(error, commands.MissingPermissions):
        await ctx.send("You do not have the permission(s) to run this command.")
    else:
        raise error```
slate swan
#

what this mean

maiden fable
#

Okay

lusty sky
#

@maiden fable

maiden fable
#

Yea I'm here lol

slate swan
#

do i just copy paste "name"

#
async def on member_join(member):
  # DONT PUT AWAIT MEMBER.SEND('PRIVATE MESSAGE')
  msg = await member.send('private message')
  await msg.edit('edited')
slate swan
#
async def on member_join(member):
  msg = await member.send('private message')
  await msg.edit('edited')```
maiden fable
#

Yes

slate swan
#

oh

maiden fable
#

But there's one issue

slate swan
#

wdym

maiden fable
#

edit(content="")

lusty sky
# maiden fable What's the issue

I was wondering how to make it embed this command

await ctx.send("You do not have the permission(s) to run this command.")
    else:
        raise error```
slate swan
#

can u rewrite w spaces

lusty sky
#

because right now this is what it does instead

lusty sky
# maiden fable Can't understand
@client.event
async def on_command_error(ctx, error):
    embed=discord.Embed(timestamp = datetime.datetime.utcnow(),title='**You do not have the permission(s) to run this command.**')
    embed.set_footer(text = ctx.author.name, icon_url = ctx.author.avatar_url)
    await ctx.send(embed=embed)
    if isinstance(error, commands.MissingPermissions):
        await ctx.send("You do not have the permission(s) to run this command.")
    else:
        raise error```
slate swan
#

copy paste..?

maiden fable
#

on_

#

Forgot a _ lol

slate swan
#

can i change the private message to the msg i wanna send

#

yay

#

even the edited?

cosmic agate
lusty sky
slate swan
#

what would that do

#

here join my server and see if u get a dm

slate swan
#

im lost

cosmic agate
slate swan
cosmic agate
unkempt canyonBOT
#

@cosmic agate :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 2
002 |     else:
003 | IndentationError: unexpected indent
slate swan
#

dms also join the server and leave if u want, i just want to know if the join msg works

cosmic agate
buoyant zodiac
#

maybe that's new

cosmic agate
#

me just testings

buoyant zodiac
#

ion really code anymore tbh

cosmic agate
lusty sky
cosmic agate
#

nvm

lusty sky
#

I mean it literally works lol

cosmic agate
#

hmm

slate swan
boreal ravine
#

show the full error

#

it's already a string..

maiden fable
#

u have a command named factor

#

Is fine

untold marlin
#

can anyone tell me the code for the following
if i type .official > the bot will give the pinged member a specific role
if i type .vc > the bot will join the specific vc

#

and what shoul be the imports like
import discord
import python

maiden fable
#

!d discord.Member.add_roles

unkempt canyonBOT
#

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

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

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

!d discord.VoiceChannel.connect

unkempt canyonBOT
#

await connect(*, timeout=60.0, reconnect=True, cls=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Connects to voice and creates a [`VoiceClient`](https://discordpy.readthedocs.io/en/master/api.html#discord.VoiceClient "discord.VoiceClient") to establish your connection to the voice server.

This requires [`voice_states`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.voice_states "discord.Intents.voice_states").
untold marlin
#

hmm only import discord ?
And code for
if i type .official it will give specific role

#

can anyone tell me the code for the following
if i type .official > the bot will give the pinged member a specific role
if i type .vc > the bot will join the specific vc
and what shoul be the imports like
import discord
import python

maiden fable
#

U only need discord import

slate swan
#

Can you help me with heroku ?

nimble plume
#

suggest some logs

maiden fable
#

?

nimble plume
maiden fable
#

Ah

nimble plume
#

or suggest a command

maiden fable
#

Idk

nimble plume
#

h

#

@maiden fable is wavelink legal

maiden fable
#

iirc nope

nimble plume
#

:<

slate swan
#

how to make your bot edit message?

boreal ravine
nimble plume
nimble plume
#

.

boreal ravine
#

that game

#

make it a command

#

:)

nimble plume
#

yh?

slate swan
nimble plume
#

idk

slate swan
#

how can i make this only trigger if the bot is mention?

if message.content.startswith("luBOT"):
#

instead of saying luBOT, you can just mention it?

zinc otter
#

But all together

slate swan
#

ohh

zinc otter
#

That would count as a mention

slate swan
#

aight thanks

#

How to host replit 24/7 on uptimer?

supple thorn
nimble plume
slate swan
#

Why?

nimble plume
#

pay for it

#

then u can

slate swan
#

Where?

#

How much?

supple thorn
supple thorn
nimble plume
supple thorn
#

You're willing to pay for weird ass hosting on replit

#

Just get a vps

slate swan
supple thorn
#

That's better than what you would pay for on replit

slate swan
#

50$ kaala_cheemda

supple thorn
nimble plume
#

per month?

slate swan
#

No year

nimble plume
supple thorn
slate swan
supple thorn
#

Bruh

nimble plume
supple thorn
#

Stop trying on replit

slate swan
supple thorn
#

Just get a vps

slate swan
#

Price?

nimble plume
#

private server

supple thorn
nimble plume
nimble plume
supple thorn
#

He never said we are

slate swan
#

Any website you know?

supple thorn
#

He's asking for a general price

slate swan
#

Yes

nimble plume
#

no idea

supple thorn
nimble plume
#

per month

supple thorn
#

I know one that does 0.50$ per month

nimble plume
#

prob low spec

supple thorn
#

@slate swan

supple thorn
nimble plume
#

clicked and laged

supple thorn
#

I suggest get a 3$ one

#

Hosting a discord bot doesn't need that much resources

slate swan
nimble plume
#

any free hosting ?

supple thorn
nimble plume
#

.

slate swan
supple thorn
#

That is not hosting

slate swan
nimble plume
#

wdym

supple thorn
nimble plume
#

then.

supple thorn
#

I meant it as not hosting for discord bots

slate swan
nimble plume
#

alright

supple thorn
#

Just self host

nimble plume
slate swan
#

Self host?

supple thorn
#

Then pay

supple thorn
nimble plume
slate swan
#

How?

nimble plume
slate swan
#

๐Ÿ˜‚

slate swan
nimble plume
#

nothing else no complex

slate swan
#

Any video?

supple thorn
nimble plume
#

^

slate swan
nimble plume
slate swan
#

๐Ÿ˜‚

nimble plume
#

ur bot goes offline

slate swan
#

Sleep is also good?

supple thorn
nimble plume
#

i thought that was mod

slate swan
#

Nice suit

nimble plume
#

idc about specs i just want my bot to up

#

better than offline

slate swan
#

@supple thorn sleep is also work?

#

Sleep?

nimble plume
#

cant

supple thorn
nimble plume
#

nvmd

slate swan
#

Like there is a option sleep and shutdown

nimble plume
#

here sometimes the electricity goes

slate swan
#

So It will work?

nimble plume
slate swan
#

๐Ÿ˜‚ ๐Ÿ˜‚

nimble plume
#

..

#

but they are some free host that are decent

slate swan
#

@slate swan is there any video on yt ?

nimble plume
#

heroku?

slate swan
#

Self host

nimble plume
#

ik its uptime is down

nimble plume
#

yes but we can?

slate swan
#

Yes we can

#

But only for 1 month

nimble plume
#

alright

#

ok.

slate swan
#

Anyone have self host video?

placid skiff
#

are you using an IDE?

slate swan
#

What happened if my windows go to sleep mode? @slate swan

nimble plume
nimble plume
placid skiff
#

You can use everything that can launch your python file

slate swan
nimble plume
placid skiff
#

self hosting isn't meant to be used in production anyways

nimble plume
#

the ide will run in back

slate swan
nimble plume
#

prob run the python file

#

instead of running from ide

proper acorn
#

whats the different of:
print("send")
print(f'send')

red zealot
placid skiff
#

as you written there is no difference, the code will print send anyways

red zealot
proper acorn
unkempt canyonBOT
#

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

slate swan
maiden fable
proper acorn
#

how to add my prefix to on_message function?

#

like

#
if message.content == (myprefix,"any message"):
  await message.channel.send("a") ```
slate swan
#

xd

alpine furnace
proper acorn
cloud dawn
slate swan
proper acorn
#

tysm!

alpine furnace
#

message.content.startswith(your prefix):

process

#

Np

maiden fable
proper acorn
#

@alpine furnace

#

how to use that? help me please

placid skiff
#

you should know python before start using d.py

proper acorn
placid skiff
#

most useless tutorials on youtube lol

proper acorn
#

im from VietNam and my english so bad

#

so hard to learn ๐Ÿ˜ฆ

placid skiff
proper acorn
#

thanks you so much, please give me an example

placid skiff
#

Lol you wanna give him examples which most probably he will not understand because probably he doesn't know what decorators are

maiden fable
#

PoV: They use discord.Client lemon_pensive

placid skiff
#

my subclass hurt

maiden fable
#

Was jk but cool

supple thorn
proper acorn
#

i mean i want to an example with "startwith" and prefix

placid skiff
#

i could bet on that answer

maiden fable
placid skiff
#

i think that i will start writing a book named "1000 reasons and more why you should know python before using any OOP package"

maiden fable
#

While writing the code: discord.User.send() ๐Ÿ‘€

placid skiff
#

as you can try to be a sword eater without studying and practing on it, you would eventually die, but you can try

maiden fable
#

In short, I, uhhh, copied most of the code

vocal plover
#

I've seen plenty of people learn python through discord bots, they just need to be very persistent and decent at googling

placid skiff
maiden fable
#

Indeed, but I still learn new langs through the same method

placid skiff
maiden fable
placid skiff
#

hahahahaha
Bruh i started with C, and before moving to python i learned plenty language, assembly too xD

placid skiff
#

Well yeah if i have some remorse his name is javascript lol

#

i would like to delete that language from my mind

maiden fable
#

Hahaha

proper acorn
placid skiff
#

bro you don't know python lol. What you wrote doesn't have any sense

maiden fable
#

Might as well use commands.Bot at this stage

#

Sad lemon_pensive

placid skiff
#

You know what? i will show him how an on_message event should work, if he will understand then i will help him

placid skiff
maiden fable
#

Blvck, please write your book in MS Word, not here

supple thorn
#

Blvck has the easiest time completing 1000 word essays

placid skiff
#

if you can explain this simple code i will help you

maiden fable
placid skiff
#

lol i'm used to intellisense :L

#

?

maiden fable
#

Nvm

#

Most probably

placid skiff
#

also he is playin at roblox lol

maiden fable
near path
#
\u001b[1;32mThat's some cool formatted text right?
#
[1;32mThat's some cool formatted text right?
placid skiff
#

javascript is shit

vocal plover
#

javascript just kinda handles most things badly

cosmic agate
#

guys can u give good tutorial for meme command with buttons

vocal plover
#

TypeScript is good, provided you can purge from your mind that it transpiles to js

maiden fable
#

It's totally different

placid skiff
#

javascript doesn't handle xD

maiden fable
#

The only reason I hate JS is cz NO TYPE CHECKING but it's ot soooo

vocal plover
#

in that case you should definitely look into typescript

placid skiff
#

oh no hunter is going to use OT

maiden fable
vocal plover
#

this is why we need threads kek

placid skiff
#

everything is a string in js D_D

vocal plover
#

who would win?
JavaScript or one large number boi

maiden fable
#

U can send a string ID to the API too

#

It's just discord.py that has made everyone think that IDs are int

#

(Idk about other modules)

vocal plover
#

I mean IDs are integers

#

they may be transmitted as strings

#

but they're numbers

maiden fable
#

Ik about ts

cosmic agate
maiden fable
#

But ig I need a project to work on, since I don't learn langs without any project in mind

maiden fable
cosmic agate
maiden fable
#

Yea

placid skiff
maiden fable
#

Just use the reddit JSON API, store the url's in a list

#

And on button click, send a random url

cosmic agate
#

no works

maiden fable
#

Show code

cosmic agate
#
@bot.command(pass_context=True)
async def memee(ctx):
    embed = nextcord.Embed(title="", description="")

    async with aiohttp.ClientSession() as cs:
        async with cs.get('https://www.reddit.com/r/memes/new.json?sort=hot') as r:
            res = await r.json()
            embed.set_image(url=res['data']['children'] [random.randint(0, 25)]['data']['url'])
            button = Button(label="Next Meme", style=nextcord.ButtonStyle.green)
            async def button_callback(interaction):
                await interaction.response.edit_message()
            await ctx.send(embed=embed)
maiden fable
#

Get the memes with a task and use a botvar lemon_pensive

cosmic agate
#

i remove button

#

i tried other way

maiden fable
#

I see pass_context ๐Ÿ‘€

cosmic agate
#

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

vocal plover
#

i should add pass context back to nextcord for the lols

maiden fable
#
bot.memes = ...  # GET MEMES AND SET THIS BOTVAR TO THE RESPONSE

async def callback(...):
    await interaction.response.send_message(random.choice(bot.memes)) 
@bot.command(...) 
async def meme(...):
    view = View(...) 
    btn = Button(...) 
    btn.callback = callback
    view.add_item(btn)
    await ctx.send(random.choice(bot.memes), view=view) 
#

(And yes, I wrote the code on mobile, don't tell that it has any mistakes)

#

Yea, but updating the git manually do be a pain

#

U still gotta use anything to get the memes from the git

#

Which requires the use of an API

jade tartan
maiden fable
#

Nvm, it's self.bot

#

Not self.client

jade tartan
# maiden fable Error?
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "c:\Users\thoma\Desktop\discord server bot\cogs\log.py", line 14, in on_ready
    if not self.bot.ready:
AttributeError: 'Bot' object has no attribute 'ready'```
maiden fable
#

!d discord.Client.is_ready

unkempt canyonBOT
#

is_ready()```
[`bool`](https://docs.python.org/3/library/functions.html#bool "(in Python v3.10)"): Specifies if the clientโ€™s internal cache is ready for use.
maiden fable
jade tartan
#

Thanks all set

#

Just a question

#

On a profile cmd can you store a user age in js file?

#

orjson

normal folio
#
msgem = discord.Embed(title = "Cooldown", description = "**This command is <t:{}:R>**".format(int(time.time() + error.retry_after)))
``` returns it to **In 0 minutes** instead of **In a few seconds**
slate swan
maiden fable
#

time.time() is the current epoch and retry_after is the seconds

normal folio
slate swan
maiden fable
#

Yea...

#

cz epoch is the seconds

slate swan
maiden fable
#

Highly debatable

regal cove
#

i hate that i need to ask this but

#

what did i do wrong here: py import discord

maiden fable
#

Nothing

regal cove
#

somehow i didnt do this right

#

somehow this aint working

maiden fable
#

Probably wrong Python version or didn't install

regal cove
#

this is the error i get: Traceback (most recent call last): File "main.py", line 1, in <module> import discord ModuleNotFoundError: No module named 'discord'

regal cove
#

idk

#

i dont really care about that code

#

im just confused why its not working

maiden fable
normal folio
maiden fable
slate swan
normal folio
maiden fable
#

Well

#

He's manually inputting that

#

Also discord itself dk the real age of most users

jade tartan
#

Ohh wait i thought the bot can record the user age instead of me manually doing this?

#

And yes

maiden fable
#

even the discord dk the users' original age, begone u

#

Indeed

paper sluice
#

i noticed @unkempt canyon uses bot.http_session to do requests, how do i set that up?

maiden fable
paper sluice
#

ah its that simple

maiden fable
#

!botvar for more information

unkempt canyonBOT
#

Python allows you to set custom attributes to most objects, like your bot! By storing things as attributes of the bot object, you can access them anywhere you access your bot. In the discord.py library, these custom attributes are commonly known as "bot variables" and can be a lifesaver if your bot is divided into many different files. An example on how to use custom attributes on your bot is shown below:

bot = commands.Bot(command_prefix="!")
# Set an attribute on our bot
bot.test = "I am accessible everywhere!"

@bot.command()
async def get(ctx: commands.Context):
    """A command to get the current value of `test`."""
    # Send what the test attribute is currently set to
    await ctx.send(ctx.bot.test)

@bot.command()
async def setval(ctx: commands.Context, *, new_text: str):
    """A command to set a new value of `test`."""
    # Here we change the attribute to what was specified in new_text
    bot.test = new_text

This all applies to cogs as well! You can set attributes to self as you wish.

Be sure not to overwrite attributes discord.py uses, like cogs or users. Name your attributes carefully!

vale wing
#

It has a hidden attribute

paper sluice
#

can i use it like i normally use clientsession

paper sluice
#

ah cool

vale wing
#

I remember there's something like bot._http.session

paper sluice
#

๐Ÿ‘€

maiden fable
vale wing
#

If you'd want to make raw requests to discord API maybe it is

#

But for other cases the custom session is preferable

maiden fable
#

Yea

native onyx
#

Does anyone know how I can access the items that are inside items1 and items2?

{
    "Items": {

        "Items1": {
            "a": 500,
            "b" : 70,
            "c": 90 
        },

        "Items2": {
            "a": 400,
            "b": 110,
            "c": 80
        }
    }
}
honest vessel
#

@native onyxhttps://www.w3schools.com/python/python_json.asp

jade tartan
#

Oh shit sorry

native onyx
#

thankss

maiden fable
#

I just like it how people tend to use dpy without learning Python

#

(Just a general statement, not targeting anyone)

#

even when made with discord bot maker

slate swan
maiden fable
#

Is okay

slate swan
maiden fable
slate swan
#

lol that was fine

maiden fable
#

I mean, the first few bots I made were made with the same

slate swan
maiden fable
#

Indeed

#

There's no stack for the things I search lemon_pensive

#

Hehe

slate swan
#

nvm

maiden fable
#

Why do u ghost ping me lemon_pensive

slate swan
maiden fable
#

I hate ghost pings, so make use of yr brain before sending messages lemon_pensive

final shard
#

I use exit() to kill the bot code

#

is that ok?

maiden fable
#

Hmm I forgot

final shard
#

await bot.logout?

maiden fable
#

Not logout

final shard
#

hm

maiden fable
#

Uh

final shard
#

awkward

maiden fable
#

Nah

final shard
maiden fable
#

!d discord.Client.close

unkempt canyonBOT
#

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

Closes the connection to Discord.
final shard
#

oo

maiden fable
#

There, smh dpy weird

final shard
#

xd

#

thx

normal folio
maiden fable
#

I told u....

#

๐Ÿ˜” As usual

final shard
#

i use kill command if im not using IDE

#

emergency shutdown

#

my friend annoying af

#

its ok nothings wrong

maiden fable
#

๐Ÿ˜” as usual he ignores me

slate swan
maiden fable
#

I'mma just go away

final shard
#

xdd

maiden fable
#

BTW @final shard

#

If u want the stop the bot all of a sudden, then use exit else use bot.close

slate swan
slate swan
maiden fable
normal folio
slate swan
maiden fable
normal folio
maiden fable
#

then why u repeatedly asking the same thing

boreal ravine
#

What is happening Bruhmoment

maiden fable
#

Probably, I am a bit too annoying for people to handle

slate swan
maiden fable
#

Lmao

slate swan
#

seems fun ngl

maiden fable
#

AGAIN GHOST PING

normal folio
maiden fable
#

Actually its a common thing now

slate swan
maiden fable
maiden fable
normal folio
#

Hey discord, how fix time getting rounded off?

maiden fable
#

๐Ÿ˜”

#

Seriously tho, u cannot do anything

slate swan
#

wtf

low latch
#

is that the official one?

maiden fable
#

No

boreal ravine
#

Why are you guys sending random invites?

maiden fable
#

This is the one and only official unofficial API Server by Discord

maiden fable
#

I meant, there are many discord devs in there, and the server is used for posting API stuff, but its still unofficial

#

So discord terms it as the official unofficial API Server

floral frigate
slate swan
sleek mountain
#

how can I talk

#

guys

gaunt ice
proper acorn
gaunt ice
#

C:

proper acorn
#

still got bug

gaunt ice
#

hm

placid skiff
# proper acorn

lol he used that code in his bot without even knowing how it works

supple thorn
proper acorn
#

ahh ok tysm, my eye is broken lol

supple thorn
#

!d discord.Message.reply

unkempt canyonBOT
#

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

A shortcut method to [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send") to reply to the [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message").

New in version 1.6.

Changed in version 2.0: This function will now raise [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.10)") or [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError "(in Python v3.10)") instead of `InvalidArgument`.
gaunt ice
#

i feel sad now

proper acorn
#

i know, i create a forbidden_words file but umm

#

can i do on json file?

placid skiff
#

AND NOW HE WANTS TO USE JSON lol

proper acorn
supple thorn
#

Blvck going at it

boreal ravine
#

how to json with economy??

proper acorn
#

k tysm

placid skiff
proper acorn
#

tysm, you help me so much!

#

how to make this ping mention on me?

#

i just try it

placid skiff
#

send him docs, don't spoon feed him xD

proper acorn
#

but still nothing change

proper acorn
#

i ussually learn on youtube

#

i did it

#

@slate swan wait, what happend if i use asyncio.sleep(1) ?

#

no

placid skiff
#

to learn discord.py you should know what is OOP, what are methods and parameters, what is a coroutine, what is a decorator and basic python knowledge

proper acorn
#

i think mention if have any delay it will work

#

let me try

#

still didnt get ping

maiden fable
#

.mention

proper acorn
#

i did it, im using replit

placid skiff
proper acorn
#

bro @slate swan

#

its didnt send anything

#

it got bug

placid skiff
#

it's not a bug

proper acorn
#

thanks you so much!

placid skiff
#

please stop spoon feeding him, he will never learn nothing like this
Bro seriously if we would help you as we help others in this group you will understand nothing at all

proper acorn
#

thanks you so much!

placid skiff
#

You were trying to use a method without having an object instance

#

he has done the basic, now he will ask us how to mute, ban, commands etc. How would you explain to him that? you can only send him code which is pretty useless without knowing what is an object of discord.py

cloud dawn
#

bro my ping command isn't working

#
#[command]
async fn ping(ctx: &Context, msg: &Message) -> CommandResult {
    msg.reply(ctx, "Pong!").await?; Ok(())
}
``` ;-;
maiden fable
cloud dawn
#

I'm getting like 15 errors lol

#

What?

#

I am getting it .-.

#

long time ago

#

Shit?

queen linden
#

help?

@bot.event
async def on_member_update(before, after):
  if before.activity != after.activity:
    channel = bot.get_channel(channel id here)
    
    required_activity = "vanity url"
    for activity in after.activities:
      if str(activity).startswith(required_activity):
          emb = discord.Embed()
          emb.description = f"""
thank for vanity :wowow:
        """
          emb.color = 0x2f3136
          emb.set_footer(text="maow")
          await channel.send(f"<@{after.id}>", embed=emb)
  else:
      return```

it sends the embed twice ??
cloud dawn
#

You got the bot running twice?

slate swan
queen linden
cloud dawn
queen linden
honest shoal
#

check any other command

#

if you get the response two times

queen linden
#

thats the only command

#

like in the file

honest shoal
#

where is the bot running?

queen linden
#

wdym?

honest shoal
#

is it hosted somewhere?

queen linden
#

no its not

cloud dawn
queen linden
#

theres nothing other than the apps im running

cloud dawn
#

You sure? Sometimes it gets buried in background processes.

slate swan
cloud dawn
queen linden
#

alrighty

maiden fable
#

I just like it how people tend to leak bot tokens accidently

#

ODAwOTc4NTQyMjI1MzkxNjU2.YAYfQ.TO8k7-5sqJYYuuwHU0Yjs is totally not HunAI's token

queen linden
#

wh

maiden fable
#

Would be fun if that worked ๐Ÿ‘€

#

Lmao

#

Eh, still half of the token is correct

#

Indeed

#

That's what I did, with half timestamp being correct too

honest vessel
#

i thought why the hell dosnt code change xD

cloud dawn
queen linden
#

it still sends it twice

honest vessel
#

@cloud dawnwb long time no see

cloud dawn
#

Do you have multiple events?

cloud dawn
honest vessel
#

why i say wb

queen linden
#

wait wrong reply

#

wait no nvm

#

those r the only events ^^

cloud dawn
# queen linden

Maby the event gets triggered twice and is true both times?

queen linden
#

๐Ÿคท

#

alrighty

honest vessel
#

kill the bot and see if it still responds?

cloud dawn
#

!d discord.Member.activity

unkempt canyonBOT
#

property activity```
Returns the primary activity the user is currently doing. Could be `None` if no activity is being done.

Note

Due to a Discord API limitation, this may be `None` if the user is listening to a song on Spotify with a title longer than 128 characters. See [GH-1738](https://github.com/Rapptz/discord.py/issues/1738) for more information.

Note

A user may have multiple activities, these can be accessed under [`activities`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member.activities "discord.Member.activities").
queen linden
honest vessel
#

aah ok

#

this tho? A user may have multiple activities, these can be accessed under activities.

queen linden
slate swan
#

but why is he making an embed like that

#

and mentioning a user like that

#

and a lot more I don't understand

#

required activity var

#

else: return

queen linden
slate swan
#

๐Ÿ‘

rough finch
#

ok

queen linden
#

im so sorry but im confused

slate swan
#

I don't know how 2 activites are supposed to start with vanity url

#

or is that just a placeholder

queen linden
#

oh icic

cloud dawn
# queen linden im not sure i understand
from discord import Member, ActivityType

@bot.event
async def on_member_update(before: member, after: member):
    if before.activity != after.activity:
        if act := [activ.name for activ in after.activities if activ.type == ActivityType.custom and activ.name == "vanity url"]:
            channel = bot.get_channel(channel id here)
            emb = discord.Embed(color=0x2f3136)
            emb.description = f"""thank for vanity :wowow:"""
            emb.set_footer(text="maow")
            await channel.send(f"<@{after.id}>", embed=emb)
#

Something like this ig

queen linden
#

aint before and after a member object already or smt

slate swan
#

what's :=

cloud dawn
#

The activity is a bit weird programmed for users end

cloud dawn
queen linden
#

ill try this thanks

slate swan
#

what it do

cloud dawn
unkempt canyonBOT
#

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

20
slate swan
#

and shouldn't it be if before.activities != after.activities

cloud dawn
slate swan
#

I don't know

cloud dawn
#

What does != do ?

slate swan
#

activity checks for the first activity only innit

queen linden
cloud dawn
#

!e ```py
if 1 != 2:
print("yes")

if 2 != 1:
print("yes")

unkempt canyonBOT
#

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

001 | yes
002 | yes
slate swan
#

this ain't related

cloud dawn
#

So doesn't matter if you switch them

slate swan
#

to what I just said

#

I didn't even switch them

#

I used the activities attr instead of the activity one

#

to check if none of the users activites changed

honest vessel
#

@cloud dawnhey brother what does if act := do?

cloud dawn
cloud dawn
#

Assigns a variable inside an if statement for example.

slate swan
#

panda you did all this

#

and forgot a : on the if statement

honest vessel
#

oh damn you oneliners ๐Ÿ˜‰

delicate hornet
#

how do i add buttons on my message?

cloud dawn
#

Lemme see how short it can get

slate swan
#

ui

#

!d discord.ui.View

unkempt canyonBOT
#

class discord.ui.View(*, timeout=180.0)```
Represents a UI view.

This object must be inherited to create a UI within Discord.

New in version 2.0.
honest vessel
slate swan
#

spam stonks

slate swan
#

also chain the footer to the definition line

#

1 line embed

queen linden
odd trench
#

is this where I come if I need help with a bot?

slate swan
#

await ctx.send(Embed(**kwargs).set_footer(**kwargs))

#

discord f it up

odd trench
#

thank you

delicate hornet
#

how do i add buttons on my message?

queen linden
#

oh yea

slate swan
#

Member

delicate hornet
#

i? how do i add buttons on my message?

odd trench
#

I am wanting to add an input box to my embed

slate swan
#

and you don't even need it

unkempt canyonBOT
#

class discord.ui.View(*, timeout=180.0)```
Represents a UI view.

This object must be inherited to create a UI within Discord.

New in version 2.0.
odd trench
#
@client.command(name="idea")
async def Discord(context):
    questions = [
        "What have ya got?",
        "Hit me with it!",
        "Oh, this should be good!",
        "Ah! Well, spit it out man!",
        "What have ya now?"
    ]
    random_question = random.choice(questions)
    embed4 = discord.Embed(title=random_question, description='')
    await context.message.channel.send(embed=embed4)
delicate hornet
odd trench
#

there is my command code

odd trench
#

I mean, kinda?

#

you would click the text box

cloud dawn
# slate swan please make the embed normal
@bot.event
async def on_member_update(before: __import__('discord').Member, after: __import__('discord').Member):
    if before.activity != after.activity and [activ.name for activ in after.activities if activ.type == __import__('discord').ActivityType.custom and activ.name == "vanity url"]: await bot.get_channel(channel id here).send(f"<@{after.id}>", embed=discord.Embed(color=0x2f3136, description="thank for vanity :wowow:").set_footer(text="maow"))
``` Done
queen linden
#

if ur asking why the name in the ping is diff im helping my friend

odd trench
#

hmmm

#

I'll try it

#

wait what?

#

forgive my ignorance

delicate hornet
odd trench
#

the check=check?

slate swan
odd trench
#

alright

delicate hornet
#

do you know that discord has a reply feature?

odd trench
#

so, that is there to make sure it doesn't over flow?

cloud dawn
delicate hornet
#

can you use it when talking to me?

odd trench
#

oh

#

oooohhh...

#

now I feel like an idiot

#

alright

#

so where would that go?

#
@client.command(name="idea")
async def Discord(context):
    questions = [
        "What have ya got?",
        "Hit me with it!",
        "Oh, this should be good!",
        "Ah! Well, spit it out man!",
        "What have ya now?"
    ]
    random_question = random.choice(questions)
    client.wait_for('message',check=check)
    embed4 = discord.Embed(title=random_question, description='')
    await context.message.channel.send(embed=embed4)
delicate hornet
odd trench
#

after it sends the embed I'm assuming?

delicate hornet
odd trench
#

yeah, quiz bots are cool

#

now but I also want it to show up in the embed

delicate hornet
#

what bot should i create?

odd trench
#

for the description

#

basically, I had the idea to make an idea input for the bot

#

and the embed would have an input box for you to type the idea

#

yes

#

or is that impossible?

maiden fable
#

U can

odd trench
#

I hAvE fEeDbAcK

maiden fable
#

Look into Modals

odd trench
maiden fable
#

!d disnake.ui.TextInput

unkempt canyonBOT
#

class disnake.ui.TextInput(*, label, custom_id, style=<TextInputStyle.short: 1>, placeholder=None, value=None, required=True, min_length=None, max_length=None)```
Represents a UI text input.

This can only be used in a [`Modal`](https://docs.disnake.dev/en/latest/api.html#disnake.ui.Modal "disnake.ui.Modal").

New in version 2.4.
slate swan
#

an input box in an embed?

maiden fable
#

Nope

cloud dawn
#

modals?

slate swan
#

isn't that what he just said

odd trench
maiden fable
#

Sorry lemon_pensive

odd trench
#

and input box

#

nah, you're good man!

slate swan
#

that would be the coolest shit I've seen on discord

#

right after my birthday system

cloud dawn
odd trench
#

I'll the embed then you say the message, then it deletes the message and the previouse embed and creates a new one with the idea in the description.

cloud dawn
#

Better Discord + private proxy server + webserver to route and save the messages.

maiden fable
#

Indeed

odd trench
maiden fable
#

!d discord.Client.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.10)"). 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.10)") 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.10)") 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**...
odd trench
#

oh

cloud dawn
#

!d discord.Message.edit

unkempt canyonBOT
#

await edit(content=..., embed=..., embeds=..., attachments=..., suppress=..., 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 "(in Python v3.10)") instead of `InvalidArgument`.
odd trench
#

lmfao

maiden fable
#

It's normal to get ignored here, dw (:

cloud dawn
#

f

odd trench
#

so then would I make a variable with the message sent?

vocal plover
#

I have discord at 90% zoom with a small font size and no space between message groups lmao

#

so many messages

maiden fable
#

Same

cloud dawn
#

beat that

vocal plover
#

brb getting a vertical untrawide

maiden fable
#

80% Zoom for Mobile for me

odd trench
vocal plover
# cloud dawn beat that

so in theory I could tell xfce that all 4 of my screens are on top of each other and drag the window across them all ๐Ÿ˜ณ

maiden fable
#

My mobile screenshot

odd trench
#

thank you, but how do I do that?

maiden fable
odd trench
#

hm

#

thanks I guess?

#

it differs away from what name sent

maiden fable
#

I'mma just go lemon_pensive

floral frigate
maiden fable
cloud dawn
# odd trench thanks I guess?
@client.command(name="play")
async def play(ctx):
  def check(m):
    return m.author == ctx.author and m.channel == ctx.message.channel

  number = random.randint(1,100)
  await ctx.send('I have a number in mind between 1 and 100, guess it')

  for i in range(0,5):
    guess = await client.wait_for("message", check=check)
    
    if int(guess.content) > number:
      await ctx.send("The number is greater")
    elif int(guess.content) < number:
      await ctx.send("The number is smaller")
    elif int(guess.content) == number:
      await ctx.send("You guessed the number!!")
    else:
      await ctx.send("It has to be a positive integer between 1 to 100")
  else:
    await ctx.send("You lost, type $play to play again.")
``` here is an example
floral frigate
maiden fable
floral frigate
odd trench
#

so like this?

msg = await client.wait_for('message',check=check)
maiden fable
#

Oh, then nvm

cloud dawn
#

Hunter being rude again smh

maiden fable
cloud dawn
#

Me neither i've been up for almost 36 hours now

odd trench
hoary cargo
maiden fable
#

Ares too here, that's my cue to leave

cloud dawn
cloud dawn
hoary cargo
maiden fable
cloud dawn
#

That emoji tops it off

odd trench
maiden fable
cloud dawn
#

verrie biglemonsaurus

maiden fable
#

๐Ÿ‘€

#
lambda msg: msg.author == ctx.message.author and msg.channel == ctx.channel
odd trench
#

at the top?

#

in the discord idea function?

cloud dawn
maiden fable
#

Indeed

odd trench
#

so how do I delete the message and embed

#

now that I have the embed and message

cloud dawn
unkempt canyonBOT
#

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

Deletes the message.

Your own messages could be deleted without any proper permissions. However to delete other peopleโ€™s messages, you need the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission.

Changed in version 1.1: Added the new `delay` keyword-only parameter.
maiden fable
#

Gn

final shard
#

How to create a webhook and then send a message through it

maiden fable
#

!d discord.TextChannel.create_webhook

unkempt canyonBOT
#

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

Creates a webhook for this channel.

Requires [`manage_webhooks`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_webhooks "discord.Permissions.manage_webhooks") permissions.

Changed in version 1.1: Added the `reason` keyword-only parameter.
maiden fable
#

!d discord.Webhook.send

unkempt canyonBOT
#
await send(content=..., *, username=..., avatar_url=..., tts=False, ephemeral=False, file=..., files=..., embed=..., embeds=..., allowed_mentions=..., view=..., thread=..., ...)```
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.10)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects to send.

Changed in version 2.0: This function will now raise [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError "(in Python v3.10)") instead of `InvalidArgument`.
cloud dawn
#

Try fetching the member

odd trench
#

question

cloud dawn
odd trench
#

are there anythings I need to add?

#

to the await delete(*, delay=None)

vocal plover
#

Hmmm what topic should I cover in a bot tutorial next ๐Ÿค”

cloud dawn
placid skiff
hoary cargo
cloud dawn
vocal plover
#

all the way up to a rewrite of my cogs tutorial, but everything beyond that is message command based and doesn't apply to slash commands

cloud dawn
#

Instead of .get .fetch and await it

odd trench
# cloud dawn Don't literally copy the method. It's just `.delete()`

Like this?

@client.command(name="idea")
async def Discord(context):
    def check(message):
        return message.author == ctx.message.author and message.channel == ctx.channel
    questions = [
        "What have ya got?",
        "Hit me with it!",
        "Oh, this should be good!",
        "Ah! Well, spit it out man!",
        "What have ya now?"
    ]
    random_question = random.choice(questions)
    embed4 = discord.Embed(title=random_question, description='Idea goes here')
    msg = client.wait_for('message',check=check)
    client.delete()
    await context.message.channel.send(embed=embed4)
cloud dawn
#

When i was learning Discord bots i threw my bot away like every week.

final shard
cloud dawn
vocal plover
odd trench
#

well, it creates an embed and then saves the next message sent as a variable

vocal plover
#

that'll create a whole new project from a template

cloud dawn
#

Yeah :)

#

Do define the member fetch

hoary cargo
#

is

@has_permissions()

a thing?

final iron
#

Iirc yes

odd trench
final iron
unkempt canyonBOT
#

@discord.ext.commands.has_permissions(**perms)```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member has all of the permissions necessary.

Note that this check operates on the current channel permissions, not the guild wide permissions.

The permissions passed in must be exactly like the properties shown under [`discord.Permissions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions "discord.Permissions").

This check raises a special exception, [`MissingPermissions`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingPermissions "discord.ext.commands.MissingPermissions") that is inherited from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
cloud dawn
#

๐Ÿ‘

placid skiff
hoary cargo
placid skiff
#

i'll check the source code so i can tell you if you can or not

hazy oxide
#

Can someone help me? I'm getting this error

NotImplementedError: Type "class 'nextcord.channel.TextChannel'>" isn't a supported typing for Application Commands
gaunt ice
#

code?

hazy oxide
# gaunt ice code?
@client.slash_command(name="announce", description="Announce an announcement to a specified text channel")
@commands.has_permissions(manage_messages=True)
async def announce(interaction: Interaction, channel: nextcord.TextChannel, *, msg):
  await interaction.send("Notice : Successfully send the announcements.")

  em = nextcord.Embed(title="Notice : New Announcement", description=f"{msg}", color=0x00FAFF)
  em.set_footer(text=f"Announcement by {interaction.user}", icon_url=interaction.user.avatar.url)
  em.timestamp = datetime.datetime.utcnow()
  await channel.send(embed=em)
cloud dawn
odd trench
#

hang on

cloud dawn
#

I feel like we are coding blind here

placid skiff
# hoary cargo <a:AShmm:582388553351299092>

yup, the decorator doesn't check if the function where the decorator is called is a command function, so actually you can call @has_permissions decorator even without using a command function, it is only need that your function has a context object as first parameter

delicate hornet
#

how do i add roles and remove roles from members?

cloud dawn
cloud dawn
unkempt canyonBOT
#

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

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

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

!d discord.Member.remove_roles

unkempt canyonBOT
#

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

Removes [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s from this member.

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the removed [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
placid skiff
cloud dawn
hazy oxide
#

you mean code?

cloud dawn
#

Yes

hazy oxide
#
@client.slash_command(name="announce", description="Announce an announcement to a specified text channel")
@commands.has_permissions(manage_messages=True)
async def announce(interaction: Interaction, channel: nextcord.TextChannel, *, msg):
  await interaction.send("Notice : Successfully send the announcements.")

  em = nextcord.Embed(title="Notice : New Announcement", description=f"{msg}", color=0x00FAFF)
  em.set_footer(text=f"Announcement by {interaction.user}", icon_url=interaction.user.avatar.url)
  em.timestamp = datetime.datetime.utcnow()
  await channel.send(embed=em)
delicate hornet
#

can someone create a text filter? for my bot?

cloud dawn
#

!pypi nextcord

unkempt canyonBOT
left crater
delicate hornet
hazy oxide
left crater
cloud dawn
# hazy oxide ya

Think an issue with the lib all the examples on their git are also without channel formatting.

odd trench
#

@cloud dawn check dms

delicate hornet
left crater
#

ok

delicate hornet
#

how do i send files ||using a bot||

slate swan
odd trench
#
@client.command(name="dance")
async def cat(context):
    dances = [
        "dances/dance1.gif",
        "dances/dance2.gif",
        "dances/dance3.gif",
        "dances/dance4.gif",
        "dances/dance5.gif",
        "dances/dance6.gif",
        "dances/dance7.gif",
        "dances/dance8.gif"
    ]
    random_dance = random.choice(dances)
    await context.send(file=discord.File(random_dance))
slate swan
#

!d discord.abc.Messageable.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/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.10)") 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.10)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
cloud dawn
slate swan
#

And convert the file to a File obj

odd trench
#

well, it works

cloud dawn
#

Okay good :)

odd trench
#

now I just need to delete the message and embed

#

then make a new embed

delicate hornet
slate swan
#

What

alpine furnace
#

Lol