#discord-bots

1 messages · Page 311 of 1

shrewd fjord
#

Image not working rip

slate swan
#

global skull

pulsar lance
#

Guys is python good for bot or js

#

To make one bot for discord

final iron
slate swan
pulsar lance
#

Yes

shrewd fjord
#

GPT knows all indeed 🤓

pulsar lance
#

But which one is good

shrewd fjord
#

Didnt robin answer you question already?

slate swan
#

both are good

shrewd fjord
#

Uff typical discord issue, messages aint loading

final iron
pulsar lance
#

Both

#

Bro I have to go bye

final iron
#

what lmao

shrewd fjord
pulsar lance
#

Ok I’m come

#

@final iron how old are you

final iron
#

Why

pulsar lance
#

Gasy ask

final iron
#

Gasy?

pulsar lance
#

I’m in school I can talk so good sorry bro

#

❤️❤️

final iron
#

???

pulsar lance
#

Omg

pulsar lance
cold oyster
#

Is it possible to get the id of the channel the command was used in?

#

I need it for my logging system

#

alr tysm

shrewd fjord
unkempt canyonBOT
shrewd fjord
#

Check the Context class actually, useful stuff u may find for your logging system

cold oyster
#

ctx.guild.name ?

shrewd fjord
#

Mhm

#

As i said check out the Context class :)

cold oyster
pulsar lance
#

Hello

#

Guys

slate swan
#

!ot

unkempt canyonBOT
pulsar lance
#

! Hi

#

!hi

unkempt canyonBOT
#
Type hints

A type hint indicates what type a variable is expected to be.

def add(a: int, b: int) -> int:
    return a + b

The type hints indicate that for our add function the parameters a and b should be integers, and the function should return an integer when called.

It's important to note these are just hints and are not enforced at runtime.

add("hello ", "world")

The above code won't error even though it doesn't follow the function's type hints; the two strings will be concatenated as normal.

Third party tools like mypy can validate your code to ensure it is type hinted correctly. This can help you identify potentially buggy code, for example it would error on the second example as our add function is not intended to concatenate strings.

mypy's documentation contains useful information on type hinting, and for more information check out this documentation page.

buoyant quail
#

huh

#

hi = typehints

final iron
#

!src hi

unkempt canyonBOT
#
Bad argument

Unable to convert 'hi' to valid command, tag, or Cog.

final iron
#

!src typehints

unkempt canyonBOT
#
Bad argument

Unable to convert 'typehints' to valid command, tag, or Cog.

#
Command Help

!source [source_item]
Can also use: src

Display information and a GitHub link to the source code of a command, tag, or cog.

buoyant quail
#

it comes from tags

final iron
#

Weird

#

Oh

#

So are they checking in on_message then?

#

Since it’s not a valid command

buoyant quail
#

idk

obsidian fable
#

hello, right now I am using subprocess to execute ffmpeg commands, which blocks discord, is there a better way to execute ffmpeg without blocking?


        subprocess.run(['ffmpeg', '-protocol_whitelist', 'file,http,https,tcp,tls,crypto', '-i', temp_file, '-bsf:a', 'aac_adtstoasc', '-loglevel', 'fatal', ffmpeg_output])

fading marlin
#

Use subprocess.Popen. run calls communicate internally which is blocking

pulsar lance
#

yo

#

can someonea

#

help me

#

how to make kick and bun command in discord

sick birch
unkempt canyonBOT
#

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

Kicks this member. Equivalent to [`Guild.kick()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild.kick).
sick birch
#

!d discord.Member.ban

unkempt canyonBOT
#

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

Bans this member. Equivalent to [`Guild.ban()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild.ban).
sick birch
#

Should be about all you'd need

spark nimbus
#

hey, i am making a suggstion command but i cant seem to work it out.. can you help?

the code:

@bot.command()
async def sug(ctx, *, suggestion):
    embed = discord.Embed(title = f'{message.author.name} has punlished a suggestion', description = f'The suggeestion that {message.author.name} has created is: {suggestion}', color = 0x749FDC)
    embed.add_field(name = "Suggestion id:", value = f"{suggestion.id}")
    await suggeestion.send_reaction(":white_check_mark:")
    await suggeestion.send_reaction(":x:")
    await ctx.send(embed = embed)

the error:
Command raised an exception: NameError: name 'message' is not defined

desert kiln
desert kiln
#

And not the channel where it was executed

spark nimbus
desert kiln
#

I will try fix this command for you now

#

Give me about 10 - 15 mins

spark nimbus
#

ok, could you tag me and tell me what you changeed?

desert kiln
#

yep :)

spark nimbus
#

🤗

sick birch
#

The ID of the message? Something you generate yourself?

spark nimbus
sick birch
spark nimbus
#

ok

#

THX

sick birch
#

Also unrelated but suggestions lend themselves well to a modal

desert kiln
# spark nimbus ok

I fixed the command for you, but I'm not gonna spoon feed so please look up a tutorial on how to make it send to different channels

Current Code:

@bot.command()
async def suggestion(ctx, *, suggestion):
    characters = string.ascii_letters + string.digits
    suggestion_id = ''.join(random.choice(characters) for _ in range(7))
    embed = discord.Embed(title = f'{ctx.author.name} has published a suggestion', description = f'The suggestion that {ctx.author.name} has created is: {suggestion}', color = 0x749FDC)
    embed.add_field(name= "Suggestion ID:", value = f"{suggestion_id}")
    embed.add_field(name= "Message ID", value=ctx.message.id)
    await ctx.message.add_reaction('✅')
    await ctx.send(embed = embed)```
desert kiln
spark nimbus
pulsar lance
#

Bro how can I make / command in my bot and I have to make bot in JavaScript or something else

desert kiln
pulsar lance
#

Ok

#

Can you make a how to get python video

#

If you can

desert kiln
#

huh

pulsar lance
#

Plz I can’t download

spark nimbus
#

gave me the error:

characters = string.characters+ string.digits
                 ^^^^^^
NameError: name 'string' is not defined```
about the script part:
``` characters = string.ascii_letters + string.digits```
can you help?
@</ Astral >
desert kiln
#

Ah yes sorry

#

at the top of your imports put this

import string

#

@spark nimbus

spark nimbus
#

@desert kiln

desert kiln
#

So you want the reaction on the embed correct?

desert kiln
#

Give me 2 mins

spark nimbus
#

ok

sick birch
spark nimbus
#

maybe: embed.add_reaction("reaction") ?

sick birch
spark nimbus
#

ok

spark nimbus
sick birch
spark nimbus
desert kiln
#

Instead of buttons, 2 emoji reactions would be easier

#

⬆️⬇️

spark nimbus
#

ok, ho do i add them?

desert kiln
#

I'm doing it now

sick birch
spark nimbus
#

I dont really carwe

desert kiln
#

yea but then you have to make even longer of a command

sick birch
desert kiln
spark nimbus
still spade
#

so as i m creating an discord bot for python
@client.event
async def on_message(message):
if message.content.lower().startswith('?hi'):
await message.channel.send(f"Hello! How can I help you today?")

i m writing this block of code for an command when it got triggered however its not working and rather when i send message on a dm to bot it then replies so how can i fix it ?

desert kiln
#

Check your intents

still spade
#

all true

#

stuck on this for a long time aha

#

any solutions or help from u all i can get

desert kiln
#

Well, are you wanting it a command, or on_message event?

still spade
#

