#discord-bots

1 messages · Page 724 of 1

blazing lynx
#

somebody help my error pls

quick gust
#

just use their animal endpoint instead of 2 different endpoints

slate swan
#

the second website gives a 404 response

grim oar
slate swan
#

🥇 🥈 🥉

#

how do i make the bot say the local timezone

quick gust
#

make your own medals till 10

slate swan
#

yea but you can still use it for top 3 people , ive seen bots doing it

slate swan
quick gust
slate swan
quick gust
#

so something like that only

pliant gulch
#

Top 10 get medals? Sounds like pity medals kek

quick gust
#

yeah ig they want uniformity in the leaderboard

#

or u could give them something else instead of metals

#

medals*

grim oar
slate swan
#

amari bot

quick gust
grim oar
#

i am a helper in that api's support server hehe

quick gust
#

dank member has a simple 🔷 for the rest of the users

#

np

slate swan
#

what db do you use?

#

will be pretty much of hard work then

final iron
#

You mean aiosqlite?

slate swan
#

aiosqlite is the wrapper , sqlite3 is th database

#

you should shift to aiosqlite , since it fits with the async syntax and is non blocking

final iron
#

^

#

Nope

slate swan
#

you wont have to learn anything new , just adding some awaits will do the work

quick gust
#

nope, shouldn't

final iron
#

You just need to add some awaits

slate swan
#

it will make your bot non-blocking

#

so if someone uses a command which uses sqlite3 , you bot doesnt freeze

final iron
#

You want to make your code as async as possible

slate swan
#

do you understand the term blocking?

#

!blocking

unkempt canyonBOT
#

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

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

import discord

# Bunch of bot code

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

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

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

slate swan
#

okimii tha saviour

final iron
#

That's is a very large embed

slate swan
#

well well well , if they make discord bots they might be already familiar to async

#

!pypi Db

unkempt canyonBOT
slate swan
slate swan
slate swan
slate swan
#

Does anyone know how to replicate yagpdb's controlled randomizer?

slate swan
final iron
#

pip install aiosqlite if that's what you mean

slate swan
#

I tried to replicate it, but my solution won't work.

final iron
#

It's just a wrapper for the sqlite3 db

slate swan
#

