#discord-bots

1 messages · Page 648 of 1

shadow wraith
#

yeah

soft radish
#

how can i fetch all of the channel on a server?

tough lance
#

!redbot

velvet tinsel
#

I’m dead

tough lance
#

What actually is a red bot?

velvet tinsel
#

I don’t know

silver wolf
unkempt canyonBOT
velvet tinsel
#

But there is someone called red in one of my servers

vale wing
#

Just upgrade pip is pip install --upgrade pip iirc, but could you please tell what your python version is?

lethal moat
#

3.9

vale wing
#

Try downgrading to 3.8, I had similar issues with installing scikit, after I downgraded it all went back to normal

unkempt jewel
#

Guys

#

It didnt work

vernal marten
#

Change client.change_presence to self.client.change_presence

unkempt jewel
#

Ok tks

peak flint
#

Guys how do I make a LFG thing in discord.py?
I guess I'll just switch to pycord in a bit tho

peak flint
#

Looking for Game, like, when someone is playing a multiplayer game and wants someone (in the server) to join his game, he uses this command to "post a request for someone to join"

#

Wait I'll send an example

unkempt jewel
#

Why, i made a clear commands

#

Help me

spring flax
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.

unkempt jewel
#

Idk

#

Why they didnt run

vernal marten
#

Always add self before ctx when want to make command in cogs

peak flint
#