on_message event like when an user send?hi the bot on the reply send hi and blah blah

desert kiln
#

why "?hi"?

#

why the question mark

still spade
#

like just as an prefix aur should i also set the prefix default ?

desert kiln
#

Just make your hi thing, into a command

still spade
#

tho i want on an specific msg only thats why

#

not on others /\

desert kiln
#

if you're gonna use a prefix to begin with

still spade
#

also if i am just sending msg hi and removing '?' from code aswell the bot is not replyign to me

sick birch
#

Sounds like a message content intents issue

still spade
#

hey robin i have set it to be true

sick birch
#

Can we see?

spark nimbus
still spade
#

yeah sure lemme share the code

#firstly we need to connect to the discord bot using out token

import discord #discord module to add
token = ""
intents = discord.Intents.default()
client = discord.Client(intents=intents) #connecting to the discord API
intents.messages = True
intents = discord.Intents.default() # create a default Intents instance
intents.message_content = True # enable message content intents
@client.event
async def on_ready ():
print(f"Bot logged in as {client.user}")
user_count = sum(guild.member_count for guild in client.guilds)
await client.change_presence(activity=discord.Game(name=f"Listening to {user_count} user"))
#for server await.client.change_presence(activity=discord.Game(name=f"listeing to {len(client.guilds)} servers"))

@client.event
async def on_message(message):
if message.content.lower().startswith('hi'):
await message.channel.send(f"Hello! How can I help you today?")

client.run(token)

dont mind the comments i m an begnieer in this so to remind myself i add cmnts

#

i have also enable from here aswell

desert kiln
sick birch
desert kiln
#

Anyways, imma go back to working on my economy bot :)

#

good luck with what your doing @still spade

final iron
spark nimbus
still spade
sick birch
still spade
sick birch
#

Well, I guess technically you can but you completely re-assigned it with a new object so

final iron
desert kiln
# spark nimbus when you will be free pls send me... <@1120856443659235498>
@bot.command()
async def suggestion(ctx, *, suggestion):
    characters = string.ascii_letters + string.digits
    suggestion_id = ''.join(random.choice(characters) for _ in range(7))
    embed = discord.Embed(title = f'{ctx.author.name} has published a suggestion', description = f'The suggestion that {ctx.author.name} has created is: {suggestion}', color = 0x749FDC)
    embed.add_field(name= "Suggestion ID:", value = f"{suggestion_id}")
    embed.add_field(name= "Message ID", value=ctx.message.id)
    message = await ctx.send(embed=embed)
    await message.add_reaction('⬆️')
    await message.add_reaction('⬇️')```
spark nimbus
#

THX

#

LOVE YOU

still spade
desert kiln
still spade
#

Tho if u just want that on the msg 'hi' it trigger would it work like not including any prefix

desert kiln
still spade
#

It to trigger any time says hi

strong sage
#

I would like to create a Flask server, and when the server receives a request, the bot sends a message to a Discord channel. I've been working on it for days

desert kiln
#

Send me your current code

pulsar lance
#

@desert kiln Bro send me a /command with py

pulsar lance
#

Why

#

Bro

desert kiln
pulsar lance
#

Ok

still spade
#

@desert kiln

#firstly we need to connect to the discord bot using out token

import discord #discord module to add
token = ""
intents = discord.Intents.default()
client = discord.Client(intents=intents) #connecting to the discord API
intents.messages = True
intents = discord.Intents.default() # create a default Intents instance
intents.message_content = True # enable message content intents
@client.event
async def on_ready ():
print(f"Bot logged in as {client.user}")
user_count = sum(guild.member_count for guild in client.guilds)
await client.change_presence(activity=discord.Game(name=f"Listening to {user_count} user"))
#for server await.client.change_presence(activity=discord.Game(name=f"listeing to {len(client.guilds)} servers"))

@client.event
async def on_message(message):
if message.content.lower().startswith('hi'):
await message.channel.send(f"Hello! How can I help you today?")

client.run(token)

dont mind the comments i m an begnieer in this so to remind myself i add cmnts
@.error.404.

Also i just want hi only

pulsar lance
#

Ok thx so much

pulsar lance
#

What is this

#

Can I make web with py

sick birch
still spade
desert kiln
# still spade I change it like in vs tho same issue Also Can u share me the edited part so i...
import discord
from discord.ext import commands

intents = discord.Intents.all() # Bot Intents (all)
token = "" # Put Your Bot Token Here
# Change The Prefix To What You Want
client = commands.Bot(command_prefix="!", intents=intents)

@client.event
async def on_ready ():
    print(f"Bot logged in as {client.user}")
    user_count = sum(guild.member_count for guild in client.guilds)
    await client.change_presence(activity=discord.Game(name=f"Listening to {user_count} user"))
    

@client.event
async def on_message(message):
 if message.content.lower().startswith('hi'):
    await message.channel.send(f"Hello! How can I help you today?")

# Run The Client Instance

client.run(token)```
#

I added notes for you to understand what the code is doing

#

If you need further explanation ping me about anything

desert kiln
desert kiln
#

Sorry about that

desert kiln
#

Hey @sick birch can you suggest some stuff for me to make, I'm wanting a challenge, but I'm not sure what to code, for a discord bot

pulsar lance
#

Z

sick birch
desert kiln
#

you just spoke another language brainmon

strong sage
sick birch
strong sage
#

the request provides an id, and it needs to send a message to the dm using that id

final iron
#

Spoonfeeding poor code is another level

desert kiln
final iron
mystic marsh
#

^

final iron
#

Helping a user would be linking to documentation and examples. Not directly making it for them

#

Most people just copy and paste the code in, and don’t understand what it does

mystic marsh
#

^

final iron
#

In my experience, this leads to a ton of beginners asking for help with fixing their code, when they don’t know what it does

#

I blame tutorials mostly for that

#

The amount of people that don’t know what an object is because a tutorial spoonfeed them code is too high

slate swan
#

why my commands r not getting registered

@bot.command() async def add(ctx, user_or_role: discord.Member): # Example: Add the user/role to a ticket system await ctx.send(f'Added {user_or_role} to the ticket.')

@bot.event async def on_ready(): print(f'Logged in as {bot.user.name} ({bot.user.id})')

help me out plz 😭

#

`import discord
from discord.ext import commands

intents = discord.Intents.default()
intents.typing = False
intents.presences = False`

#

anyone here plz help

unkempt canyonBOT
#
Discord Message Content Intent

The Discord gateway only dispatches events you subscribe to, which you can configure by using "intents."

The message content intent is what determines if an app will receive the actual content of newly created messages. Without this intent, discord.py won't be able to detect prefix commands, so prefix commands won't respond.

Privileged intents, such as message content, have to be explicitly enabled from the Discord Developer Portal in addition to being enabled in the code:

intents = discord.Intents.default() # create a default Intents instance
intents.message_content = True # enable message content intents

bot = commands.Bot(command_prefix="!", intents=intents) # actually pass it into the constructor

For more information on intents, see /tag intents. If prefix commands are still not working, see /tag on-message-event.

slate swan
naive briar
#

You did not mention slash commands until now

slate swan
#

@naive briar why my commands dont get registered tho??

#

Because what you wrote are not slash commands duh

slate swan
#

Read that

#

k

strong sage
spark nimbus
#

!message_content

unkempt canyonBOT
#
Discord Message Content Intent

The Discord gateway only dispatches events you subscribe to, which you can configure by using "intents."