basically , using await before everything you did with sqlite3
sqlite3 ```py

connecting

sqlite3.connect(....

executing cursor/db

cursor/db.execute(....

**aiosqlite** ```py
# connection
await aiosqlite.connect(....
# executing
await cursor/db.execute(.....
``` same goes for `commit` , `fetchone` and `fetchmany` too
#

the queries remain name

#

*same

pliant gulch
slate swan
#

@hidden hazel remember coros need await

def function():
    print("sync function")

#calling the function
function()

if it were a coro it would be

async def asyncfunction():
    print("async function")

#calling the function
await asyncfunction()
slate swan
#

you can use multiple dbs , or multiple tables in the same db

#

theres dbs that use servers like postgresql

pliant gulch
#

You should use a single database, and a redis cache

slate swan
pliant gulch
#

That's what a lot of big corps use, and for good reason

slate swan
#

!pypi redis

unkempt canyonBOT
pliant gulch
slate swan
#

ah ic

slate swan
#

im gonna slack on jarvide tomorrow and learn sql dont tell caeden

pliant gulch
#

Yep, good for taking some load off your database

pliant gulch
#

Also slows down latency if your accessing through memory via redis

slate swan
pliant gulch
#

redis is amazing, crazy fast

#

Strong recommend

slate swan
slate swan
#

well when u run it , you actually get to know if thats an error or its normal

pliant gulch
#

Did you make indentation errors kek?

slate swan
#

spacing errors in params smh

#

i was in a hurry 😔

#

🤔 how can spacing in params get you an error? example pls

slate swan
#

😔

#

use black ez

#
param(self, ctx,*,something)

he bullied me for something like this

#

😔

#

lmao

pliant gulch
#

Oh yea that is really triggering

slate swan
#

no its not

#

he even made me read pep8 from top to bottom😔

pliant gulch
#

I wouldn't blame him ¯_(ツ)_/¯

slate swan
slate swan
slate swan
#

im going to sleep gn guyspithink

#

gunnite

#

gannnute

#

docs.......................

#

🕵️‍♂️🏃

#
db1 = # connect to db from which to transfer data
db2 = # connect to db in which data is to be transferred

# get all data from db1
db1.execute("SELECT * FROM tablename")
data_tuple = db.fetchall()``` and then you can write all the data from db1 to db2 using a loop
#

or wait there's an easier way

untold token
#

That's triggered

#

Follow pep8 please

jagged aurora
#

working on a ping command how do I get it to quote the before edit

#
@bot.command()
async def ping(ctx: commands.Context):
  message = await ctx.send(f"before:`{round(bot.latency * 1000)}ms`")
  await asyncio.sleep(2)
  await message.edit(content=(f"after:`{round(bot.latency * 1000)}ms`"))
jaunty wraith
#

Can anyone tell me why my code isnt working

slate swan
#

im trying to make a welcome message get sent to dms but it wont work and the error says fun object has no attribute 'member'

@commands.Cog.listener()
    async def on_member_join(self, member):
        print("Welcome message sent in DMs.")
        languages = random.choice(langs)
        embed = discord.Embed(
            description="WELCOMEEEEE"
        )
        embed.set_author(name=f"{languages} {self.member.name}!", icon_url=self.member.avatar_url)
        await member.send(embed=embed)```
#

can someone help?

slate swan
#

ok

near sail
lucid gazelle
#

hiii

#

can someone help me on this? Thanks

jaunty wraith
#

Dont you need to put commands,context ext inside of the ctx ()

#

@lucid gazelle

near sail
lucid gazelle
#

okii

lucid gazelle
#

ohhh

jaunty wraith
#

@bot. command ()
@is_registered
40 y async def balance (ctx,commands, Context member: Discord.Member = None):

lucid gazelle
#

thanksss

jaunty wraith
#

I think

near sail
#

!d discord.Message

unkempt canyonBOT
#

class discord.Message```
Represents a message from Discord.

x == y Checks if two messages are equal.

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

hash(x) Returns the message’s hash.
jaunty wraith
lucid gazelle
#

ohhh okayyy

#

thanksss

#

this also

jaunty wraith
# lucid gazelle

Add a space infront of the await until it doesnt have a red line under it i see your using replit

lucid gazelle
#

yepp

#

this is the pic

#

if I put it in 47, the user_account= will be invalid syntax

#

and the red line didnt get rid of

brazen raft
#

Send a screenshot of the entire command

lucid gazelle
#

okiii

brazen raft
#

Your indentation is wrong, probably

lucid gazelle
#
@is_registered
async def balance(ctx,command,Context, member: discord.Member = None): 

 if not member:  
   member = ctx.message.author


user_account = await economy.get_user(member.id)

embed = discord.Embed
colour=discord.Color.from_rgb(244, 182, 89)
    
embed.add_field(name=f"{member.display_name}'s balance", value=f"""Bank: **{user_account.bank}**
                                                                     Wallet: **{user_account.wallet}**
                                                                     Items: **{user_account.items}**""")
embed.set_footer(text=f"Invoked by {ctx.message.author.name}", icon_url=ctx.message.author.avatar_url)
await ctx.send(embed=embed)```
#

so this is the command

brazen raft
#

Either send a screenshot or use

lucid gazelle
#

ohhh

brazen raft
lucid gazelle
brazen raft
#

Okay

lucid gazelle
#

that

#

thankssss

brazen raft
#

Your indentation is definitely wrong

lucid gazelle
#

oh

#

can you change it?

brazen raft
#

Every line in the screenshot after the if block should have the same amount of spaces as the if block

lucid gazelle
#

how?

brazen raft
#

That's how Python indentation works

lucid gazelle
#

so i will indent one space on each?

brazen raft
#

If that's your indentation, yes

lucid gazelle
#

oh

brazen raft
#

I see you have word warping, I hate that thing. You can disable it in the settings

foggy current
#

word warping?

lucid gazelle
#

helppp what's this?

lucid gazelle
spring obsidian
#

how can i use embed.set_image to set the image from the local dir

#

?

pliant gulch
#

!local-file

unkempt canyonBOT
#

Thanks to discord.py, sending local files as embed images is simple. You have to create an instance of discord.File class:

# When you know the file exact path, you can pass it.
file = discord.File("/this/is/path/to/my/file.png", filename="file.png")

# When you have the file-like object, then you can pass this instead path.
with open("/this/is/path/to/my/file.png", "rb") as f:
    file = discord.File(f)

When using the file-like object, you have to open it in rb mode. Also, in this case, passing filename to it is not necessary.
Please note that filename can't contain underscores. This is a Discord limitation.

discord.Embed instances have a set_image method which can be used to set an attachment as an image:

embed = discord.Embed()
# Set other fields
embed.set_image(url="attachment://file.png")  # Filename here must be exactly same as attachment filename.

After this, you can send an embed with an attachment to Discord:

await channel.send(file=file, embed=embed)

This example uses discord.TextChannel for sending, but any instance of discord.abc.Messageable can be used for sending.

obsidian ledge
#

how do i send a message to another channel

#

if i like said "!send hello" then it would send to another channel

#

how do i do that

slate swan
unkempt canyonBOT
slate swan
#

get the channel and use .send()

obsidian ledge
slate swan
obsidian ledge
#

or do i put it on another line

slate swan
obsidian ledge
#

how do i send a message with it?

#

do i put like a "," then like 'hello'

rapid walrus
#

how to make the bot send an embed with dropdown menu? and if user click one of the menu the bot edit the embed (edit not send another message)

lucid gazelle
#

help

#

bc im coding in a tablet

quick gust
#
  1. does that module exist
  2. if yes did u pip install it
lucid gazelle
#

I think that's the last problem

quick gust
#

idk i don't use replit but it's probably the same

#

pip install DiscordEconomy in terminal

lucid gazelle
#

thanks

obsidian ledge
#

i think u have to do it in shell but i might be wrong

#

oh nvm yeah u have to do it in terminal

lucid gazelle
#

what will i do?

obsidian ledge
#

wdym no terminal..

#

console is terminal?

lucid gazelle
#

ohhh

#

uhmmm

obsidian ledge
#

?

lucid gazelle
#

what will I put?

obsidian ledge
#

pip install DiscordEconomy

lucid gazelle
#

uhmm it doesnt work HUHU

obsidian ledge
#

try it in shell

#

wym

rapid walrus
kind wind
#

i searched up on the discordpy website for status and when I put the code it didnt work. client = discord.Client(activity=discord.Game(name='my game'))

jovial arrow
#

hey, cant read messages, no intent, plz help

silver pulsar
#

Do i need to learn everything in object oriented programming to learn asynchronous programming?

#

What topics is useful for disnake

kind wind
#

its below the 2Auth

kind wind
#

send pic of the code and the bot page

dusk pumice
#

:(

#

I got rate limits

#

Have to wait 1hour.

#

sad...

#

Is there any ways to unlock rate limits?

#

:(
Anyone ping me to awnser

slate swan
#
@client.command()
async def clear(ctx, amount=5):
    author_id =ctx.author.id
    guild_id = ctx.guild.id

    dbc.execute('select * from guilds where guild_id = ?', (guild_id,))
    flag = dbc.fetchone()

    if flag == None:
        await ctx.send('Guild not registered. Please use `>guild`.')
    
    else:
        dbc.execute('select modrole_id from guilds where guild_id = ?', (guild_id,))
        modrole_id = dbc.fetchone()
        if modrole_id == None:
            await ctx.send('No `modrole` defines.')
        
        else:
            user = client.get_user(author_id)
            guild = client.get_guild(guild_id)
            modrole = guild.get_role(modrole_id)

            if modrole in user.roles: # user has now attribute role error
                await ctx.channel.purge(limit=amount)
            
            else:
                await ctx.send('Only a `moderator` can do this!')```
slate swan
#

How do I make a statistics bot?

jade tartan
#

cuz i mean i was hoping to create a dashboard like carl bot

#

or any sort of public bot

#

Yes

#

But i would assume i would have to do it with flash

#

sorry flask

slate swan
# jade tartan But i would assume i would have to do it with flash

In this video, we will make a discord bot dashboard using Python (Flask) in 2021

Code: https://github.com/CodeWithSwastik/Dashboard-Tutorials

If you have any suggestions for future videos/doubts, leave it in the comments below. I might not be able to answer everyone but you can join my discord server for help: https://discord.gg/TXF3hBj

Some ...

▶ Play video
#

Watch this

jade tartan
slate swan
#

If you want it quick and easy

#

https://youtu.be/56Zw8-eaNq8 look at this series if your looking into more in-depth stuff

A LOT of you have been asking for a new bot dashboard series, and here you have it. This will be a series where I will show you how to create a Discord bot web dashboard using Python and React.

In this video, we will be creating a bot with a custom prefix, welcome, and leave messages.

😀SUBSCRIBE for more videos! https://youtube.com/c/ahnafza...

▶ Play video
#

read the docs if you are really into indepth stuff

#

tutorials are shit

slate swan
#

flask has docs too

#

Oh yeah

#

mhm

cobalt jacinth
#

can i run fastapi on the same server where my discord bot is running

slate swan
#

What statistics

velvet tinsel
#

What

slate swan
# slate swan Wdym?

Like a bot that'll extract data from a website, an example would be an MMA bot that'll give you access to all the latest fights and predictions.

slate swan
#

Public APIs from the websites aren’t though

slate swan
#

Use BS4 or Selenium for web scraping

#

Alr

velvet tinsel
#

Beautiful soup 🍜

slate swan
#

They should sell it at restaurants

#

Wonder what it tastes like

#

Web scraping your mouth

#

😋

#

Back to topic

velvet tinsel
#

yes ♥️

cobalt jacinth
#

can i run fastapi on same server running discord bot ?

cobalt jacinth
#

whats the performance cost ?

slate swan
#

Idk

#

This is a channel abut discord bots

kindred drum
#
class discordBot:
    @bot.command()
    async def whois(ctx, member : discord.Member):
        embed = discord.Embed(title = member.name, description = member.mention, color = discord.Color.red())
        embed.add_field(name = "ID", value = member.id, inline = True)
        embed.add_field(name = "TEST", value = "test", inline = True)
        embed.set_thumbnail(url = member.avatar_url)
        embed.set_footer(icon_url = ctx.author.avatar_url, text = f"Requested by {ctx.author.name}")
        await ctx.send(embed=embed)
    
if __name__ == "__main__":
    discordBot()
``` yo this comes up with the error '```
discord.ext.commands.errors.CommandNotFound: Command "whois" is not found``` anyone know why
slate swan
#

Full traceback

kindred drum
#
Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "whois" is not found```
slate swan
#

Not full traceback

kindred drum
#

its something

#

to do with the class but like I don't know

#

what I need to do

slate swan
#

Put it out of the class

kindred drum
#

na bro I wanna make it all in the class, works out of the class

slate swan
#

Bot.run needs to be inside the class

#

Otherwise it can’t read the class

slate swan
#
class discordBot(commands.Bot):
  def __init_(self):
    # stuff
    pass

bot = discordBot()

@bot.command()
async def cmd(....

bot.run()```
#

basically u need to subclass the bot object , not make a class

kindred drum
#

ah

#

okay but how do I pass variables through different commands /functions @slate swan

cold sonnet
#

!botvar

unkempt canyonBOT
#

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

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

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

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

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

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

kind wind
#

I want to make a !buy command. How can I detect what thing the person wants to buy without needing to create multiple commands for each item?

kind wind
#

what do i put in the * instead?

slate swan
#

The * is saying that the item var can be multiple words

kind wind
#

oh

#

so if thats it then the actual command?

slate swan
#

async def buy(ctx, item, amount: int = None)

#

That’s for item name and amount

slate swan
slate swan
#

Buying 2 ham burgers

kind wind
#

so I just type like this:

@bot.command()
async def buy(ctx, item, amount: food = 10):
  await ctx.reply("You bought food")

async def buy(ctx, item, amount: house = 10000):
  await ctx.reply("You bought a house!")
#

in one command

eager trail
#

Need help how do i split multiple line into single line?

slate swan
#

amount: food = 10 isn’t gonna work

kind wind
slate swan
#

:int is showing that it has to be an number

kind wind
#

can u send an example using like the word weapon?

slate swan
#

And = None shows that you don’t need the variable

eager trail
slate swan
#

Nvm I can’t send an example

#

Mobile is hard to use

kind wind
#

okay

#

ill send an example of how i thought it will work

#
@bot.command()
async def buy(ctx, weapons, ammount: int = None):
  await ctx.reply("You got weapons")
eager trail
#

hmm

eager trail
#
@bot.command()
async def buy(ctx, *, weapons, amnt=None):
  amnt = int(amnt)

#

@kind wind

#

does it work?

kind wind
#

and where do i put the name of the item?

eager trail
#

Wdym

potent summit
#

Anyone know why this code does not work for me?

async def selectboxTesting(ctx):
    await ctx.send(content = 'Select an option! ', components = [Select(
                                                    placeholder='Select something',
                                                    options= [
                                                        SelectOption(label='Option1', value=1),
                                                        SelectOption(label='Option2', value=2),
                                                        SelectOption(label='Option3', value=3),
                                                        SelectOption(label='❌ cancle', value='cancle')
                                                        
                                                    ],
                                                    custom_id= 'SelectTesting'
    )])
    interaction = await client.wait_for('select_option', check=lambda inter: inter.custom_id == 'SelectTesting' and inter.user == ctx.author)
    await interaction.send('you chose an option')
eager trail
#

what’s wrong

potent summit
#

I choose something and it writes to me interaction failed

eager trail
#

try overwrite

potent summit
#

What do you mean?

eager trail
#

overwrite just like @bot.command()

potent summit
#

ok i will try

eager trail
#

K dude if not works srry cuz i use discord_button_plugins only

kindred drum
#

yo

eager trail
#

Yo

kindred drum
#
class MyBot(commands.Bot):
    
    def __init__(self, command_prefix, self_bot):
        commands.Bot.__init__(self, command_prefix=command_prefix, self_bot=self_bot)
        self.message1 = "[INFO]: Bot now online"
        self.message2 = "Bot still online"
        self.add_commands()
    
    async def on_ready(self):
        print(self.message1)
    
    def add_commands(self):
        @self.command(name="status", pass_context=True)
        async def status(ctx, member : discord.Member):
            embed = discord.Embed(title = member.name, description = member.mention, color = discord.Color.red())
            embed.add_field(name = "ID", value = member.id, inline = True)
            embed.add_field(name = "TEST", value = "test", inline = True)
            embed.set_thumbnail(url = member.avatar_url)
            embed.set_footer(icon_url = ctx.author.avatar_url, text = f"Requested by {ctx.author.name}")
            await ctx.send(embed=embed)```
not sure why I get this error, got an idea?
``discord.ext.commands.errors.MissingRequiredArgument: member is a required argument that is missing.``
eager trail
#

Oh

#

try member : discord.Member=None

slate swan
#

thats what they did.

#

you didnt pass the member when you did that

kindred drum
eager trail
kindred drum
#

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

eager trail
#

Dude

slate swan
#

Bruh 💀

eager trail
#

i know why

#

you can do member

slate swan
#

Discord.member is a member object

#

It’s nonetype because it is equals to None

#

And hasn’t been passed

kindred drum
kindred drum
eager trail
#

Is getting bug?

kindred drum
#

discord.ext.commands.errors.MissingRequiredArgument: member is a required argument that is missing.

eager trail
#

try member : discord.Member=None yet?

wanton veldt
#

my bot is going crazy

eager trail
#

lmao

#

try close like 1 min

#

and then open again

kindred drum
#

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

eager trail
#

wait

wanton veldt
#

i did that and now its working

eager trail
#

i’ll fix your code real quick

eager trail
#
member = commands.fetch_user(member.id)
member.mention
#

@kindred drum

kindred drum
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: module 'discord.ext.commands' has no attribute 'fetch_user'

#

@eager trail

eager trail
#

okay

#

cog?

kindred drum
#

cogs? I aint using them

eager trail
#

Bot

#

try bot.fetch

kindred drum
eager trail
#

Lemme take a breathe

#

HMM

spark estuary
#

AttributeError: 'Embed' object has no attribute 'set'

spark estuary
slate swan
#

Embed.set_x where x can be footer , author , thumbnail and image

spark estuary
manic wing
#

!d disnake.Embed.set_field_at

unkempt canyonBOT
#

set_field_at(index, name, value, *, inline=True)```
Modifies a field to the embed object.

The index must point to a valid pre-existing field.

This function returns the class instance to allow for fluent-style chaining.
slate swan
manic wing
#

you listed examples so i gave you another example

slate swan
#

Gg

kindred drum
#

I fixed it @eager trail

#

if you are curious how lmk

spark estuary
slate swan
#

that's not it

spark estuary
slate swan
#

no

#

the line causing the error, you'd see it somewhere in the traceback

spark estuary
#

await coro(*args, **kwargs)
File "c:\Users\hp\Pictures\Python\turd.py", line 60, in on_message
if message.context=='bruh':
AttributeError: 'Message' object has no attribute 'context'

i get this...is it line 60?

slate swan
#

it's content

#

not context

#
if message.content == 'bruh':
#

fixed code ^

slate swan
#

what's the new error

#

you have to run the program again after fixing it

spark estuary
spark estuary
vale wing
#

There should be no brackets

spark estuary
vale wing
#

Also could you please show where you define client?

spark estuary
vale wing
#

If you define it like client = commands.Client it is the wrong way

spark estuary
vale wing
#

Ok this is good

slate swan
spark estuary
oblique adder
#

youtube_dl ? against youtube Tos ครับ ?

#

100 + servers

#

13 k users

#

now using wavelink no bug. Just want to ask for suggestion. anyone ?

eager trail
#

oh

#

python sleep.py

oblique adder
neon harbor
#

!warn 668433997189087232 Remain on topic, and only speak in English, as per our #rules

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied warning to @eager trail.

eager trail
#

sirry

#

sorry sir

#

next time i’lll do better

neon harbor
#

@oblique adder we won’t help with your project here, as YT;DL is against discord TOS and violates our 5th rule

eager trail
#

My fault not him

eager trail
#

he is using wavlink

oblique adder
neon harbor
#

I’m not sure what your question is. You seemed to ask whether YTDL was against TOS or not, and then for help with lava link

oblique adder
#

I am asking what lavalink wrapper I should use. He suggested I use ffmpeg but I said it was against youtube tos.
your welcome.

neon harbor
#

I’m looking at lava link now, and it seems to also stream off YouTube, which is still against their TOS

#

If your music bot just meant to grab music from YouTube?

slate swan
#
    if member == None:
        await ctx.send('`Member` is missing!')
        return

this doesn't work

oblique adder
#

I mean if they just stream off youtube doesn't that mean the creator get something ? compare to using youtube_dl which straight up download them

slate swan
#

this is for my ban command

slate swan
# oblique adder more detail

if a admin tries to use the ban command without the user argument, it will send a message saying Member was missing

neon harbor
neon harbor
#

See terms 1, 3, and 9

#

!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)
slate swan
# oblique adder any error ?
Ignoring exception in command unban:
Traceback (most recent call last):
  File "C:\Users\mal\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\mal\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 855, in invoke
    await self.prepare(ctx)
  File "C:\Users\mal\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 789, in prepare
    await self._parse_arguments(ctx)
  File "C:\Users\mal\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 706, in _parse_arguments
    kwargs[name] = await self.transform(ctx, param)
  File "C:\Users\mal\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 542, in transform
    raise MissingRequiredArgument(param)
discord.ext.commands.errors.MissingRequiredArgument: member is a required argument that is missing.
slate swan
oblique adder
slate swan
#

you didnt mention a member while running the command

oblique adder
#

you didnt assign member a value so it say it is missing

slate swan
oblique adder
#

async def ban(ctx,member=None):

#

now member is set default as none even if u dont write member it will still be none and not empty

slate swan
#

i was seeing if it would send a message if the member argument was missing

slate swan
slate swan
#

cool ! , you would be using on_command_error event to handle the error sent as MissingRequiredArgument , hard coding by setting member to None is a really bad way to handle error

oblique adder
slate swan
#
Ignoring exception in command unban:
Traceback (most recent call last):
  File "C:\Users\mal\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\bot\recode\main.py", line 88, in unban
    member_name, member_discriminator = member.split("#")
AttributeError: 'NoneType' object has no attribute 'split'
#

lucas?

slate swan
#

the unban/ban method is from lucas' tutorials

#

you can just py async def ban(ctx , member : discord.Member):
and use await member.ban() to ban the member.

slate swan
#

oh , is that from someone else?

slate swan
#

i don't know if it's made off of lucas or off them

#

well then , could you show the code?

#
@bot.command()
async def unban(ctx, *, member = None):
    if not ctx.author.guild_permissions.administrator:
        await ctx.send("You're missing the `Administrator` permission in order to continue this operation!")
        return

    if member == None:
        emb = discord.Embed(
            color=0x3ad8fc,
            title='**Argument Error**',
            description=f"`Member` argument was missing!"
        )
        await ctx.send(embed=emb)
    banned_users = await ctx.guild.bans()
    member_name, member_discriminator = member.split("#")

    for ban_entry in banned_users:
        user = ban_entry.user

        if (user.name, user.discriminator) == (member_name, member_discriminator):
            await ctx.guild.unban(user)
            embed = discord.Embed(
                color=0x3ad8fc,
                title=f'**Unbanned User!**',
                description=f"{ctx.author} has unbanned {user}!"
            )
            await ctx.send(embed=embed)
            return
#
      for ban_entry in banned_users:
          user = ban_entry.banned_users

          if (user.name, user.discriminator) == (member_name, member_discriminator):
              ...```
#

bet it looks like this

slate swan
#

read the message in the screenshot , it has fix

#
Traceback (most recent call last):
  File "C:\Users\mal\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\bot\recode\main.py", line 86, in unban
    id = member.id
AttributeError: 'str' object has no attribute 'id'
placid skiff
#

You have to use typehint when you declare a command and check if the parameter you retrieve is an instance of the object you want

dense coral
#
@bot.event
async def on_member_join(member)
  channel = bot.get_channel(925523794666352640)
  await channel.send(f"{member} Join the server!")```
Does not work for me, anyone know what the solution is?
slate swan
#

How to fix this man

dense coral
slate swan
final iron
#

!pypi utils

unkempt canyonBOT
slate swan
#

i mean if you mean discord.ultils , import it from discord

placid skiff
#

If it is not then you should try to convert it, if it can't be converted then probably it is not an object

dense coral
slate swan
dense coral
dense coral
slate swan
#

if not , do it

#
bot = commands.Bot(..... , intents = intents)```
dense coral
#

Oh okay

steel void
#
@client_main.event
async def on_message(message):
    if message.author == client_main.user:
        return

    if message.content.lower() == "upgrade" and "th":
        await message.channel.send('As a reminder make sure youre fully maxed defence, troops, heroes, and spells before you upgrade. **We do not allow rushing, if you rush we will ban you unless if you get direct permission from Vondy.** Rushing is stupid 98% of the time.')
dense coral
slate swan
steel void
#

hey how do i make it where, if someone say 2 keywords in full, it'll reply with the message?

slate swan
kindred drum
#

yo why does this listener not react when a user joins ``` @commands.Cog.listener()# Checking the user when they join to see if they have been verified
async def on_member_join(member):
print("[INFO]:{member} has joined")

unkempt canyonBOT
#

When checking if something is equal to one thing or another, you might think that this is possible:

if favorite_fruit == 'grapefruit' or 'lemon':
    print("That's a weird favorite fruit to have.")

While this makes sense in English, it may not behave the way you would expect. In Python, you should have complete instructions on both sides of the logical operator.

So, if you want to check if something is equal to one thing or another, there are two common ways:

# Like this...
if favorite_fruit == 'grapefruit' or favorite_fruit == 'lemon':
    print("That's a weird favorite fruit to have.")

# ...or like this.
if favorite_fruit in ('grapefruit', 'lemon'):
    print("That's a weird favorite fruit to have.")
final iron
#

It's the same concept for and

slate swan
strong shale
#

Anyone know how to make docs using **sphinx **module ?

kindred drum
final iron
slate swan
#

any help how to fix this?

strong shale
final iron
#

But it's not related to any relevant discord library

viscid wren
slate swan
tough lance
#

Hi

trail raven
#

I have a clear command working, but I want it to send a certain message when the amount argument is not a number. I've played with if amount != int: but it keeps giving me errors. So I'm using @clear.error but when the isinstance == True, I don't get a response.

How do I get @clear.error to have the bot respond in the channel?

@client.command()
@commands.has_permissions(manage_messages=True)
async def clear(ctx, amount: int=10000000):
    if amount == 10000000:
        await ctx.send(embed=discord.Embed(title="Error", description=":x: You didn't specify how many messages you'd like me to delete.", color=red))
        return
    if amount < 1:
        await ctx.send(embed=discord.Embed(title="Error", description=":x: I can't delete less than 1 message.", color=red))
        return
    if amount > 0:
        await ctx.channel.purge(limit=amount+1)
        await ctx.send(embed=discord.Embed(title="Success!", description=f"![check](https://cdn.discordapp.com/emojis/894012823938670612.webp?size=128 "check") Successfully deleted `{amount}` messages.", color=green))
        await asyncio.sleep(1)
        await ctx.channel.purge(limit=1)

@clear.error
async def clear_error(error, ctx):
    if isinstance(error, commands.BadArgument) == True:
        await ctx.send("worked2")
cold sonnet
#

mixed the names I think

#

!d discord.ext.commands.Bot.on_command_error

unkempt canyonBOT
#

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

The default command error handler provided by the bot.

By default this prints to [`sys.stderr`](https://docs.python.org/3/library/sys.html#sys.stderr "(in Python v3.9)") however it could be overridden to have a different implementation.

This only fires if you do not specify any listeners for command error.
cold sonnet
#

yes, ctx is first

#

async def clear_error(ctx, error)

#

also, I'm kinda late so I'll ping @trail raven

trail raven
#

It worked, thanks!

umbral dome
#
import discord, logging, json, requests
from discord.ext import commands

with open("config.json") as f:
    config = json.load(f)


client = commands.Bot(command_prefix=config['Prefix'])

@client.event
async def on_ready():
    print(f"{client.user.name}en er klar til brug")
    message = {
        "content" : (f"Så {client.user.name} klar igen")}

    requests.post(config['Webhookurl'], data=message)


 
@client.command()
@commands.has_permissions(administrator=True)
async def removediscord(ctx, discord):
    mycursor = mydb.cursor()

    sql = f"DELETE FROM main_database WHERE discord_id = '{discord}'"

    mycursor.execute(mysql)

    mydb.commit()

    user = await client.fetch_user(int(discord))
    embed = discord.Embed(
      title = f"User: {user} \nDiscord ID: {discord}\n\nStatus: Added user to database ✔️",
      color = 0x7CFC00
      )

      
    await ctx.send(embed = embed)

@client.command()
async def removediscord(ctx, error):  
     if isinstance(error, commands.BadArgument) == True:
        await ctx.send("worked")



if __name__ == '__main__':
    client.run(config['Token'])
#

in transform
raise MissingRequiredArgument(param)
discord.ext.commands.errors.MissingRequiredArgument: discord is a required argument that is missing.

#

Need help

supple summit
#

hi i need help
how i can make an forever loop in d.py without stopping the bot

#

ping me if you are going to tell me something

umbral dome
#
import discord, logging, json, requests
from discord.ext import commands

with open("config.json") as f:
    config = json.load(f)


client = commands.Bot(command_prefix=config['Prefix'])

@client.event
async def on_ready():
    print(f"{client.user.name}en er klar til brug")
    message = {
        "content" : (f"Så {client.user.name} klar igen")}

    requests.post(config['Webhookurl'], data=message)

if __name__ == '__main__':
    client.run(config['Token'])

@supple summit

#

In client event you can just replace with anything

tacit horizon
#
KeyError: 0```
#

??????????

umbral dome
#

Wait are u trying to do?

#

@tacit horizon

tacit horizon
#

from response

supple summit
#

because i can't understand the previous one

umbral dome
#
message = {
        "content" : (f"message) ")}

    requests.post(config['Webhookurl'], data=message)

@tacit horizon

umbral dome
tacit horizon
#

:O

umbral dome
#

Why [0]

supple summit
#

like checking database every 10 seconds

#

for cooldown thing

tacit horizon
#

after removing

umbral dome
#
while True:
  Print("hello world")
supple summit
umbral dome
#

That does not stop the bot

supple summit
#

ok

umbral dome
#

But the while True:
Will keep looping

vocal shoal
#

is it better to store user_id as int or string or there is no differance?

vocal shoal
#

yes

umbral dome
#

Could u help me create a database?

vocal shoal
#

sure

umbral dome
#

in Dm? or

vocal shoal
#

i think dm is vetter

tacit horizon
#

ahhh

#

not working

lusty swallow
#

like this

print(response[0])
#

keyerror implies that message key doesn't exist

umbral dome
# umbral dome ```py import discord, logging, json, requests from discord.ext import commands ...
import discord, logging, json, requests
from discord.ext import commands

with open("config.json") as f:
    config = json.load(f)


client = commands.Bot(command_prefix=config['Prefix'])

@client.event
async def on_ready():
    print(f"{client.user.name}en er klar til brug")
    message = {
        "content" : (f"Så {client.user.name} klar igen")}

    requests.post(config['Webhookurl'], data=message)


 
@client.command()
@commands.has_permissions(administrator=True)
async def removediscord(ctx, discord):
    mycursor = mydb.cursor()

    sql = f"DELETE FROM main_database WHERE discord_id = '{discord}'"

    mycursor.execute(mysql)

    mydb.commit()

    user = await client.fetch_user(int(discord))
    embed = discord.Embed(
      title = f"User: {user} \nDiscord ID: {discord}\n\nStatus: Added user to database ✔️",
      color = 0x7CFC00
      )

      
    await ctx.send(embed = embed)

@client.command()
async def removediscord(ctx, error):  
     if isinstance(error, commands.BadArgument) == True:
        await ctx.send("worked")



if __name__ == '__main__':
    client.run(config['Token'])
tacit horizon
lusty swallow
#

fix your code

#

also
did you mean

@client.error
async def removediscord(ctx, error):  
     if isinstance(error, commands.BadArgument) == True:
        await ctx.send("worked")
velvet tinsel
#

lol

#

also you don’t need a == True 💀

#

if you just do a if isinstance that’s enough

#

and it should be is True if you want to add it but idk why you do that yert

crystal cliff
final iron
#

I'm going to make a blacklist system for my bot. Could I achieve this by creating a decorator that checks a database for the user's id and if it finds it returns the function?

vocal shoal
#

yes,
you can also use the on_message event, check if the author is in the blacklist, if yes return

if message.author.id in blacklist:
        return
final iron
#

I'm just going to use it to prevent use of the bots commands

#

Can I have a sample of what the decorator would look like?

#

I've never made one

muted vessel
#

i need info

crystal cliff
crystal cliff
final iron
crystal cliff
final iron
#

Thats why I'm creating a decorator

crystal cliff
final iron
#

Oh yeah, one more thing. With an Sqlite3 db, should I be creating new files or new tables for my different purposes?

sage otter
#

The only extra databases you should have are backups. You don’t need to have more than 1 main database to write and read to.

final iron
#

Alright

fluid spindle
#

Hi, could there be a reason why I might be getting coroutine object has no attribute 'start'
When I try to run a loop?

fluid spindle
#

Nvm I realised my mistake

slate swan
#

hi i am making a moderator bot and i was ran into an error

unkempt canyonBOT
#

Hey @slate swan!

Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:

• If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)

• If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:

https://paste.pythondiscord.com

slate swan
#

but it looks like i cant send it

final iron
slate swan
final iron
#

I'm confused with decorators

#

!decorators

unkempt canyonBOT
#

Decorators

A decorator is a function that modifies another function.

Consider the following example of a timer decorator:

>>> import time
>>> def timer(f):
...     def inner(*args, **kwargs):
...         start = time.time()
...         result = f(*args, **kwargs)
...         print('Time elapsed:', time.time() - start)
...         return result
...     return inner
...
>>> @timer
... def slow(delay=1):
...     time.sleep(delay)
...     return 'Finished!'
...
>>> print(slow())
Time elapsed: 1.0011568069458008
Finished!
>>> print(slow(3))
Time elapsed: 3.000307321548462
Finished!

More information:
Corey Schafer's video on decorators
Real python article

final iron
#

Looking at this doc, is the inner functioned needed and what is its purpose?

#

Could someone provide a better example?

magic ore
#

the slow function in that example is equivalent to slow = timer(slow)

#

timer(func) returns a callable, the inner function

calm sparrow
#

How do you check if a embed or a string was returned from a function?

outer violet
#

How do I make my bot send a message to the users dms once they get a certain role from the server?

digital ingot
#
    @commands.command()
    async def gebet(self, *, ctx):  
        url = "https://dailyprayer.abdulrcs.repl.co/api/berlin"
        response = requests.get(url)
        data = response.json()
        city = (data['city'])
        date = (data['date'])
        for prayer in data["today"]:
          await ctx.send(city, date, prayer + ": " + data["today"][prayer])  
        # If you want to request for tomorrow prayer's time:
        # for prayer in data["tomorrow"]:
        #  print(prayer + ": " + data["tomorrow"][prayer])```
pliant gulch
digital ingot
#

my brain is hurting trying to fix this

#

i think the await ctx.send is wrong

#

like the things that come after it

calm sparrow
pliant gulch
#

discord.Embed

fluid spindle
soft lynx
#

am i allowed to ask questions about slash commands here

digital ingot
# fluid spindle When you call gebet, don't put in self as the first argument

i uh did some changes and

    @commands.command()
    async def gebet(self, ctx):  
        url = "https://dailyprayer.abdulrcs.repl.co/api/berlin"
        response = requests.get(url)
        data = response.json()
        city = (data['city'])
        date = (data['date'])
        for prayer in data["today"]:
            em = discord.Embed(
            title=f'Gebetszeiten Berlin {date}'
            description=f'city, date, prayer + ": " + data["today"][prayer]'
            )
        await ctx.send(embed=em)``` now the description doesnt work
calm sparrow
# pliant gulch discord.Embed

Sweet thanks, working now. I forgot the discord part 😛 Been a few months since I worked on this bot lol Thanks!

digital ingot
#

i did a code before but it didnt show the city and the date

#

it only showed the times

fluid spindle
fluid spindle
digital ingot
#

i already fixed it

#

but still thank you sm

fluid spindle
#

cool, np

echo lagoon
#

got a bit of an issue, dpy how to check if an arg is either a discord channel mention (get channel) or just a normal string? (do something else)

quaint epoch
#

is it possible to check if the member running a command has (perm) or (perm and perm)?

#

like: py @client.command() @commands.has_permissions(moderate_members=True or manage_messages=True and manage_members=True)?

echo lagoon
#

could do a custom check. .

quaint epoch
upbeat otter
placid willow
#

When designing a bot that uses internal resources, is there a way to avoid relative-to-repo-root paths or do I just have to suck it?

echo lagoon
# quaint epoch how do i do that?
# this is just an example, 
    @staticmethod
    def is_guild_owner():
        async def predicate(ctx):
            if ctx.guild.owner_id != ctx.author.id:
                return False
            return True
        return commands.check(predicate)

#to use: 
@commands.check(is_guild_owner)
echo lagoon
#

didnt think of using isinstance ; - ;

upbeat otter
upbeat otter
echo lagoon
echo lagoon
#

(doesnt excuse me for writing bad code, ig)

upbeat otter
quaint epoch
#

so, i made a bot on my class server, and i tried to mute my use the timeout feature in my alt accnt for testing, im an admin on my class server, with admin perms, but i can't use the timeout command - py @client.command() @commands.has_permissions(moderate_members=True) async def timeout(ctx, member: discord.Member, time: float = None, *, reason='None'): duration = (time * 60) await member.timeout(duration=duration, reason=reason) try: await member.send(f'''{member.mention} you were put in the timeout chair by **{ctx.author}** for {time} minutes, because: **{reason}**.''') except (discord.HTTPException, discord.errors.HTTPException, discord.ext.commands.errors.CommandInvokeError, commands.CommandInvokeError, commands.CommandError, AttributeError, discord.Forbidden): print(f'Cannot direct message {str(member)}.') await ctx.send(f'''{ctx.author.mention} put {member.mention} in the timeout chair for {time} minutes, because: **{reason}**.''')

#

so, even with administrator perms, i don't have moderate_members perms?

#

im using disnake 2.3 btw

#

it works perfectly fine on my personal server, since there is only me, and my bot there and im the owner

slate swan
#

i have a problem while declaring this variable:

    async def play(self,ctx,url):
      ctx.voice_client.stop()
      FFMPEG_OPTIONS = (
       "before_options" : "-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5",
       "options": "-vn"
       )```

       "before_options" :** "-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5"**
gives a error and idk why
slate swan
quaint epoch
quaint epoch
# slate swan yea

idk, maybe py @client.command() async def play(self,ctx,url): ctx.voice_client.stop() FFMPEG_OPTIONS = ( "before_options" : "-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5", "options": "-vn" )

fluid spindle
#

async def foo(self, ctx, *, abc):
What does the * exactly do here?

quaint epoch
#

try doing your client var for the decorator

quaint epoch
echo lagoon
quaint epoch
#

so if i were to enter hello my name is hrlo77 for the last part of the command, the whole string would be the abc

fluid spindle
quaint epoch
fluid spindle
#

got it, thanks

quaint epoch
bitter perch
unkempt canyonBOT
#

@discord.ext.commands.check_any(*checks)```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if any of the checks passed will pass, i.e. using logical OR.

If all checks fail then [`CheckAnyFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckAnyFailure "discord.ext.commands.CheckAnyFailure") is raised to signal the failure. It inherits from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").

Note

The `predicate` attribute for this function **is** a coroutine.

New in version 1.3.
bitter perch
#

though has_permissions should take a list

#

discord.ext.commands.has_permissions(**perms)

slate swan
#

Is making a snipe command against discords tos?

prime marten
#

anyone have a solution to this error, i'm trying to create an economy bot with aiosqlite

#

Here is some of the code

    db = await aiosqlite.connect('main.db')
    cursor = await db.cursor()
    await cursor.execute(f"SELECT * FROM economy WHERE member_id = {member.id}")
    result = await cursor.fetchone()

    sql = f"UPDATE economy SET wallet = ? WHERE member_id = ?"
    val = {result[1] + amount, member.id}

    await cursor.execute(sql, val)
    await db.commit()
    await cursor.close()
    await db.close()```
prime marten
#

ty, funny enough i just found the solution xD

umbral dome
#

Could someone help me so when i people do !join
it writes peoples id to my folder so they are whitelisted

tulip mural
#

im making a Discord bot, but if I try to run my code I get this error:

    from discord.ext
                   ^
SyntaxError: invalid syntax```

This is my code for the project:
```TOKEN = 'my token'

import discord
from discord.ext
import commands
import youtube_dl
import os
import nacl

client = commands.Bot(command_prefix = "*")

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

@client.command()
async def join(ctx):
   voiceChannel = discord.utils.get(ctx.guild.voice_channels, name = "music custombot")
await voiceChannel.connect()

@client.command()
async def play(ctx, url: str):
   song_there = os.path.isfile("song.mp3")
if song_there:
   os.remove('song.mp3')

voice = discord.utils.get(client.voice_clients, guild = ctx.guild)

ydl_opts = {
   'format': 'bestaudio/best',
   'postprocessors': [{
      'key': 'FFmpegExtractAudio',
      'preferredcodec': 'mp3',
      'preferredquality': '192',
   }],
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
   ydl.download([url])
for file in os.listdir("./"):
   if file.endswith(".mp3"):
   os.rename(file, "song.mp3")
voice.play(discord.FFmpegPCMAudio("song.mp3"))

client.run(TOKEN)```

I don't know where the error comes from, please help!
final iron
tulip mural
#

yeah, but I just wanted a really simple bot that loops an .mp3 file. For my own server^^

#

I copied most of my code btw

final iron
#

"I just wanted a really simple bot that loops an .mp3 file. For my own server" Blatantly uses ytdl

tulip mural
#

I copied most of my code

final iron
#

!youtube-dl @tulip mural

tulip mural
#

I know that is used YouTube know

final iron
#

!youtube-dl

#

Uh

tulip mural
#

yes, but it gives me sintax error for some reason

final iron
tulip mural
#

in this message

final iron
#

^

tulip mural
#

oh, okay!

final iron
#

I know enough to use them in my bot

#

Just ask your question/send your error

#

Have you tried using WHERE?

#

No clue. I only started with sql (3?) days ago

tulip mural
#

My project will just not work, can someone share me a script of a bot that:

  1. join a voicechannel when it goes online.
  2. infinitly loop an .mp3 file.

please help, im looking for it all day 😦

#

oh...

final iron
tulip mural
#

yes, but I want to loop an .mp3 file. not a Youtube video

#

(my old script was with yt i know)

slate swan
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)
final iron
slate swan
final iron
#