Can't find one, but as long as I can say an example (it's not how every LFG work but still)
When someone sends a command like "!createlobby" you either put the required arguments directly in the command (id, pass if there is one) and then it posts an embed into a channel (it's a private bot so I know which channels it'll post it in) or the bot asks you separately id and password to join and still posts the embed in a channel
People can join by putting ID (and pass) and, if possible, it makes a channel (or a thread, but I think they're not implemented in discord.py) to chat

#

Aight, LFG

slate solar
#

how do i delete the message that activited the command?

unkempt jewel
#

Wdym

#

Clear commands?

slate solar
#

nah

unkempt jewel
#

Or u use command and it will be deleted after the bot activited it?

unkempt jewel
#

Idk

#

U can make slash command bruh

peak flint
#

Not in discord py I guess

vale wing
gentle rose
#

is there any event similar to on_message but about rections - on_reaction_added for example

valid perch
#

on_reaction_add iirc

#

!d discord.on_reaction_add

unkempt canyonBOT
#

discord.on_reaction_add(reaction, user)```
Called when a message has a reaction added to it. Similar to [`on_message_edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message_edit "discord.on_message_edit"), if the message is not found in the internal message cache, then this event will not be called. Consider using [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") instead.

Note

To get the [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") being reacted, access it via [`Reaction.message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Reaction.message "discord.Reaction.message").

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

Note

This doesn’t require [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") within a guild context, but due to Discord not providing updated user information in a direct message it’s required for direct messages to receive this event. Consider using [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") if you need this and do not otherwise want to enable the members intent.
gentle rose
slate swan
#

is it possible to have 2 bot.wait_for in a messagE?

slate swan
# unkempt jewel

use
prtscsysrq+f12 to take screenshot then ctrl+v to paste it in chat

valid perch
slate swan
# valid perch in a message? But yea, you can use it twice. Although your usecase might not wor...

i am trying to make a business command and this is what i thought

@bot.command()
async def business(ctx, invest: str):
    success = random.randint(400, 1000)
    lost = random.randint(150, 300)
    guess = random.randint(success, lost)
    conn = sqlite3.connect('test.sql')
    msg = await bot.wait_for('message')
    if msg.content == "invest":
        await ctx.send('hmmm')
    else:
        await ctx.send('where?')
    if msg.content == "(A)":
        await ctx.send(f'you invested in blah and got {guess}')
    else:
        await ctx.send('sad')
    if msg.content == "(B)":
        await ctx.send(f'you invested in blah and got {guess}')
    else:
        await ctx.send('no money')```
valid perch
#

I mean thats only 1, so easy as

slate swan
#

its giving dis
i guess something is wrong with the random.randint
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ValueError: empty range for randrange() (973, 159, -814)

#

How to get the bot to take the msg variable From the emb command to on_reaction_add??

valid perch
#

What is guess meant to be? And why do you take 3 lines for it

valid perch
#

Explain your usecase if you dont mind, am confused

slate swan
valid perch
#

Why not just randint(150, 1000)

slate swan
slate swan
# worldly bane Code?

there is an msg = await bot.wait_for('message', check=check, timeout=None ) in the emb command and I want to take it from the Emb command to @bot.event on_reaction_add

slate swan
worldly bane
slate swan
slate swan
#

which database

worldly bane
#

Or just a command

slate swan
# worldly bane Is this for roles?

my team: The user writes a message after that, the bot sends it to the channel for verification to the moderators to approve his questionnaire after they have approved, the bot should send it to the anketa channel

slate swan
worldly bane
worldly bane
slate swan
#

should I just upload this code to the database and it will work?

worldly bane
worldly bane
slate swan
#

"Indent"

worldly bane
slate swan
#
@bot.command()
async def business(ctx, invest: str):
    guess = random.randint(150, 1000)
    conn = sqlite3.connect('test.sql')
    await ctx.send('where?')
    if ctx.content == "(A)":
        await ctx.send(f'you invested in blah and got {guess}')
    else:
        await ctx.send('sad')
    if ctx.content == "(B)":
        await ctx.send(f'you invested in blah and got {guess}')
    else:
        await ctx.send('no money')
```error:
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Context' object has no attribute 'content'
vernal marten
slate swan
slate swan
worldly bane
velvet tinsel
#

This looks more familiar

velvet tinsel
worldly bane
#

Elif

velvet tinsel
#

@slate swan

#

I’m being a hypocrite

#

But

worldly bane
velvet tinsel
#

@slate swan change your name to bot.event

worldly bane
#

Do it also to bot.event and async def

velvet tinsel
worldly bane
#

?

slate swan
worldly bane
#

Search python if elif

#

Don’t use multiple if else statements

#

Use await bot.wait_for

#

I don’t think ctx.message.content is the thing you need

slate swan
gentle rose
#

how to get emoji by code points?
bot.get_emoji(int('\U0001F642'))

boreal ravine
gentle rose
boreal ravine
#

get_emoji only works for custom emoji's

gentle rose
#

oh, ok. thanks

gentle rose
gentle rose
#

why my code can't see my reacted emoji?
it doesn't see the IF statement where my print('debug') located

@bot.event
async def on_reaction_add(reaction, user):
    channel = bot.get_channel(916255565896892426)

    if reaction.message.channel.id != channel:
        return
    if str(reaction.emoji) == "1️⃣":
        print('debug')
        await channel.send("let's play")
boreal ravine
#

channel is a channel object, u cant use the operator on that, ur also using the id attribute to check if it isnt equal to a channel object and not a channel object's id

gentle rose
boreal ravine
#

Hm

boreal ravine
gentle rose
#

seems like this one is causing issues:

    if reaction.message.channel.id != channel:
        return
gentle rose
gentle rose
gentle rose
#

yeah lol, that was the issue

#

@boreal ravine thanks

slate swan
#
    @commands.Cog.listener()
    async def on_member_update(self,before, after):       
        guild = self.bot.get_guild(645753561329696785)
        member = after
        if after in guild.members:
            if 'a1b2c3' in str(after.activity):
                role = guild.get_role(916271809333166101)
                await after.add_roles(role)
            else:
                role = guild.get_role(916271809333166101)
                await after.remove_roles(role)

Hey why do I get the error
discord.errors.NotFound: 404 Not Found (error code: 10011): Unknown Role
The role ID is correct

#

how do i send a dm to the user using their ID?

#

Use user.send

slate swan
# slate swan Use `user.send`

like dis?

@bot.command()
async def msg(ctx, user: discord.User):
    user = bot.get_user(856914222549958689)
    await user.send('hmm')```
error: 
discord.ext.commands.errors.MissingRequiredArgument: user is a required argument that is missing.
boreal ravine
slate swan
slate swan
velvet tinsel
slate swan
velvet tinsel
velvet tinsel
#

Like

#

msg @Bob

#

No need to hardcode

gentle rose
#

@boreal ravine do you know how to immediately delete reaction in on_reaction_add event?

slate swan
# velvet tinsel msg @Bob

error:
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'send'

slate swan
boreal ravine
#

wtf

velvet tinsel
#

Remove the get user

boreal ravine
#

@unkempt canyon

#

!d discord.Message.remove_reaction

unkempt canyonBOT
#

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

Remove a reaction by the member from the message.

The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji").

If the reaction is not your own (i.e. `member` parameter is not you) then the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission is needed.

The `member` parameter must represent a member and meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.
velvet tinsel
#

The user should be the user:discord.Member

boreal ravine
gentle rose
#

thanks!

boreal ravine
#

!d discord.Reaction.message for the message instance

unkempt canyonBOT
gentle rose
velvet tinsel
#

I'm gonna work on pybot

gentle rose
velvet tinsel
#

millions wtf

boreal ravine
slate swan
#

like dis?

async def msg(ctx, user:discord.Member):
    user = bot.get_user(856914222549958689)```
velvet tinsel
velvet tinsel
velvet tinsel
#

but Caeden said no global ;-;

slate swan
#

wait so what I do now?

boreal ravine
velvet tinsel
velvet tinsel
boreal ravine
slate swan
#

because he isnt in my server

#

there is a giveaway winner from other server which I want to message with his ID

full valley
#
if ctx.author.id in team1_ids.values() and outcome in win_outcome or ctx.author.id in team2_ids.values() and outcome in loss_outcome:
``` Is there a way to simplify this? Just seems so verbose
full valley
#

yeah

velvet tinsel
#

:sadge:

#

💀 greetings dead chat

slate swan
#

they're awful as a "db" but much better than global variables

boreal ravine
slate swan
#

store values in a channel

boreal ravine
#

he doesn't want that

slate swan
#

Why not use bot variable instead of global?

boreal ravine
slate swan
#

And how would that be different with globals?

boreal ravine
#

why'd you use a bot var then? 😨

slate swan
#

To keep it consistent and accessible everywhere with the bot

boreal ravine
#

just import it, it isnt that big of a deal

kindred drum
#

yo

#

how do I make this not dm the user

#

await user.send("Please enter your paypal address in the following format: +paypal example@gmail.com")

umbral dome
#

Ohh

#
wait ctx.send("message")
#

And you need to call ctx

kindred drum
#

I don't have ctx

#

in the parameter

umbral dome
#

Like this

@client.command(name = "commandcall")
async def _commandcall(ctx):
  await ctx.author.send(f"answer")

kindred drum
#
async def on_reaction_add(reaction, user):
             
    if reaction.emoji == "💸":
        roleID = 915961885738819604
        roleObj = user.guild.get_role(roleID)
        await user.add_roles(roleObj)
        for i in range(0,len(Json_Items)): #It doesn't exist
            for x in Json_Items[i]:
                if int(x) == int(user.id):
                    Json_Items[i][x]['Payment Method'].append("Paypal")
                    json.dump(Json_Items, open("./all_user_rep.json", "w"), indent=1)
        await user.send("Please enter your paypal address in the following format: +paypal example@gmail.com")```
umbral dome
#

give me 2

#

i dont really know this code

#

i dont really know how to make it say tell it in the channel with parameter

obsidian ledge
#

can someone give me like a code that if i say ?role {role} {member} it gives the role to the member

full valley
#

I cant give you like a code, but just pass the role and member in as arguments, and add the roles to them

vocal shoal
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'PosixPath' object is not subscriptable
what does this error mean?
this is the code:

import json
from pathlib import Path

def get_path():
    """
    A function to get the current path to main.py

    Returns:
     - cwd (string) : Path to main.py directory
    """
    cwd = Path(__file__).parent[1]
    cwd = str(cwd)
    return cwd

def read_json(filename):
    """
    A function to read a json file and return the data.

    Params:
     - filename (string) : The name of the file to open

    Returns:
     - data (dict) : A dict of the data in the file
    """
    cwd = get_path()
    with open(cwd+'/client_config/'+filename+'.json', 'r') as file:
        data = json.load(file)
    return data

i get the error when i use read_json()

data = read_json(blacklist)
full valley
obsidian ledge
#

ty

full valley
obsidian ledge
#

okayy

velvet tinsel
#

Sarthak

#

Hai

#

Hai tylerr

#

Bye tylerr

sage otter
sage otter
velvet tinsel
#

How are you

sage otter
#

Tired.death

velvet tinsel
#

Obviously

#

I’m screwed

#

😭

sage otter
#

?

velvet tinsel
#

I forgot my shoes

#

So I have to play in my school shoes

#

😭 and it’s raining

#

:sadge:

sage otter
#

Felt that.

timber crescent
#

is there a way to add multiple reactions together?

tawdry perch
#

does disnake support slash commands?

timber crescent
#

or do we need to .addreaction('for_each_reaction_separately')

sage otter
#

Wrong reply

#

Meant to reply to the one you just sent. But the closest thing you got is using a for loop with Message.add_reaction

slate swan
#

hey so how I make a command such as dis
user: !confirm
bot: you confirm?
user:!confirm
bot: ok

sage otter
#

Are you trying to make confirm a command or are you just wanting them to say confirm and it does whatever

slate swan
#

!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.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.

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

This function returns the **first event that meets the requirements**...
slate swan
#
async def on_reaction_add(reaction, user):
             
    if reaction.emoji == "💸":
        roleID = 915952966022856725
        roleObj = user.guild.get_role(roleID)
        await user.add_roles(roleObj)
        for i in range(0,len(Json_Items)): #It doesn't exist
            for x in Json_Items[i]:
                if int(x) == int(user.id):
                    Json_Items[i][x]['Payment Method'].append("Paypal")
                    json.dump(Json_Items, open("./all_user_rep.json", "w"), indent=1)
        await reaction.channel.send("Please enter your paypal address in the following format: +paypal example@gmail.com")

How can I make it so reaction.channel.send works? I can't pre-define channel as it changes per user. Can I fetch like the channel the role was reacted in?

slate swan
#

message isn't defined?

#

why wont it be?

#

lemme try 1s

#

is it possible to use 2 bot.wait_for in a single message?

slate swan
sage otter
slate swan
sage otter
slate swan
#
@bot.event
async def on_reaction_add(reaction, user):
             
    if reaction.emoji == "💸":
        roleID = 915952966022856725
        roleObj = user.guild.get_role(roleID)
        await user.add_roles(roleObj)
        for i in range(0,len(Json_Items)): #It doesn't exist
            for x in Json_Items[i]:
                if int(x) == int(user.id):
                    Json_Items[i][x]['Payment Method'].append("Paypal")
                    json.dump(Json_Items, open("./all_user_rep.json", "w"), indent=1)
        await user.channel.send("Please enter your paypal address in the following format: +paypal example@gmail.com")
sage otter
#

You trying to send a dm or something?

slate swan
#

send a message in a channel, but can't define channel

sage otter
#

Or do you want it in the channel they reacted in?

slate swan
#

yes!

sage otter
#

sarthak already told you

#

reaction.message.channel.send()

slate swan
#

we tried that, fetched an error

sage otter
#

I edited again. My bad. but man I’ve been messing up lately with telling people what to do

slate swan
#

I know, sent the wrong code

#

AttributeError: 'Reaction' object has no attribute 'channel' is the error

#
@bot.event
async def on_reaction_add(reaction, user):
             
    if reaction.emoji == "💸":
        roleID = 915952966022856725
        roleObj = user.guild.get_role(roleID)
        await user.add_roles(roleObj)
        for i in range(0,len(Json_Items)): #It doesn't exist
            for x in Json_Items[i]:
                if int(x) == int(user.id):
                    Json_Items[i][x]['Payment Method'].append("Paypal")
                    json.dump(Json_Items, open("./all_user_rep.json", "w"), indent=1)
        await reaction.channel.send("Please enter your paypal address in the following format: +paypal example@gmail.com")
#

and if I change it to reaction.message.send, the error changes to:

AttributeError: 'Message' object has no attribute 'send'

sage otter
slate swan
#

ty ,3

#
async def on_reaction_add(reaction, user):
             
    if reaction.emoji == "💸":
        if user == bot.user:         
            return 

How do I make it so if the bot reacts, it returns the code?

#

if user==bot.user : return

velvet tinsel
slate swan
#
@bot.event #User leave with bannedfromtrading role
async def on_member_remove(member): #When someone leaves
    for server in bot.guilds:
        for channel in server.channels:
            if member.id in channel:
                    await channel.delete()

How can I get this to work?

#

TypeError: argument of type 'CategoryChannel' is not iterable is the error

valid galleon
velvet tinsel
#

Hi

upbeat otter
slate swan
#

when someone leave the server I wanna delete a channel that was created when they joined

slate swan
#

do you know how to do it or no?

upbeat otter
#

Nope

slate swan
#

o oke

upbeat otter
#

Either try getting the channel name

slate swan
#

I mean thats what im doing

slate swan
#

bro what

sullen shoal
#

store the channel ids that the users create

slate swan
#

the user's ID is in the channel name

sullen shoal
#

then get the channel name

#

which is very costly and dumb

slate swan
sullen shoal
#

member.guild will return the guild

#

then i'd do guild.text_channels

#

!d discord.Guild.text_channels

unkempt canyonBOT
#

property text_channels: List[discord.channel.TextChannel]```
A list of text channels that belongs to this guild.

This is sorted by the position and are in UI order from top to bottom.
sullen shoal
unkempt canyonBOT
slate swan
#
async def on_member_remove(member): #When someone leaves
    for server in member.guild:
        for channel in server.channels:
            if member.id in discord.TextChannel.name:
                    await channel.delete()
#

so you would do something like that @sullen shoal

sullen shoal
#

should work

slate swan
#

k lemmme try

sullen shoal
#

no it wont

#

name is str

slate swan
sullen shoal
#

str

slate swan
sullen shoal
#

yes

slate swan
sullen shoal
#

you didnt get the text channels of the guild

slate swan
#

you mean guild isn't defined?

sullen shoal
#

actually the code is entirely wrong, i just realised

slate swan
#

oh xd

sullen shoal
#

what do you think member.guild returns

#

as a human and judging by the name

slate swan
#

all member info

velvet tinsel
#

Im going to make friend server because I'm lonely

sullen shoal
#

what do you think a guild is

slate swan
#

should it be bot.guild

sullen shoal
#

a guild is a discord server

slate swan
#

right

#

so bot.guild

sullen shoal
#

member.guild will return the guild the member was from

#

.guild will be an instance of discord.Guild

#

which has a property named text_channels

#

!d discord.Guild.text_channels

unkempt canyonBOT
#

property text_channels: List[discord.channel.TextChannel]```
A list of text channels that belongs to this guild.

This is sorted by the position and are in UI order from top to bottom.
sullen shoal
#

it says list

slate swan
#

hm alr, so what do I change?

sullen shoal
#

so what do you think you should do

#

how do you get and do stuff on each element of the list

slate swan
#

a for loop?

sullen shoal
#

yes

slate swan
#

for server in guild?

sullen shoal
#

so sum up all this info and show me your code

slate swan
#

for server in discord.Guild.text_channels

#

yikes alr lemme try xd

sullen shoal
#

thats the class not an instance

sullen shoal
#

it will return an instance of it

slate swan
#

can you be more specific with 'instance'?

sullen shoal
#

for that you have to know the use of a class

slate swan
#

for server in guild.channels

#

not server tahts just the iterator btw

sullen shoal
#

thats not the right attribute of the instance

prisma spoke
#
Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\nextcord\client.py", line 351, in _run_event
    await coro(*args, **kwargs)
  File "c:\Users\admin\Downloads\underdev.py", line 132, in on_command_error
    raise error
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\bot.py", line 
995, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 887, in invoke
    await self.prepare(ctx)
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 821, in prepare
    await self._parse_arguments(ctx)
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 727, in _parse_arguments
    transformed = await self.transform(ctx, param)
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 579, in transform
    return await run_converters(ctx, converter, argument, param)  # type: ignore
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\converter.py", line 1182, in run_converters
    return await _actual_conversion(ctx, converter, argument, param)       
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\converter.py", line 1076, in _actual_conversion
    return await converter().convert(ctx, argument)
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\converter.py", line 395, in convert
    raise ChannelNotFound(channel_id)
nextcord.ext.commands.errors.ChannelNotFound: Channel "None" not found. ```
#

how to solve?

lament mesa
unkempt canyonBOT
#

@lament mesa :white_check_mark: Your eval job has completed with return code 0.

001 | <class '__main__.Foo'>
002 | <__main__.Foo object at 0x7f8a0c494fd0>
sullen shoal
#

@slate swan see, without the right knowledge of classes, everything is so confusing?

prisma spoke
sullen shoal
#

that is why you should first learn about classes and OOP

slate swan
sullen shoal
#

then make a bot

slate swan
#

im a function man now 🙂

sullen shoal
#

this library aint right for you then

prisma spoke
slate swan
#

I mean it's fine, I just get stuck sometimes!

sullen shoal
#

the entire library is object oriented

prisma spoke
#
bot.ticket_configs = {}
@bot.event
async def on_ready():
    async with aiofiles.open("ticket_configs.txt", mode="a") as temp:
        pass

    async with aiofiles.open("ticket_configs.txt", mode="r") as file:
        lines = await file.readlines()
        for line in lines:
            data = line.split(" ")
            bot.ticket_configs[int(data[0])] = [int(data[1]), int(data[2]), int(data[3])]

    print(f"{bot.user.name} is ready.")

@bot.event
async def on_raw_reaction_add(payload):
    if payload.member.id != bot.user.id and str(payload.emoji) == u"\U0001F3AB":
        msg_id, channel_id, category_id = bot.ticket_configs[payload.guild_id]

        if payload.message_id == msg_id:
            guild = bot.get_guild(payload.guild_id)

            for category in guild.categories:
                if category.id == category_id:
                    break

            channel = guild.get_channel(channel_id)

            ticket_channel = await category.create_text_channel(f"ticket-{payload.member.display_name}", topic=f"A ticket for {payload.member.display_name}.", permission_synced=True)
            
            await ticket_channel.set_permissions(payload.member, read_messages=True, send_messages=True)

            message = await channel.fetch_message(msg_id)
            await message.remove_reaction(payload.emoji, payload.member)

            await ticket_channel.send(f"{payload.member.mention} Thank you for creating a ticket! Use **'-close'** to close your ticket.")

            try:
                await bot.wait_for("message", check=lambda m: m.channel == ticket_channel and m.author == payload.member and m.content == "-close", timeout=3600)

            except asyncio.TimeoutError:
                await ticket_channel.delete()

            else:
                await ticket_channel.delete()

@bot.command()
async def configure_ticket(ctx, msg: nextcord.Message=None, category: nextcord.CategoryChannel=None):
    if msg is None or category is None:
        await ctx.channel.send("Failed to configure the ticket as an argument was not given or was invalid.")
        return

    bot.ticket_configs[ctx.guild.id] = [msg.id, msg.channel.id, category.id] # this resets the configuration

    async with aiofiles.open("ticket_configs.txt", mode="r") as file:
        data = await file.readlines()

    async with aiofiles.open("ticket_configs.txt", mode="w") as file:
        await file.write(f"{ctx.guild.id} {msg.id} {msg.channel.id} {category.id}\n")

        for line in data:
            if int(line.split(" ")[0]) != ctx.guild.id:
                await file.write(line)
                
    await msg.add_reaction(u"\U0001F3AB")
    await ctx.channel.send("Succesfully configured the ticket system.")```
slate swan
#

christ

sullen shoal
#

the error says the channel is not found

prisma spoke
#

and its there

sullen shoal
#

you tried to get a channel by passing None

prisma spoke
sullen shoal
#

well basically what your code does is,
.get_channel(None)

#

and im not helping more than that until you use an actual database

slate swan
#
async def on_member_remove(member): #When someone leaves
    for guild in bot.guilds:
        for channel in guild.text_channels:
            if str(member.id) in channel.name:
                await channel.delete()

well that wasn't that hard! Sometimes you just have to point people in the right direction

prisma spoke
prisma spoke
brisk helm
slate swan
#

it works no?

sullen shoal
#

it works but its slow

prisma spoke
brisk helm
sullen shoal
#

you're iterating through every server for no reason when all you need is the member's guild object

brisk helm
#

bu the channel is None

prisma spoke
brisk helm
#

XD

#

check sqlite3

sullen shoal
slate swan
lament mesa
boreal ravine
prisma spoke
slate swan
#

so, I got a command that reads in arguments like this

async def test(ctx, var1: int = None)

but if I have message before ctx as I need to get the authors ID it counts that as being a variable

prisma spoke
slate swan
glass rock
#

im on somehost, how can I make the bot send pics that are on my computer?

slate swan
#

oh yeah haha

#

thank you guys

boreal ravine
#

!d discord.ext.commands.Context.author <= is a discord.Member instance

unkempt canyonBOT
boreal ravine
slate swan
prisma spoke
prisma spoke
slate swan
prisma spoke
#

#discordpy #python #tutorial

Welcome to the eleventh episode of my Discord PY Rewrite Tutorial Series where I go through and explain how to create an advanced ticket reaction system that could be deployed in a public bot, it is customisable and can easily be developed.

Thank you for watching! If you enjoyed, please subscribe as 99% of my viewe...

▶ Play video
#

i followed this

prisma spoke
#

id*

boreal ravine
#

tutorials shmuck, I cant help you but i recommend you use a real db, i can do this in mongodb in like 30~ minutes and for your error the channel wasn't found thats all I can say since im on mobile

slate swan
#

I always used mysql whats different with mongodb?

boreal ravine
velvet tinsel
#

Making friend server

#

Yay happy

#

The hardest part is actually making the server, coding is the easy bit

#

I need to make a role and make nearly all the channels visible to verified people and only one channel visible to unverified people that just has a message

#

I also need to keep bot alive :sadge:

slate swan
velvet tinsel
#

Kraots

#

I’m making a bot similar to yours

slate swan
#

it's not relational tho, but is document-like structured, basically json/dicts underneath

slate swan
velvet tinsel
slate swan
#

ik

velvet tinsel
#

Making the server is hard

slate swan
#

btw my bot uses special custom made decorators to check for permissions so gl with that too 👍

velvet tinsel
#

😭

slate swan
#

and with the mute command :kek:

velvet tinsel
#

Mute is easy as well

#

Check for permissions should also be ok

#

But the server hard af I don’t even understand what’s happening

slate swan
#

my mute doesn't care whether i give the time at the start or at the end, it can also take in times such as "tomorrow" and a specific date

velvet tinsel
#

Oh

slate swan
#

:kek:

placid skiff
#

that's cool

velvet tinsel
#

Well I’m going to have to make an if statement

#

To check if it’s a tomorrow or something

placid skiff
velvet tinsel
#

Or maybe create a different command to make a date and time

velvet tinsel
slate swan
#

uses datetime, parsedatetime, and relativedelta

#

and regex

#

👍

velvet tinsel
#

Yay

#

:kek:

#

I’m going to try to make it more complicated

#

Whenever your bot sent me a message or when you used the bot, pictures of an estimation of your code float across my head each time

#

It’s kind of annoying but cool at the same time

slate swan
#

lol

velvet tinsel
#

I just also figured out how you can put the arguments wherever you put

slate swan
#
    @tasks.loop(minutes=30)
    async def checker(self):
        try:
            fetchall = self.coll.find({})  # return all documents inside the db
            current_time = datetime.utcnow()
            async for x in fetchall:
                if current_time >= x["BannedUntil"]:  # do stuff after this
                    unbanuser = x["user_id"]
                    member = discord.Object(id=unbanuser)
                    guild = self.bot.get_guild(645753561329696785)
                    await guild.unban(member, reason="Tempban for new account expired.")
                    deletetime = await self.coll.find_one({"user_id": int(unbanuser)})
                    await self.coll.delete_one(deletetime)

        except Exception as e:
            print(e)

This is my code to unban users who were tempbanned, however with their being 800+ documents fetching all doesnt seem like the best idea, any alternatives?

placid skiff
#

just check the ban list of the server?..

velvet tinsel
#

😳

slate swan
velvet tinsel
#

Me no like big code on mobile

boreal ravine
slate swan
boreal ravine
#

😨

boreal ravine
velvet tinsel
#

Imagine using dyno

slate swan
boreal ravine
#

hm

slate swan
#

Oh wow thats amazing, thanks a lot!!

velvet tinsel
#

I don’t like reading big code on mobile

slate swan
#

1 -> from the lowest to the highest
-1 -> from the highest to the lowest

slate swan
slate swan
quaint epoch
#

Guys what perms would i put in ```py
@commands.has_permissions()

velvet tinsel
#

I can’t even understand

velvet tinsel
modern fiber
#

Hey guys. Is it possible to make a command / feature that records the Audio in Voice Channels from every user's, also when you execute the command "!leave" it auto-sends the mp3 file of each user (or all together).

#

?

quaint epoch
boreal ravine
quaint epoch
modern fiber
#

Hey guys. Is it possible to make a command / feature that records the Audio in Voice Channels from every user's, also when you execute the command "!leave" it auto-sends the mp3 file of each user (or all together).

velvet tinsel
#

Ok

#

I think recording is against the rules

slate swan
velvet tinsel
#

Without permissions

quaint epoch
#

yeah, especially without consent

boreal ravine
velvet tinsel
quaint epoch
#

that's kinda creepy

lament mesa
velvet tinsel
#

Or consent

slate swan
boreal ravine
#

saw a pr for it

velvet tinsel
#

im definitely not making an excuse for not typing the code

slate swan
#

but they're making it a command i believe so it's fine

lament mesa
quaint epoch
#

what command do i use to make sure the user is an admin in py @commands.has_permissions() to check if they are an administrator?

boreal ravine
quaint epoch
#

i don't wanna go through the documentation again

lament mesa
quaint epoch
boreal ravine
quaint epoch
boreal ravine
#

It has all you need, why not read it for your own sake

quaint epoch
boreal ravine
quaint epoch
boreal ravine
#

ok

tiny ibex
full valley
#
Traceback (most recent call last):
  File "D:\6Mans\Heps6Mans\Main\mainwithdict.py", line 620, in report
    set_new_mmr(pid, get_new_mmr(pid))
  File "D:\6Mans\Heps6Mans\Main\mainwithdict.py", line 608, in get_new_mmr
    expectedprob = expected[[playerid]]
TypeError: unhashable type: 'list'
#

Whats this tryna say

boreal ravine
tiny ibex
#

I thought it was a PR still pending

tiny ibex
boreal ravine
boreal ravine
tiny ibex
#

And I am not updated

full valley
tiny ibex
#

Oof

boreal ravine
#

ok

tiny ibex
quaint epoch
#

Guys my bot is logging all the messages sent like this in a csv, help

quaint epoch
brisk helm
#

.join()

#
" ".join(arg)```
quaint epoch
#

i don't understand i've never used csv before why is it rainbow

quaint epoch
#

that .join

quaint epoch
tiny ibex
quaint epoch
#

ah, my reputation at it's finest

tiny ibex
#

lol

slate swan
#

I am pretty sure Cleaning up after 1800 task in 6 hours of the bot running isnt good right? I feel like I have something which is really eating a lot of memory suddenly

#

how can I get emoji image url

lament mesa
#

!d discord.Emoji.url

unkempt canyonBOT
slate swan
#

+1:

#

IndentationError: unindent does not match any outer indentation level

#

??

slate swan
slate swan
#

so there's no need to use async for, just loop over it like a normal list

#

every element in that list is a document which is basically a dict object

slate swan
slate swan
#

ohh

#

help :x

#

i don't help with basic python errors

#

...

#

¯_(ツ)_/¯

#

I am French, I don't understand much

#

idk how to explain that error better than its already explained tbh 😔

#

the error already tells you what the problem is, it's a really basic python error

#

@slate swan When I reboot my bot Cleaning up after 6048 tasks. I get something like that after the bots been running for just a few minutes, recently I have been having low memory, Is 6048 tasks in like 5 minutes normal?

slate swan
#

are you sure that it's an issue from your bot and not your pc?

#

I am running it on heroku. I never had memory issues until like a day back

#

weird

#

idk from where all those 6048 tasks could come from

slate swan
#

...

#

Sorry, I'm so stupid, I didn't see that so I don't understand why it didn't work

#

@slate swanthx

#

is it possible to make a group roulette command for multiple users?

#

like i have a normal roulette command which is just color choosing like
!roulette red 50
if it comes red then user gets 2x

#

anyway i can get my bot to auto role on the new version of discord.py

#

so is it possible to make the command in group like 5 people will play each putting some money and the wheel spins and person who bets on red1 and if red1 comes then the winner will get everyone's money

wicked atlas
#

Anything is possible if you try hard enough

slate swan
#

how creating a text channel in a specific category?

lament mesa
#

!d discord.Guild.create_text_channel

unkempt canyonBOT
#

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

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

Note that you need the [`manage_channels`](https://discordpy.readthedocs.io/en/master/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/master/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")) as the key and a [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/master/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/master/api.html#discord.TextChannel.edit "discord.TextChannel.edit") will be required to update the position of the channel in the channel list...
lament mesa
#

there is a category parameter

gentle rose
#

any ideas how to delete message after for example 10 minutes?
is there any sleep function in discord.py?

slate swan
gentle rose
lament mesa
#

await message.delete(delay=600)

gentle rose
lament mesa
#

nope, you can do it anywhere

#

you just need the message object

#

in a command it will be ctx.message

slate swan
#

hi,so bassicly i am making bot that auto screenshots my screen by pressing a button,and i have done that,but my problem is that i need it to be sent in a specific discord channel,how can i do this?

#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'int' object has no attribute 'id'

@bot.command()
async def create(ctx):
    guild = ctx.message.guild
    await guild.create_text_channel('easy', category = 916008353505890434)

why does it give this error?

icy mango
slate swan
kindred drum
#

yo anyone know a quick fix

#

await bot.delete_message(temp_list_4[0])
AttributeError: 'Bot' object has no attribute 'delete_message'

slate swan
#

@icy mango here is code

slate swan
#

anyone know how to make embed?

#

just like a normal one

#

Yea easy

#

plus footer and all of that

slate swan
#

!discord.embed

#

wut

#

wait a second

#

kk

#

getting url

kindred drum
slate swan
#

well then your task cant be done

#

simple as that

kindred drum
#

bro what

slate swan
#

whats the v2 attr to return a users banner as discord.Embed.set_image?

slate swan
kindred drum
#

await reaction.message.channel.send will that work then/

lament mesa
kindred drum
#

but it has no ctx

#

so no right

slate swan
kindred drum
#
@bot.event
async def on_reaction_remove(reaction, user):
    if reaction.emoji == "💸":
        roleid = 915961885738819604
        roleobj = user.guild.get_role(roleid)
        await user.remove_roles(roleobj)
        for i in range(0,len(Json_Items)): #It doesn't exist
            for x in Json_Items[i]:
                if int(x) == int(user.id):
                    Json_Items[i][x]['Payment Method'].remove("Paypal")
                    json.dump(Json_Items, open("./all_user_rep.json", "w"), indent=1)
        await bot.delete_message(temp_list_4[0])```
manic wing
slate swan
slate swan
manic wing
unkempt canyonBOT
#

discord.on_reaction_remove(reaction, user)```
Called when a message has a reaction removed from it. Similar to on\_message\_edit, if the message is not found in the internal message cache, then this event will not be called.

Note

To get the message being reacted, access it via [`Reaction.message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Reaction.message "discord.Reaction.message").

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

Note

Consider using [`on_raw_reaction_remove()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_remove "discord.on_raw_reaction_remove") if you need this and do not want to enable the members intent.
lament mesa
slate swan
kindred drum
#

it does ignore it

slate swan
#

whats the v2 attr to return a users banner as discord.Embed.set_image?

slate swan
kindred drum
wicked atlas
slate swan
slate swan
unkempt canyonBOT
#
Certainly not.

No documentation found for the requested symbol.

slate swan
#

!d discord.User.accent_colour

unkempt canyonBOT
#

property accent_colour: Optional[discord.colour.Colour]```
Returns the user’s accent colour, if applicable.

There is an alias for this named [`accent_color`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.accent_color "discord.User.accent_color").

New in version 2.0.

Note

This information is only available via [`Client.fetch_user()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client.fetch_user "discord.Client.fetch_user").
lament mesa
slate swan
#

That's the banner

slate swan
#

Banner

#

alright i guess

#

No wait that's probably the color

#

Uh

#

yeah figured

#

!d discord.User.banner

unkempt canyonBOT
#

property banner: Optional[discord.asset.Asset]```
Returns the user’s banner asset, if available.

New in version 2.0.

Note

This information is only available via [`Client.fetch_user()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client.fetch_user "discord.Client.fetch_user").
slate swan
#

assets, there we go

#

:/

#

@wicked atlas help pls?

wicked atlas
slate swan
#

Guys, How do I make the bot create a text channel with rules so that no one sees the channel except the author?

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

What’s the problem

slate swan
#

because if the bot can make a channel it cannot be private
users/bot with admin perms can see the channel

velvet tinsel
#

It is possible

slate swan
velvet tinsel
#

You can do it

slate swan
#

he wants just the bot and the author to see the channel

velvet tinsel
#

That’s possible

slate swan
#

not mods/people with admin perms

velvet tinsel
#

Make a role and then give the bot the role also

#

And make only the channel visible to the role

#

😂

velvet tinsel
slate swan
#

нуы

#

yes

velvet tinsel
tawdry perch
slate swan
velvet tinsel
slate swan
velvet tinsel
#

Not a straight answer

slate swan
#

ik

slate swan
#

but still dis might help

velvet tinsel
#

Or you can do it via the bot

#

I mean making the server is the hardest bit

#

The bot is the easiest imo

slate swan
#

The bot creates a channel, after that it sets the rules for @everyone and for author how do I do it.

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

Errr…well I guess manually create it

#

The role I mean

#

jam_cavedude idk never did it before

tawdry perch
#

I have done role creation via code

velvet tinsel
#

I did role creation only for mute

gentle rose
#

why do i get None when try to get and send custom server emoji by id?
my code:

ono = bot.get_emoji(916363012141637693)
    await channel.send(ono)

its 100% correct id of emoji

#

maybe i need guild id to get guilds custom emojis?

manic wing
#

do you have emoji intents

gentle rose
#

no

icy mango
#

how do i use animated emoji in my embed

manic wing
gentle rose
manic wing
#

!intents

unkempt canyonBOT
#

Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default, discord.py has all intents enabled, except for 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.

velvet tinsel
#

Hi @manic wing

velvet tinsel
manic wing
#

it says that in the embed

#

To enable one of these intents, you need to first go to the Discord developer portal,

manic wing
unkempt canyonBOT
gentle rose
velvet tinsel
#

You have to enable it in your code as well

manic wing
#

did you do intents = discord.Intents.all() and pass it into commands.Bot(intents=intents, ...)

gentle rose
#

thanks

velvet tinsel
#

Me no have PC with me 😭

gentle rose
#

actually do i need to enable all intents in web site? maybe only message intents?

velvet tinsel
#

All intents is probably recommended

#

Idk only used it once

manic wing
#

discord.Intents.default() is recommended, however all is easier

velvet tinsel
hasty loom
gentle rose
#

i still can't send custom emoji

slate swan
velvet tinsel
gentle rose
#

maybe the reason is because i send emoji in on_ready event?

hasty loom
velvet tinsel
#

Disnake, pycord, nextcord

slate swan
gentle rose
slate swan
velvet tinsel
#

But it’s just discontinued

slate swan
velvet tinsel
gentle rose
#

no, i have all intents

velvet tinsel
#

Ok

#

Does it work now?

slate swan
#

Where did you run this line of code?

#

Before bot gets ready ig

gentle rose
velvet tinsel
#

yert ok

slate swan
#

Umm can you share the code? @gentle rose

gentle rose
#

i do this in on_ready event, because its like role selection bot

#

sec

sage otter
gentle rose
#
intents = discord.Intents.all()
# prefix for bot commands
bot = commands.Bot(intents=intents, command_prefix='!')

@bot.event
async def on_ready():
    print(f'We have logged in as {bot.user}.')

    channel = bot.get_channel(916354676088254474)
    text = 'Testing . . .'
    hub = await channel.send(text)
    ono = bot.get_emoji(916363012141637693)
    await channel.send(ono) # not working, Reason: can't send empty text
    await hub.add_reaction(str(ono)) # not working

    with open("hub.json", "r+") as file:
        data = json.load(file)
        data.append(hub.id)
        file.seek(0)
        json.dump(data, file)
sage otter
slate swan
#

Animated

sage otter
#

It’s what discord does to flag the emoji as animated

gentle rose
#

oh, do i need to put flags to default custom emojis?

velvet tinsel
#

Hello all 😄

sage otter
#

Literally just put a backslash behind whatever animated emoji in discord that you want to use

#

And copy whatever it outputs

slate swan
#

Better this

slate swan
gentle rose
#

bot can use animated stuff without nitro?:D

slate swan
#

Yes

velvet tinsel
#

It has nitro

slate swan
#

Except animated avatars, server boost, umm.... multi avatars, and maybe more

summer flume
#

how do I create an event where my bot will spam a message in everyhour

gentle rose
#
await channel.send('Hallll oo :pepe_rose:')`

still can't get custom emoji, wtf

sage otter
#

It’s not supposed to look like that btw.

slate swan
#

Emojis don't work like this

gentle rose
#

no, its just discord

slate swan
#

Just put a backslash before an emoji and copy paste the output

sage otter
#

Also make sure the emoji you're trying to use is in a guild it’s in.

gentle rose
#

gimme sec

slate swan
#

thats how u use custom emotes

#

\:pepe:

kindred drum
#
        roleid = 915961770961666118
        roleobj = user.guild.get_role(roleid)
        await user.remove_roles(roleobj)
        for i in range(0,len(Json_Items)): #It doesn't exist
            for x in Json_Items[i]:
                if int(x) == int(user.id):
                    Json_Items[i][x]['Payment Method'].remove("Cashapp")
                    json.dump(Json_Items, open("./all_user_rep.json", "w"), indent=1)
        await bot.delete_message(temp_list_4[1])
        ```
anyone know a fix?
```AttributeError: 'Bot' object has no attribute 'delete_message'
gentle rose
#

i did it, but discord kicks this emoji ID

slate swan
#

not bot

kindred drum
slate swan
#

Prob not sharing the server the emoji is in

kindred drum
#

how is there no way

slate swan
#

maybe discord.Context.delete_message

#

idk

quaint epoch
#

So my bot gave me this error when i tried to kick my friend

gentle rose
quaint epoch
#

my friend is admin

sage otter
slate swan
gentle rose
#

bot is in the guild that this emoji have:D

quaint epoch
#

Anyone know why it gave me 403?

sage otter
gentle rose
summer flume
quaint epoch
#

so why then?

sage otter
#

Use the tasks framework

sage otter
#

Read everything i said

slate swan
#

does @commands.cooldown(1, 5,commands.BucketType.user) work on events\

sage otter
#

No

slate swan
quaint epoch
sage otter
#

it’s probably lower than your friend on the role hierarchy

quaint epoch
#

yeah that makes sense

summer flume
sage otter
#

I just said use the tasks framework

#

!d discord.ext.tasks.loop

unkempt canyonBOT
#

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

does anyone know how to change the perms for a user, like not letting them text?

#

because i wanted to make a mute command

sage otter
#

you can create a overwrite

summer flume
#

ok

sage otter
#

For a role or user

quaint epoch
sage otter
#

!d discord.TextChannel.set_permissions

unkempt canyonBOT
#

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

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

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

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

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

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this...
quaint epoch
sage otter
#

send_messages

quaint epoch
sage otter
#

Set it to false if you don’t want them to be able to send messages.

quaint epoch
#

will the overwrite also overwrite the other perms to false?

sage otter
#

No just the ones you set

quaint epoch
velvet tinsel
#

I’m back

slate swan
#

Does anyone know how to get the symbol that’s in front of his name

#

I can’t find it in any ascii list

quaint epoch
#

idk

velvet tinsel
#

idk

sage otter
velvet tinsel
#

How did you do eval

#

Oh wait nvm

#

yert I have your text in my bookmarks mwahahah

sage otter
#

They got an emoji for every discord badge

slate swan
#

Oh thank you I’ll try. Don’t want the image just want the character

#

To copy paste kind of thing

quaint epoch
#

do i have to use await ctx.send(embed=embed)? I've seen it done before but is it necessary?

velvet tinsel
#

Yes

#

For embeds you need to

#

Otherwise it would be <discord embed object> or something like that with a lot of nonsense

slate swan
quaint epoch
#

no i mean just direct messages likeawait ctx.send()would work?

velvet tinsel
#

Okimii still have not answered me what is breathing 🤬 🤬

slate swan
velvet tinsel
velvet tinsel
#

No?

velvet tinsel
#

What is breathing 😭

#

💀jam_cavedude what is breathing

#

Damn not on pypi

quaint epoch
#

so breathing does not exist?

velvet tinsel
quaint epoch
#

awwwwwwwwwwwwww

velvet tinsel
#

Let me Google it

#

I don’t understand

quaint epoch
#

It isn't letting me mute someone, it says that member has no attribute server, BUT I NEVER USED MEMBER.SERVER

wild imp
#

help

#

how to create like this for memberupdate

slate swan
#

how to check if a message exist or not

quaint epoch
#

so it tries to mute a user, but it just says it mutes a user but the user can still send messages

slate swan
summer flume
#

@sage otter how?

quaint epoch
slate swan
quaint epoch
sage otter
slate swan
#

make a role urself and drag it to the top and then make the bot give role to the person you mute and remove all its roles

velvet tinsel
#

Oh god

#

Tylerr I know your pain

summer flume
quaint epoch
#

Uh, im not the owner but i AM ADMIN so how do i make roles(im stupid)

velvet tinsel
#

I think there is a create role function

quaint epoch
velvet tinsel
#

But I gtg bye tylerr have a nice time

sage otter
slate swan
velvet tinsel
#

👋 Bye I never existed here bye

slate swan
wild imp
#

how to make a memberroleupdates like this

gentle rose
#

how to copy emoji id? with RMB and copy id?

wild imp
#

do \emojiname

#

like

#

\😆

gentle rose
#

it works if its custom emoji?

wild imp
#

dice_8:

gentle rose
#

\smile

wild imp
#

only for custom

#

and not name u have to paste that emoji

gentle rose
#

\pepe_rose
like this?

wild imp
#

just copy paste emoji after \

#

like for this emoji brainmon

gentle rose
#

:pepe_rose:

#

:pepe_rose:

#

oh, thanks

wild imp
#

that emoji is in this server?

gentle rose
#

nah, its not

#

i try it my code

wild imp
#

eh

gentle rose
#

thanks! it works

wild imp
#

oo

#

lol

gentle rose
#

fuck, i lost my all hour with copying emoji with RMB -> Copy Id

#

sad

wild imp
#

xD

quaint epoch
#

I'm making a moderation bot, what features should i add?

slate swan
manic wing
#

kick, ban, addrole, createrole, mute, delete channel, create channel, purge channel, lock channel, change perms, softban

hasty loom
slate swan
#

does anyone have any idea of encryption like base64 and stuff

gentle rose
quaint epoch
slate swan
gentle rose
#

np

quaint epoch
#

maybe search up stuff for it?

#

idk

slate swan
#

i cant figure out what encryption it i

quaint epoch
slate swan
#

it looks like base64 but its not

quaint epoch
slate swan
#

P6RFHIEOp7zfiPZ03tkX/fSvGmsa//alSLiBbQIVhnxqTjyJgeFyXqnHoUNih1nNbFSSw05syA3cWVCRX6rEOv4Ga9ZJ96w9Ez5so7KAwjT7K63yuBPbeEA+llzKOyPAV+A+fzq+jRYSCSiDVLFl0BObk9xkQbuRLlArGt7ewqo=

manic wing
#

agreed

slate swan
#

i think its bannable

#

idk what it says

quaint epoch
#

report to mods maybe?

slate swan
#

well i dont want to waste their time

#

so i need to see what it says

manic wing
#

probably the wrong channel.

quaint epoch
#

if you think its against tos then report it!

#

that is what mods are for!

hasty loom
#

i should probably make virtual envs now cus ive started to work on more than 1 discord bot so can anyone send a guide to working with them?

quaint epoch
#

how do i check if the message sent was sent by a bot?

#

like, if a bot sends i message i don't want to log it

manic wing
manic wing
unkempt canyonBOT
#

property bot```
Equivalent to [`User.bot`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.bot "discord.User.bot")
hasty loom
#

because im gonna use something other than discord.py

manic wing
#

!pypi pyenv

unkempt canyonBOT
slate swan
#

@commands.cooldown(1, 5, commands.BucketType.guild)
@commands.command()
@commands.has_permissions(ban_members=True)
async def ban(self, ctx, member: discord.Member, *, reason=None):
await member.ban(reason=reason)
await ctx.send(f'User {member} has been kick')

#

Hey can anyone help me with ban cmds?

manic wing
#

!code

unkempt canyonBOT
#

Here's how to format Python code on Discord:

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

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

slate swan
#

!code @commands.cooldown(1, 5, commands.BucketType.guild)
@commands.command()
@commands.has_permissions(ban_members=True)
async def ban(self, ctx, member: discord.Member, *, reason=None):
await member.ban(reason=reason)
await ctx.send(f'User {member} has been kick')

manic wing
slate swan
#
@commands.cooldown(1, 5, commands.BucketType.guild)
    @commands.command()
    @commands.has_permissions(ban_members=True)
    async def ban(self, ctx, member: discord.Member, *, reason=None):
      await member.ban(reason=reason)
      await ctx.send(f'User {member} has been kick')```
#

can anyone help me with this cmd?

hasty loom
#

whats the issue

slate swan
#

its showing error here idk why

#
from discord.ext import commands


class Commands(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

 
#this was in a cog   
# The below code bans player.
    @commands.cooldown(1, 5, commands.BucketType.guild)
    @commands.command()
    @commands.has_permissions(ban_members=True)
    async def ban(self, ctx, member: discord.Member, *, reason=None):
      await member.ban(reason=reason)
      await ctx.send(f'User {member} has been kick')
        

def setup(bot):
  bot.add_cog(Commands(bot))    ```
novel bolt
#

hey is there a way we can delete this webhook message using bot ?

manic wing
unkempt canyonBOT
#

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

Deletes this Webhook.
manic wing
novel bolt
novel bolt