The message content intent is what determines if an app will receive the actual content of newly created messages. Without this intent, discord.py won't be able to detect prefix commands, so prefix commands won't respond.

Privileged intents, such as message content, have to be explicitly enabled from the Discord Developer Portal in addition to being enabled in the code:

intents = discord.Intents.default() # create a default Intents instance
intents.message_content = True # enable message content intents

bot = commands.Bot(command_prefix="!", intents=intents) # actually pass it into the constructor

For more information on intents, see /tag intents. If prefix commands are still not working, see /tag on-message-event.

spark nimbus
#

how do i get the channel that some one wrote the like ctx.author.channel?

#

how does it work?

spark nimbus
spark nimbus
sick birch
spark nimbus
#

TY

slate swan
#

i assume the issue is with the embed, but i can't see where i'm going wrong

@client.event
async def on_message_delete(message):
    server = client.get_guild(1153285434907045888) 
    if message.guild == server:
        author = message.author
        deleter = message.guild.get_member(message.author.id)
        content = message.content
        avatar_url = author.avatar_url
        

        channel = client.get_channel(1159728026641240124)
        
        embed = discord.Embed(title=f"Message deleted by {deleter.display_name} ({deleter.id})", description=f"{content}")
        embed.set_footer(text=f"Author: {author.display_name} ({author.id})", icon_url=f"{avatar_url}" )
        
        await channel.send(embed=embed)
#

oh wait

#

nvm

#

i thought i found the issue

#

what's the issue

#

nothing happens on message delete

#

previously, i used the same command without an embed and it worked

rotund flame
#

client.get_channel(1159728026641240124)

this channel exists?

slate swan
#

it's 100% an issue with the embed

#

i've changed nothing other than adding one

#

isn't it author.avatar.url?

spark nimbus
#

well, i have this code of message edit:

@bot.event
async def on_message_edit(message_before, message_after):
    embed = discord.Embed(title = f"{message_before.author.name} has edited a message (user id: {message_before.author.id}).", color =0x0051FF)
    embed.add_field(name = "Before Message", value = f"{message_before.content}", inline = False)
    embed.add_field(name = "Afetr Message", value = f"{message_after.content}", inline = False)
    embed.add_field(name = "Channel:", value = f"{message.channel.mention}", inline = False)
    embed.set_footer(text ="This bot was made by _mr3x. ")
    channel = bot.get_channel(1139331476559757412)
    await channel.send(embed = embed)

and I want to tag the channel in the last field i tried message.channel.mention
should i try message_before.channel.mention?

slate swan
#

it's author.avatar_url

#

what version are you on

rotund flame
slate swan
#

i said earlier, up until i added the embed, everything worked fine

#

ignore the weird image

rotund flame
#

😭 dude

slate swan
#

💀

slate swan
slate swan
# slate swan can i see your preiviois code
@client.event
async def on_message_delete(message):
    server = client.get_guild(1153285434907045888)  # Replace YOUR_SERVER_ID with your server's ID
    if message.guild == server:
        author = message.author
        deleter = message.guild.get_member(message.author.id)
        content = message.content

        reupload_message = f"Message deleted by {deleter.display_name} ({deleter.id})\nAuthor: {author.display_name} ({author.id})\nContent: {content}"

        channel = client.get_channel(1159728026641240124)  # Replace with your desired channel ID
        
        
        await channel.send(reupload_message)
#

latest

#

so nothinh gets sent at all?

slate swan
#

print(avatar_url)

#

try removing your icon url and see if it sends

slate swan
#

that shit worked 😭

#

why he say fuck me for

#

cus i was sure that wasnt the issue

#

and it was

#

it's because your icon_url variable is wrong

#

thx for the help

#

you can still use icon just fix the variable

rotund flame
slate swan
#

you probably also have an incorrect error handler since you didn't receive any error

spark nimbus
#

and adding user avatar as a thumbnail in event is ctx.user.avatar

code:

async def on_member_join(member):
    logchannel = bot.get_channel(channel ID)
    embed = discord.Embed(title = "new member joined", description = f"{member.mention} has landed from the battle pass!", color =0x095dfc)
    embed.set_footer(text ="This bot was made by _mr3x. ")
    await logchannel.send(embed=embed)

what i should do:
add embed.add_thumbnail(url = ctx.user.avatar) ?

vocal laurel
#

!d discord.Guild

unkempt canyonBOT
#

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

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

x == y Checks if two guilds are equal.

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

hash(x) Returns the guild’s hash.

str(x) Returns the guild’s name.
mystic marsh
#

Check the docs

still spade
civic reef
#

please anyone tell me step by step guide

#

I watched YT videos but didn't got clear idea

mystic marsh
still spade
#

if u want the source public u can use replit

#

tho token can be stealed

slate swan
#
import discord
from discord.ext import commands

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

    @commands.Cog.listener()
    async def on_ready(self):
        print('[+] Ping')

    @commands.command()
    async def ping(self, ctx):
        latency = round(self.bot.latency * 1000)
        embed = discord.Embed(title="🏓 Pong!", description=f'Latency: {latency}ms', color=0x800080)
        await ctx.send(embed=embed)

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

discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.ping' raised an error: TypeError: object NoneType can't be used in 'await' expression

unkempt canyonBOT
#
Traceback

Please provide the full traceback for your exception in order to help us identify your issue.
While the last line of the error message tells us what kind of error you got,
the full traceback will tell us which line, and other critical information to solve your problem.
Please avoid screenshots so we can copy and paste parts of the message.

A full traceback could look like:

Traceback (most recent call last):
  File "my_file.py", line 5, in <module>
    add_three("6")
  File "my_file.py", line 2, in add_three
    a = num + 3
        ~~~~^~~
TypeError: can only concatenate str (not "int") to str

If the traceback is long, use our pastebin.

slate swan
# naive briar !traceback
  bot.add_cog(Ping(bot))
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Traceback (most recent call last):
  File "C:\Users\<USERNAME>\Downloads\bot\env\Lib\site-packages\discord\ext\commands\bot.py", line 947, in _load_from_module_spec
    await setup(self)
TypeError: object NoneType can't be used in 'await' expression

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "c:\Users\<USERNAME>\Downloads\bot\main.py", line 68, in <module>
    asyncio.run(main())
  File "C:\Users\<USERNAME>\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "C:\Users\<USERNAME>\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\<USERNAME>\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "c:\Users\<USERNAME>\Downloads\bot\main.py", line 63, in main
    await load()
  File "c:\Users\<USERNAME>\Downloads\bot\main.py", line 60, in load
    await client.load_extension(f'cogs.{filename[:-3]}')
  File "C:\Users\<USERNAME>\Downloads\bot\env\Lib\site-packages\discord\ext\commands\bot.py", line 1013, in load_extension
    await self._load_from_module_spec(spec, name)
  File "C:\Users\<USERNAME>\Downloads\bot\env\Lib\site-packages\discord\ext\commands\bot.py", line 952, in _load_from_module_spec
    raise errors.ExtensionFailed(key, e) from e
discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.ping' raised an error: TypeError: object NoneType can't be used in 'await' expression
naive briar
compact lion
#

yo guys I have problem with my bot

#

this is the list of bad words

#

but when I say yapicam he block my message

#

but yapicam isn't in the list?

turbid condor
#

Even if you type picture it will get deleted too

compact lion
slate swan
#