It's strange

slate swan
#

ikr

slate swan
slate swan
quaint epoch
quaint epoch
slate swan
#

if you have one kwarg yes it will eat all text

final iron
#

Alright so I need some help. I'm trying to make a decorator and I have no clue what I'm doing. I wrote the code which (should) be working. Can someone explain to me how to turn this in to a functioning decorator?

async def is_blacklisted(member_id: int): # member_id will be ctx.author.id when I can change this in to a decorator
    path = pathlib.Path(__file__).parent.parent.absolute() / "main.db"
    connection = await aiosqlite.connect(path)
    cursor = await connection.cursor()
    await cursor.execute(f"REPLACE INTO blacklisted_members(member_id, reason, data) Values({member_id}, 'random text', 'more text')")
    await connection.commit()
    await cursor.execute(f'''SELECT member_id FROM blacklisted_members
                            WHERE member_id={member_id}''')
    line = await cursor.fetchone()
    if line is None:
        await connection.close()
        pass
    else:
        await connection.close()
        return
slate swan
final iron
#

I've never done it before

slate swan
#
def decorator():
    async def asyncfunction():
final iron
#

So

def is_blacklisted():
  async def blacklisted_check(member_id: int): # member_id will be ctx.author.id when I can change this in to a decorator
    path = pathlib.Path(__file__).parent.parent.absolute() / "main.db"
    connection = await aiosqlite.connect(path)
    cursor = await connection.cursor()
    await cursor.execute(f"REPLACE INTO blacklisted_members(member_id, reason, data) Values({member_id}, 'random text', 'more text')")
    await connection.commit()
    await cursor.execute(f'''SELECT member_id FROM blacklisted_members
                            WHERE member_id={member_id}''')
    line = await cursor.fetchone()
    if line is None:
        await connection.close()
        pass
    else:
        await connection.close()
        return

