#discord-bots

1 messages · Page 445 of 1

slate swan
#

no

#

do the IDs for guilds, roles and users have the same amount of digits?

hasty iron
#

that was a joke

slate swan
#

my question wasn't

hasty iron
#

and yes probably

slate swan
#

267624335836053506
511195913583198218

#

nah

soft trout
#

i mean

slate swan
#

wait

soft trout
#

did you have to ask here if you knew already

slate swan
#

well that explains a lot to me

#

how do you make a text channel with a bot

dapper cobalt
unkempt canyonBOT
#

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

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

Note that you need the [`manage_channels`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to create the channel.

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

Note

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

how can I make it so anyone can message my bot even if they dont share a server with it?

slate swan
dapper cobalt
#

!d discord.ext.commands.Bot.get_guild

unkempt canyonBOT
spark kite
dapper cobalt
#

Remember that the bot must have manage_channels permissions.

dapper cobalt
#

The only way a user can dm a user (a bot is considered a user) while they don't share a server with them is to add them as a friend.

spark kite
#

so there's no way to like change settings to accept all dms?

dapper cobalt
#

Nope.

spark kite
#

oh

covert igloo
#

hey how do i put an emoji thats just in one server into my embed

stuck walrus
#

Now that discord.py is ceasing development what is a good alternative?

dapper cobalt
#

!pypi disnake it's in beta and very soon will be out. It has the same syntax and also includes slash commands, buttons, user commands, etc.

unkempt canyonBOT
dapper cobalt
#

!pypi dislash.py is made by the developer of disnake.

unkempt canyonBOT
hasty iron
#

cant they just port dislash to disnake

covert igloo
hasty iron
#

and remove the monkeypatching

covert igloo
#

because when I used the universal, it worked fine

dapper cobalt
#

!charinfo 👋

unkempt canyonBOT
covert igloo
#

ok ty let me try it

stuck walrus
dapper cobalt
reef trail
#

how do you check if a message contains a specific word

#

if message.contains() ?

hasty iron
#

if str in message.content

reef trail
#

ty

dapper cobalt
reef trail
#

appreciate it

#
@commands.Cog.listener(name='on_message')
async def NoBadWords(self, message):
    if message.guild is None:
        return
    if message.guild.id == 871629438952022076:
        if "BadWord" in message.content:
            await message.author.ban()```
  Would this work? Im pretty sure banning like this doesnt work but feel free to let me know how to do it
slate swan
#

how do you create a webhook inside a chanmel

covert igloo
#

is it supposed to be the emoji ID

flat solstice
#

so I have this event for a starboard which works for the most part except it sends a new msg for every user that reacts rather than editing the existing msg. I'm not sure where I'm going wrong so does someone mind pointing out my mistake. here is my code: https://sourceb.in/je3f7lYMNw

slate swan
#

hey

#

someones knows?

#

sometime its works and somtimes not

dapper cobalt
slate swan
dapper cobalt
slate swan
#

what?

dapper cobalt
dapper cobalt
slate swan
#

send

dapper cobalt
slate swan
slate swan
covert igloo
dapper cobalt
covert igloo
#

yes

dapper cobalt
#

Let me have a look.

covert igloo
#

someone told me it doesnt work in titles

hasty iron
#

yes it doesn’t

dapper cobalt
hasty iron
#

huh

soft trout
covert igloo
dapper cobalt
hasty iron
#

that’s a modified discord client isn’t it?

soft trout
slate swan
#

its like 1-2 days ago

dapper cobalt
hasty iron
#

that could be why it works

soft trout
#

!e

unkempt canyonBOT
#
Command Help

!eval [code]
Can also use: e

*Run Python code and get the results.

This command supports multiple lines of code, including code wrapped inside a formatted code
block. Code can be re-evaluated by editing the original message within 10 seconds and
clicking the reaction that subsequently appears.

We've done our best to make this sandboxed, but do let us know if you manage to find an
issue with it!*

hasty iron
#

also they’re all against ToS

dapper cobalt
#

I'm aware of that. However, I don't do anything harmful or stupid with it, so I should be clear.

#

I only give my eyes a better experience, and that doesn't bother anyone, does it?

bronze wigeon
#

Discord cares if you use plugins that let you see certain things / do certain things you shouldn't, other than that if you use themes they could't care less

#

I'm agreeing with you btw^

slate swan
dapper cobalt
# slate swan

I'm not sure what package is that, but I think that "ZeroNodesConnected" means that whatever you are doing requires nodes and there are none connected.

hasty iron
#

we cant help with anything involving lavalink

dapper cobalt
#

Oh that's lavalink?

#

!ytdl

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)
hasty iron
#

wavelink is a wrapper for it

stray path
#

What's lavalink?

hasty iron
#

a music player specifically made for discord bots

stray path
#

Oh ok

dapper cobalt
#

Yes. And it violates YouTube's ToS since it downloads audio from videos.

soft trout
#

is that why groovy is ending its service

hasty iron
#

yes

stray path
#

Yes

dapper cobalt
covert igloo
dapper cobalt
bronze wigeon
#

Says who?

covert igloo
#

wdym

bronze wigeon
#

I've used it before

#

It works fine..

soft trout
dapper cobalt
bronze wigeon
hasty iron
#

no you cant

#

you cant have markdown in titles

bronze wigeon
#

Huh, then how'd I use it?

hasty iron
#

unless you have a modified client

dapper cobalt
#

It does.

covert igloo
#

what should i change the title to to contain the emoji

dapper cobalt
#

Embeds are weird.

hasty iron
covert igloo
#

why is mine not working

hasty iron
#

we’re talking about normal discord

dapper cobalt
stray path
bronze wigeon
hasty iron
stray path
#

I didn't touch my discord.py in anyway other than installing it, and I can put emojis in my title

dapper cobalt
#

I will check it on Discord from the web.

bronze wigeon
#

Only a theme

#

which uses CSS, not JS

dapper cobalt
#

It does.

hasty iron
#

what

#

since when??

covert igloo
#

@bronze wigeon what should i change my title to

soft trout
#

thats kind of sus

covert igloo
#

to include the emoji

#

rn it just prints the name of the emoji

hasty iron
#

@covert igloo does it work for you

soft trout
#

I need to test this theory

covert igloo
#

let me try it

bronze wigeon
#

The bot may need to be in the server(s)

covert igloo
#

its my test server

bronze wigeon
#

Hm

vale pendant
#

Normal discord client.

#

This is the discord browser.

soft trout
#

@hasty iron AHHHHHHHHHHHHHHHHHH

#

IT ACTUALLY WORKS

hasty iron
#

what about emotes

#

wtf

vale pendant
#

Haven't tried it out.

dapper cobalt
#

It does for me.

bronze wigeon
covert igloo
#

its not working for me

vale pendant
covert igloo
dapper cobalt
bronze wigeon
#

It's because it's in bold, I believe

#

Maybe

#

Idrk

forest blade
#

Try it in the description and not the title

covert igloo
#

not sure why it isnt working for me

dapper cobalt
# covert igloo

Discord is really weird.. try seeing it on the web? Maybe you are missing an update. I'm not sure.

reef trail
#

@commands.Cog.listener(name='on_message')
async def AutoBanNWord(self, message):
    if message.guild is None:
        return
    if message.guild.id == 871629438952022076:
        if "BadWord" in message.content.lower():
            reason = "[AutoBan] Racism / Hard R"
            await message.author.guild.ban(reason=reason)
        ```
 Does this look good?
vale pendant
#

Emojis work too.

covert igloo
#

wtf

hasty iron
#

i could swear this didnt work before

dapper cobalt
hasty iron
#

it must be some new thing

dapper cobalt
hasty iron
#

that’s why i was confused

reef trail
#

Cant put the actual word i want to be autobanned

#

you get what i mean

soft trout
#

ok so emojis do actually work on titles?

dapper cobalt
visual island
covert igloo
#

no it isnt

#

doesnt work in description either

dapper cobalt
#

Try another emoji.

visual island
#

probably the ID is wrong

dapper cobalt
#

Then you probably got the ID wrong.

vale pendant
#

Is your bot in the same server as the emoji?

covert igloo
#

ok let me try it

covert igloo
visual island
#

Note: you can't directly copy the id of an emoji from a message

dapper cobalt
covert igloo
#

i was right clicking the emoji after sending it and copying the ID

dapper cobalt
#

\ :emoji: and remove the space between :emoji: and \ .

visual island
dapper cobalt
dapper cobalt
covert igloo
#

@dapper cobalt @visual island thank you, it was just an ID issue

visual island
covert igloo
#

this is what i have for unbans rn

#

it doesnt unban when you use ID

#

hold on let me try it

visual island
#

typehint it

dapper cobalt
covert igloo
#

where

visual island
#

you can directly do await member.unban() instead of making 10 lines of code

dapper cobalt
#
 async def unban(self, ctx, user: discord.User):
        try:
            await ctx.guild.unban(discord.Object(id=user.id))
        except:
            return await ctx.send(f"**{user}** is not banned!")

        await ctx.send(f"**{user}** has been unbanned.")
hasty iron
#

you have a User object

#

pass that in directly

dapper cobalt
hasty iron
#

?

dapper cobalt
#

Some people don't know how to get an ID.

reef trail
#

How do i check if the message author is the bot

hasty iron
#

in guild.unban you passed in an Object

#

that isn’t necessary

dapper cobalt
hasty iron
#

just pass in the User object directly

reef trail
#

Its in an event

dapper cobalt
hasty iron
#

Guild.unban takes in an abc.Snowflake

covert igloo
#

would it work without it

dapper cobalt
#

I don't know why I use it, I just like it there, shrug

dapper cobalt
covert igloo
#

ok

dapper cobalt
dapper cobalt
reef trail
dapper cobalt
covert igloo
dapper cobalt
#

I just yoinked the code from my bot.

hasty iron
#

no reason argument lolololoollol so bad

dapper cobalt
hasty iron
#

yeah true

reef trail
#
@commands.Cog.listener(name='on_message')
async def AutoBanNWord(self, message):
    if message.guild is None:
        return
    if message.guild.id == 871629438952022076:
        if "badword" in message.content.lower():
            reason = "[AutoBan] Racism / Hard R"
            me = self.bot.get_user(101118549958877184)
            other = self.bot.get_channel(873078748847669259)
            try:
                await message.author.send(f"You have been banned from {message.guild.name} for being a racist.")
            except:
                pass
            await message.author.guild.ban(reason=reason)
            if message.author == self.bot.user:
                return
            else:
                await me.send(f"{message.author.name} was just banned in {message.guild.name}\n**Message Content**{message.content}")
                await other.send(f"{message.author.name} was just banned from this server for being racist {me.mention}")```
 Would this completely ignore its self? i may be overthinking this but i really dont wanna fuck anything up lmao
hasty iron
#

you can just check if the author is a bot or not

#

at the beginning of your code

reef trail
#

ah

dapper cobalt
reef trail
#

you're right

#

Yep

#

Thanks guys

dapper cobalt
#

Yeah as blanket said.

#

No problem. a_thumbsup

reef trail
#

Its been a while since ive made anything automated using on_message events

dapper cobalt
hasty iron
#

that was an accidental fork

#

some time ago

dapper cobalt
#

Understandable.

reef trail
#

How can i ignore a whole channel category?

#

like

if message.category.id == ID:
    return```
 would it work like this?
dapper cobalt
reef trail
#

ahh

dapper cobalt
reef trail
#

no idea

#

it does not

dapper cobalt
#

How could I forget about that.

covert igloo
reef trail
dapper cobalt
visual island
dapper cobalt
#

I store mutes so if a user rejoins they would get muted again too.

covert igloo
#

oo

dapper cobalt
#

Yeah, pretty advanced stuff.

#

I was super surprised when it worked tbh.

covert igloo
#

will do it eventually

#

but rn i just need it to assign the role

visual island
#

why do everyone uses Mongo tho..

dapper cobalt
#

I didn't see any bot that has that, so I didn't have hope to be the first one to do it.

dapper cobalt
visual island
dapper cobalt
unkempt canyonBOT
visual island
#

oh

dapper cobalt
#

(I don't use motor, but I make async functions myself)

flat solstice
#

Is anyone able to help me troubleshoot these errors?py Ignoring exception in on_raw_reaction_add Traceback (most recent call last): File "/home/snowyjaguar/.local/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event await coro(*args, **kwargs) File "/home/modmail/cogs/events.py", line 331, in on_raw_reaction_add if len(stared_message.reactions.count) == stars[1]: TypeError: object of type 'builtin_function_or_method' has no len() Ignoring exception in on_raw_reaction_add Traceback (most recent call last): File "/home/snowyjaguar/.local/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event await coro(*args, **kwargs) File "/home/modmail/cogs/events.py", line 319, in on_raw_reaction_add embed.set_footer(text = f"Stars: {len(stared_message.reactions.count)}") TypeError: object of type 'builtin_function_or_method' has no len() Ignoring exception in on_raw_reaction_add Traceback (most recent call last): File "/home/snowyjaguar/.local/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event await coro(*args, **kwargs) File "/home/modmail/cogs/events.py", line 319, in on_raw_reaction_add embed.set_footer(text = f"Stars: {len(stared_message.reactions.count)}") TypeError: object of type 'builtin_function_or_method' has no len() Ignoring exception in on_message_delete Traceback (most recent call last): File "/home/snowyjaguar/.local/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event await coro(*args, **kwargs)my code is https://sourceb.in/AgbveWoyoz

dapper cobalt
#
async def get_balance(user_id:int):
  economy.find_one({"_id": ctx.author.id})
  #some more stuff
crude crater
#

how would i write "user =" and then a mentioned user

#

like for a userinfo command

dapper cobalt
covert igloo
#

user = member.mention

bitter perch
reef trail
#
for channel in ctx.channel.category.id == 873078702861336606:
    print(channel.name)```
 how could i do this properly lmfao, im trying to print all of the channels under the category
dapper cobalt
crude crater
covert igloo
crude crater
#

thats kinda what i thought but im autistic so i couldnt think lmao

covert igloo
#

so am i lmao

visual island
#

but yeah it already returns int

crude crater
#

twins, lmaooooo

dapper cobalt
crude crater
#

LMFAO

covert igloo
#

it is

#

lol

covert igloo
#

@dapper cobalt how can i get the bot to send a ban dm to the user thats banned

flat solstice
flat solstice
crude crater
#

ill send u my code

covert igloo
crude crater
#

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

dapper cobalt
crude crater
#
await member.send(f"You were muted in the server {guild.name} for {reason}")
#

whoops

#

await member.send(f"You were muted in the server {guild.name} for {reason}")

crude crater
#

well it says muted but just changed it to banned

dapper cobalt
#

Do you have guild defined?

crude crater
#

no, its just guild

#

its not ctx.guild broski

dapper cobalt
unkempt canyonBOT
#

class discord.CategoryChannel```
Represents a Discord channel category.

These are useful to group channels to logical compartments.

`x == y` Checks if two channels are equal.

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

`hash(x)` Returns the category’s hash.

`str(x)` Returns the category’s name.
dapper cobalt
#

You can check for the CategoryChannel object's attributes there.

covert igloo
#

yea it aint work for me with just guilded

dapper cobalt
crude crater
#

try what he's saying then

dapper cobalt
#

That's Discord.

crude crater
covert igloo
#

guild i mean

crude crater
#

try ctx.guild

covert igloo
#

ok

crude crater
#

import discord
import asyncio
import random
import keep_alive
import json
import os
import re

dapper cobalt
crude crater
#

if you put that at the top of allllllll of your code then it should automatically define guild

crude crater
crude crater
#

i put that too

covert igloo
#

i didnt have guild defined

crude crater
#

yes

covert igloo
#

thats why it wasnt working

dapper cobalt
#

I called it.

crude crater
crude crater
covert igloo
#

its good now i think

#

let me go test it

crude crater
#

i honestly dont know how i defined guild so i apologize for that

dapper cobalt
#

guild = ctx.guild?

crude crater
#

but when you do the "import discord" im ALMOST certain that it defines it

crude crater
bitter perch
#

Back up.
What is going on here?

dapper cobalt
#

You can highlight "guild" and see where you defined it.

dapper cobalt
crude crater
#

i said i think nowhere did i say it does lol

dapper cobalt
#
import discord

@bot.command()
async def guildname(ctx):
  await ctx.send(guild.name)
crude crater
#

and by "they" you mean me

dapper cobalt
#

Yeah, I didn't want to assume your gender.

crude crater
#

LMFAO

#

word

covert igloo
#

@crude crater ayo u got mute and unmute fo me 💀

crude crater
#

because if you are then yeah ofc lmao

covert igloo
#

yes dog

crude crater
#

i gotchu bro

#

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

covert igloo
#

jesus im so lazy

#

dm it

crude crater
#
@client.command(description="Mutes the specified user.")
@commands.has_permissions(manage_messages=True)
async def mute(ctx, member: discord.Member, *, reason=None):
    guild = ctx.guild
    mutedRole = discord.utils.get(guild.roles, name="Muted")
#Mute---------------------------------------------------------Start
    if not mutedRole:
        mutedRole = await guild.create_role(name="Muted")

        for channel in guild.channels:
            await channel.set_permissions(mutedRole, speak=False, send_messages=False, read_message_history=True, read_messages=False)

    await member.add_roles(mutedRole, reason=reason)
    await ctx.send(f"Muted {member.mention} for reason {reason}")
    await member.send(f"You were muted in the server {guild.name} for {reason}")
covert igloo
#

or not

crude crater
#

@client.command(description="Unmutes a specified user.")
@commands.has_permissions(manage_messages=True)
async def unmute(ctx, member: discord.Member):
mutedRole = discord.utils.get(ctx.guild.roles, name="Muted")

await member.remove_roles(mutedRole)
await ctx.send(f"Unmuted {member.mention}")
await member.send(f"You were unmuted in the server {ctx.guild.name}")
dapper cobalt
vale pendant
#

Both mute commands could be better.

visual yarrow
#

Where can I find documentation for different versions of the Discord API?

crude crater
dapper cobalt
vale pendant
dapper cobalt
vale pendant
#

I could send mine too.

covert igloo
#

show me lmfao

crude crater
#

bro nobody cares, i dont mean to be rude but like seriously

dapper cobalt
#

Bet.

crude crater
#

ugh

unkempt canyonBOT
vale pendant
#

It does matter though.

crude crater
#

LMAO

dapper cobalt
#

Damnit.

covert igloo
dapper cobalt
#

One second.

covert igloo
#

lol

vale pendant
#

Dm's

visual yarrow
#

Use the paste service please:

#

!paste

crude crater
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.pydis.com/

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

dapper cobalt
covert igloo
dapper cobalt
#

That's my mute command.

covert igloo
#

so i have it

dapper cobalt
#

190 lines.

vale pendant
#

I'll send mine.

covert igloo
#

dog what

dapper cobalt
#

Hold, that's the mute and unmute, I didn't realize.

crude crater
visual yarrow
crude crater
covert igloo
#

190 lines for a mute comand???

dapper cobalt
crude crater
#

151 for a mute command is wasting your time lmfaooo

dapper cobalt
crude crater
#

its literally for a MUTE

vale pendant
dapper cobalt
hasty iron
covert igloo
#

@crude crater dm me the mute and unmte

crude crater
dapper cobalt
crude crater
#

and?

dapper cobalt
crude crater
#

how much money do you make off of your discord bot?

dapper cobalt
vale pendant
#

Don't want it timed.

dapper cobalt
vale pendant
#
  • I already have logs for muted command.
dapper cobalt
#

Let me check my paypal.

visual yarrow
# hasty iron what do you need it for

Erm, just trying some stuff out. Making some HTTP requests. I'm finding that I get back json with fields that are not in the docs. But it's not clear to me which version of the API those docs document.

vale pendant
#

Nor do I care about people having their own mute role.

crude crater
visual yarrow
#

@crude crater That is actually quite rude.

hasty iron
dapper cobalt
hasty iron
#

arent always*

crude crater
covert igloo
#

@crude crater does ur mute have a timer

vale pendant
#
  • the bot that I made is strictly for anti-nuke.
covert igloo
#

or do you need to unmute manually

dapper cobalt
crude crater
#

i do have a tempban though

#

so ill just do the same thing with that but with the mute

visual yarrow
covert igloo
#

or any channels for that matter

crude crater
#

it makes it to where they cant type

#

they can still view but cant type

covert igloo
#

when i used it, it removed the person i muted from the channel list

#

like you couldnt see them in the right

crude crater
#

you also have to fix the perms in your server

covert igloo
#

i did read_messages=True

dapper cobalt
covert igloo
covert igloo
dapper cobalt
#

What about view_channel?

crude crater
crude crater
#

you can just do it in the discord server

#

in the role perms

dapper cobalt
#

!d discord.Permissions

unkempt canyonBOT
#

class discord.Permissions(permissions=0, **kwargs)```
Wraps up the Discord permission value.

The properties provided are two way. You can set and retrieve individual bits using the properties as if they were regular bools. This allows you to edit permissions.

Changed in version 1.3: You can now use keyword arguments to initialize [`Permissions`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions "discord.Permissions") similar to [`update()`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions.update "discord.Permissions.update").
dapper cobalt
#

You can do it in both code and through the server.

crude crater
#

its easier to do it in the server

final iron
#

Are there any good alternative Reddit API wrappers from asyncpraw

dapper cobalt
crude crater
#

doing it in code just clutters stuff more when you can just click a button

unkempt canyonBOT
#
Not in a million years.

Package could not be found.

dapper cobalt
#

!pypi redditeasy

unkempt canyonBOT
#

RedditEasy is an API wrapper for getting posts using the Reddit JSON API with both sync and async options

dapper cobalt
dapper cobalt
#

You can set the send_messages and read_messages from the server too.

covert igloo
#

@crude crater i have read_messages=True but it still is removing them from the channel member list

crude crater
dapper cobalt
covert igloo
#

channel perm or actual role perm

crude crater
#

both

dapper cobalt
#

Channel permissions.

covert igloo
#

the role has view channel

#

ok i think its fixed

#

was missing channel perms

flat solstice
#

so I'm not sure where I'm going wrong but every time a new user reacts on a msg that is already stared it sends the msg to the starboard again. I want it to only send to the starboard once and then every other time it should update the footer of the first msg. this is my code https://sourceb.in/rLvSvU6yRd

manic wing
#

@hasty iron

#

are you alive

#

can you help me pwease

dapper cobalt
#

Don't ask to ask, just ask.

manic wing
#

im asking blanket, because blankets a friend and i know he will be able to help

dapper cobalt
manic wing
#
@asyncSlot()
    async def filter_id(self) -> discord.abc.Messageable:

        _id = self.id_edit.text()
      
        try:
            _id = int(_id)
            try:
                channel = await self.bot.fetch_channel(_id)
                if channel:
                    print('z')
                    return channel
            except:
                pass

            try:
                user = await self.bot.fetch_user(_id)
                print(user)
                if user:
                    print('x')
                    return user
                    print('e')

            except:
                pass

                

        
        except Exception as e:
            print(e)
            users = list(filter(lambda m: m.name.startswith(self.id_edit.text), bot.users))
            if len(users) == 1:
                return users[0]
            
            return None
            
        finally:
            print('f')
            return None

    @asyncSlot()
    async def trigger_message(self):
        msg = QMessageBox()

        if not self.id_edit.text:
            msg.setText('Specificy an id')
            msg.exec_()
            return
        else:
            final_object = self.filter_id()
            if final_object:
                print(final_object)
                await final_object.send(self.message_edit.text if self.message_edit.text else 'Hello')
                return
            msg.setText('Invalid id')
            msg.exec_()

why the hell is this erroring? AttributeError: '_asyncio.Task' object has no attribute 'send' it errors half way through filter_id

hasty iron
#

hello

manic wing
#

it errors on the await final_object.send(self.message_edit.text if self.message_edit.text else 'Hello')

#
PS C:\Users\caede\Desktop\Github\integrated-bot-gui> & C:/Users/caede/AppData/Local/Programs/Python/Python39/python.exe c:/Users/caede/Desktop/Github/integrated-bot-gui/bot-gui/main.py
<Task pending name='Task-72' coro=<MainWindow.filter_id() running at c:\Users\caede\Desktop\Github\integrated-bot-gui\bot-gui\src\Mainwindow.py:97> cb=[asyncSlot.<locals>._error_handler() at C:\Users\caede\AppData\Local\Programs\Python\Python39\lib\site-packages\qasync\__init__.py:775]>
Traceback (most recent call last):
  File "C:\Users\caede\AppData\Local\Programs\Python\Python39\lib\site-packages\qasync\__init__.py", line 777, in _error_handler
    task.result()
  File "c:\Users\caede\Desktop\Github\integrated-bot-gui\bot-gui\src\Mainwindow.py", line 150, in trigger_message
    await final_object.send(self.message_edit.text if self.message_edit.text else 'Hello')
AttributeError: '_asyncio.Task' object has no attribute 'send'
hasty iron
#

final_object is a task

manic wing
#

how?

hasty iron
#

no clue, check your function that returns it

manic wing
#

filter_id returns it and its been breaking

hasty iron
#

send code for that

manic wing
#

its in the code above

hasty iron
#

oh its there

#

whats asyncSlot

manic wing
#

i print(user) and it shows my name, i return user, it prints the x but not the e, is there some voodoo shit where it cant return in a try except or smthing?

manic wing
#

its not really relevant

hasty iron
#

that could be it

manic wing
#

i dont think so

#

would it be?

hasty iron
#

you dont return a task anywhere in your function

manic wing
#

its worked fine for everything else

hasty iron
#

oh wait

#

you didn’t await it

#

thats the issue

manic wing
#

i didnt await what?

hasty iron
#

filter_id

#

in trigger_message

manic wing
#

oh fuck

#

yea

#

well at least it gave a different error this time lol

#
Exception in callback <TaskWakeupMethWrapper object at 0x0000017FDE4A9F40>(<Future finished result=None>)
handle: <Handle <TaskWakeupMethWrapper object at 0x0000017FDE4A9F40>(<Future finished result=None>)>
Traceback (most recent call last):
  File "C:\Users\caede\AppData\Local\Programs\Python\Python39\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
RuntimeError: Cannot enter into task <Task pending name='Task-1' coro=<MainWindow.start() running at c:\Users\caede\Desktop\Github\integrated-bot-gui\bot-gui\src\Mainwindow.py:55> wait_for=<Future finished result=None> cb=[asyncSlot.<locals>._error_handler() at C:\Users\caede\AppData\Local\Programs\Python\Python39\lib\site-packages\qasync\__init__.py:775]> while another task <Task pending name='Task-72' coro=<MainWindow.trigger_message() running at c:\Users\caede\Desktop\Github\integrated-bot-gui\bot-gui\src\Mainwindow.py:149> cb=[asyncSlot.<locals>._error_handler() at C:\Users\caede\AppData\Local\Programs\Python\Python39\lib\site-packages\qasync\__init__.py:775]> is being executed.
manic wing
#
final_object = await self.filter_id()
            print(final_object)
            if final_object:
                print(final_object)
                #await final_object.send(self.message_edit.text if self.message_edit.text else 'Hello')
                return
            msg.setText('Invalid id')
            msg.exec_()

``` this raises that error
#

i think it errors on the msg.setText('Invalid id') msg.exec_()

flat solstice
# dapper cobalt I'm sorry but that seems a little too complicated so I can't help you.

do you mean what I'm attempting to do is complicated or the way I'm doing it is overly complex?

What I am trying to do is listen for a on_raw_reaction_add event which uses one of the reactions in my list of star_reactions. the db will log the following things:

  • the ID of the message which was reacted to
  • the amount of reactions it has (the inclusive total of each reaction in star_reactions)
  • the id of the msg the bot sends to my starboard channel

I then want the footer of the embed the bot sends to show how many stars the msg has (pulled from the db). The bot should edit the msg each time a new star gets added so as the reflect the db value.

Does that make more sense? Do you think i'm on the right track to achieving my aim or have i gone wrong somewhere.

manic wing
#

wtf

#
@asyncSlot()
    async def filter_id(self) -> discord.abc.Messageable:

        _id = self.id_edit.text()
        main = None
        try:
            _id = int(_id)
         
            channel = self.bot.get_channel(_id)
            if channel:
                main = channel
    
            user = await self.bot.fetch_user(_id)
            if user:
                main = channel
                

        except Exception as e:
            print(e)
            users = list(filter(lambda m: m.name.startswith(self.id_edit.text), bot.users))
            if len(users) == 1:
                main = users[0]
            
            
        finally:
            print(main)
            return main
``` why is this returning none, im specifying a valid id
crisp pine
#

I have an error when i tried ban the user and there dms are closed it would not ban the user

    @commands.has_permissions(ban_members=True)
    @commands.command()
    async def ban(self, ctx,  user: discord.Member, *, reason="No reason provided"):   
        if ctx.author.top_role > user.top_role or ctx.author == ctx.guild.owner:
            if user == ctx.author:
                return await ctx.send("***:no_entry: You can't softban yourself...***")
           
            ban = discord.Embed(color=0x2f3136, title=f":heartbroke_roles: New User Banned", description=f"**```{user} Has Been\nBanned By {ctx.author}```**")
            ban.set_footer(text =f"{ctx.author} Has Banned {user}")
            ban.set_thumbnail(url = user.avatar_url)
            await ctx.channel.send(embed=ban)
            embed=discord.Embed (title=f"Banned",description=f":heartbroke_member: **_You have been \nbanned In_\n{ctx.guild.name} _by_** {ctx.author}\n\n:heartbroke_rules: **Reason:** {reason}",color=0x2f3136 )
            await user.send(embed=embed)
            await user.ban(reason=reason)
    @ban.error 
    async def ban_error(self, ctx, error):
        if isinstance(error, (commands.MissingPermissions)):
            embed = discord.Embed(color=0x2f3136, title="You Need **Permission** To Ban That User")
            await ctx.send(embed=embed)
        if isinstance(error, commands.MissingRequiredArgument):
            embed = discord.Embed(color=0x2f3136, title="Mention A User To Get Them **BAN**")
            await ctx.send(embed=embed)```
hollow hemlock
#

how to send a file?

hot cobalt
#

@manic wing Get rid of that bare except, chances are there's another issue you haven't anticipated throwing a different error from the one you expect

manic wing
covert igloo
#

@dapper cobalt how should i do error messages

hot cobalt
#

Catch whatever specific error you want to catch

covert igloo
#

like if a command is used wrong

manic wing
#

im rewriting that portion

#

its bugging me though

dapper cobalt
# flat solstice do you mean what I'm attempting to do is complicated or the way I'm doing it is ...

If it stores the message's ID then you can do:

  • check if there's already an ID stored that's equal to the message's ID
  • generate a unique ID for each "starred message" and store it
  • put the generated ID in the embed's footer
  • check in the channel's history using the discord.TextChannel.history() and try to see if there's any embed that has the unique ID in its footer
  • if you find the embed, you now have the embed's object, edit it

(I'm not very familiar with this, but this is all I could think of at 3 AM)

dapper cobalt
crisp pine
#

alright

crisp pine
manic wing
#

the typehint

dapper cobalt
manic wing
#

dude what

hot cobalt
#

@manic wing I wouldn't imagine so

#

!d discord.abc.Messageable

unkempt canyonBOT
#

class discord.abc.Messageable```
An ABC that details the common operations on a model that can send messages.

The following implement this ABC...
hot cobalt
#

should be fine

manic wing
#

this

print(self.bot.get_user(298043305927639041))
            print(await self.bot.fetch_user(298043305927639041))
            return self.bot.get_user(_id)
``` these 2 print me; ```py
final_object = await self.filter_id()
            print(final_object)``` this prints `None`...What?
#
@asyncSlot()
    async def filter_id(self) -> discord.abc.Messageable:

        _id = self.id_edit.text()
        main = None
        if not _id.isalpha():
            print(self.bot.get_user(298043305927639041))
            print(await self.bot.fetch_user(298043305927639041))
            return self.bot.get_user(_id)

        

        print(e)
        users = list(filter(lambda m: m.name.startswith(self.id_edit.text), bot.users))
        if len(users) == 1:
            main = users[0]
            

    @asyncSlot()
    async def trigger_message(self):
        msg = QMessageBox()

        if not self.id_edit.text:
            msg.setText('Specificy an id')
            msg.exec_()
        else:
            final_object = await self.filter_id()
            print(final_object)
            if final_object:
                print(final_object)
                await final_object.send(self.message_edit.text if self.message_edit.text else 'Hello')
                return
#

ive been stuck on this for an hour and its killing me

hot cobalt
#

What's self.id_edit.text() returning

manic wing
#

an str

#

i spent 10 minutes with it erroring because i didnt put the (), i thought it was a property :/

flat solstice
covert igloo
#

@dapper cobalt how do i make error message og

crisp pine
#

Thanks @dapper cobalt

hot cobalt
#

!d discord.Client.get_user

unkempt canyonBOT
hot cobalt
#

Would get_user() throw an error if _id isn't an int?

manic wing
#

fetch_user raises error

manic wing
hot cobalt
#

Or, would it just return None

manic wing
#

but both

print(self.bot.get_user(298043305927639041))
            print(await self.bot.fetch_user(298043305927639041))
``` these both print my user object
#

its something whack with the returns

hot cobalt
#

It's not being given an int

dapper cobalt
lyric moat
#
@client.command()
async def sp(ctx, user: discord.Member = None):
    if user == None:
        user = ctx.author
        pass
    if user.activities:
        for activity in user.activities:
            if isinstance(activity, Spotify):
                embed = discord.Embed(
                    title=f"{user.name}'s Spotify",
                    description="Listening to {}".format(activity.title),
                    color=0xC902FF)
                embed.set_thumbnail(url=activity.album_cover_url)
                embed.add_field(name="Artist", value=activity.artist)
                embed.add_field(name="Album", value=activity.album)
                embed.set_footer(text="Song started at {}".format(
                    activity.created_at.strftime("%H:%M")))
                await ctx.send(embed=embed)```
can someone help the command gives no error but the bot would not reply
dapper cobalt
dapper cobalt
hot cobalt
#

return self.bot.get_user(int(_id)) I would imagine you'd want to give it an int, if it's not throwing an error otherwise I can only assume that discord.py tries to convert it for you, or it just decides to return None

#

So it's worth a shot

manic wing
#

it was int before and still didnt work

hot cobalt
#

They do

#

Holdon lemme look at the try except again

covert igloo
#

lets say someone does ".mute @..." without a reason

#

it would pop up saying they need to have a reason

dapper cobalt
covert igloo
#

yes

dapper cobalt
#

To get the command's name you can use ctx.command and for the missing argument you can use error.missing_params.name.

covert igloo
#

ok ill try it

lyric moat
#
@client.command()
async def sp(ctx, user: discord.Member = None):
    if user == None:
        user = ctx.author
        pass
    if user.activities:
        for activity in user.activities:
            if isinstance(activity, Spotify):
                embed = discord.Embed(
                    title=f"{user.name}'s Spotify",
                    description="Listening to {}".format(activity.title),
                    color=0xC902FF)
                embed.set_thumbnail(url=activity.album_cover_url)
                embed.add_field(name="Artist", value=activity.artist)
                embed.add_field(name="Album", value=activity.album)
                embed.set_footer(text="Song started at {}".format(
                    activity.created_at.strftime("%H:%M")))
                await ctx.send(embed=embed)```
can someone help the command gives no error but the bot would not reply
lyric moat
#

@dapper cobalt can u help?

dapper cobalt
manic wing
#

you said 'To get the command's name' - the command's name would be

#

ctx.command.name

dapper cobalt
#

Oh right, my bad.

dapper cobalt
#

But I meant if it's something like this, ctx.command.name will be only "add" and not "filter add".

hot cobalt
#

@manic wing Not entirely sure why the previous version went wrong, in the future try to avoid having bare excepts, since it makes it a lot easier to locate unexpected issues

dapper cobalt
manic wing
# hot cobalt <@!298043305927639041> Not entirely sure why the previous version went wrong, in...

okay, i dont think await self.bot.fetch_user in a try works...? py Exception in callback <TaskWakeupMethWrapper object at 0x00000149F7EB9DC0>(<Future finished result=N File "C:\Users\caede\AppData\Local\Programs\Python\Python39\lib\asyncio\events.py", line 80, in _run self._context.run(self._callback, *self._args) RuntimeError: Cannot enter into task <Task pending name='Task-1' coro=<MainWindow.start() running at c:\Users\caede\Desktop\Github\integrated-bot-gui\bot-gui\src\Mainwindow.py:55> wait_for=<Future finished result=None> cb=[asyncSlot.<locals>._error_handler() at C:\Users\caede\AppData\Local\Programs\Python\Python39\lib\site-packages\qasync\__init__.py:775]> while another task <Task pending name='Task-71' coro=<MainWindow.trigger_message() running at c:\Users\caede\Desktop\Github\integrated-bot-gui\bot-gui\src\Mainwindow.py:148> cb=[asyncSlot.<locals>._error_handler() at C:\Users\caede\AppData\Local\Programs\Python\Python39\lib\site-packages\qasync\__init__.py:775]> is being executed. Exception in callback <TaskWakeupMethWrapper object at 0x00000149F772AC40>(<Future finished result=None>) handle: <Handle <TaskWakeupMethWrapper object at 0x00000149F772AC40>(<Future finished result=None>)> Traceback (most recent call last): File "C:\Users\caede\AppData\Local\Programs\Python\Python39\lib\asyncio\events.py", line 80, in _run self._context.run(self._callback, *self._args) RuntimeError: Cannot enter into task <Task pending name='Task-9' coro=<ConnectionState._delay_ready() running at C:\Users\caede\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\state.py:415> wait_for=<Future finished result=None>> while another task <Task pending name='Task-71' coro=<MainWindow.trigger_message() running at c:\Users\caede\Desktop\Github\integrated-bot-gui\bot-gui\src\Mainwindow.py:148> cb=[asyncSlot.<locals>._error_handler() atC:\Users\caede\AppData\Local\Programs\Python\Python39\lib\site-packages\qasync\__init__.py:775]> is being executed.

#
@asyncSlot()
    async def filter_id(self) -> discord.abc.Messageable:

        _id = self.id_edit.text()
        main = None

        if not _id.isalpha():
            _id = int(_id)

            try:
                channel = self.bot.get_channel(_id)
                if channel:
                    main = channel  
                    
            except Exception as e:
                print('SAFE', e)

            try:

                user = await self.bot.fetch_user(_id)
                if user:
                    main = channel

            except Exception as e:
                print('SAFE ', e)
            
            return main

        

        users = list(filter(lambda m: m.name.startswith(self.id_edit.text), bot.users))
        if len(users) == 1:
            main = users[0]
            
        return main

#

i dont get this

#

i dont see why api calls arent working

hot cobalt
#

hmm, that is odd

#

Haven't seen that error appear before

manic wing
#

yep, and its gonna make me go psycho

#

i am going mental

#
@asyncSlot()
    async def filter_id(self) -> discord.abc.Messageable:

        _id = self.id_edit.text()
        main = None

        if not _id.isalpha():
            print('hi')
            _id = int(_id)

            channel = self.bot.get_channel(_id)
            if channel:
                return channel

            user = self.bot.get_channel(_id)
            if user:
                return user
        

        users = list(filter(lambda m: m.name.startswith(self.id_edit.text()), self.bot.users))
        if len(users) == 1:
            return users[0]

        return None
``` this doesnt even work
#

tf

#
Traceback (most recent call last):
  File "C:\Users\caede\AppData\Local\Programs\Python\Python39\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
RuntimeError: Cannot enter into task <Task pending name='Task-104' coro=<DiscordWebSocket.send_heartbeat() running at C:\Users\caede\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\gateway.py:596> cb=[_chain_future.<locals>._call_set_state() at C:\Users\caede\AppData\Local\Programs\Python\Python39\lib\asyncio\futures.py:391]> while another task <Task pending name='Task-102' coro=<MainWindow.trigger_message() running at c:\Users\caede\Desktop\Github\integrated-bot-gui\bot-gui\src\Mainwindow.py:139> cb=[asyncSlot.<locals>._error_handler() at C:\Users\caede\AppData\Local\Programs\Python\Python39\lib\site-packages\qasync\__init__.py:775]> is being executed.
#

its

#
#msg.setText('Invalid id')
           # msg.exec_()
``` this is erroring
#

(when it wasnt blanked out)

#

that was cuasing the error i think

#

yeah it was

#

tf

sweet pilot
#

how can I create a new webhook

manic wing
#

await channel.create_webhook

dapper cobalt
#

!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/stable/api.html#discord.Permissions.manage_webhooks "discord.Permissions.manage_webhooks") permissions.

Changed in version 1.1: Added the `reason` keyword-only parameter.
dapper cobalt
#

@sweet pilot

sweet pilot
#

ok

#

thx

manic wing
#

ok so it just gives a really weird error when i use QMessageBox

#

i can work with that ig

flint forum
#

Is it possible to make an if state ment like this for bots:

@bot.command()
async def choose(ctx):
# here the bot asks a questiona and await for three options test test2 test3

# after that it makes an if statement

#example: if choose==test1
ctx.send("cookie") 

# or like ctx.role(role) which basically gives a person a role ```
#

and stuff like that

dapper cobalt
#

You can use python statements anywhere.

#

And what is ctx.role(role)?

flint forum
#

it was just a random example of giving a person a role:)

flat solstice
#
Ignoring exception in on_raw_reaction_add
Traceback (most recent call last):
  File "/home/snowyjaguar/.local/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "/home/modmail/cogs/events.py", line 316, in on_raw_reaction_add
    embed.set_footer(text = f"Stars: {str(reaction.count())}")
TypeError: 'int' object is not callable```not sure why this is happening as I'm converting it to a string ![shrug](https://cdn.discordapp.com/emojis/828693267495256115.webp?size=128 "shrug"). the codes too long to send here so you ca find it here: https://sourceb.in/R4ha5fuqRt
flint forum
#

not rly meant to be real code to use

#

just an example

dapper cobalt
#

Ah okay. But to give the author a role it's ctx.author.add_roles(role).

flint forum
#

I just want to make 1 little 2 menu option

flint forum
#

I know some of it except the if statements
I haven't gone over those

dapper cobalt
#

Try to see if it's a string or an int.

bitter perch
#

count is not a method

crisp pine
#

How do i make my ban command says "you can not ban that person"

flint forum
crisp pine
#

like if the try run the ban command on the owner

crisp pine
# crisp pine How do i make my ban command says "you can not ban that person"
    @commands.has_permissions(ban_members=True)
    @commands.command()
    async def ban(self, ctx,  user: discord.Member, *, reason="No reason provided"):   
        if ctx.author.top_role > user.top_role or ctx.author == ctx.guild.owner:
            if user == ctx.author:
                return await ctx.send("***:no_entry: You can't softban yourself...***")
           
            ban = discord.Embed(color=0x2f3136, title=f":heartbroke_roles: New User Banned", description=f"**```{user} Has Been\nBanned By {ctx.author}```**")
            ban.set_footer(text =f"{ctx.author} Has Banned {user}")
            ban.set_thumbnail(url = user.avatar_url)
            await ctx.channel.send(embed=ban)
            embed=discord.Embed (title=f"Banned",description=f":heartbroke_member: **_You have been \nbanned In_\n{ctx.guild.name} _by_** {ctx.author}\n\n:heartbroke_rules: **Reason:** {reason}",color=0x2f3136 )
            try:
             await user.send(embed=embed)
            except:
             pass           
            await user.ban(reason=reason)
    @ban.error 
    async def ban_error(self, ctx, error):
        if isinstance(error, (commands.MissingPermissions)):
            embed = discord.Embed(color=0x2f3136, title="You Need **Permission** To Ban That User")
            await ctx.send(embed=embed)
        if isinstance(error, commands.MissingRequiredArgument):
            embed = discord.Embed(color=0x2f3136, title="Mention A User To Get Them **BAN**")
            await ctx.send(embed=embed)```
slate swan
dapper cobalt
dapper cobalt
crisp pine
#

like if "kutie" trys ban an admin

dapper cobalt
flint forum
#

how do you make a bot send a message and make it await for messages to go on with the code

dapper cobalt
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/stable/api.html#discord-api-events) for a list of events and their parameters.

This function returns the **first event that meets the requirements**...
crisp pine
#

!ban

dapper cobalt
unkempt canyonBOT
crisp pine
#

does this work? py if ctx.author.top_role > user.top_role or ctx.author == ctx.guild.owner: if user == ctx.author: return await ctx.send("***:no_entry: You can't softban yourself...***")

bitter perch
#

its an attribute

#

meaning it's not callable....

dapper cobalt
#

Oh I got you wrong, my bad.

dapper cobalt
flat solstice
dapper cobalt
#

As Vaskel said, it's an attribute not a method, so it's not callable.

flint forum
#
@bot.command()
async def ifstate(ctx):
  await ctx.send("Hi whats your name:")
  if ctx.content.startswith("test1"):
    await ctx.send("Correct")```
#

I got the bot to send Hi whats your name atleast... @dapper cobalt I did stuff wrong uh I need help

dapper cobalt
#

Use wait_for to make it wait for a message.

flint forum
#

so ctx.wait_for("test"):

dapper cobalt
#
@bot.command()
async def ifstate(ctx):
  await ctx.send("Hi! What's your name?")
  name = await bot.wait_for("message", check=lambda m: m.author == ctx.author)
  await ctx.send(f"Alright, your name is {name.content}")
slate swan
#

How can I loop in a list/text file?

dapper cobalt
slate swan
#

Oh okay

dapper cobalt
#

I'm not sure how can you loop through a text file.

slate swan
#

The list is in the text file

#

It's all the bad words

dapper cobalt
#

!d discord.Guild

unkempt canyonBOT
#

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

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

`x == y` Checks if two guilds are equal.

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

`hash(x)` Returns the guild’s hash.

`str(x)` Returns the guild’s name.
heavy folio
#

ty

flint forum
dapper cobalt
flint forum
#

oo awesome

ebon island
#

Is there a good resource I can look into in terms of methodology for setting server specific custom prefixes?

covert igloo
#

@dapper cobalt do u have an error or warning symbol i can yoink

dapper cobalt
covert igloo
#

thank you

dapper cobalt
ebon island
#

where should that get_prefix be in terms of the file hierarchy?

dapper cobalt
#

Above your bot instance.

ebon island
#

hmm I guess I can just call any method that way if it's imported, I'm going to try that out

#

thank you Key! ❤️

dapper cobalt
#

Key... Yeah no problem, X!

sweet pilot
#

is it possible to give webhook a color?

dapper cobalt
#

If it sends an embed you can give the embed a color.

#

!d discord.Embed

unkempt canyonBOT
#

class discord.Embed(**kwargs)```
Represents a Discord embed.

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

Certain properties return an `EmbedProxy`, a type that acts similar to a regular [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") except using dotted access, e.g. `embed.author.icon_url`. If the attribute is invalid or empty, then a special sentinel value is returned, [`Embed.Empty`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Embed.Empty "discord.Embed.Empty").

For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") for you.
flint forum
#
@bot.command()
async def ifstate(ctx):
    optionembed = discord.Embed(title='Please choose an option', description="Option 1, Option 2, Option 3", color=c.purple())
    await ctx.send(embed=optionembed)

    options = await bot.wait_for("message", check=lambda m: m.author == ctx.author)
    await ctx.send(f"Nice you picked! {options.content}")``` @dapper cobalt
#

How do I add a statement if it has neither Option 1 Option 2 Or Option 3 It returns Incorrect option as an embed text

dapper cobalt
#
@bot.command()
async def ifstate(ctx):
    optionembed = discord.Embed(title='Please choose an option', description="Option 1, Option 2, Option 3", color=c.purple())
    await ctx.send(embed=optionembed)

  available_options = ["option 1", "option 2", "option 3"]

  def check(msg):
    return msg.author == ctx.author and msg.content in available_options

    options = await bot.wait_for("message", check=check)
    await ctx.send(f"Nice you picked! {options.content}")
flint forum
#

ohh I could have used a list all thattime?

dapper cobalt
#

Pretty pythonic, innit?

ebon island
#

How best do I import methods from within a cog Class? Does it require anything to instantiate or can you just call the class eg example = Example() and access a method via example.test() without any modification required?

flat solstice
#

well I'm slowly getting there with this event (I think). The number of stars is now increasing correctly however for some reason it keeps sending the star post each time a new reaction is added. My code: https://sourceb.in/86s5I6Nf0L.

tl;dr: event works however it keeps sending a new msg fir each reaction rather than editing the existing msg

heavy folio
#

hi how do i check my dpy version (not python version)

flat solstice
heavy folio
#

in terminal?

flint forum
flat solstice
heavy folio
#

oh okay

tame nymph
#

new free hosting method

#

the host is called || localhost || don't tell this to others

#

keep the jewel to yourself

heavy folio
#

nice

ivory drum
#

i want to make a command called 8ball but i can't create a variable with a number as the first character, how do i fix this? my code is

@bot.command()
async def 8ball(ctx):
  await ctx.send("placeholder")```
vale pendant
#
@bot.command(name="8ball")
async def _8ball(ctx):
  await ctx.send("placeholder")```
ivory drum
#

thanks

heavy folio
#

tried in terminal

vale pendant
#

Type py in terminal

#

Import discord

#

Then type discord.__version__

heavy folio
#

ohh tyy

covert igloo
#

how should i indent this for .bbed to work in the else

#

@dapper cobalt

vale pendant
flat solstice
#

is there a way to only edit a embeds footer without having to edit the whole embed?

covert igloo
#

how would i write it so it is defined

vale pendant
#

Like I said, it's only defined in the if statement. You would have to put it in the else statement, just cut it and paste.

#
else:
  bbed = discord.Embed(...)

  await ctx.send(embed=bbed)```
covert igloo
#

yea got it

deft hill
#

Whats the client.__ for non cog commands?

patent lark
deft hill
dapper cobalt
covert igloo
#

@vale pendant how would i go deleting a message after a certain amount of time if its an embed

vale pendant
#

You can add delete_after

dapper cobalt
#

delete_after=seconds

deft hill
covert igloo
#

it just printed it when i tried using that

patent lark
#

the .send() method has a delete_after kwarg

dapper cobalt
dapper cobalt
deft hill
dapper cobalt
#

And are you trying @client.command or client.command()?

patent lark
#

do not use discord.Client()

vale pendant
#

That's the error right there.

patent lark
#

there’s your issue

dapper cobalt
#

Ah yes.

patent lark
#

use this ,

deft hill
patent lark
#

!d discord.ext.commands.Bot

unkempt canyonBOT
#

class discord.ext.commands.Bot(command_prefix, help_command=<default-help-command>, description=None, **options)```
Represents a discord bot.

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

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

It should be client = discord.ext.commands.Bot(command_prefix="prefix").

deft hill
#

Ahhh, thanks.

flint forum
#

what do u use to make it capital and lowercase letters

#
@bot.command()
async def ifstate(ctx):
    optionembed = discord.Embed(title='Please choose an option', description="hug", "high5", color=c.purple())
    await ctx.send(embed=optionembed)

    available_options = ["hug", "high5"]

    def check(msg):
        return msg.author == ctx.author and msg.content in available_options

    options = await bot.wait_for("message", check=check)
    pickedembed = discord.Embed(title=f"Nicely done you have chosen:", description=f"{options.content}",
                                color=c.purple())
    await ctx.send(embed=pickedembed)```
#

because I can't have hug and high5 together since its in avaliable_options

ivory drum
#

why is this giving me "invalid syntax"? (it's in a list defined by answers = [list here])

dapper cobalt
flint forum
#

so

dapper cobalt
#

!e

print("heLLo ThErE".lower())
print("heLLo ThErE".upper())
unkempt canyonBOT
#

@dapper cobalt :white_check_mark: Your eval job has completed with return code 0.

001 | hello there
002 | HELLO THERE
flint forum
#

hmm I wanted to bypass it from giving me this error: optionembed = discord.Embed(title='Please choose an option', description="hug", "high5", color=c.purple())
^
SyntaxError: positional argument follows keyword argument

vagrant brook
#

What is "high5"

ivory drum
flint forum
#

like high five!

#

just a shortcut

vagrant brook
#

Then why did you put it in a separate parameter

flint forum
#

Wdym

vagrant brook
#

It's not in description or title

flint forum
#

im so damn confused what are you saying rn

vagrant brook
#

Oh, your description is just "hug"

flint forum
#

yes

vagrant brook
#

"high5" is separated

flint forum
#

yes

vagrant brook
#

That's the error

flint forum
#

oh ok

oak solar
#

hey this is supposed to send a message to my friend when he messages

#

it does nothing tho

#

that id is right click copied on his user

dapper cobalt
#

Add an else statement to print the message.author.id.

oak solar
#

trying it rn

keen talon
maiden hazel
#

yea

dapper cobalt
#

Oh right, I completely forgot, that's considered API abuse.

flint forum
#
@bot.command()
async def ifstate(ctx):
    optionembed = discord.Embed(title='Please choose an option', description="hug, high 5", color=c.purple())
    await ctx.send(embed=optionembed)

    available_options = ["hug", "high 5"]

    def check(msg):
        return msg.author == ctx.author and msg.content in available_options

    options = await bot.wait_for("hug", check=check)
    hugembed = discord.Embed(title=f"Nicely done you have chosen:", description=f"{options.content}",
                                color=c.purple())
    await ctx.send(embed=hugembed)

    options = await bot.wait_for("high 5", check=check)
    high5embed = discord.Embed(title=f"Nicely done you have chosen:", description=f"{options.content}",
                                color=c.purple())
    await ctx.send(embed=high5embed)```
#

I tried to make it 2 different options

oak solar
#

this did nothing

oak solar
#

idk if i have a wrong client token

flint forum
#

how would I make it check for hug and high 5

dapper cobalt
#

"hug" isn't an event.

keen talon
flint forum
dapper cobalt
#

It's wait_for("event").

oak solar
maiden hazel
flint forum
#

but how would i seperate it from 2 things

dapper cobalt
flint forum
#

2 options

oak solar
keen talon
oak solar
flint forum
#

huh?

oak solar
#

i was just curious if it works

#

i wasnt trying to spam anyone

dapper cobalt
oak solar
keen talon
flint forum
#

@dapper cobalt anyways back to my thingy how would I separate it with 2 options if the user sends hug it returns that embed text if the user returns high 5 it returns the other embed

dapper cobalt
#

wait_for waits for events only.
Examples:
wait_for("message")
wait_for("reaction_add")
wait_for("member_ban")

vagrant brook
#

I mean you can just read until someone sends "hug" or "high 5"

maiden hazel
vast juniper
#

what is high5

flint forum
#

High 5 is an option mah god

flint forum
#

Just a simple text

flint forum
#

is that a possibility

dapper cobalt
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/stable/api.html#discord-api-events) for a list of events and their parameters.

This function returns the **first event that meets the requirements**...
dapper cobalt
#

Read that.

flint forum
#

got it

dapper cobalt
#

Click on the title.

#

It has 2 examples.

flint forum
#

I'm reading it alr

#
 def check(m):
            return m.content == 'hello' and m.channel == channel

        msg = await client.wait_for('message', check=check)
        await channel.send('Hello {.author}!'.format(msg))``` "hello" basically is the message being waited
#

I'm guessing

dapper cobalt
#

It checks if the content of the message is "hello", correct.

#

You can check if the message content is inside a list ["hug", "high 5"].

flint forum
#

can I make 2 lists and make it check for that?

covert igloo
#

@dapper cobalt how do i add a command cooldown

dapper cobalt
unkempt canyonBOT
#

discord.ext.commands.cooldown(rate, per, type=<BucketType.default: 0>)```
A decorator that adds a cooldown to a [`Command`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command")

A cooldown allows a command to only be used a specific amount of times in a specific time frame. These cooldowns can be based either on a per-guild, per-channel, per-user, per-role or global basis. Denoted by the third argument of `type` which must be of enum type [`BucketType`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.BucketType "discord.ext.commands.BucketType").

If a cooldown is triggered, then [`CommandOnCooldown`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.CommandOnCooldown "discord.ext.commands.CommandOnCooldown") is triggered in [`on_command_error()`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.on_command_error "discord.on_command_error") and the local error handler.

A command can only have a single cooldown.
dapper cobalt
#
@client.command()
@commands.cooldown(how_many_seconds, how_many_uses, commands.BucketType.user/commands.BucketType.channel/commands.BucketType.guild)
flint forum
#
@bot.command()#6600
async def ifstate(ctx):
    optionembed = discord.Embed(title='Please choose an option', description="hug, high 5", color=c.purple())
    await ctx.send(embed=optionembed)

    available_options = ["hug"]

    available_options2 = ["high 5"]
    
    def check(msg):
        return msg.author == ctx.author and msg.content in available_options

    options = await bot.wait_for("hug", check=check)
    hugembed = discord.Embed(title=f"Nicely done you have chosen:", description=f"{options.content}",
                                color=c.purple())
    await ctx.send(embed=hugembed)

    def check(msg):
        return msg.author == ctx.author and msg.content in available_options2

    options = await bot.wait_for("high 5", check=check)
    high5embed = discord.Embed(title=f"Nicely done you have chosen:", description=f"{options.content}",
                                color=c.purple())
    await ctx.send(embed=high5embed)
#

failer

flint forum
#

oops

dapper cobalt
#

bot.wait_for("message")

flint forum
#

sorry my bad

#

yes yes thats my mistake

dapper cobalt
#

Why did you make 2 lists each one for a single option?

#

You can make one list available_options = ["high 5", "hug"].

#

And make one check to check if the content is in available_options.

flint forum
#

well because I didn't really want the same stuff

#

because for high 5

#

I would add an image with someone high 5ing

#

and hug someone hugging

#

an embed image with text

dapper cobalt
#
@bot.command()
async def ifstate(ctx):
    optionembed = discord.Embed(title='Please choose an option', description="hug, high 5", color=c.purple())
    await ctx.send(embed=optionembed)

    available_options = ["hug", "high 5"]
    
    def check(msg):
        return msg.author == ctx.author and msg.content in available_options

    options = await bot.wait_for("message", check=check)
    if options.content == "hugh":
      hugembed = discord.Embed(title=f"Nicely done you have chosen:", description=f"{options.content}", color=c.purple())
      await ctx.send(embed=hugembed)
    if options.content == "high 5":
      high5embed = discord.Embed(title=f"Nicely done you have chosen:", description=f"{options.content}", color=c.purple())
      await ctx.send(embed=high5embed)
pliant gulch
#

Wouldnt it be better to make a mapping of all the choices?

dapper cobalt
#

I don't usually spoonfeed but my brain cannot really explain things at this time.

pliant gulch
#

I.e ```py
CHOICES = {"hug": "hug link", "high 5": "high five link"}

if choice in CHOICES:
....return CHOICES[choice]

dapper cobalt
#

Yeah, you can do that.

#

{"hug": hugembed, "high 5": high5embed}

flint forum
#

It would be easier but my brain can't handle that rn

#

that's the result rn

dapper cobalt
#

You could make a hug command and a high5 command btw.

flint forum
#

Ik but I just wanted to do a little fun menu

#

This could be used for help a custom help later on!

dapper cobalt
#

Hmm. Fair enough.

flint forum
#

I'm not such a pro with discord.py but I'm trying my best here!

dapper cobalt
dapper cobalt
#

You can use reactions or buttons.

flint forum
#

yeah that's a good idea

#

although I need to learn that soon

dapper cobalt
#

You can subclass it too.

pliant gulch
#

reactions use wait_for though

dapper cobalt
#

!d discord.ext.commands.HelpCommand

unkempt canyonBOT
#

class discord.ext.commands.HelpCommand(**options)```
The base implementation for help command formatting.

Note

Internally instances of this class are deep copied every time the command itself is invoked to prevent a race condition mentioned in [GH-2123](https://github.com/Rapptz/discord.py/issues/2123).

This means that relying on the state of this class to be the same between command invocations would not work as expected.
dapper cobalt
#

I should get some sleep, right? Wrong.

covert igloo
#

@dapper cobalt what is the command to add footer

dapper cobalt
unkempt canyonBOT
#

set_footer(*, text=Embed.Empty, icon_url=Embed.Empty)```
Sets the footer for the embed content.

This function returns the class instance to allow for fluent-style chaining.
covert igloo
#

something _addfooter or sum

#

ah

flint forum
dapper cobalt
covert igloo
#

comes back as an error

dapper cobalt
covert igloo
#

swear there was a _addfotter

#

footer*

dapper cobalt
#

!d discord.Embed you can look at it yourself.

unkempt canyonBOT
#

class discord.Embed(**kwargs)```
Represents a Discord embed.

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

Certain properties return an `EmbedProxy`, a type that acts similar to a regular [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") except using dotted access, e.g. `embed.author.icon_url`. If the attribute is invalid or empty, then a special sentinel value is returned, [`Embed.Empty`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Embed.Empty "discord.Embed.Empty").

For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") for you.
covert igloo
#

unexpected indent

broken turtle
#

hi

covert igloo
#

@dapper cobalt

broken turtle
#
@bot.command()
async def coinflip(ctx):
    if random.choice(determine_flip) == 1:
        embed = discord.Embed(title="Coinflip | (Bot Name)", description=f"{ctx.author.mention} Flipped coin, we got **Heads**!")
        await ctx.send(embed=embed)

    else:
        embed = discord.Embed(title="Coinflip | (Bot Name)", description=f"{ctx.author.mention} Flipped coin, we got **Tails**!")
        await ctx.send(embed=embed)

error is determin_flip isnt defined

dapper cobalt
dapper cobalt
broken turtle
#

its not

#

thats what im trying to figure

#

im new to python so

dapper cobalt
#

Since you are using random.choice then I think determine_flip is a list that contains two integers, 1 and 2, right?

broken turtle
#

right

slate swan
dapper cobalt
#

Then you can define it that way: determine_flip = [1, 2].

slate swan
#

Disocrd embed generator

visual island
broken turtle
#

ok let me try that

rare pewter
visual island
rare pewter
#

Woke up a minute ago potatowatermelon

dapper cobalt
#

I don't like to be that guy but.

#

!ot

unkempt canyonBOT
rare pewter
broken turtle
#

ok bot is running time to see iof it works

visual island
dapper cobalt
#

Sorry. sad

broken turtle
#

this is what i got

visual island
broken turtle
#

determin flip isnt defined

#

and idk how to define it 😐

rare pewter
dapper cobalt
#

Can you show your code again?

rare pewter
broken turtle
#
@bot.command()
async def coinflip(ctx):
    if random.choice(determine_flip) == [1,2]:
        embed = discord.Embed(title="Coinflip | (Bot Name)", description=f"{ctx.author.mention} Flipped coin, we got **Heads**!")
        await ctx.send(embed=embed)
    else:
        embed = discord.Embed(title="Coinflip | (Bot Name)", description=f"{ctx.author.mention} Flipped coin, we got **Tails**!")
        await ctx.send(embed=embed)
dapper cobalt
#

You didn't define it still.

rare pewter
#

u can do random.range(2) potatosnuggling

rare pewter
dapper cobalt
#

Do what this smartie said.

broken turtle
#

so to dfeine it

#

it would be difned_flip=determine_flip????/

dapper cobalt
#

No.

#

determine_flip = [1, 2]

rare pewter
#

What smarty said but before if Statement

dapper cobalt
rare pewter
dapper cobalt
broken turtle
#

thx for you help

#
@bot.command()
async def coinflip(ctx):
    determine_flip = [1,2]
    if random.choice(determine_flip) == [1,2]:
        embed = discord.Embed(title="Coinflip", description=f"{ctx.author.mention} Flipped coin, we got **Heads**!")
        await ctx.send(embed=embed)
    else:
        embed = discord.Embed(title="Coinflip", description=f"{ctx.author.mention} Flipped coin, we got **Tails**!")
        await ctx.send(embed=embed)

this is the working code for coinflip

ivory drum
#

how to i check if a channel is nsfw or not? i have this so far: py async def is_nsfw(channel: discord.TextChannel): try: _gid = channel.server.id except AttributeError: return False data = await bot.http.request( discord.http.Route( 'GET', '/guilds/{guild_id}/channels', guild_id=_gid)) channeldata = [d for d in data if d['id'] == channel.id][0] return channeldata['nsfw'] but it returns with <coroutine object is_nsfw at 0x7fe2bc3df340> instead of a boolean

broken turtle
#

ok found a bug

#

it only lands on tails

#

@dapper cobalt

dapper cobalt
broken turtle
#

changing to that rn

#

to see if it works

dapper cobalt
unkempt canyonBOT
#

discord.ext.commands.is_nsfw()```
A [`check()`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that checks if the channel is a NSFW channel.

This check raises a special exception, [`NSFWChannelRequired`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.NSFWChannelRequired "discord.ext.commands.NSFWChannelRequired") that is derived from [`CheckFailure`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").

Changed in version 1.1: Raise [`NSFWChannelRequired`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.NSFWChannelRequired "discord.ext.commands.NSFWChannelRequired") instead of generic [`CheckFailure`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure"). DM channels will also now pass this check.
ivory drum
#

wouldn't it be easier to do py @bot.command() async def coinflip(ctx): if random.randint(0, 1) == 0: embed = discord.Embed(title = "Coinflip", description = f"{ctx.author.mention} flipped a coin and got **heads**!") await ctx.send(embed = Embed) else: embed = discord.Embed(title = "Coinflip", description = f"{ctx.author.mention} flipped a coin and got **tails**!") await ctx.send(embed = Embed) so you don't need to use a list?

dapper cobalt
#

@commands.is_nsfw()

ivory drum
#

ohhh, thanks a lot

covert igloo
#

@dapper cobalt how do i add date and time to footer

broken turtle
dapper cobalt
unkempt canyonBOT
ivory drum
# dapper cobalt @commands.is_nsfw()

the problem is, i want the command to work outside of nsfw channels but only with a specific set of responses and using this will only allow it to run in nsfw channels (i think)

dapper cobalt
unkempt canyonBOT
#

is_nsfw()```
[`bool`](https://docs.python.org/3/library/functions.html#bool "(in Python v3.9)"): Checks if the channel is NSFW.
dapper cobalt
#

You can do

if ctx.channel.is_nsfw():
  ...
else:
  ...
ivory drum
#

oh i see thanks

dapper cobalt
covert igloo
dapper cobalt
#

Where do you think? potatothink

flint forum
#

image embed how? when where

#

just need the source

#

!discord.Embed.image

covert igloo
#

idk i just tried to do it in embed.add_footer()

flint forum
#

wha

reef trail
#

how do i check if a user doesnt have a role