[2023-10-12 16:33:38] [WARNING ] discord.ext.commands.bot: Privileged message content intent is missing, commands may not work as expected.

holy this doesnt even get fixed i even enabled in dev portal also restarded bot and stuff still doesnt go away

final iron
final iron
#

When someone explains something and you respond simply with "wdym" or "I don't understand", that is extremely unhelpful. It tells us nothing about which part you didn't understand or how we can target the explanation to help you. It roughly translates to

Please re-explain everything and pick random different words in the hopes that I get it this time.

Ask targeted questions about what you did not understand. If you didn't understand anything, split it up into individual parts and ask about one at a time specifically.

slate swan
#

it got fixed

slate swan
#

[2023-10-12 17:01:58] [INFO ] discord.client: logging in using static token [2023-10-12 17:02:00] [INFO ] discord.gateway: Shard ID None has connected to Gateway (Session ID: 488f34c7f241278193a7f31edaa74566). Logged in as BotX-acc-lister

got fixed xd

#

@final iron 1 more help commands dont get registered even im using await bot.tree.sync()

#

`@bot.event
async def on_ready():
try:
await bot.change_presence(activity=discord.Game("Made by BotX"))
print(f'Logged in as {bot.user.name}')
except Exception as e:
print(f'Error in on_ready: {e}')

    await bot.tree.sync()

Event for handling command errors

@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandError):
output_text = f"An error occurred: {error}"
await ctx.send(output_text)
`

#

also im using @bot.command

#

anyone can help me fix it??

desert kiln
slate swan
slate swan
# desert kiln what's the problem?

``@bot.event
async def on_ready():
try:
await bot.change_presence(activity=discord.Game("Made by BotX"))
print(f'Logged in as {bot.user.name}')
except Exception as e:
print(f'Error in on_ready: {e}')

    await bot.tree.sync()

Event for handling command errors

@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandError):
output_text = f"An error occurred: {error}"
await ctx.send(output_text)
`

im using this but still not able to register commands

#

also im using @bot.command

#

@bot.command(name="ticket_add", description="command to add a user to a ticket") async def ticket_add(ctx, user: discord.Member): # Implement /ticket-add command logic here output_text = f'Added {user} to the ticket.' await ctx.send(output_text)

this is command :(

desert kiln
slate swan
slate swan
desert kiln
#

strange

slate swan
#

idk why

slate swan
#

i can provide code

slate swan
#

this is my code

desert kiln
#

I suggest using cogs, if you aren't

final iron
#

It won’t register as a slash command

#

You also shouldn’t be changing your presence, or syncing your tree in on_ready

slate swan
#

then??

#

@final iron how can i fix it tho?

final iron
#

Fix what

slate swan
final iron
#

Like I said, you cannot register prefixed commands

#

Prefixed commands are handled by you

#

You’d need to create app commands

slate swan
#

ok

rugged shadow
turbid condor
#

It accepts an activity arg

rugged shadow
#

ok thx

turbid condor
#

Or you can use a task incase you want to change presence at specific intervals and start it in setup hook or along with your sync command or something similar so that the request to start the task is sent only once

final iron
unkempt canyonBOT
#

class discord.ext.commands.Bot(command_prefix, *, help_command=<default-help-command>, tree_cls=<class 'discord.app_commands.tree.CommandTree'>, description=None, intents, **options)```
Represents a Discord bot.

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

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

Unlike [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client), this class does not require manually setting a [`CommandTree`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CommandTree) and is automatically set upon instantiating the class.

async with x Asynchronously initialises the bot and automatically cleans up.

New in version 2.0.
final iron
#

status and activity

#

Or, use a task

gray grotto
#

!d discord dont dm command

unkempt canyonBOT
#

In order to work with the library and the Discord API in general, we must first create a Discord Bot account.

Creating a Bot account is a pretty straightforward process.

final iron
gray grotto
# final iron What are you looking for

i have an AI bot but its interacting with other people in DM i want it to interact only in guild and with me. i have tried all the code guild only command but its still replying other in DM

final iron
gray grotto
gray grotto
#

i am tired of it !

final iron
naive briar
#

Don't give anyone bots' tokens

gray grotto
spark nimbus
#

how can i create roles log like: [random role] has been added to [user]

#

or removed

kind roost
#

what are the scripts to create add roles and remove roles from people

spark nimbus
final iron
pulsar lance
#

O

slate prairie
#

hello everyone. im new to python and i want to do my discord bot ig so im searching for someone to code with me and i could learn something from it

still spade
#

embed.set_image()
can we like set personal properties for it like how much width i want or height etc /

still spade
#

ight thnx

still spade
#

what is the api for like an suggestion adding

#

and where can i find its details

final iron
#

You want to suggestion an addition to the discord API?

still spade
#

no

#

like i want to create like this on my own is there any documantation of api on it ?

final iron
#

That’s not how Discords API works

#

The API and discord.py provide you with a toolset, and you have to create the features yourself

still spade
#

alright got it

#

so like we would generate random suggestion id or like there would be any ? @final iron

final iron
still spade
#

so like we can just use msg id right

final iron
#

???

#

Literally what I said

still spade
#

yeh got it

fallow mauve
#

hey im trying to get back into coding after a long break and i downlaoded vsc and started to set up a bot with discord.py and it says discord isnt a module i can import, did something happen that prevent this or am i just dumb

fallow mauve
#

whats that

#

if it became a thing in the last year or so i dont know about it

final iron
#

They’ve been around for a lot longer than that

unkempt canyonBOT
#
Virtual environments

Virtual environments are isolated Python environments, which make it easier to keep your system clean and manage dependencies. By default, when activated, only libraries and scripts installed in the virtual environment are accessible, preventing cross-project dependency conflicts, and allowing easy isolation of requirements.

To create a new virtual environment, you can use the standard library venv module: python3 -m venv .venv (replace python3 with python or py on Windows)

Then, to activate the new virtual environment:

Windows (PowerShell): .venv\Scripts\Activate.ps1
or (Command Prompt): .venv\Scripts\activate.bat
MacOS / Linux (Bash): source .venv/bin/activate

Packages can then be installed to the virtual environment using pip, as normal.

For more information, take a read of the documentation. If you run code through your editor, check its documentation on how to make it use your virtual environment. For example, see the VSCode or PyCharm docs.

Tools such as poetry and pipenv can manage the creation of virtual environments as well as project dependencies, making packaging and installing your project easier.

Note: When using PowerShell in Windows, you may need to change the execution policy first. This is only required once per user:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
still spade
#

@final iron so yeh need help i have create an async def suggestions (sugg)
And then the code but the thing i want is that like i it should be do on a command like ! Suggestion like that also when i m trying to get the user id do we need to add on_message ?

final iron
still spade
#

commands.Bot(command_prefix="!")
Yes i have set up to this and while adding a suggestion things i m doing like this
Client.command
Async def suggestion (ctx):
Tho i need help to understand how would we fetch the user id as in this now

final iron
unkempt canyonBOT
final iron
unkempt canyonBOT
#