?

#

I'm guessing this is wrong

slate swan
#

example

def decorator():
    def function():
        if something in list:
            return

@decorator
async def asyncfunction():
final iron
#

I can test it

slate swan
#

go for it

final iron
#

Of yeah, how would I get ctx.author.id?

slate swan
#

wdym

final iron
#

My goal is to have the decorator check the authors id against the database of blacklisted users

#

Right now you have to input a member

#

Is there anyway I can make that default to the author (ctx.author.id)

slate swan
#

not sure

#

cant really say

#

not really

#

dont even know sql got bored of it lol

#

know the basics

#

lol ikr

#

im going to make a new bot that uses a db today so i better get to it

#

not really their just hard to master

#

lol

#

wdym annoying?

#

well we all learn at are on rate and sometimes are answers are always under are noses

#

lol

#

ic

final iron
#

Its not working

slate swan
#

i think im going to do a atm bot like a atm machine with a db

final iron
#

I'm getting TypeError: is_blacklisted() missing 1 required positional argument: 'member_id'

#

When I don't put the id

final iron
#

Wait

slate swan
#

just add a default value of None

final iron
#

And when I add the id I get TypeError: 'NoneType' object is not callable

slate swan
#

guess its None

#

why not type hint the id as a member?

final iron
slate swan
#

