#discord-bots

1 messages ยท Page 505 of 1

grand oracle
#

@grand oracle

#

aww

heavy folio
#

what does message_object mean

tropic briar
#
@client.event
async def on_message(msg):
    for word in Filter:
        if word in msg.content:
            await msg.delete()

    await client.process_commands(msg)
cloud dawn
tropic briar
#

is this alrigtht?

heavy folio
#

u should use for loop

tropic briar
#

oh wait I am mad

maiden fable
#

The message. Don't save only the content but the whole message which u get via on_message so that u can also get the user info

heavy folio
#

huh

slate swan
#

bruh..

slate swan
tropic briar
#

lemme try

slate swan
#
import discord
import keep_alive
from discord.ext import commands
from discord import utils
import datetime

prefix = "b."

client =commands.Bot(command_prefix=prefix, help_command=None, pass_context=True, owner_id=503035525456855051)
@client.event
async def on_ready():
    print(f"Connected to {client.user}")
    await client.change_presence(activity = discord.Activity(discord.ActivityTye.listening, name =f"to {prefix} in {str(len(client.guilds))} servers")

@client.command()
async def help(ctx):
    embed=discord.Embed(title="Embed Bot", color=discord.Colour.random())
    embed.add_field(name="\uD83E\uDDCA `"+prefix+"help`", value="Shows all commands' info", inline=False)
    img = ctx.message.author.avatar_url
    embed.set_thumbnail(url=img)
    embed.add_field(name="\uD83E\uDDCA `"+prefix+"embed <message>`", value="Sends embeded message\n *(Requires 'Manage Messages' Permissions)*", inline=False)
    embed.add_field(name="\uD83E\uDDCA `"+prefix+"about`", value="Shows info about the bot", inline=False)
    embed.timestamp =datetime.datetime.utcnow()
    embed.set_footer(text="Requested by {}".format(ctx.author))
    await ctx.reply(embed=embed)```
#

Still error :<

cloud dawn
unkempt canyonBOT
#

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

yes
tropic briar
#
F:\Python\monke bot\main.py:46: RuntimeWarning: coroutine 'Message.delete' was never awaited
  msg.delete()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Ignoring exception in command bant:
Traceback (most recent call last):
  File "F:\monke bot\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "F:\Python\monke bot\main.py", line 22, in bant
    await member.ban(reason=reason)
AttributeError: 'Context' object has no attribute 'ban'

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

Traceback (most recent call last):
  File "F:\monke bot\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "F:\monke bot\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "F:\monke bot\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
maiden fable
tropic briar
cloud dawn
tropic briar
#

but How

#

I mean no command is working for now

slate swan
#

๐Ÿ˜ฎ

tropic briar
#

Not even ban and kick

maiden fable
cloud dawn
# tropic briar but How
word_list = ['yes', 'no']
if any(word in message.content for word in word_list):
    await message.author.ban()
tropic briar
#

this looks easy

slate swan
#

Because of this bracket, I wasted 6 hours of mine and some people of this server

tropic briar
#

but it won't work unless I fix my errors

maiden fable
slate swan
#

๐Ÿฅ” PC

maiden fable
#

I run VSCode on a 1.7 GHz processor and 4 GB RAM

grand oracle
#

Which Is Better? แ—ทIT โ’ทโ“˜โ“ฃ

grand oracle
#

edit*

maiden fable
#

Your wish

#

I just told u the logic

cloud dawn
placid skiff
maiden fable
#

@slate swan you can always DM me in case u need help setting up an IDE (:

tropic briar
#
Bot is now Online
Ignoring exception in on_message
Traceback (most recent call last):
  File "F:\monke bot\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "F:\Python\monke bot\main.py", line 45, in on_message
    await msg.delete()
  File "F:\monke bot\lib\site-packages\discord\message.py", line 1023, in delete
    await self._state.http.delete_message(self.channel.id, self.id)
  File "F:\monke bot\lib\site-packages\discord\http.py", line 250, in request
    raise NotFound(r, data)
discord.errors.NotFound: 404 Not Found (error code: 10008): Unknown Message
Ignoring exception in on_message
Traceback (most recent call last):
  File "F:\monke bot\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "F:\Python\monke bot\main.py", line 45, in on_message
    await msg.delete()
  File "F:\monke bot\lib\site-packages\discord\message.py", line 1023, in delete
    await self._state.http.delete_message(self.channel.id, self.id)
  File "F:\monke bot\lib\site-packages\discord\http.py", line 250, in request
    raise NotFound(r, data)
``` bot deletes my message when I try to ban but doesn' ban
slate swan
#

What should I do.....never got this error...I understand the error but now what to do ._.

slate swan
#
    await client.change_presence(activity = discord.Activity(discord.ActivityType.listening, name =f"to {prefix} in {str(len(client.guilds))} servers"))
TypeError: __init__() takes 1 positional argument but 2 were given```
maiden fable
#

I never said I gave the code. logic

tropic briar
#
import discord
from discord.ext import commands

client = commands.Bot(command_prefix='.')
Filter = 'giant'


@client.event
async def on_ready():
    await client.change_presence(status=discord.Status.idle, activity=discord.Game('Hello there!!'))
    print('Bot is ready')
    print('Bot is now Online')


@client.command()
async def kickt(member: discord.Member, *, reason=None):
    await member.kick(reason=reason)


@client.command()
async def ban(member: discord.Member, *, reason=None):
    await member.ban(reason=reason)


@client.command()
async def setdelay(ctx, seconds: int):
    await ctx.channel.edit(slowmode_delay=seconds)
    await ctx.send(f"Set the slowmode delay in this channel to {seconds} seconds!")


@client.command()
async def clear(ctx, amount=5):
    await ctx.channel.purge(limit=amount)


@client.command()
async def delete(ctx, message):
    await ctx.channel.delete(message)


@client.event
async def on_message(msg):
    for word in Filter:
        if word in msg.content:
            await msg.delete()

    await client.process_commands(msg)
maiden fable
unkempt canyonBOT
#

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

Changes the clientโ€™s presence.

Example

```py
game = discord.Game("with the API")
await client.change_presence(status=discord.Status.idle, activity=game)
```   Changed in version 2.0: Removed the `afk` keyword-only parameter.
maiden fable
#

They are kwargs

#

Soo, lemme tell what to do

slate swan
#

I didnt made init

#
async def on_ready():
    print(f"Connected to {client.user}")
    await client.change_presence(activity = discord.Activity(discord.ActivityType.listening, name =f"to {prefix} in {str(len(client.guilds))} servers"))```
maiden fable
#

Weird

#

Ah

#

!d discord.Activity

unkempt canyonBOT
#

class discord.Activity(**kwargs)```
Represents an activity in Discord.

This could be an activity such as streaming, playing, listening or watching.

For memory optimisation purposes, some activities are offered in slimmed down versions:

โ€ข [`Game`](https://discordpy.readthedocs.io/en/master/api.html#discord.Game "discord.Game")

โ€ข [`Streaming`](https://discordpy.readthedocs.io/en/master/api.html#discord.Streaming "discord.Streaming")
maiden fable
#

Those are kwargs

slate swan
#

oooooooooo

maiden fable
#

type=discord.ActivityType.listening

slate swan
#

So listeneing?

cloud dawn
slate swan
#

len gives string?

grand oracle
cloud dawn
maiden fable
#

Yea that ^^^

slate swan
grand oracle
#

its in f string it does it automatically

#

ll*

slate swan
#

I removed it

cloud dawn
#

moves from python to compiled code sweat

tropic briar
#
@client.on_message
async def delete(ctx, message):
word_list = ['yes', 'no']
if any(word in message.content for word in word_list):
    await message.author.ban()
``` Is this right?
tropic briar
#

ohh

maiden fable
#

Imagine spoonfeeding

cloud dawn
#

and brackets on decorator

maiden fable
#

Bruh.....?

grand oracle
#

so just saying

#

E

cloud dawn
#

Best is just to throw the bot away๐Ÿ˜‚

maiden fable
#

What do u even wanna do

maiden fable
tropic briar
#
@client.on_message
async def delete(ctx, message):
    word_list = ['yes', 'no']
    if any(word in message.content for word in word_list):
        await message.author.ban()
slate swan
#

Well what to do about the activity btw

maiden fable
maiden fable
tropic briar
slate swan
#

lel

maiden fable
#

It's fine

cloud dawn
#

Also i hate to make life difficult but don't change presence inside on_ready

maiden fable
#

Indeed

cloud dawn
slate swan
#

Actually I want my bot to refresh its guild number in activity as soon as possible but I dont want it to get rate limited

cloud dawn
slate swan
#

async def wait_until_ready ??

cloud dawn
#

Just refresh once 10 minutes in a task

slate swan
#

IDK why repl it rate limited my bot

#

last day

cloud dawn
#

since you share your ip adress meaning other people can rate limit you.

slate swan
#

?

cloud dawn
#

thats why it sucks

grand oracle
#

i like ur funny words, magic man

slate swan
#

other people?

maiden fable
cloud dawn
# slate swan ?

So you got an adress assigned like a router, but repl.it has the same router for multiple users instead of their own network.

slate swan
#

So any other free platform other than heroku?

cloud dawn
#

Nothing in life is free

slate swan
grand oracle
cloud dawn
slate swan
#

Also how can I unblock my github E_

maiden fable
grand oracle
tropic briar
#

I deleted some code but the ban command is still not working

Traceback (most recent call last):
  File "F:\monke bot\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "F:\Python\monke bot\main.py", line 22, in ban
    await member.ban(reason=reason)
AttributeError: 'Context' object has no attribute 'ban'
@client.command()
async def ban(member: discord.Member, *, reason=None):
    await member.ban(reason=reason)
slate swan
#

many days ago my passwords were breached

#

And my github got terminated

tropic briar
#

oh

cloud dawn
grand oracle
#

so member becomes ctx

maiden fable
slate swan
slate swan
#

except on_ready

maiden fable
#

!d discord.ext.commands.Bot.status

unkempt canyonBOT
#

property status```
[`Status`](https://discordpy.readthedocs.io/en/master/api.html#discord.Status "discord.Status"): The status being used upon logging on to Discord.
maiden fable
#

!d discord.ext.commands.Bot.activity

unkempt canyonBOT
#

property activity: Optional[Union[discord.activity.Activity, discord.activity.Game, discord.activity.CustomActivity, discord.activity.Streaming, discord.activity.Spotify]]```
The activity being used upon logging in.
maiden fable
#

Use these. Kwargs in the bot constructor

cloud dawn
#

or use the task like i said if you want to update it.

cloud dawn
tropic briar
#
Bot is now Online
Ignoring exception in command ban:
Traceback (most recent call last):
  File "F:\monke bot\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "F:\Python\monke bot\main.py", line 22, in ban
    await member.ban(reason=reason)
  File "F:\monke bot\lib\site-packages\discord\member.py", line 554, in ban
    await self.guild.ban(self, **kwargs)
  File "F:\monke bot\lib\site-packages\discord\guild.py", line 2026, in ban
    await self._state.http.ban(user.id, self.id, delete_message_days, reason=reason)
  File "F:\monke bot\lib\site-packages\discord\http.py", line 248, in request
    raise Forbidden(r, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions

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

Traceback (most recent call last):
  File "F:\monke bot\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "F:\monke bot\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "F:\monke bot\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
#
@client.command()
async def ban(ctx, member: discord.Member, *, reason=None):
    await member.ban(reason=reason)

tropic briar
#

lol

#

let's try again

slate swan
#

๐Ÿ‘

maiden fable
#

Best code would be

@client.event
async def on_message(message):
    await message.author.ban() 
#

(Seriously don't try that code else RIP)

#

I won't be responsible if u try that code hehe

tropic briar
#
Ignoring exception in command ban:
Traceback (most recent call last):
  File "F:\monke bot\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "F:\Python\monke bot\main.py", line 22, in ban
    await member.ban(reason=reason)
  File "F:\monke bot\lib\site-packages\discord\member.py", line 554, in ban
    await self.guild.ban(self, **kwargs)
  File "F:\monke bot\lib\site-packages\discord\guild.py", line 2026, in ban
    await self._state.http.ban(user.id, self.id, delete_message_days, reason=reason)
  File "F:\monke bot\lib\site-packages\discord\http.py", line 248, in request
    raise Forbidden(r, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions

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

Traceback (most recent call last):
  File "F:\monke bot\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "F:\monke bot\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "F:\monke bot\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
maiden fable
#

No perms

#

!d discord.Forbidden

unkempt canyonBOT
#

exception discord.Forbidden(response, message)```
Exception thatโ€™s raised for when status code 403 occurs.

Subclass of [`HTTPException`](https://discordpy.readthedocs.io/en/master/api.html#discord.HTTPException "discord.HTTPException")
tropic briar
#

My progress

#
@client.command()
async def ban(ctx, member: discord.Member, *, reason=None):
    await member.ban(reason=reason)
#

Why is this not working

#

Now it even has admin permission

maiden fable
#

Wait

#

Dyno role is above bot's

tropic briar
#

My godness

#

I will kill Dyno today

placid skiff
#

Question
The guild.unban command works with the Username#Discriminator right?
If i pass only the username in the command and then convert that username string into a User object and pass username and discriminator in guild.ban it should work right?

maiden fable
#

Uhh, nope

tropic briar
#

gg

maiden fable
#

guild.unban(discord.Object(id=))

#

!d discord.Object

unkempt canyonBOT
#

class discord.Object(id)```
Represents a generic Discord object.

The purpose of this class is to allow you to create โ€˜miniatureโ€™ versions of data classes if you want to pass in just an ID. Most functions that take in a specific data class with an ID can also take in this class as a substitute instead. Note that even though this is the case, not all objects (if any) actually inherit from this class.

There are also some cases where some websocket events are received in [strange order](https://github.com/Rapptz/discord.py/issues/21) and when such events happened you would receive this class rather than the actual data class. These cases are extremely rare.

x == y Checks if two objects are equal.

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

hash(x) Returns the objectโ€™s hash.
maiden fable
#

It requires a Discord Object

placid skiff
#

Understand

#

So to make it work

#

I have to retrieve the id of the user

#

Then convert it again into a discord object

tropic briar
#

!pypi discord-anti-spam Now I will be using this

unkempt canyonBOT
maiden fable
maiden fable
#

Bruh

placid skiff
maiden fable
#

!customcooldown @tropic briar

unkempt canyonBOT
#

Cooldowns in discord.py

Cooldowns can be used in discord.py to rate-limit. In this example, we're using it in an on_message.

from discord.ext import commands

message_cooldown = commands.CooldownMapping.from_cooldown(1.0, 60.0, commands.BucketType.user)

@bot.event
async def on_message(message):
    bucket = message_cooldown.get_bucket(message)
    retry_after = bucket.update_rate_limit()
    if retry_after:
        await message.channel.send(f"Slow down! Try again in {retry_after} seconds.")
    else:
        await message.channel.send("Not ratelimited!")

from_cooldown takes the amount of update_rate_limit()s needed to trigger the cooldown, the time in which the cooldown is triggered, and a BucketType.

placid skiff
#

The problem is if the bot can convert a string to a user object even if both doesn t share servers

#

But there is a solution to everything, it will be more annoying, but it will work anyway ๐Ÿ˜‚

tropic briar
#

When I send a message

#

and the bot wasn't stopping

placid skiff
#

Cuz he is responding to it own message

tropic briar
#

That's the problem

#

So

tropic briar
reef shell
#

do you have an on_message event?

grand oracle
placid skiff
#
@client.event()
async def on_message(msg):
     if msg.author == client.user:
           return
     #your code

tropic briar
#
@client.event
async def on_message(message):
        if message.author == client.user:
            return
        bucket = message_cooldown.get_bucket(message)
        retry_after = bucket.update_rate_limit()
        if retry_after:
            await message.channel.send(f"Slow down! Try again in {retry_after} seconds.")
        else:
            await message.channel.send("Not ratelimited!")
grand oracle
#

bot command ideasss

spring flax
grand oracle
tropic briar
#

because spam will check when someone sends a message

spring flax
tropic briar
spring flax
tropic briar
#

Where can I get that link

placid skiff
# tropic briar yea

Well, the better way is to set the slowmode on the channel but this works too lel

tropic briar
#

But i am unable to host it using replit

#

I cannot get that link

#

that I see in the video

placid skiff
#

?

tropic briar
#

Hi, In this video I will show you how to setup uptimerobot in order to keep your Python Discord Bot Online. This is part 2 and part 1 is required in order for part 2 to work.

๐ŸŒUpTimeRobot: https://uptimerobot.com

๐ŸŽฌPART 1: https://youtu.be/g7n4OMy5tIY

๐Ÿ˜ƒPatreon: https://www.patreon.com/m692aus

๐Ÿ”ฅPlease Consider Subscribing:๐Ÿ”ฅ
https://www.youtube...

โ–ถ Play video
#

I am watching this video to host my bot

#

and I need that link as shown in the video

#

this is my screen

placid skiff
#

You re trying to hosting it by creating a flask and then continously sending HTPPS requests from another service

valid niche
#

replit

grand oracle
tropic briar
#

huh?

valid niche
#

the lowest you can go, replit is the WORST thing out there for hosting

tropic briar
placid skiff
grand oracle
#

create a html file???

valid niche
#

oh and with replit you want to keep resetting your token every 2 seconds

valid niche
#

because all your replits are public unless you have a paid account, but if you have a paid account you should just get a VPS

tropic briar
placid skiff
#

They added enviroment variables

valid niche
tropic briar
valid niche
#

so there is no real free option

tropic briar
valid niche
#

anything free has massive issues

#

it's """free"""

placid skiff
grand oracle
tropic briar
tropic briar
#

or repl?

placid skiff
placid skiff
#

It made me even sick of php ๐Ÿ˜‚ ๐Ÿ˜‚

valid niche
#

@tropic briar read this

grand oracle
#

self host

tropic briar
#

so

#

There is no way to host it for free?

valid niche
#

no

#

self hosting technically also costs money

grand oracle
#

there is 1

valid niche
#

tho most say it's free

tropic briar
#

Then the use of making a bot is non-sense?

grand oracle
#

i mean yeah

tropic briar
valid niche
#

self hosting is considered free by most, tho you have to have hardware to run it already and need to pay for electricity and such

placid skiff
placid skiff
tropic briar
#

Can I use Heroku ?

valid niche
#

read the same post

grand oracle
#

self hosting

so uh, you have a old laptop or phone, you install py in it and run ur bot

Then never turn that device off.
valid niche
#

heroku is just as bad as replit

#

just in its own way

tropic briar
#

which is better heroku or repl

#

atleast the bot can come online

valid niche
#

both are equally bad

grand oracle
#

it is not meant for bots, anything else good.

valid niche
#

there is no good in replit or heroku for a bot

tropic briar
#

So what if I still do it

#

What will happen then

valid niche
#

you'll run into tons of issues, annoyances, bad hosting, and you'll get tons of flak from all of the community

grand oracle
#

ull die or smthing idk

tropic briar
#

Now should I?

valid niche
#

i wont help you

tropic briar
#

ok ok

valid niche
#

i'd say get a cheap VPS, those things only cost like a few dollars a month

tropic briar
#

anyways bye

valid niche
#

a discord bot does not need much, like if a raspberry pi can run it almost anything can run it, except replit servers, because they are just bad in every thinkable way

supple thorn
placid skiff
valid niche
placid skiff
valid niche
#

on a VPS not dedicated even

grand oracle
#

replit is good to learn stuff and to not install an ide

soft lake
#

Hello Guys

cloud dawn
#

Whats the deal with an ide

placid skiff
soft lake
#

where can I get a good curse for Discord bots with python

valid niche
valid niche
#

so all servers are located there

valid niche
grand oracle
#

on yt

valid niche
soft lake
#

Thanks
Good luck for all of you

grand oracle
#

i mean they have new forks to code on

placid skiff
placid skiff
valid niche
#

i use their 6 euros plan

grand oracle
#

to get started use a course

placid skiff
grand oracle
soft lake
#

can someone explane
async and await

grand oracle
#

are you new to python?

placid skiff
#

Lol

grand oracle
#

hmmm

soft lake
#

Yes

grand oracle
#

so first things first

soft lake
#

I know the basics

soft lake
#

wrong link ?

grand oracle
#

thats uh for learning py, imma get async/await

#

In today's video, I'll be talking to you about asynchronous programming in python. This Python Async tutorial will cover the 'async' and 'await' keyword, coroutines, futures and tasks, and some basic features from the asyncio module in Python. This video is for intermediate programmers, and it's recommended you have Python 3.7 or above.

๐Ÿ’ป Algo...

โ–ถ Play video
soft lake
grand oracle
#

In this video we learn about asynchronous programming in Python. We will talk about the keywords async and await.
โ—พโ—พโ—พโ—พโ—พโ—พโ—พโ—พโ—พโ—พโ—พโ—พโ—พโ—พโ—พโ—พโ—พ
๐Ÿ“š Programming Books & Merch ๐Ÿ“š
๐Ÿ’ป The Algorithm Bible Book: https://www.neuralnine.com/books/
๐Ÿ The Python Bible Book: https://www.neuralnine.com/books/
๐Ÿ‘• Programming Merch: https://www.neuralnine.com/shop

๐Ÿ’ป Exclusiv...

โ–ถ Play video
grand oracle
soft lake
#

Thank you so muck for helping me

grand oracle
#

async await basically allows you to run stuff in the background

soft lake
grand oracle
#

after running the code
s

#

so.. lets say you are getting input ig, and you make a func that does stuff to it
so while that function is doing stuff we can also do stuff

#

so we can make it go run in the background

soft lake
#

it's like multi tasking right ?

grand oracle
#

yep

placid skiff
#

Yes

#

For example, image you have a tempban command in your bot

grand oracle
#

but use the course to implement this in python :)

cloud dawn
#

you'd also need an async scheduler though

placid skiff
#

If you don t use async/await your bot will sleep until the member you tempbanned is unbanned

grand oracle
#

(omg i feel so good helping)

soft lake
#

oh
I get it
Now I know the reason why we use async a lot in Discord.py

placid skiff
soft lake
grand oracle
#

aight imma go

soft lake
#

Good luck body

grand oracle
#

thx

soft lake
#

np

grand oracle
#

and uh buddy* (but if you meant a body...)

soft lake
#

thanks for your time

grand oracle
soft lake
#

Cya

kind trellis
#

Is it possible to reference embed.Colour outside of the embed class?

cloud dawn
#

!d discord.Colour

unkempt canyonBOT
#

class discord.Colour(value)```
Represents a Discord role colour. This class is similar to a (red, green, blue) [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)").

There is an alias for this called Color...
placid skiff
#

I remembered something weird that happened to me some days ago

I had those lines here:

print(f"{ctx.author.name} sent {ctx.message.content}\nNo command found for {[cnt[0] for cnt in ctx.message.content.split(' ')" )

Instead of gave me the command invoked it gave me some random letter in the string, i had to declare a list before and assign it to ctx.message.content.split

kind trellis
cloud dawn
slate swan
#

he did tho

placid skiff
vale narwhal
#

why "on_message" event making my bot crashed? It didn't send any error too

kind trellis
#

I still need it to change the embed, but I want the color to change base on an arg

vale narwhal
#
@bot.event
async def on_message(message):
    if message.content.startswith('@itsHarbinger#5005'):
        e = await message.channel.send("itsHarbinger Is AFK: :CD_Inasleep:")
        await asyncio.sleep(15)
        await e.delete()
#

the code

#

i put it on my bot and it crashed my bot for no reason

#

it make my bot not respoding to another command

#

rather than on_message event

cloud dawn
vale narwhal
#

@cloud dawn Still the same

#

It make my whole bot not responding

#

only the on_messgae itself

spring flax
#

either use @bot.listen() as decorater, or add await bot.process_commands(message) to the bottom of @bot.event @vale narwhal

vale narwhal
#

wha

cloud dawn
#

I just shorten his current code

spring flax
#

oh wait wrong ping my bad

cloud dawn
slate swan
#

Hey, buddies
I wanna self deploy @unkempt canyon bot.
But I don't have a pc. Me using termux to run simple codes but when It comes to the requirements of python bot. Termux failed to provide resources.
Can somebody help me with it
To deploy Python bot to heroku.
As heroku cli works pretty well.

vale narwhal
cloud dawn
vale narwhal
sacred folio
#

Hello,

Im trying to add a few emojis on an embed that I send to the channel so I can later react to them. But I cant really find how to go about it, what i wish there was is a command much like embed.add_field but for emojis. Any insights? :)

ember sorrel
#

you mean react with emojis to the embed sent?

sacred folio
#

Yes, essentially make it so that the bot pre-reacts on the embed, so users can react on it once its displayed

brisk plover
#

is there any way to use the random library, but not repeat the same?
lets say i have
[1, 2, 3]
i use random.random and it gives 1, if i do it again it has to either say 2 or 3, cant say 1 again

placid skiff
ember sorrel
brisk plover
placid skiff
ember sorrel
brisk plover
#

oh that simple, thanks alot!

ember sorrel
#

np

cloud dawn
unkempt canyonBOT
#

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

001 | 2
002 | 3
003 | 1
sacred folio
#

Do you copy the actual emoji or just the name for it

placid skiff
ember sorrel
#

message.add_reaction("๐Ÿš€")

placid skiff
#

Someone has a dict of discord reaction? Lol

cloud dawn
spring flax
spring flax
placid skiff
# spring flax what?

Something like:
[reaction_name: reaction_id, reaction_name1: reaction_id1, ...]

spring flax
#

What for?

#

You want the format of an emoji?

placid skiff
#

Because i found really annoying using the id to send emojis xD

sacred folio
#

Thank you! If i want to then listen to reactors, i read something about collectors so im going to look into that first. Could i achieve this by adding '.then' on the ctx.send(embed=embed).then like that and then processing and even adding everything in there?

placid skiff
#

I m a lazy person i know

#

Snorlax is better than me

brisk plover
#

can i make the embed image a gif?

ember sorrel
spring flax
unkempt canyonBOT
#

set_image(*, url)```
Sets the image for the embed content.

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

Changed in version 1.4: Passing [`Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty") removes the image.
brisk plover
#

ty

ember sorrel
sacred folio
#

Ah okay

slate swan
#

Hello

sacred folio
#

Yeah, my async abilities are from Js so i assumed something like next was needed. Thanks for clarifying

slate swan
#

Hello

slate swan
#

.d embed

#

How to do this

#

!d help

unkempt canyonBOT
#

help([object])```
Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the interactive help system starts on the interpreter console. If the argument is a string, then the string is looked up as the name of a module, function, class, method, keyword, or documentation topic, and a help page is printed on the console. If the argument is any other kind of object, a help page on the object is generated.

Note that if a slash(/) appears in the parameter list of a function when invoking [`help()`](https://docs.python.org/3.10/library/functions.html#help "help"), it means that the parameters prior to the slash are positional-only. For more info, see [the FAQ entry on positional-only parameters](https://docs.python.org/3.10/faq/programming.html#faq-positional-only-arguments).

This function is added to the built-in namespace by the [`site`](https://docs.python.org/3.10/library/site.html#module-site "site: Module responsible for site-specific configuration.") module.
spring flax
slate swan
#

!d help embed

unkempt canyonBOT
#

help([object])```
Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the interactive help system starts on the interpreter console. If the argument is a string, then the string is looked up as the name of a module, function, class, method, keyword, or documentation topic, and a help page is printed on the console. If the argument is any other kind of object, a help page on the object is generated.

Note that if a slash(/) appears in the parameter list of a function when invoking [`help()`](https://docs.python.org/3.10/library/functions.html#help "help"), it means that the parameters prior to the slash are positional-only. For more info, see [the FAQ entry on positional-only parameters](https://docs.python.org/3.10/faq/programming.html#faq-positional-only-arguments).

This function is added to the built-in namespace by the [`site`](https://docs.python.org/3.10/library/site.html#module-site "site: Module responsible for site-specific configuration.") module.
spring flax
#

And you can test out in #bot-commands

slate swan
#

How to make a embed help!

spring flax
#

!d discord.Embed

unkempt canyonBOT
#

class discord.Embed(*, colour=Embed.Empty, color=Embed.Empty, title=Embed.Empty, type='rich', url=Embed.Empty, description=Embed.Empty, timestamp=None)```
Represents a Discord embed.

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

bool(b) Returns whether the embed has any data set.

New in version 2.0.

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

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

What I have to do?

spring flax
#

do to do that?

slate swan
#

give me full command

sacred folio
#

@ember sorrel if my intention is to listen to the reactions, and im using client.command() to wait for the initial command to prompt the embed, do i need to setup a bot.event to listen for reactions?

slate swan
#

Like if I say !help

spring flax
# unkempt canyon

im not going to give you the command, but you can use this for a reference to making an embed

slate swan
#

Okay

hardy onyx
ember sorrel
#

!d discord.Client.wait_for

unkempt canyonBOT
#

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

Waits for a WebSocket event to be dispatched.

This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.

The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.

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

This function returns the **first event that meets the requirements**...
sacred folio
#

This will definitely solve it, thank you!

ember sorrel
#

np :)

slate swan
#

Import "DiscordUtils" could not be resolved ๐Ÿค” can anyone help?

#

install the library...

slate swan
#

still saying the same thing

#

how do you install it?

slate swan
#

have you installed it in the same version of python you are using rn?

#

wdym

brisk plover
#

just to confirm, if i delete something from a list, and i restart the bot, the list is reset ya?

slate swan
#

Yes

floral jacinth
#

hello guys, quick question, how do i check when a member entered in the server?

unkempt canyonBOT
#

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

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

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

not member_join

#

the lifetime inside the server

ember sorrel
#

oh that

#

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

floral jacinth
ember sorrel
#

np

hardy onyx
#

hm

ember sorrel
#

use a for loop and use wait_for() every time it iterates

#

isn't that possible?

#

I don't know much about slash commands so I'm just confiming,

#

ah well sadly I don't know then, I haven't really touched d.py ever since slash commands were added

heavy radish
#

My BOTs not detecting server Emoji's??

boreal ravine
heavy radish
#

one sec

heavy radish
#

Why is it like that?

boreal ravine
heavy radish
#

Yes

boreal ravine
#

Did u use the ID?

heavy radish
#

umm

#

No, Emoji's have IDs??

boreal ravine
#

yes

heavy radish
#

How do I use it and how do i get it

boreal ravine
#

add a backslash before an emoji then send it*

heavy radish
#

\๐Ÿฅœ

rigid island
#

Can u explain a bit??

heavy radish
#

Doesnt work

boreal ravine
heavy radish
#

\๐Ÿ—ฃ๏ธ

boreal ravine
#

Use a custom emoji..

heavy radish
boreal ravine
#

those are unicode emoji's they dont change lol

heavy radish
#

Hm

#

Do i just paste it like that?

boreal ravine
#

yes

heavy radish
#

Ahh

#

Thank You!!

plain eagle
#

oops wrong message ping

heavy radish
#

hm

plain eagle
heavy radish
#

Nice

surreal sierra
#

Hey does anyone know why this doesn't work? Before when I only had users[str(user.id)]["Wallet"] += bet * 1000 it worked.
The problem is that it doesn't add the numbers to the json file, for example the it doesnt add bet to GEarned in the json file. Same to all those 5

crystal cliff
#

@Bot.command()
async def Bot_Info(ctx:commands.Context):
await ctx.send({f"**{random.choice(Bot_Info)} im trying to make a random choice bot info command, but im not sure of the code ๐Ÿค” is it right or?

boreal ravine
#
@Bot.command()
async def Bot_Info(ctx):
    await ctx.send(f"**{random.choice(Bot_Info)}**")
``` you can just do this
boreal ravine
crystal cliff
#

@raven peak
async def Quote(ctx):
Quote = get_quote()
await ctx.send(Quote) this wont send a quote, ๐Ÿค”

jade jolt
#

show code

#

of get_quote()

crystal cliff
#

def get_quote():
response = requests.get("https://zenquotes.io/api/random")
json_data = json.loads(response.text)
quote = json_data[0]['q'] + " -" + json_data [0]['a']
return(quote)

jade jolt
#

return doesnt use () iirc

#

just do return quote

hasty iron
#

both work

jade jolt
#

ok then his quote is empty

crystal cliff
hasty iron
#

can you print Quote

crystal cliff
slate swan
#

How to let my bot react on his own message and when i react to 1๏ธโƒฃ it says like "text"?

hasty iron
#

text

#

markdown works for bots

boreal ravine
#

If someone invites a user how do we know that they invited them? like for example

@kayle#0000 joined by @Modmail#0000 
#

any clues

crystal cliff
#

@raven peak
async def Hey(ctx:commands.Context):
await ctx.send(f"{random.choice(Replying_Words)}
{ctx.message.author.mention} ๐Ÿ‘‹
") it wont mention the user, whats wrong here?

jade jolt
#

ctx.author.mention

slate swan
#

There's no other way to do it

boreal ravine
#

hm

drifting arrow
#

\o/

half briar
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ClientException: ffmpeg was not found.

#

How to slove

drifting arrow
# slate swan There's no other way to do it

Well the method would be:
1 - When an invite is created, store who created it and the invite information.
2 - When a user joins, check to see if they were invited. If so, check what link they used.
3 - Credit the person \o/

slate swan
#
@client.event
async def on_guild_join():
  await client.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name=f'{prefix}help in {len(client.guilds)} servers'))

error: on_guild_join() takes 0 positional arguments but 1 was given

crystal cliff
drifting arrow
half briar
#

sc = FFmpegPCMAudio("audio.mp3")
voi = vc.play(sc)
voi.start

#

@drifting arrow

boreal ravine
#

you already used context lol

drifting arrow
#

what import is that coming from @half briar ?

half briar
#

@drifting arrow what

crystal cliff
boreal ravine
#

see it now?

drifting arrow
half briar
#

Oo

crystal cliff
half briar
#
from discord import FFmpegPCMAudio``` @drifting arrow
boreal ravine
drifting arrow
crystal cliff
boreal ravine
drifting arrow
boreal ravine
half briar
#

@drifting arrow not work

#

):

slate swan
crystal cliff
slate swan
drifting arrow
boreal ravine
# crystal cliff No clue, lol

You already had ctx and you did ctx.message.author.mention. I'm saying why did u add the extra message in that when you only needed ctx.author.mention?

slate swan
half briar
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ClientException: ffmpeg was not found.@drifting arrow

crystal cliff
jade jolt
drifting arrow
slate swan
#

!d discord.on_guild_join

unkempt canyonBOT
#

discord.on_guild_join(guild)```
Called when a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild") is either created by the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") or when the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") joins a guild.

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

@jade jolt cwd?

jade jolt
#

current working directory

slate swan
#

ok

#

trying

drifting arrow
#

Anyway

#

im off to go watch youtube and be unproductive

rugged tinsel
#

hey, can anyone help me with finding apis for dadjokes? please thanks

hasty iron
#

literally first search result on google

latent ermine
#

!eval

@client.command(aliases=["unbanall"])
async def MassUnban(ctx):
  try:
    guild = ctx.message.guild

    def UnbanAll(member_id):
      r = requests.delete(f"https://discord.com/api/v9/guilds/{guild}/bans/{member_id}",
      headers=headers)
    if r.status_code == 200 or r.status_code == 201 or r.status_code == 204:
      print(f'> Unbanned {member_id}')
unkempt canyonBOT
#

@latent ermine :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 10
002 |     print(f'> Unbanned {member_id}')
003 |                                     ^
004 | SyntaxError: unexpected EOF while parsing
latent ermine
#

yea can someone help

rugged tinsel
#

yea i went to the tenth page and got random crap lmao that's why i didnt find anything

latent ermine
maiden fable
#

BTW does anyone know how to send stickers with bot?

hasty iron
#

ah yes, massunban when passing a single member_id

maiden fable
#

lmao

hasty iron
#

why are you trying to call the raw api

#

and why with requests?

#

whats the point?

latent ermine
#

dosent it make it faster

hasty iron
#

???

#

faster?

#

lol?

#

anyways just use Guild.unban

latent ermine
#

ok

placid skiff
# latent ermine ok

The API has a guild.bans which return the lists of all banned users, use that

latent ermine
fallow mauve
#

im wanting to make a command where an admin can say <giveroll [@user] [role ID] and it gives the specified user the role, how would i do that?

unkempt canyonBOT
#

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

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

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

so how do i target a user?

slate swan
#

Pass a member: discord.Member into command arguments, or get the user with ID or utils or something

fallow mauve
#

command arguments?

#

pretend idk what that is

boreal ravine
fallow mauve
#

ok

slate swan
boreal ravine
#

!d discord.ext.commands.RoleConverter for role ids I think

unkempt canyonBOT
#

class discord.ext.commands.RoleConverter(*args, **kwargs)```
Converts to a [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role").

All lookups are via the local guild. If in a DM context, the converter raises [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") exception.

The lookup strategy is as follows (in order)...
slate swan
fallow mauve
#

@slate swan

slate swan
#

use the name kwarg

fallow mauve
#

?

slate swan
#

I think

#

!d discord.ext.commands.Bot.command

unkempt canyonBOT
#

@command(*args, **kwargs)```
A shortcut decorator that invokes [`command()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.command "discord.ext.commands.command") and adds it to the internal command list via [`add_command()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin.add_command "discord.ext.commands.GroupMixin.add_command").
fallow mauve
#

im new to python and have never used kwarg before, can u explain that?

slate swan
#

!resources

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

slate swan
#

not just 'addrole', but name='addrole'

unkempt canyonBOT
#

*args and **kwargs

These special parameters allow functions to take arbitrary amounts of positional and keyword arguments. The names args and kwargs are purely convention, and could be named any other valid variable name. The special functionality comes from the single and double asterisks (*). If both are used in a function signature, *args must appear before **kwargs.

Single asterisk
*args will ingest an arbitrary amount of positional arguments, and store it in a tuple. If there are parameters after *args in the parameter list with no default value, they will become required keyword arguments by default.

Double asterisk
**kwargs will ingest an arbitrary amount of keyword arguments, and store it in a dictionary. There can be no additional parameters after **kwargs in the parameter list.

Use cases
โ€ข Decorators (see !tags decorators)
โ€ข Inheritance (overriding methods)
โ€ข Future proofing (in the case of the first two bullet points, if the parameters change, your code won't break)
โ€ข Flexibility (writing functions that behave like dict() or print())

See !tags positional-keyword for information about positional and keyword arguments

slate swan
#

quick question: py embed.set_footer(text="Requested by {}".format(ctx.author))
How do I bold the requester's name?

#

no, @raven peak doesn't take no positional argument

#

I genuinely don't care that I pinged somebody....

fallow mauve
#

or within the brackets?

slate swan
#

nah it just print * in the footer

#

what does google say?

slate swan
void mortar
#

how i can add a hyperlink in embed.add_fields

slate swan
void mortar
#

oh..

slate swan
fallow mauve
#

i still dont know what to put after this someone pls help

slate swan
slate swan
#

you mean that?

#

and use
@bot.command(name='addrole')

#

you can also leave it empty

#

indeed

#

but since we don't know how you want your command to work....

hasty iron
slate swan
#

idk, the doc didn't say anything

hasty iron
#

yes its not

fallow mauve
hasty iron
#

there is no *, before it

hasty iron
fallow mauve
#

was that dumb?

hasty iron
#

i dont know, you tell me

slate swan
#

oh lol

#

ctx is never gonna be None

fallow mauve
#

ok

slate swan
#

but it shouldn't throw an error because of that, right?

hasty iron
#

because of what

slate swan
#

because of =None

hasty iron
#

it will

#

!e ```py
def foo(a=1, b): pass

unkempt canyonBOT
#

@hasty iron :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 1
002 |     def foo(a=1, b): pass
003 |                   ^
004 | SyntaxError: non-default argument follows default argument
fallow mauve
slate swan
#

makes sense

fallow mauve
#

so

hasty iron
#

it wont throw an error, if they're keyword arguments though

fallow mauve
hasty iron
#

!e ```py
def foo(*, a=1, b): pass

unkempt canyonBOT
#

@hasty iron :warning: Your eval job has completed with return code 0.

[No output]
slate swan
#

indeed no addroll command

#

only addrole

fallow mauve
#

thx it works now

#

and now that i understand how that works i can now add the removerole command

valid galleon
#

so i was working on a bot on my other pc, and it worked fine(except for a couple errors here and there), but when i tried to continue working on the same bot on my current pc, it gives me this error. it wasnt on my other pc:
ImportError: cannot import name 'PartialMessageable' from 'discord.channel'

hasty iron
#

do you have some kind of third party lib

valid galleon
fallow mauve
#

how do i make my command require certain perms to use again? i forgor

fallow mauve
#

thx

valid galleon
#

@hasty iron yeah, i think i had a third party lib on this PC :kek

hasty iron
#

that could be the issue

fallow mauve
valid galleon
fallow mauve
#

thx

hasty iron
#

discord.Guild.create_custom_emoji is a method

#

not a converter

mortal thistle
#

can someone tell me to escape from an error in aiosqlite?

hasty iron
#

try-except it?

valid galleon
#

now i get this:
ImportError: cannot import name 'commands' from 'discord.ext' (unknown location)

hasty iron
#

use the correct converter?

#

discord.Emoji or discord.PartialEmoji

valid galleon
#

alright

fallow mauve
#

im wanting to use embeds for my help menu, how do i do that?

slate swan
#

remove self

#

from the args

hasty iron
#

you need an instance of discord.Guild not the class itself

valid galleon
#

this is why yu dont copy paste code you find on the internet lol

hasty iron
#

and image takes in bytes not Emoji or PartialEmoji

valid galleon
#

consider moving your commands to cogs dont put them in the main file

slate swan
#

how specific

valid galleon
#

sus

#

uhh

hasty iron
#

well i dont think stackoverflow answers would do such as a mistake to not use a Guild object

waxen python
#

well you dont use self in a non-cog

valid galleon
#

is your code in the main file or in a cog?

slate swan
#

!d discord.Guild.create_custom_emoji

unkempt canyonBOT
#

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

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

There is currently a limit of 50 static and animated emojis respectively per guild, unless the guild has the `MORE_EMOJI` feature which extends the limit to 200.

You must have the [`manage_emojis`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_emojis "discord.Permissions.manage_emojis") permission to do this.
slate swan
#

wait I thought you already removed discord.Guild from your code

#

that could be the only reason, because this function can't even raise a TypeError otherwise lmao

crystal cliff
steep estuary
fading harness
#

hello

reef shell
#

lol

fading harness
#

i want to know that do the message of the bot in dm is sent successfully or not

maiden fable
magic walrus
#

how do i ensure that once the word "Pious" has been replied in the bots dm's, it does not continue to respond even if "Pious" is stated a second time

steep estuary
#

postgres is a website? :/

steep estuary
fading harness
steep estuary
#

or a library

reef shell
steep estuary
maiden fable
steep estuary
#

but ppls can see ur code

maiden fable
steep estuary
#

in repl

crystal cliff
reef shell
#

lmao

magic walrus
steep estuary
fading harness
#

using if-else

steep estuary
#

i just want to store my variable safe that's why i want database

fading harness
crystal cliff
#

Anybody got a on_member join code, that works, & a server_info code, pls.

reef shell
#

you need to attach a file

#

as your command is coded in that way

sacred folio
#

Hello again, im trying to update an embed after sending it to the channel. What im trying to achieve is to add the names of everyone reacting to the embed. I read something about ctx.edit that uses discord.richembed but i cant seem to get it to work. Any thoughts?

hasty iron
steep estuary
#

ok

hasty iron
steep estuary
#

kk

slate swan
#

Hello

invite = ctx.channel.create_invite()

Will this code return a permanent invite?

steep estuary
slate swan
#

Help pls

slate swan
#

Then how to generate a permanent one?

maiden fable
#

!d discord.TextChannel.create_invite

unkempt canyonBOT
#

await create_invite(*, reason=None, max_age=0, max_uses=0, temporary=False, unique=True, target_type=None, target_user=None, target_application_id=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Creates an instant invite from a text or voice channel.

You must have the [`create_instant_invite`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.create_instant_invite "discord.Permissions.create_instant_invite") permission to do this.
maiden fable
#

Wait, nvm

#

It does, yea

slate swan
#

@maiden fable ok thanks

#

:)

zealous berry
#

help. this is my code for reaction role command, so when i write ?react3 then the message and the reaction pops out. But when i react to it, it doesn't give me the role. How to fix?

@client.command()
async def react3(ctx):
  guild = ctx.guild
  role = discord.utils.get(guild.roles, name="artist")
  message = await ctx.send("React to me!")
  while True:
    await message.add_reaction(':white_check_mark:')
    reaction = await ctx.wait_for_reaction(emoji=':white_check_mark:', message=message)
    await ctx.add_roles(reaction.author, role)
fierce light
#
    open(help.html)```
Error: Command raised an exception: NameError: name 'Help' is not defined
On entering help it is supposed to open help.html (its in the same folder as the py file)
How do I do it?
#

Thanks

mental kraken
#

Fixed
That cursed annotation was placed there in order to fix a linter error
We have changed a couple of things and annotations are now okay

slate swan
slate swan
#

what did you do in the event?

zealous berry
high flame
high flame
sacred folio
#

Replit has a db connected to it, so you can store stuff

#

But its not complex at all, it only allows for a single table

high flame
#

but it's bad

sacred folio
#

It is, but if youre a beginner i think its adequate

high flame
#

it's just json

high flame
#

it's recommended

slate swan
high flame
#

mm

steep estuary
high flame
#

yeah sure but use aiosqlite3

zealous berry
#

how to fix this ```py
reaction = await ctx.message.wait_for_reaction('โœ…')

it says message has no attribute wait_for_reaction and idk what to do
high flame
#

because it isn't

zealous berry
#

oh

#

how to do it then

high flame
#

Bot.wait_for("reaction_add")

#

!d discord.ext.commands.Bot.wait_for

unkempt canyonBOT
#

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

Waits for a WebSocket event to be dispatched.

This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.

The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.

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

This function returns the **first event that meets the requirements**...
zealous berry
#

oh alright lemme read that

stoic sparrow
#

@unkempt canyon

high flame
sacred folio
#

Im trying to update a single field in an embed thats been sent to the channel is there a way to achieve it easily?

high flame
#

yeah

zealous berry
sacred folio
#

When i try and use embed_message.edit it collapses the old one and only title shows

high flame
sacred folio
#

I save it as a variable as i send it to ctx

high flame
#

edit the embed like this: ```py
embed = discord.Embed(title="hello")
embed.title = "hey"

sacred folio
#

Hmm

high flame
sacred folio
#

If i have lets say 3 fields.. How would you specify to edit the first one

high flame
#

yeah it's right

#

!d discord.Embed.fields

unkempt canyonBOT
#

property fields: List[_EmbedFieldProxy]```
Returns a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of `EmbedProxy` denoting the field contents.

See [`add_field()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.add_field "discord.Embed.add_field") for possible values you can access.

If the attribute has no value then [`Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty") is returned.
sacred folio
#

So embed_message.field[0] =.. Can i still give it two parameters or should i send in a string containing both

high flame
#

embed_message.fields[0]

#

you can do like embed_message.fields[0].name = "something"

#

embed_message.fields[0].value = ...
embed_message.fields[0].inline = ...

fading harness
slate swan
fading harness
#

there is database built in replit

high flame
slate swan
#

yes but replit it self is not a databade

fading harness
#

yes.

sacred folio
#

Im trying but it gives me invalid syntax. Do i need to import something to use. Fields

high flame
#

it's just a key: value

fading harness
steep estuary
#

how i can store data like user levels and xp ?

high flame
#

use postgres maybe

steep estuary
#

json cannot do this?

high flame
#

SQL? it's not that hard

#

you can learn it in one day or two

slate swan
steep estuary
#

hmm

visual island
#

sql is case insensitive potatopopcorn

boreal ravine
steep estuary
#

i just want to confirm cuz i don't want to delete the code if it will not work in heroku

#

should i use sqlite or postgres?

slate swan
#

its upto you rlly

high flame
steep estuary
visual island
#

sqlite is not for high traffic purposes, postgres is fine tho

boreal ravine
high flame
#

hmm, if you use heroku then json isn't the best choice (will never be)

solemn grove
#
@bot.group(invoke_without_command=True)
async def help(ctx):

It's only triggering on help
How can I make it to trigger on Help, HELP etx.

boreal ravine
#

what

steep estuary
#

i think i should learn postgres so it will be good for future use too

sacred folio
#
await embed_message.fields[0].value = "test" 

I get that the message object has no attribute fields

visual island
unkempt canyonBOT
#

Whether the commands should be case insensitive. Defaults to False. This attribute does not carry over to groups. You must set it to every group if you require group commands to be case insensitive as well.

high flame
hollow mortar
#

hey i have question do i can use this

#
role = ## your role id 
await ctx.channel.set_permissions(role, send_messages= False)```
#

does this work if i do it ?

high flame
#

no

hollow mortar
#

why ?

high flame
#

role is just and int in your case

#

you need a discord.Role

hollow mortar
#

so what should i do role = discord.role( my role id ? )

high flame
#

do get_role(<role_id>) and save in a variable

sacred folio
#

Hmm, when i first declare the embed, i then save it as a variable like this

await embed_message = await ctx.send(embed = embed) 

I dont get anymore errors when i set up the edit like you wrote, however nothing happens when I react on the embed in discord

high flame
#

and put the variable in set_permissions

hollow mortar
#

so role = get_role(my role id )

#

and then this

high flame
#

just ```py
embed_message = await ctx.send(embed = embed)
embed = embed_message.embeds[0]
embed.value = "something"
await embed_message.edit(embed = embed)

hollow mortar
#

await ctx.channel.set_permissions(role, send_messages= False)

sacred folio
#

My bad. My head is wobbley, there is only 1 await hahah

boreal ravine
#

embeds aren't even coro's

hollow mortar
#

this doesnt work

#
role = get_role(891031599708266629)```
boreal ravine
#

get_role is not defined

hollow mortar
#

yes

#

idk how to fix it

boreal ravine
#

idk is not defined

high flame
#

im leaving the chat

sacred folio
#

Thanks for the help! Ill get it soon enough

boreal ravine
#

im_leaving is missing one required positional argument. (self)

sacred folio
#

Its just some trial and error to be done

high flame
high flame
sacred folio
#

Hmm, something is not allowing it to update

hollow mortar
#

bot not defined

high flame
#

Bot as you need an instance of commands.Bot and not pasting the code in your bot ;-;

hollow mortar
#

wehat ?

#

look its not defined it show yellow

#

line that means not defined

sudden quail
#

Setting up...
Traceback (most recent call last):
File "launcher.py", line 10, in <module>
main()
File "launcher.py", line 6, in main
bot.run()
File "/[REDACTED]/discord/bot/bot.py", line 21, in run
self.setup()
File "/[REDACTED]/discord/bot/bot.py", line 15, in setup
self.load_extension(f"bot.cogs.{cog}")
File "/[REDACTED]/.local/lib/python3.6/site-packages/discord/ext/commands/bot.py", line 676, in load_extension
raise errors.ExtensionNotFound(name)
discord.ext.commands.errors.ExtensionNotFound: Extension 'bot.cogs.cogs' could not be loaded.

sacred folio
#

Bot with small b?

sudden quail
#

this is the error

slate swan
#

someone can give me ticket system?

sudden quail
#

Welcome to the discord.py music series - the series where I teach you how to build a music bot for yours and others' servers!

Series requirements can be found here:
https://files.carberra.xyz/requirements/discord-music-2020

You'll also need an IDE; I use Visual Studio Code in this series:
https://code.visualstudio.com/

The GitHub repository f...

โ–ถ Play video
#

whats the problem?

slate swan
#

show the error

little ether
hollow mortar
#

yup this one works i think let me try

slate swan
sudden quail
sudden quail
#

scrub to there

#

?

hollow mortar
little ether
solemn grove
#

How to check whether the user have a specific number of invites?

sacred folio
#

I found the issue, dont know how to get around it. I cant just do fields[0].value ="test" because fields[0] is a tuple

#

Does anyone know how to replace a tuple in an embed?

compact field
#

guys how can i send embed in dropdowns ?

#

when user click on dropdown options send embed instead message

slate swan
compact field
#

why ?

slate swan
compact field
hasty iron
compact field
#
@client.command()
async def test(ctx):
    embed = discord.Embed(title='testin bot', description='testing bot for drop down discord!')
    my_embed1 = discord.Embed(title=f'Optionsf 1')
    my_embed2 = discord.Embed(title=f'Optionsf 2')
    my_embed3 = discord.Embed(title=f'Optionsf 3')

    msg = await ctx.send(
        embed=embed,
        components=[
            SelectMenu(
                custom_id="test",
                placeholder="Click nkni shab miyam to khabet !",
                max_values=1,
                options=[
                    SelectOption("Option 1", "value 1", description='All testing for bot', emoji='๐Ÿค'),
                    SelectOption("Option 2", "value 2", description='All testing for bot', emoji='๐Ÿค'),
                    SelectOption("Option 3", "value 3", description='All testing for bot', emoji='๐Ÿค')
                ]
            )
        ]
    )
    # Wait for someone to click on it
    inter = await msg.wait_for_dropdown()
    # Send what you received
    labels = [option.label for option in inter.select_menu.selected_options]
    await inter.reply(f"{', '.join(labels)}")
#

this is my code

slate swan
compact field
sacred folio
#

@hasty iron i didnt know, i got help earlier but i just found out its a tuple. I tried converting it to a list and replacing the value, then converting it back and setting the embedded tuple to the new one. Didnt work

hasty iron
#

whats your code?

sacred folio
#

Can i tag you in half an hour. Gotta get home whilst the rain is slowing down a bit

hasty iron
#

ok

#

!d discord.Client.users

unkempt canyonBOT
#

property users: List[discord.user.User]```
Returns a list of all the users the bot can see.
hasty iron
#

it would return a set of Member though

#

yeah

#

thats old

#

!d discord.Client.guilds

unkempt canyonBOT
#

property guilds: List[discord.guild.Guild]```
The guilds that the connected client is a member of.
hasty iron
#

if you're going to copy code atleast copy something not outdated

#

do you have intents

#

add intents=discord.Intents.all() to your bot's constructor and enable them in your dev page

boreal ravine
#

i cant read shit

slate swan
#

how come

slate swan
#

best explanation

#

Ty ty

#

wat

boreal ravine
#

this is clear?

hasty iron
#

looks fine for me

placid skiff
meager whale
dapper cobalt
dapper cobalt
boreal ravine
dapper cobalt
#

Battery saver.

meager whale
boreal ravine
dapper cobalt
meager whale
#

Ok

boreal ravine
unkempt canyonBOT
#

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

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

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

^

meager whale
#

I just removed the dot

#

After commands

dapper cobalt
boreal ravine
placid skiff
dapper cobalt
meager whale
#

Ok

boreal ravine
maiden fable
#

Yo, anyone here knows how to scrape a traceback to get the module which isn't imported?

#

NameError

#

I can check if the module is in the list of modules

#

How to get the name

#

Wait

#

!d NameError

unkempt canyonBOT
#

exception NameError```
Raised when a local or global name is not found. This applies only to unqualified names. The associated value is an error message that includes the name that could not be found.

The `name` attribute can be set using a keyword-only argument to the constructor. When set it represent the name of the variable that was attempted to be accessed.

Changed in version 3.10: Added the `name` attribute.
maiden fable
#

I hope it has an attribute to get the name which errored

dapper cobalt
#

name

#

In v3.10 tho.

maiden fable
#

Yea, but added in 3.10

#

sad :c

dapper cobalt
#

Still gonna use 3.8.6.

maiden fable
#

I use 3.9, sadly

frigid dune
#

How can I check if a user have a specific role?