property id```
Equivalent to [`User.id`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User.id)
still spade
#

@final iron @client.command
async def suggestion(ctx):
embed = discord.embed(title='An suggestion Published by {message.author.name} user',description="The suggestion that {message.author.name} has published is {message.content},color = discord.Color.pink()")
embed.add_field(name = "Message ID",)
await client.reply(embed=embed)
await client.add_reaction('⬆️')
await client.add_reaction('⬇️')

i have wrote this tho when doing the command in server the bot doesnt response also there is no error in the terminal how can i fix it ? / whats the error

final iron
#

You should be getting an error

#

client.add_reaction doesn’t exist

#

client.reply doesn’t exist

#

message is undefined

#

discord.embed isn’t a class or function

#

value is a required arg

nova vessel
sick birch
nova vessel
#

I was wondering if there was documentation for them using discord.py

final iron
#

!d discord.app_commands.CommandTree

unkempt canyonBOT
#

class discord.app_commands.CommandTree(client, *, fallback_to_global=True)```
Represents a container that holds application command information.
final iron
#

I would definitely look at the examples in the repo

nova vessel
#

Where is the repo for examples?

final iron
turbid condor
still spade
harsh orbit
#

I have list of roles how I can check if there is a role in user.roles and know what is it

#

like
[role1, role2, role3]
if the user have any of this role an action will happen also I will know what the role

naive briar
#

If one is, break the loop

harsh orbit
#

Can you show example ?

naive briar
#

Of?

harsh orbit
#

the loop

#

only the loop

naive briar
#

Like any for-in-loops

harsh orbit
#

How to check if only 1 thing in list in user.roles?

naive briar
#

The in statement:

something in some_list
harsh orbit
#

But the user has another roles that not in the list

naive briar
#

What's about them? You just want to check if any of your defined roles is in them, isn't it?

harsh orbit
#
                        roles = [role1, role2, role3, role4, role5, role6, role7]
                        for i in roles:
                            if i in interaction.user.roles:
                                print("Yes")

Like this?

naive briar
#

Yes

still spade
vapid parcel
still spade
#

discord.ext.commands.errors.CommandRegistrationError: The command help is already an existing command or alias.

i m getting this error although there are no help cmnd there is just one that shows however it is now showing error that it already exist

mystic marsh
mystic marsh
#

Mind sharing.

still spade
vapid parcel
#

bot.remove_command("help")

mystic marsh
#

yep, can I see your help command. And how have you defined client.

vapid parcel
#

define bot.remove_command("help") above the help command

#

but use client, i use bot, but you use client

still spade
#

i m using client

vapid parcel
#

i just say that lol

mystic marsh
#

He doesn't have to necassarily, depends how he's running the code, using cogs etc.

mystic marsh
#

What?

vapid parcel
#
client = commands.Bot(command_prefix="!", intents=intents)
client.remove_command('help')
@client.event
async def on_ready ():
    print(f"Bot logged in as {client.user}")
    user_count = sum(guild.member_count for guild in client.guilds)
    await client.change_presence(activity=discord.Game(name=f"Listening to {user_count} user"))

#two things happening in the api if on_message 1 reply on the mention and one reply when an bot detects the triggered message and lastly !help trigger


@client.event
async def on_message(message):
 if message.content.lower().startswith('hey'):
    await message.channel.send(f"Hello! How can I assist you today?")
 if client.user.mentioned_in(message):
      await message.reply(f"My prefix is '!' if you need more help type '!' help")


@client.command()
async def help(ctx):
         #make the things in embed version and send its feature of the bot 
         embed = discord.Embed(title="Commands of Bot", description="This is the description of the embed.",color = discord.Color.red())
         embed.set_footer(text ="An project of Abdullah development !",icon_url="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTEHfmHcrz102p1QsLJuo0XPOgofu4WaMpQp_M1_3kBXw&s")
         embed.set_thumbnail(url="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRnoWVyWgqFjnNyli14PKLfell97OCM7BlmrJnhG-R9dA&s")
         embed.set_image(url="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTRmAqo26QA87kUluxNHgdnNYtRfFF5f1LHU4EWcscL7w&s")
         await ctx.reply(embed=embed)```
#

better 😭

still spade
#

yeh sorry i forget how to use it

vapid parcel
#

you good lol

mystic marsh
#

and the bot is running, like it prints Bot logged in as ...

vapid parcel
#

thats on_ready

mystic marsh
#

Yes Ik, im asking if it's actually running.

still spade
#

nops giving error discord.ext.commands.errors.CommandRegistrationError: The command help is already an existing command or alias

vapid parcel
#
@client.event
async def on_ready():
    print(f'Logged in as {bot.user.name}')
    print("The bot is now ready for use!")
    print("------------------------------")```
still spade
#

the bot is not even starting when i m running it says

discord.ext.commands.errors.CommandRegistrationError: The command help is already an existing command or alias

#
async def suggestion(ctx, *, suggestion):
        print("Suggestion command trigger   ed.")
        embed = discord.Embed(title=f'An suggestion Published by {ctx.author.name} ', description=f'The suggestion that {ctx.author.name} has published is that **{suggestion}**',color=discord.Color.pink())
        embed.add_field(name = "Message ID",value=ctx.message.id)
        message = await ctx.send(embed=embed)
        await message.add_reaction(':arrow_up:')
        await message.add_reaction(':arrow_down:')  



client.run(token)   

vapid parcel
#

use `

#

3 of them

still spade
#

also the code below is this

still spade
mystic marsh
#

it works for me buddy. Maybe you have some other scripts/cogs.

#

Wait hang on

still spade
#

lemme make txt file send u qwhole code

mystic marsh
#

Ah I see the problem

#

No need for that.

still spade
#

alright

mystic marsh
#

You need to add
await client.process_commands(message) in on message.

vapid parcel
mystic marsh
#

Whats that gotta do with anything?

vapid parcel
#

im asking a question 😭

#

to see if you can help

mystic marsh
#

Oh yea i do

#

lol

vapid parcel
#
import discord
from discord import app_commands
from discord.ext import commands
from env import TOKEN


class Bot(commands.Bot):
    def __init__(self):
        intents = discord.Intents.default()
        intents.message_content = True
        intents.members = True
        intents.reactions = True
        intents.typing = False
        intents.presences = True
        intents.guilds = True
        intents.invites = True
        super().__init__(command_prefix="!", intents=intents)

    async def setup_hook(self):
        await self.tree.sync()

        print(f"Synced slash commands for {self.user}.")

    async def on_command_error(self, ctx, error):
        await ctx.reply(error, ephemeral=True)


bot = Bot()


@bot.hybrid_command(name='test', description='Test')
@app_commands.guilds(1099856442686701630)
async def test(ctx):
    await ctx.send('Test')


bot.run(TOKEN)```
#

how to make a certain command

#

sync to a certain guild

still spade
#
@client.event
async def on_message(message):
 if message.content.lower().startswith('hey'):
    await message.channel.send(f"Hello! How can I assist you today?")
 if client.user.mentioned_in(message):
      await message.reply(f"My prefix is '!' if you need more help type '!' help")
await client.process_commands(message)


#

like this or where

vapid parcel
#

yeah

mystic marsh
#

In await self.tree.sync() you gotta add guild=..

slate swan
#

why doesnt my discord code work it gives always invalid token error but the same code runs on github, replit etc!

vapid parcel
#

thats the goal, so how can i do that?