argument naming lmao

final iron
#

Its just showing errors

#

I need to figure out how to get ctx.author.id

slate swan
#
@commands.command(name="profile") # Profile Command
    async def profile(self, ctx: commands.Context, member: discord.Member = None) -> None:
        if not member:
            member = ctx.author.id
ebon island
#

I'm confused about why I'm getting an exception indicating that my turn_loop method is taking three arguments when it is only supposed to be taking 2:

    def done_callback(self, _task: asyncio.Task, ctx, curr_server, settings, count=2):
        try:
            exc = _task.exception()
            if exc:
                capture_exception(exc)
                message_to_be_sent = f'Barbot had an exception, delayed for {count}: {exc}'
                print(message_to_be_sent)
                capture_message(message_to_be_sent)
                if count:
                    count *= 2
                else:
                    count = 2
            else:
                count = 0
            curr_server.task = asyncio.create_task(self.turn_loop(curr_server=curr_server, count=count))
            curr_server.task.add_done_callback(partial(self.done_callback, ctx=ctx, curr_server=curr_server, settings=settings, count=count))
        except asyncio.exceptions.CancelledError:
            print('task cancelled :)')

    async def turn_loop(self, curr_server, count):
        channel_to_be_sent = curr_server.approved_channel
        settings = await self.get_server_settings(curr_server)
        if count:
            await self.error_delay(count)
        if curr_server.cypher_mode in self.client.cypher_modes:
            settings = await self.cypher_list_updater(curr_server, settings)
        if settings:
            await self.take_turn(curr_server, settings)
        else:
            message_to_be_sent = f'**The BarBot cannot be run in {curr_server.cypher_mode} Mode when the Cipher List is empty.**'
            await self.message_sender(channel_to_be_sent, message_to_be_sent)
            curr_server.task.cancel()

Any ideas? It seems also like it's only happening on my production server and not on my dev build for some reason I'm not really understanding

final iron
#

If I type hint the id to a member then and make it default to None I get TypeError: is_blacklisted() takes 0 positional arguments but 1 was given

#

This is the current code

def is_blacklisted():
    async def blacklisted_check(member_id: disnake.Member = None):
        path = pathlib.Path(__file__).parent.parent.absolute() / "main.db"
        connection = await aiosqlite.connect(path)
        cursor = await connection.cursor()
        await cursor.execute(f"REPLACE INTO blacklisted_members(member_id, reason, data) Values({member_id}, 'random text', 'more text')")
        await connection.commit()
        await cursor.execute(f'''SELECT member_id FROM blacklisted_members
                                WHERE member_id={member_id}''')
        line = await cursor.fetchone()
        if line is None:
            await connection.close()
            pass
        else:
            await connection.close()
            return
#

Not sure if I'm doing something wrong

#

This is what I'm putting over the command @is_blacklisted(758119644984115243)

#

I gtg

#

Ping me you know what I'm doing wrong

manic wing
#

would be alot easier

final iron
#

I just want to keep my code clean

manic wing
#

lol

#

having a global check is unfathomably cleaner than decorating each command

final iron
#

Oh I misunderstood