slate swan
still spade
vapid parcel
#
@client.event
async def on_message(message):
 if message.content.lower().startswith('hey'):
    await message.channel.send(f"Hello! How can I assist you today?")
 if client.user.mentioned_in(message):
      await message.reply(f"My prefix is '!' if you need more help type '!' help")
  await client.process_commands(message)```
mystic marsh
#

Hmmm, well. Im not sure about this one.

vapid parcel
still spade
#

discord.ext.commands.errors.CommandRegistrationError: The command help is already an existing command or alias.

mystic marsh
#

I'll look into it

mystic marsh
#

If I have time

#

Working for someone else rn lol, im a paid dev 😭

vapid parcel
#

i just dont know how to do it, and its sucks for me cuz im a visual learner right? and everyone just sends me text, and expecting me to understand the most

slate swan
vapid parcel
#

examples help the best for me 😭

vapid parcel
#

and even tho i do what the text says, it still fails, thats the sad thing

still spade
mystic marsh
#

if they pay me sure lmao

slate swan
vapid parcel
#

thats why hes trying to do that lol

mystic marsh
#

Send ur code again.

vapid parcel
mystic marsh
#

ali

vapid parcel
#

you gave us no code

still spade
#

alright

mystic marsh
#

beacuse ur token is probably invalid? reset it

vapid parcel
#

and you prolly didnt install libraries

still spade
#

@mystic marsh here is the whole code

#

solved one error in suggestion thing and this error poped up lmaao

still spade
#

discord.ext.commands.errors.CommandRegistrationError: The command help is already an existing command or alias.

slate swan
#

i saw ur code the code u using is used in .py

still spade
#

ayo ik that tho i dont wanna do that i want help only

still spade
slate swan
still spade
slate swan
still spade
#

why is this error comming cant i just use help as the one i dont wanna change it helpme or help_command

#

i want help only and hence how can i do it

slate swan
still spade
#

never mind fixedddd

#

its working now on help

slate swan
still spade
#

ty all

vapid parcel
#

@mystic marsh

final iron
#

You’re sure the token is valid, correct?

vapid parcel
#

its pep

#

the goat.

vapid parcel
# final iron You’re sure the token is valid, correct?

Remember about guild syncing, if anyone ever asks, this is how you do it, just figured it out basically, just so you can help others if they ask.

import discord
from discord import app_commands
from discord.ext import commands
from env import TOKEN


class Bot(commands.Bot):
    def __init__(self):
        intents = discord.Intents.default()
        intents.message_content = True
        intents.members = True
        intents.reactions = True
        intents.typing = False
        intents.presences = True
        intents.guilds = True
        intents.invites = True
        super().__init__(command_prefix="!", intents=intents)

    async def setup_hook(self):
        await self.tree.sync()

        print(f"Synced global slash commands for {self.user}.")

        await self.tree.sync(guild=discord.Object(1154935757631406080))

        print(f"Synced guild slash commands for {self.user}.")

    async def on_command_error(self, ctx, error):
        await ctx.reply(error, ephemeral=True)


bot = Bot()


@bot.hybrid_command(name='test', description='Test')
@app_commands.guilds(1154935757631406080)
async def test(ctx):
    await ctx.send('Test')


bot.run(TOKEN)```
#

discord dpy helped me on this one

turbid condor
#

That's a bad practice

vapid parcel
# turbid condor again don't auto sync

yes i know that, but issue is i gotta figure out how to make it do syncing like that with a sync command, which ill just do later, im tired and wanted to get it done lol

turbid condor
#

If you could do this then it shouldn't be hard putting it in a command

meager rock
#

i just use a flag while running the bot whenever I want to to sync
python main.py --sync does the task for me ( you can use argparse to detect flags)

vapid parcel
#

its simple ik lol

#

it wont be hard XD

#

im just really tired 😭

vapid parcel
# turbid condor If you could do this then it shouldn't be hard putting it in a command
@bot.command()
@commands.guild_only()
@commands.is_owner()
async def sync(ctx: commands.Context, spec: Optional[Literal["~"]] = None) -> None:
    if spec == "~":
        synced = await ctx.bot.tree.sync(guild=ctx.guild)
    else:
        synced = await ctx.bot.tree.sync()

    await ctx.send(
        f"Synced {len(synced)} commands {'to the current guild.' if spec == '~' else 'globally'}."
    )```
#

something like this should work

#

just for what i need

turbid condor
#

You don't need the if else statement

#

And neither the spec parameter

#

Just use this command in server for which you have created it

vapid parcel
#
@bot.command()
@commands.guild_only()
@commands.is_owner()
async def sync(ctx: commands.Context) -> None:
    synced_global = await ctx.bot.tree.sync()
    synced_guild = await ctx.bot.tree.sync(guild=ctx.guild)

    await ctx.send(
        f"Synced {len(synced_global)} commands globally and {len(synced_guild)} commands to the current guild."
    )```
#

so this?

#

to where !sync would just do both

#

instead of doing !sync then doing !sync ~

#

just make !sync do both and gg easy lol

brazen raft
#

Imagine union Discord types

#

Command overloading

slate swan
vapid parcel
#

@turbid condor

#

there we go XD

#

no auto syncing now :)

turbid condor
#

Yeah it's better than auto syncing

#

And you won't run in some rate limit error

vapid parcel
#

yeah i noticied that with auto sync

#

was annoying, but now ion have to deal with that

vapid parcel
#

that shows when you should sync or whatever it was

#

imma save that.

turbid condor
#

Just get it from the forum

#

Or search umbras sync command on google

vapid parcel
#

where at on the website

still spade
#

is it possible to fetch the avatar of user ?

vapid parcel
turbid condor
vapid parcel
#
icon_url=ctx.author.avatar.url```
#

oops mb

turbid condor
#

!d discord.Member.avatar

unkempt canyonBOT
#

property avatar```
Equivalent to [`User.avatar`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User.avatar)
vapid parcel
#

thats author lol, but yeah

still spade
#

ayy thnx

#

in which sections are these cant find

vapid parcel
#

@still spade