manic wing
#

you literally just return a bool

#

!d discord.ext.commands.check ```py
@bot.check
async def blacklisted_check(ctx):
if ctx.author in blacklisted:
return False

return True```
unkempt canyonBOT
#

@discord.ext.commands.check(predicate)```
A decorator that adds a check to the [`Command`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") or its subclasses. These checks could be accessed via [`Command.checks`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command.checks "discord.ext.commands.Command.checks").

These checks should be predicates that take in a single parameter taking a [`Context`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Context "discord.ext.commands.Context"). If the check returns a `False`-like value then during invocation a [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure") exception is raised and sent to the [`on_command_error()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.discord.ext.commands.on_command_error "discord.discord.ext.commands.on_command_error") event.

If an exception should be thrown in the predicate then it should be a subclass of [`CommandError`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CommandError "discord.ext.commands.CommandError"). Any exception not subclassed from it will be propagated while those subclassed will be sent to [`on_command_error()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.discord.ext.commands.on_command_error "discord.discord.ext.commands.on_command_error").
final iron
#

Is there any way I can make it not apply to certain commands?

#

There are some that I would like to be only available to blacklisted users

manic wing
#
@bot.check
async def blacklisted_check(ctx):
    if ctx.command.name in ['a', 'b']:
      return True
    if ctx.author in blacklisted:
      return False  

    return True```
final iron
#

There we go

#

Thanks

manic wing
#

this - where ['a', 'b'] are the command names you dont want to work

manic wing
muted lynx
#

is there an event for channel creation and deletion

#

I can't find one in the docs

pliant gulch
unkempt canyonBOT
#

discord.on_guild_channel_delete(channel)``````py

discord.on_guild_channel_create(channel)```
Called whenever a guild channel is deleted or created.

Note that you can get the guild from [`guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.GuildChannel.guild "discord.abc.GuildChannel.guild").

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

!d discord.on_guild_channel_delete

unkempt canyonBOT
#

discord.on_guild_channel_delete(channel)``````py

discord.on_guild_channel_create(channel)```
Called whenever a guild channel is deleted or created.

Note that you can get the guild from [`guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.GuildChannel.guild "discord.abc.GuildChannel.guild").

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

Is there a way to bypass cooldowns by having an if statement with a users discord id?

#

for example

  no more cooldown```
rare saddle
#

How to make a random color for embed?

manic wing
unkempt canyonBOT
#

classmethod random(*, seed=None)```
A factory method that returns a [`Colour`](https://docs.disnake.dev/en/latest/api.html#disnake.Colour "disnake.Colour") with a random hue.

Note

The random algorithm works by choosing a colour with a random hue but with maxed out saturation and value.

New in version 1.6.
rare saddle
molten heron
#

make the prefix "".

#

and give that user application command perms.

#

Me either. But seeing how bots I use work that should work too

manic wing
molten heron
#

what

pliant gulch
#

They asked for any message, by setting the prefix to "" it will only work when a valid command is in the message

prime wolf
#

bruh

pliant gulch
#

The goto is doing an on_message event where you check the ID of the author

#

You want to make an on_message event, then access the author.id of the message object

#

!d discord.Message.author

unkempt canyonBOT
sacred cargo
#

i need help

#

im trying to make it so leveling doesnt sync across servers,

#

but for individual servers

prime wolf
#

!d discord.on_typing

unkempt canyonBOT
#

discord.on_typing(channel, user, when)```
Called when someone begins typing a message.

The `channel` parameter can be a [`abc.Messageable`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable "discord.abc.Messageable") instance. Which could either be [`TextChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel "discord.TextChannel"), [`GroupChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.GroupChannel "discord.GroupChannel"), or [`DMChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.DMChannel "discord.DMChannel").

If the `channel` is a [`TextChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel "discord.TextChannel") then the `user` parameter is a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member"), otherwise it is a [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User").

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

i need to store the guild id and the user id, but idk how

prime wolf
sacred cargo
#

heres my code

#
if message.author.bot == True:
        print("message is from bot, ignoring")
    else:
        with open('level.json', 'r') as f:
            level = json.load(f)

        if level[str(message.guild.id)] == 1: 
            with open('messages.json', 'r') as f:
                messages = json.load(f)

            try:
                messages[str(message.author.id)] += 1
            except KeyError:
                messages[str(message.author.id)] = 1
        
            with open('messages.json', 'w') as f:
                json.dump(messages, f, indent=4)
potent spear
sacred cargo
#

ik, its that i dont know how to use a db

#

:(

potent spear
heavy folio
pliant gulch
#

??? What is on_typing here for?

potent spear
#

no, surely not

pliant gulch
#

You just need to check if the id of the message author is the same as the user id you want

potent spear
#

ever used docs/ is this your first python project? looks like it tbh

sacred cargo
potent spear
#

surely not

heavy folio
#

use an instance of it.. not the class objecy

potent spear
#

learn the basics first, then move on from there, you don't want to start this without even knowing the different between and object and a class

#

you're comparing a class with a user ID, if you know basics, you know that's basically wrong

#

you have to compare the attributes of 2 objects

#

worst thing you can do

sacred cargo
potent spear
sacred cargo
#

just ANSWER

heavy folio
#

lol?

#

basic python

potent spear
#

get the message author's ID and compare it to the given ID
if it's True, get the channel object, use it's async send method

sacred cargo
#

@heavy folio can you help me

heavy folio
#

ye

pliant gulch
#

Nice, is this a compiler or interpreted? I'm also making my own compiler but in C++

heavy folio
unkempt canyonBOT
heavy folio
#

take note user and member is different @slate swan

#

member is in guild, user is a discord user

pliant gulch
#

Ah, same for the compiler bit lol. I've been stuck on writing the Assembly code

potent spear
# heavy folio !d discord.User.id

this is not that relevant for his on_message event
this guy doesn't know yet that a member basically is a user etc
I also don't think he knows what class object message.author returns

pliant gulch
#

A friend referred me to that guide as well, wasn't much use for me though as I'm aiming for a compiled one

heavy folio
#

oh

sacred cargo
pliant gulch
#

A compiler in python sounds cursed though, thank god I'm writing it in C++

pliant gulch
sacred cargo
#

i uh

#

may or may not be banned

pliant gulch
#

Perhaps a dictionary or something? This would also mean that you don't need global

#

Or perhaps a bot var

potent spear
sacred cargo
#

be honest, you just dont wanna help someone that uses json

potent spear
pliant gulch
#

Not really I've been winging it without any resources

#

I'm stuck at the parser bit though, I haven't done actual compiling nor evaluation

#

Hence I'm stuck at the assembly code

#

Nope

#

Nope but close

#

message.author is a User or Member object

#

You want to access the id property of said object

#

This returns an integer which you can compare

#

Yep

echo lagoon
#

dang it, got an io blocking task which blocks the whole bot, how would i run the whole method in another thread and await a result?

pliant gulch
#

You should probably checkout run_in_executor

echo lagoon
#

thx!

echo lagoon
#

actually im not so sure if that is the best. . .
considering im also making threads in the method. . . should be a better way. .

quaint epoch
#

hi

echo lagoon
digital ingot
#
    @commands.command()
    async def faridmemo(self, ctx, *, member : discord.Member = None):
        await ctx.message.delete()
        url = "https://cdn.discordapp.com/attachments/794990120791965737/800852985461735424/video0.mov"
        download(url)
        if not member:
            await ctx.send(file=File(fp="video.mp4", filename="Farid_Memo.mp4"))
        else:
            await ctx.send(f"von {ctx.author.mention} an {member.mention}", file=File(fp="video.mp4", filename="Farid_Memo.mp4"))
        os.remove("video.mp4")```
#

uh

#

it doesnt send the video

#

neither does it delete the message of the author

digital ingot
#

ig this is a unsolveable problem

potent spear
#

also very important note:
you seem to download from url synchronously, this will block other code if not put in an executor

heavy folio
#

can interaction.followup (discord.py) be responded ephemerally

lucid gazelle
#

can i ask how to module.export ||that's discord.js but i want it on discord.py||?

lucid gazelle
#

yep

slate swan
#

you can use cogs for that. Basically creating a class which has commands from a category

#

!d discord.ext.commands.Cog

unkempt canyonBOT
#

class discord.ext.commands.Cog(*args, **kwargs)```
The base class that all cogs must inherit from.

A cog is a collection of commands, listeners, and optional state to help group commands together. More information on them can be found on the [Cogs](https://discordpy.readthedocs.io/en/master/ext/commands/cogs.html#ext-commands-cogs) page.

When inheriting from this class, the options shown in [`CogMeta`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CogMeta "discord.ext.commands.CogMeta") are equally valid here.
lucid gazelle
#

thanksss

#
@commands.cooldown(1, 3600, commands.BucketType.user)
@is_registered
async def daily(ctx: commands.Context):
    random_amount = random.randint(40, 180)
    await economy.add_money(ctx.message.author.id, "wallet", random_amount)
    embed = discord.Embed(
        colour=discord.Color.from_rgb(47,49,54)
    )
    embed.add_field(name=f"Daily", value=f"You successfully claimed, random_amount 💎!")
    embed.set_footer(text=f"Invoked by {ctx.message.author.name}", icon_url=ctx.message.author.avatar_url)
    await ctx.reply(embed=embed)```
#

how can I put the amount in You successfully claimed (random_amount)?

slate swan
#

!f-string

#

!f-strings

unkempt canyonBOT
#

Creating a Python string with your variables using the + operator can be difficult to write and read. F-strings (format-strings) make it easy to insert values into a string. If you put an f in front of the first quote, you can then put Python expressions between curly braces in the string.

>>> snake = "pythons"
>>> number = 21
>>> f"There are {number * 2} {snake} on the plane."
"There are 42 pythons on the plane."

Note that even when you include an expression that isn't a string, like number * 2, Python will convert it to a string for you.

slate swan
#

Use a f string , it's similar to ` ` strings in js

lucid gazelle
#

oh okayyy

#

uhmmm how can i put the amount?

slate swan
#

f"You got {amount}"

lucid gazelle
#

okayyy thanksss

#

its random

#

so f"You successfully claimed {random_amount} 💎"

#

?

#

@slate swan

slate swan
#

Yeah it will work

lucid gazelle
#

okay thanksss

quaint epoch
#

how do i get the member icon

#

!d disnake.Member.avatar

unkempt canyonBOT
#

property avatar```
Equivalent to [`User.avatar`](https://docs.disnake.dev/en/latest/api.html#disnake.User.avatar "disnake.User.avatar")
quaint epoch
#

hm, does it return an image? and if so bytes?

slate swan
#

it returns an discord.Asset object

#

!d discord.Asset

unkempt canyonBOT
#

class discord.Asset```
Represents a CDN asset on Discord.

str(x) Returns the URL of the CDN asset.

len(x) Returns the length of the CDN asset’s URL.

x == y Checks if the asset is equal to another asset.

x != y Checks if the asset is not equal to another asset.

hash(x) Returns the hash of the asset.
slate swan
#

if you want the file , you can .read() it

quaint epoch
#

and when i do that, it says it has an invalid start byte

#

.read() returned a bunch of bytes

#

but it just gave an error for the bytes

steel void
#
@client_main.event
async def on_message(message):
    if message.author == client_main.user:
        return

    if 'th' in message.content and 'upgrade' in message.content:
        await message.channel.send('As a reminder make sure youre fully maxed defence, troops, heroes, and spells before you upgrade. **We do not allow rushing, if you rush we will ban you unless if you get direct permission from Vondy.** Rushing is stupid 98% of the time.')

    elif 'townhall' in message.content and 'upgrade' in message.content:

        await message.channel.send('As a reminder make sure youre fully maxed defence, troops, heroes, and spells before you upgrade. **We do not allow rushing, if you rush we will ban you unless if you get direct permission from Vondy.** Rushing is stupid 98% of the time.')

    elif '!rushed' in message.content or '!upgrade' in message.content:
        await message.channel.send(' As a reminder make sure youre fully maxed defence, troops, heroes, and spells before you upgrade. **We do not allow rushing, if you rush we will ban you unless if you get direct permission from Vondy.** Rushing is stupid 98% of the time.')

    elif 'should' in message.content and 'upgrade' in message.content:
        await message.channel.send(' As a reminder make sure youre fully maxed defence, troops, heroes, and spells before you upgrade. **We do not allow rushing, if you rush we will ban you unless if you get direct permission from Vondy.** Rushing is stupid 98% of the time.')
``` why does this code break every command ?
#

for example as soon as i comment this out, my !who and my !uptime command works

quaint epoch
#

at the end*

steel void
#

will try it

#

it worked thanks, i was so confused haha

final iron
#

Is it possible to create a check (bot.check) inside a cog/class?

sullen shoal
sullen shoal
#

!d discord.ext.commands.Bot.before_invoke

unkempt canyonBOT
#

@before_invoke```
A decorator that registers a coroutine as a pre-invoke hook.

A pre-invoke hook is called directly before the command is called. This makes it a useful function to set up database connections or any type of set up required.

This pre-invoke hook takes a sole parameter, a [`Context`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Context "discord.ext.commands.Context").

Note

The [`before_invoke()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.before_invoke "discord.ext.commands.Bot.before_invoke") and [`after_invoke()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.after_invoke "discord.ext.commands.Bot.after_invoke") hooks are only called if all checks and argument parsing procedures pass without error. If any check or argument parsing procedures fail then the hooks are not called.
sullen shoal
#

Context.command
will return thecommands.Command instance of the invoking command

#

for example,

if ctx.command.name in ("upgrade", "townhall"):
    await ctx.send(...)```
woven ingot
#

Could anyone help me out my embed isn't working am i doing something wrong?

#
@client.command()
async def cher(ctx):
  embed = discord.Embed(
    title = 'Cherry Network',
    description = "The Cherry Project is a Decentralized Autonomous Organization developing a layer one blockchain network optimized for data operations.",
    colour = discord.Colour.orange()
  )
embed.add_field(name="Field 1 Title", value="This is the value for field 1. This is NOT an inline field.", inline=False)
  await ctx.send(embed=embed)```
cobalt jacinth
#

how many bots can i make on 1 account ?

slate swan
#
from​ ​io​ ​import​ ​BytesIO 
 ​from​ ​PIL​ ​import​ ​Image 
 Image​.​open​(​BytesIO​(​await​ ​user​.​display_avatar​.​read​()))
``` this is what I used to get a byte and open it
quaint epoch
#

but it says that the first byte is invalid

slate swan
#

Just use .url

#

And send the link...

sullen shoal
quaint epoch
slate swan
quaint epoch
#

so i don't have code

sullen shoal
#

put a print statement

slate swan
cobalt jacinth
#

okok

slate swan
sullen shoal
slate swan
slate swan
quaint epoch
#

but just letting you know i did py async def bm(ctx, message_id): message = await ctx.fetch_message(message_id) author = await ctx.guild.fetch_member(message.author.id) embed = discord.Embed() image = author.avatar.read() embed = embed.footer(text=f'{image} {author} sent {message.content}')

slate swan
#

You cannot send an byte object.....

#

if you want the icon to appear in the embed below , use the icon_url kwarg

sullen shoal
#

4 yr old tho

#

its 25 ig

slate swan
slate swan
quaint epoch
#

i'll try it when i get back on my device

quaint epoch
sullen shoal
#

you dont even need to do get it

#

message.author will return member when possible

#

in dms, it wont

quaint epoch