#
@bot.hybrid_command(name="avatar", description="Shows the mentioned members avatar")
@commands.guild_only()
async def avatar(ctx, *, member: discord.Member = None):
    if not member:
        member = ctx.message.author

    embed = discord.Embed(
        title=f"{member.display_name}'s Avatar",
        color=0x5865F2
    )

    embed.set_image(url=member.avatar)

    await ctx.send(embed=embed)```
turbid condor
still spade
#

i dont wanna copy paste like i wanna do on my own

vapid parcel
#

heres a basic avatar feature, just change bot.hybrid_command to client.command

turbid condor
vapid parcel
turbid condor
#

I literally fetched you the docs

still spade
still spade
turbid condor
vapid parcel
#

i cant find on the website what you sent me @turbid condor

#

me = stupid

turbid condor
#

!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.
still spade
#

also like can we get what roles user have

and when user joined server and dsicord ?]

vapid parcel
#

yes

meager rock
#

!d discord.Member.roles for a member yes

unkempt canyonBOT
#

property roles```
A [`list`](https://docs.python.org/3/library/stdtypes.html#list) of [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role) that the member belongs to. Note that the first element of this list is always the default [‘@everyone](mailto:'%40everyone)’ role.

These roles are sorted by their position in the role hierarchy.
vapid parcel
#

you can do that, thats really simple

turbid condor
#

!d discord.Member.joined_at

unkempt canyonBOT
#

An aware datetime object that specifies the date and time in UTC that the member joined the guild. If the member left and rejoined the guild, this will be the latest date. In certain cases, this can be None.

vapid parcel
#

theres a lot of cool things for discord bots

turbid condor
#

!d discord.Member.created_at

unkempt canyonBOT
#

property created_at```
Equivalent to [`User.created_at`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User.created_at)
vapid parcel
#

heres an example of one that ive made

turbid condor
vapid parcel
turbid condor
vapid parcel
#

sh

#

okay so basically only sync when i update commands right? or when i add commands?

turbid condor
#

discord just provides a simple way to format it

stark nexus
#

Can anyone help with me error in a music bot?

meager rock
meager rock
#

Nvm you're not using Ytdl

stark nexus
#

im using FFmpeg i guess

vapid parcel
#

use import yt_dlp

meager rock
#

!d discord.Guild.voice_client You need to access the client using

unkempt canyonBOT
#

property voice_client```
Returns the [`VoiceProtocol`](https://discordpy.readthedocs.io/en/latest/api.html#discord.VoiceProtocol) associated with this guild, if any.
vapid parcel
#

yt_dlp is better than youtube_dl

#

its also updated unlike youtube_dl

turbid condor
vapid parcel
#

wait what?

#

yt_dlp is against ToS?

turbid condor
#

!ytdl

unkempt canyonBOT
#
Our youtube-dl, or equivalents, policy

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)
stark nexus
#

How can i fix that error?(where is problem?)

vapid parcel
#

so no more music bots..?

turbid condor
stark nexus
turbid condor
vapid parcel
#

so music bots for youtube is against YouTubes ToS..? thats kinda stupid...

#

L YouTube moment :/

turbid condor
#

And does anyone even care about ToS

stark nexus
vapid parcel
#

Thats a L

#

so whats the best to use

#

spotify? cuz my whole bot uses youtubes URLs XD like 😭

turbid condor
turbid condor
stark nexus
#

so i should use ctx?

meager rock
#

YouTube together exists

vapid parcel
#

sound cloud..?

meager rock
turbid condor
#

Don't know haven't checked SoundCloud

vapid parcel
#

is extracting counted as downloading 😭

turbid condor
#

And then use voice_client on it

meager rock
#

You can download in memory but not download and distribute

vapid parcel
#
    ydl_opts = {
        'format': 'bestaudio/best',
        'postprocessors': [{
            'key': 'FFmpegExtractAudio',
            'preferredcodec': 'mp3',
            'preferredquality': '192',
        }],
    }```
#

kinda how i do it for yt, but now i have to completely take that out

#

i have to use a whole new music app or api

turbid condor
#

Welp it's your choice

vapid parcel
#

rather not break ToS of big companies 😭

#

rather not get sued of sum stupid

cursive bane
#

I am expecting some biased answers here, but I'll ask anyways:

A discord.py bot that I host and run for various tasks on my server is long out of date. I am going to do a full rewrite.

Does anyone have some experience/opinions on how I proceed? Discord.py vs pycord vs discord.js

vapid parcel
#

damn, soundclouds api is closed :/

stark nexus
vapid parcel
#

i prefer discord.py, but js is more popular, but thats up to you

turbid condor
vapid parcel
#

JS is far more popular for discord bots tho sadly

turbid condor
meager rock
vapid parcel
#

im broke ^

meager rock
#

Djs except for voice receive has no features that dpy doesn't support
While dpy has many of them like command handlers and views

turbid condor
#

Does it matter what u use when u know what u are doing?

vapid parcel
#

well

meager rock
vapid parcel
#

XD

vapid parcel
#

Spotify isnt allowed, youtube isnt either, soundcloud has their api closed

turbid condor
#

Don't know i'd use wavelink

vapid parcel
#

wavelink

#

never heard of that..

turbid condor
#

But that also uses yt and spotify to play music

vapid parcel
#

Bruh

#

the world we live in 😭

turbid condor
#

You will need a lavalink server inorder to make it work as wavelink is wrapper for that

vapid parcel
#

damn

#

i see why there is no music bots now :/

meager rock
turbid condor
stark nexus
turbid condor
#

!d discord.Interaction

unkempt canyonBOT
#

class discord.Interaction```
Represents a Discord interaction.

An interaction happens when a user does an action that needs to be notified. Current examples are slash commands and components.

New in version 2.0.
vapid parcel
#

i broke tos without knowing i broke it, and i just broke it again for using youtube

turbid condor
vapid parcel
#

to many rules, who needs rules? thats for LOSERS, ToS is for losers, get rid of it, lets riot :)

cursive bane
#

Replying to a bunch of ppl here on mobile, sorry, read what's relevant to you.

I heard there was a time when d.py was not being maintained but now is being picked back up? A lot of migration of bots happened then but unsure if that matters in my case since I didn't touch my bot for that whole duration.

Pycord seems like it's now out of the question since it looks like I can get the same / more support with just d.py

I only did a bit of JS in post secondary, I don't imagine it being too hard to learn. Only think I am worried about is one OCR component to my bot that I will need to learn how to do in JS all over.

vapid parcel
vapid parcel
#

that was like 2021 or sum

meager rock
#

it has all latest features as of now

vapid parcel
#

bros way behind 😭

cursive bane
# vapid parcel bros way behind 😭

Yeah, haven't touched my bot in years, it just worked lol. Only have a few commands that I needed but was looking to write a new one and clean things up

turbid condor
vapid parcel
#

ye

meager rock
#

😏 not wyvern

turbid condor
vapid parcel
#

okay so we all agree to riot youtube? so we can use their api?

turbid condor
#

It's just a simple solution

vapid parcel
#

bet

turbid condor
vapid parcel
#

L

cursive bane
stark nexus
vapid parcel
#

personal opinion^

turbid condor
cursive bane
turbid condor
#

As you have to handle everything yourself so you know what you are doing and what not

vapid parcel
turbid condor
#

And slash command implementation is best as far as i saw

vapid parcel
#

nextcord has good slash commands i think..?

meager rock
cursive bane
#

Alright, made up my mind. Going to try d.js just for the learning experience, if I run into too much trouble I'm going to fall back to an updated dpy and you'll see me begging in #1035199133436354600

Thanks all'y'all

vapid parcel
#

have fun

#

@turbid condor i have a question

turbid condor
meager rock
#

fair

vapid parcel
#

Now how tf does mee6 do this, and im wondering if its possible in py?

#

ive seen people do it in js, but not py.

turbid condor
#

U need to use pillow

meager rock
unkempt canyonBOT
vapid parcel
#

is it easy or annoying 😭

turbid condor
#

Both

vapid parcel
#

i need to know before i even look

#

fuck me

stark nexus
#

im doing pillow image these day

turbid condor
#

Just state your question instead pf saying can i ask

vapid parcel
#

XD

#

i do the same shit 😭

turbid condor
vapid parcel
#

is it easier tho...?

turbid condor
#

But it has little features compared to pillow

vapid parcel
#

idk anything about pillow tbh

turbid condor
vapid parcel
#

never used it

#

do you have a video i could watch to see it?

#

nvm

#

i found a video

stark nexus
turbid condor
vapid parcel
#

uh

#

okay so this video is 3 years old, but would this tut still basically work?

https://youtu.be/htHGw6eM1ig

In this video, we will learn Image Manipulation with Pillow. We also make an image command like Dank memer using discord.py (rewrite) in 2020.

If you have any suggestions for future videos, leave it in the comments below.

Some Useful Links -

Discord Developer Portal- https://discord.com/developers
My Discord Server- https://discord.gg/TX...

▶ Play video
#

idk how often pillow is changed

turbid condor
stark nexus
vapid parcel
stark nexus
#

this is result

#

how can i force texts in the box? (And make it at middle)

turbid condor
meager rock
stark nexus
vapid parcel
turbid condor
#

I still don't get what you mean by can't paste it?

meager rock
vapid parcel
stark nexus
meager rock
#

told ya

turbid condor
turbid condor
stark nexus
#

how?

vapid parcel
#

when im coding im focused, when im reading im not :/

stark nexus
stark nexus
#

what is rgba

#

that looks super complex

turbid condor
vapid parcel
#

my main goal is game development and maybe game hacking

vapid parcel
#

wheres a good spot to get a welcome image 😭

stark nexus
#

rgb?

stark nexus
turbid condor
stark nexus
#

yah i know that

vapid parcel
turbid condor
vapid parcel
#

god im ass at canva 😭

stark nexus
#

its a good tool

turbid condor
#

Just make sure your image has low pixels that way your image will take less time to process

#

Making your code faster

stark nexus
turbid condor
vapid parcel
#

ill make one later after i sleep i think

#

9am rn XD

stark nexus
turbid condor
#

That's why i fetched you an example

#

Cuz even i suck at Pillow

stark nexus
#

But I don’t understand it 💀

turbid condor
#

I just use easy-pil since most i have to do is make the image round or just put a text nothing fancy

stark nexus
turbid condor
#

Not that any i know of

stark nexus
#

alr
then i might will try it next time when my friend online, then how can i fix the text problem?

stark nexus
vapid parcel
#

no templates

#

that means i cant be lazy fuck

stark nexus
stark nexus
vapid parcel
stark nexus
vapid parcel
#

OCD, so when i make anything, my brain just makes me think it looks bad in some way

stark nexus
#

I usually do it when i got bored in class

vapid parcel
#

paid or free?

stark nexus
#

free

vapid parcel
#

W

stark nexus
#

i love drawing

vapid parcel
#

supporting the poor out here, get this man a raise :)

turbid condor
#

You need to use either one of them

#

To center the text

#

I'm not sure which one tho

turbid condor
#

Like the line where you put text on the image the text functions accepts anchor and align argument you need to use that

still spade
vapid parcel
#

XD

vale wing
#

Iirc set_thumbnail(url=guild.icon.url)

turbid condor
vale wing
#

Cause it's an Asset isn't it

#

Look at my name ☺️

turbid condor
vapid parcel
#
    embed.set_image(url=member.avatar)
turbid condor
#

avatar is also an asset

vapid parcel
#

imma make you an asset

stark nexus
vale wing
#

Also yeah that's not really spoonfeeding

still spade
#

for role and top role can u share me the documantation @vapid parcel

turbid condor
vale wing
#

Giving code for person to look at is much more efficient than spending 15 minutes trying to explain basic concepts, if person is a beginner they will get there eventually

stark nexus
#

Fixed ty

vale wing
#

1 line is not a big deal anyways

turbid condor
#

Can be in some cases

vapid parcel
#

i made my userinfo a long time ago

#

he knows the documantation :)

turbid condor
#

!d discord.Member.roles for all the roles

unkempt canyonBOT
#

property roles```
A [`list`](https://docs.python.org/3/library/stdtypes.html#list) of [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role) that the member belongs to. Note that the first element of this list is always the default [‘@everyone](mailto:'%40everyone)’ role.

These roles are sorted by their position in the role hierarchy.
turbid condor
#

!d discord.Member.top_role

unkempt canyonBOT
#

property top_role```
Returns the member’s highest role.

This is useful for figuring where a member stands in the role hierarchy chain.
turbid condor
#

This for top role

vapid parcel
#

w

still spade
#

thnx bro

turbid condor
#

I don't know any documentation it's just most of the commonly used stuff

vapid parcel
#

yeah my userinfo command is at the top

#

so i made this shit a long time ago, i have 88 commands in my bot 😭

still spade
vapid parcel
#

command?

stark nexus
#

what about this error?

#

i want use drugdown menu to make a get role fuction

vapid parcel
#

prolly level system, i made a whole level system in my bot, thats prolly the hardest ive made, besides the music part of my bot which has to be taken out.

stark nexus
still spade
vapid parcel
still spade
#

yt

vapid parcel
#

against ToS

slate swan
#

epic tos breacher

vapid parcel
#

yep

slate swan
#

me when !ytdl

still spade
#

ok then which one is allowed ?

slate swan
#

none that is good

vapid parcel
#

yeah

turbid condor
vapid parcel
#

none

still spade
#

ok my bot will have no music then

slate swan
#

good choice

vapid parcel
#

YEAHHHHHH i made a whole music for no reason

still spade
vapid parcel
#

i put a custom bass boost, a volume, and everything

#

for NOTHING

vapid parcel
#

L youtube.

still spade
#

i was creating music bot for my portfolio tho

turbid condor
#

74

vale wing
#

Yeah you forgor to instantiate view

vapid parcel
#

so

vale wing
#

😭

vapid parcel
#

lets all agree on raiding youtube tonight?

#

and like allow us to use their music for discord bots? and if not we completely NUKE them and end their company? joking totally...

vale wing
#

Attacking youtube would require a botnet of quantum computers

vapid parcel
#

nah just nuke em

#

American style 😭

vale wing
#

Ah you mean like 💥 🦅

velvet depot
#

Did this server had a Balkan programmer?

vale wing
#

Wtf is balkan programmer

sick birch
#

Everything alright in here? pithink

still spade
#

yes

vale wing
#

Yeah hi robin ☺️

vapid parcel
#

dont tell youtube we are nuk- NOT nuking them

velvet depot
#

Is there anyone from the Balkans here?

vapid parcel
#

balkans..?

still spade
#

ok lemme do my bot work now i m already tired lemme get more tired for a peaceful sleep

stark nexus
#

is there anything i should know about give role fuction?

turbid condor
vapid parcel
slate swan
velvet depot
#

Idk just asking

turbid condor
slate swan
unkempt canyonBOT
stark nexus
#

(I haven’t checked any tutorial yet, just asking)

vapid parcel
#

we arent off topic, idk what you mean

vale wing
#

@slate swan #236 awaits ☺️

vapid parcel
#

we were talking about music bots and nuking youtube for not letting us use their api, clearly on topic imo

velvet depot
#

Ok

slate swan
stark nexus
vale wing
#

Thanks 🤗

turbid condor
#

!d discord.Member.add_roles

slate swan
unkempt canyonBOT
#

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

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

You must have [`manage_roles`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_roles) to use this, and the added [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role)s must appear lower in the list of roles than the highest role of the member.
slate swan
vapid parcel
stark nexus
#

k

vapid parcel
#

that simple XD

stark nexus
turbid condor
#

Similarly there is a remove_roles function too

stark nexus
turbid condor
#

!d discord.Guild.get_role

unkempt canyonBOT
#

get_role(role_id, /)```
Returns a role with the given ID.

Changed in version 2.0: `role_id` parameter is now positional-only.
velvet depot
#

🇧🇦

#

Bosnia

stark nexus
vapid parcel
#

what is coding master talking abt

turbid condor
#

Use this to get the role first

vapid parcel
#

im so lost?

slate swan
#

random off topic stuff we can fully ignore

vapid parcel
#

okayyyyy

#

so anyone know a good open source security bot 😭

stark nexus
turbid condor
#

Just put the id

#

Like

my_role = ctx.guild.get_role(12457643322456)
vapid parcel
#

what are you doing?

sick birch
#

the good ones, anyway

vapid parcel