#discord-bots

1 messages Β· Page 508 of 1

high flame
#

that's not how you do it

river kindle
#

how

high flame
#

client.get_channel(mychannel) returns a discord.TextChannel instance

river kindle
#

and?

high flame
#

save it in a variable named x for example

dim cedar
#

more like this

high flame
#

then await x.send("content")

river kindle
high flame
#

to the client.get_channel()...

river kindle
#

okok

dim cedar
high flame
#

so now you got x an instance of discord.TextChannel

magic stump
#

Aaa

#

Oke

river kindle
high flame
#

not really

high flame
dim cedar
river kindle
# high flame can you show the current code?
async def on_command_completion(ctx, channel: TextChannel, *, mylogs):
  await ctx.send("{} used {}".format(ctx.author, ctx.command.name))
  mylogs = client.get_channel(mychannel)
high flame
#

now do await mylogs.send("whatever")

#

you don't need that await ctx.send("{} used {}".format(ctx.author, ctx.command.name)) lol

high flame
#

change to on_command_completion(ctx):

river kindle
river kindle
fallow mauve
#

i fixed my problem

dim cedar
slate swan
#
                                                  ^
SyntaxError: invalid syntax```
sweet herald
#

i have a list of Message objects and i want to sort them based on creation_date attr. could someone help with that?

river kindle
dim cedar
river kindle
#

yes

fallow mauve
# dim cedar what is it?

i was adding an on_message event before the command and forgot to add "return" to the end of it

dim cedar
dim cedar
#

help

#

does that code sorts out the help part?

fallow mauve
dim cedar
#

i wanted tht too

#

thanks

fallow mauve
#

dont u go and copy my code tho, thats not how ya learn

#

u gotta understand it or you wont be able to fix any errors u run into

fallow mauve
#

good

dim cedar
#

but i needed to learn how to do the thing

fallow mauve
#

if u wanna copy/paste it thats fine, but u gotta break it apart and learn how it works

#

you cant just copy the code and call it good

dim cedar
#

not a problem

fallow mauve
#

k

dim cedar
#

i can understand

river kindle
dim cedar
#

in what?

#

the code?

river kindle
#

with the log

#

yes

dim cedar
#

send your current code please

river kindle
#

k

#
@client.event
async def on_command_completion(ctx):
  await ctx.send("{} used {}".format(ctx.author, ctx.command.name))
  await client.get_channel(893147273884729345)

get channel is the problem

brisk fiber
#

the get_x methods aren't asynchronous

river kindle
#

now I have to go, as soon as you can if you can tell me in dm how to do it, I will not be able to read the messages here

brisk fiber
river kindle
#

how

#

idk how to use

brisk fiber
lime rune
#

yo

dim cedar
#

guess what i think u didnt import get

#

@river kindle

gentle sedge
#

I need a suggestion on how to use mongodb with discord bot. Should I create a file with functions inside that will call a database or use something else?

dim cedar
#

@river kindle

#
from urllib import parse, request```
#
from requests import get```
steep estuary
#

hi

hasty iron
steep estuary
#

i am working with postgres
asyncpg
and it is showing this
when i am loading a row's object

hasty iron
hasty iron
dim cedar
steep estuary
#

to render?

hasty iron
steep estuary
hasty iron
#

!e ```py
import asyncio

def get_something(id: int):
return id

async def main():
await get_something(123)

asyncio.run(main())

unkempt canyonBOT
#

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

001 | Traceback (most recent call last):
002 |   File "<string>", line 9, in <module>
003 |   File "/usr/local/lib/python3.9/asyncio/runners.py", line 44, in run
004 |     return loop.run_until_complete(main)
005 |   File "/usr/local/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
006 |     return future.result()
007 |   File "<string>", line 7, in main
008 | TypeError: object int can't be used in 'await' expression
hasty iron
steep estuary
#

ctx.prefix?

#

bot.prefix?

hasty iron
#

do you forget this easily

steep estuary
#

what is ctx.prefix?

hasty iron
#

bot.prefix??????

steep estuary
hasty iron
#

dude we literally talked about this earlier

#

!d discord.ext.commands.Context.prefix

unkempt canyonBOT
steep estuary
#

let me see it properly :/

hasty iron
#

The prefix that was used to invoke the command.

#

what do you want to see?? i dont understand

brazen seal
#

Someone can help me please?

waxen granite
#

@hasty ironpy if before.permissions != after.permissions: diff = set(after.permissions).difference(set(before.permissions)) for perm, value in diff: if value == True: list1.append(perm) else: list2.append(perm) embed.add_field(name = "Added Permission(s):", value ='\n'.join(list1), inline = False) embed.add_field(name = "Removed Permission(s):", value ='\n'.join(list2), inline = False) await logChannel.send(embed = embed) this works when perms are added and removed in one go, but doesnt when only perm is added or when perm is removed

high flame
steep estuary
#

let me try :/

maiden fable
hasty iron
#

"ohh" man

maiden fable
#

Lmao

steep estuary
#

noice it worked

#

:/

#

tysm :)

maiden fable
#

.....?

brazen seal
#

hm?

high flame
#

hmm

magic stump
#
@bot.command()
async def test(ctx):
    if  ctx.author.status == dnd:
        await ctx.send("oNligne")``` how to change DND to online ?
high flame
#

better discord again πŸ‘€

hasty iron
#

its not, copium

magic stump
#

siet

plucky shoal
#

That's a modified client right there

magic stump
plucky shoal
hasty iron
#

deleting it wont change the fact that 3 people saw it

plucky shoal
#

Yeah

#

Also mods have logs

magic stump
#
@bot.command()
async def test(ctx):
    if  ctx.author.status == dnd:
        await ctx.send("oNligne")``` how to change DND to online ?
high flame
#

he already showed it before in a bigger ss

magic stump
#

because bot send DND

hasty iron
#

yeah i saw it

steep estuary
#

how to connect postgres with heroku

#

i was using

#

pgadmin 4

#

but when update in heroku

#

it is saying address not connected

brazen seal
#

so someone can?

proven ore
#

errors?

magic stump
#

When how to change DND to online?

#
@bot.command()
async def test(ctx):
    status = ctx.author.status

    await ctx.send(status)```
brazen seal
#

and i can't solve my problem

waxen granite
#

anyone help!

tranquil quest
#

hey I am making a command which you run, I then want the bot to ask a question such as:

What is your favourite color?

and wait 30 seconds for a response before stopping, what is the easiest way to achieve this?

#

I can think of some complex ways but i'm sure there must be some simpleish way built into pycord/discord.py

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**...
high flame
#

finally not using better discord

high flame
high flame
craggy cloak
#

How can i define aiohttp?

spring flax
high flame
waxen granite
#

help

high flame
waxen granite
#

no error

high flame
#

can you print diff

waxen granite
#

it works for both added and removed perms , but if only perms are added or only removed, it doesnt work

waxen granite
waxen granite
slate swan
#

Do a len before adding the field

#

If the list is empty then don't add the field

waxen granite
#

wdym len

#

for perm?

ember mauve
#

Yo!! guys

magic stump
magic stump
magic stump
crystal cliff
#

is it bot status?

magic stump
high flame
#

dnd is your status and it is do not disturb

magic stump
#

aaaa

slate swan
#
async def on_ready():
    await client.change_presence(activity=discord.Activity(type=discord.ActivityType.competing, name="slums"))
    print("daddy slums is online.")``` why does it say client is not defined the variable?
high flame
#

have you copied the code?

slate swan
#

no i done it myself

high flame
#

do you have bot = commands.Bot(...)?

slate swan
high flame
#

show the whole error

dawn zinc
#

I am trying to create an admin bot. I have a csv file of cuss words. How do I ban someone who uses any of these cuss words?

slate swan
#

β€Ž||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||https://khadz.fuckedyourmom.today/β€‹β€Œβ€‹β€Œβ€‹β€Œβ€Œβ€‹β€‹β€Œβ€‹β€‹β€‹β€Œβ€Œβ€Œβ€‹β€‹β€Œβ€Œβ€Œβ€‹β€‹β€Œβ€‹β€Œβ€Œβ€Œβ€Œβ€‹β€‹β€‹β€‹β€Œβ€‹β€Œβ€‹β€Œβ€‹β€‹β€‹β€Œβ€‹β€Œβ€‹β€‹β€Œβ€‹β€‹β€Œβ€‹β€‹β€Œβ€Œβ€‹β€‹β€‹β€Œβ€‹β€‹β€‹β€Œβ€‹β€‹

manic wing
high flame
#

tf

#

is that an embed

slate swan
high flame
#

looks sus

slate swan
manic wing
slate swan
#
from discord.client import _ClientEventTask, Client
from discord.ext import commands

import json
import os
import os

intents = discord.Intents.default()
intents.members = True

@client.event
async def on_ready():
    await client.change_presence(activity=discord.Activity(type=discord.ActivityType.competing, name="slums"))
    print("daddy slums is online.")

client = commands.Bot(command_prefix = ";", intents=intents)

if os.path.exists(os.getcwd() + "/config.json"):

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

else:
    configTemplate = {"Token": "", "Prefix": ";"}
    
    with open(os.getcwd() + "/config.json", "w+") as f:
        json.dump(configTemplate, f)

token = configData["Token"]
prefix = configData["Prefix"]

initial_extensions = []

for filename in os.listdir('./cogs'):
    if filename.endswith('.py'):
        initial_extensions.append("cogs." + filename[:-3])


if __name__ == '__bot__':
    for extensions in initial_extensions:
       client.load_extension(extensions)

client.run(token)```
manic wing
#

bye

dapper cobalt
slate swan
slate swan
#

oh nvm i see

dapper cobalt
#

!e

print(e)
e = "e"
unkempt canyonBOT
#

@dapper cobalt :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | NameError: name 'e' is not defined
slate swan
#

fixed

manic wing
dapper cobalt
#

You can't use a variable before you've defined it.

slate swan
#

β€Ž||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||https://khadz.fuckedyourmom.today/β€‹β€Œβ€Œβ€‹β€Œβ€‹β€Œβ€Œβ€‹β€Œβ€Œβ€‹β€‹β€‹β€Œβ€‹β€‹β€‹β€Œβ€Œβ€‹β€‹β€Œβ€‹β€‹β€‹β€Œβ€Œβ€‹β€Œβ€‹β€Œβ€‹β€Œβ€Œβ€Œβ€‹β€Œβ€‹β€‹β€‹β€Œβ€‹β€Œβ€‹β€‹β€‹β€Œβ€‹β€Œβ€‹β€‹β€Œβ€‹β€Œβ€Œβ€‹β€Œβ€Œβ€‹β€Œβ€‹β€‹β€Œ

#

how do i fix this now?

manic wing
#

β€Ž||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​|https://khadz.fuckedyourmom.today/β€‹β€Œβ€Œβ€‹β€Œβ€‹β€Œβ€Œβ€‹β€Œβ€Œβ€‹β€‹β€‹β€Œβ€‹β€‹β€‹β€Œβ€Œβ€‹β€‹β€Œβ€‹β€‹β€‹β€Œβ€Œβ€‹β€Œβ€‹β€Œβ€‹β€Œβ€Œβ€Œβ€‹β€Œβ€‹β€‹β€‹β€Œβ€‹β€Œβ€‹β€‹β€‹β€Œβ€‹β€Œβ€‹β€‹β€Œβ€‹β€Œβ€Œβ€‹β€Œβ€Œβ€‹β€Œβ€‹β€‹β€Œ

dapper cobalt
#

KeyError means not found. Check if you have "Token" where you are trying to find it.

slate swan
dapper cobalt
# manic wing β€Ž||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​|...

β€ŽDJS.||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||β€Œhttps://discord.gg/dpy

#

Wrong URL, wait.

high flame
#

something is weird

manic wing
#

ohhh

slate swan
high flame
#

does discord removes the link and keep the embed now?

manic wing
#

its just invisible characters + a link that discord converts to an embed

dapper cobalt
high flame
#
dapper cobalt
high flame
#

ehh no

dapper cobalt
manic wing
#

||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​|https://top.gg

high flame
#

how

manic wing
#

yeah got it

high flame
#

someone will get banned soon with it

manic wing
# high flame how

β€ŽJavaScript.||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||β€Œhttps://top.gg```
high flame
#

ah i remember that one

#

someone used to mention me without @

dapper cobalt
#

β€Œβ€‹β€Œβ€Œβ€‹β€‹β€Œβ€‹β€‹β€‹β€Œβ€Œβ€Œβ€‹β€‹β€Œβ€Œβ€Œβ€‹β€‹β€Œβ€‹β€Œβ€Œβ€Œβ€Œβ€‹β€‹β€‹β€‹β€Œβ€‹β€Œβ€‹β€Œβ€‹β€‹β€‹β€Œβ€‹β€Œβ€‹β€‹β€Œβ€‹β€‹β€Œβ€‹β€‹β€Œβ€Œβ€‹β€‹β€‹β€Œβ€‹β€‹β€‹β€Œβ€‹That's how it actually looks.

slate swan
# dapper cobalt Either in file, or dict.

β€Œβ€‹β€‹iβ€Œ do not have Tokenβ€‹β€Œβ€‹β€‹β€‹β€‹β€‹β€Œβ€‹β€‹β€Œβ€Œβ€‹β€‹β€‹β€Œβ€Œβ€Œβ€Œβ€‹β€‹β€‹β€‹β€Œβ€‹β€‹β€Œβ€Œβ€Œβ€‹β€‹β€Œβ€Œβ€Œβ€‹β€‹β€‹β€Œβ€‹β€Œβ€‹β€Œβ€Œβ€‹β€‹β€Œβ€‹β€‹β€Œβ€Œβ€‹β€‹

slate swan
dapper cobalt
# high flame someone used to mention me without @

||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||β€Œ@high flame

manic wing
#

!e print(hmmm why doesnt this work)

unkempt canyonBOT
#

@manic wing :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 1
002 |     print(hmmm why doesnt this work)
003 |                ^
004 | SyntaxError: invalid syntax
manic wing
#

you have done a day of python and expect to make a discord bot

unkempt canyonBOT
#

@dapper cobalt :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 2, in <module>
003 | KeyError: 'age'
dapper cobalt
#

KeyError because the dict doesn't have "age".

#

But it does have "name".

#

!e

my_dict = {"name": "Seif Wessam"}
print(my_dict["name"])
unkempt canyonBOT
#

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

Seif Wessam
slate swan
manic wing
#

!e

my_dict = {"name": "Seif Wessam"}
print(my_dict["life"])
unkempt canyonBOT
#

@manic wing :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 2, in <module>
003 | KeyError: 'life'
manic wing
#

i can suggest you learn basics for a month

slate swan
#

tell me what i should learn and ill do it

manic wing
# slate swan alright, i will then

im happy to help you with the basics in a help channel or dms (despite my name) if you need basics help, its just hard to jump into the deep end with python - discord.py is a bit more intermediate

manic wing
slate swan
dapper cobalt
#

Make a game.

manic wing
#

i recommend watching youtube videos for each of them

dapper cobalt
#

Just kidding haha.

slate swan
#

i sent you a friend request fred

dapper cobalt
#

Try to learn about dicts. Make a dict variable called "player" and append a health field, shield field, inventory field which should be an array, and level field.

magic stump
#
@commands.command()
    async def join(self, ctx):
        if ctx.author.voice is None:
            await ctx.send("Bot doΕ‚Δ…czyΕ‚ do kanaΕ‚u gΕ‚osowego!")
        voice_Channel = ctx.author.voice.channel

        if ctx.voice.channel is None:
            await voice_Channel.connect()

        else:
            await ctx.voice_client.move.to(voice_Channel)```wtf discord.ext.commands.errors.CommandNotFound: Command "join" is not found
dapper cobalt
#

Should look like this:

player = {
  "name": "Player 1",
  "health": 100,
  "shield": 50,
  "inventory": ["sandwich", "sword"],
  "level": 1
}
#

@slate swan

dapper cobalt
#

Would be a rookie mistake.

magic stump
#

mhm wait

slate swan
slate swan
manic wing
# slate swan sure
  1. make a window with tkinter (its called tkinter.tk) -> watch tk tutorials
  2. learn tkinter in general
  3. make a window with pyqt5 (why not)
  4. make a class which will give a random name and some random jazz (just watch python class tutorials)
  5. make balls bounce around a tkinter window
  6. use the module requests to get a random joke from an api (just google python requests api get joke) or something
  7. use sqlite or mongodb (databases) to transfer data to and from the databases - plenty of tutorials
  8. learn dicts and lists (dict indexing (dict[]), dict keys, etc)
  9. learn these modules: (not super in depth but just a little bit):
  • time
  • random
  • numpy
  • simpleeval
  1. fully comprehend the uses of dir and completely grasp attrition, properties of objects. Everything in python is an object. "HI" is a string which has attributes like upper, lower, split

.
these should take a month or so, if you need any help you can ask me

slate swan
#

That's a lot of tkinter

magic stump
# dapper cobalt Did you reload the cog?
Traceback (most recent call last):
  File "c:/Users/Uzytkownik/Desktop/Dawid Orginalny/Python/Avexa Music/main.py", line 8, in <module>
    import music
  File "C:\Users\Uzytkownik\AppData\Local\Programs\Python\Python38\lib\site-packages\music\__init__.py", line 1, in <module>
    from .utils import H
  File "C:\Users\Uzytkownik\AppData\Local\Programs\Python\Python38\lib\site-packages\music\utils.py", line 5, in <module>
    from . import core
  File "C:\Users\Uzytkownik\AppData\Local\Programs\Python\Python38\lib\site-packages\music\core\__init__.py", line 1, in <module>
    from .functions import *
  File "C:\Users\Uzytkownik\AppData\Local\Programs\Python\Python38\lib\site-packages\music\core\functions.py", line 275, in <module>
    foo = n.linspace(-1, 1, Lt/2, endpoint=False)
  File "<__array_function__ internals>", line 5, in linspace
  File "C:\Users\Uzytkownik\AppData\Local\Programs\Python\Python38\lib\site-packages\numpy\core\function_base.py", line 120, in linspace
    num = operator.index(num)
TypeError: 'float' object cannot be interpreted as an integer``````py
import discord
from discord import channel
from discord.channel import VoiceChannel
from discord.ext import commands
from discord.ext.commands.core import command
from discord.player import FFmpegAudio


import music

slate swan
#

Should've also recommended smth like making a tic-tac-toe or a rock-paper-scissors or something

manic wing
slate swan
#

Never learnt tkinter

#

Never needed it

slate swan
#

And still teach you something

#

The easiest way to learn something is if it's enjoyable and fun, so they'd be a great learning experience, especially if they compare their code with someone else's, then they can improve their skills even further

manic wing
#

ive been vagueish meaning they can learn all they can

slate swan
#

Understandable

magic stump
#

to

#

spofity music

final iron
#

Isnt that against Spotify tos

dapper cobalt
hasty iron
#

it is with the music import

#

read the whole traceback

magic stump
hasty iron
#

what even is music

#

!pypi music

unkempt canyonBOT
#

music is a python package for making music and sounds, based on the MASS framework

hasty iron
#

?? why do you have it??

magic stump
#

i have this

#

because

#

i coding bot

hasty iron
#

what?

high flame
slate swan
hasty iron
high flame
#

Object Oriented Programming

hasty iron
#

do you know what you’re doing?

slate swan
magic stump
#

My libraries are wrong, instead of music, there should be time

#

yes

high flame
hasty iron
#

…

high flame
#

error 404: beginner definition not found

final iron
hasty iron
magic stump
#

i don't know

hasty iron
#

you need something lower level

high flame
hasty iron
#

like C and assembly

high flame
hasty iron
#

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

high flame
#

!projects

unkempt canyonBOT
#

Kindling Projects

The Kindling projects page on Ned Batchelder's website contains a list of projects and ideas programmers can tackle to build their skills and knowledge.

slate swan
manic wing
flat solstice
#

I'm getting a syntax error on the else:, how can I stop this? is there something i would need to add to the end of the try: like pass, continue etc or do I need to add in a exception?py if joincount[2] > 3: embed = discord.Embed(title = "Member Banned!", description = f'{member.name}#{member.discriminator} account is **{acc_age.days}** days old and has joined the server {joincount[2]} times so the member was banned by raidmode.') await member.ban(reason = f"Raidmode enabled: {member.name}#{member.discriminator}'s account was deemeed too new by your raidmode configuration. The required age is {data[15]} days old and this users account is {acc_age.days} days old. You can check the current required age with the modconfig command. This user has also joined the server {joincount[2]} times which resulted in their ban.") await raid.send(embed = embed) try: await member.send(f"This server has raidmode **active** and requires users have a account that is older than **{data[15]}** days old and to have not joined more than **3** times. As your account is less than the servers threshold and you have joined {joincount[2]} times you have been banned.") else: embed = discord.Embed(title = "Member Kicked!", description = f'{member.name}#{member.discriminator} account is **{acc_age.days}** days old and so the member was kicked by raidmode.') await member.kick(reason = f"Raidmode enabled: {member.name}#{member.discriminator}'s account was deemeed too new by your raidmode configuration. The required age is {data[15]} days old and this users account is{acc_age.days} days old. You can check the current required age with the modconfig command.") await raid.send(embed = embed) try: await member.send(f"This server has raidmode **active** and requires users have a account that is older than **{data[15]}** days old. As your account is less than the servers threshold you have been kicked.")

manic wing
#

always

#
try:
  print(this wont work)
except:
  print('no syntax error!')
flat solstice
#

okay, i don't know how or why but my previous implementation didn't error without the except

manic wing
#

try always goes with except

brazen seal
manic wing
#

you could try giving...more information

#

so...more people can help

brazen seal
brazen seal
#

okay maybe i'll ask otherwise

magic stump
#

raise ClientException(executable + ' was not found.') from None
discord.errors.ClientException: ffmpeg was not found.

manic wing
brazen seal
#

How i can make help command using reaction - if you click page changing? etc

magic stump
#

windows

manic wing
magic stump
#

in cmd?

manic wing
brazen seal
#

what can you recommend to me?

manic wing
#

um

manic wing
#

ill just tweak it

magic stump
manic wing
# magic stump what

FFMPEG is an incredibly powerful bit of command-line software, but if you've never 'installed' it before, or are used to command-line software then this may be something more than a little confusing for you.

FFMPEG: https://www.ffmpeg.org/download.html
7-Zip: https://7-zip.org/download.html

β–Ά Play video
brazen seal
manic wing
hasty iron
#

what..

#

are you even trying to help

manic wing
hasty iron
#

??

#

just tell them what they could do to solve their issue

#

it’s that simple

manic wing
brazen seal
brazen seal
#

im still learning

hasty iron
#

not spoonfeed

manic wing
hasty iron
#

basically spoonfeeding wow

magic stump
#

Okr

manic wing
# hasty iron basically spoonfeeding wow

mate if he wants to be spoonfed (which he does, as he said), then he can - and I'm saying what I did to change it, ill explain it in depth + ill leave a couple errors so its not completely perfect. Also, I don't see you helping him

brazen seal
hasty iron
#

let’s see your in-depth explanation

magic stump
#

How long PayPal send money to bank?

hasty iron
unkempt canyonBOT
magic stump
#

Sorry

wispy spade
#

!or-gotcha

unkempt canyonBOT
#

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

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

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

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

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

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

I can't understand whatever language its in, so you can just write the embeds

manic wing
#

im writing it rn

brazen seal
manic wing
#

Okay

#

im going to add very little formatting

#

you can make it look nice

brazen seal
#

okayy

manic wing
#

im only going to add the emojis controlled help to the default help (you can do the rest)

manic wing
#

how many commands do you have

brazen seal
#

Emoticon control is probably the most important for me

brazen seal
#

with emoji user can switch categories

#

message editing to another embed clear reactions add new reactions etc

errant bramble
#

Can someone help with this prefix issue im having sorry

brazen seal
fallow mauve
errant bramble
#

I want to set the command prefix as text other than one character such as !

#

Ive did this but the bot does not reply to commands anymore

fallow mauve
#

hmm

errant bramble
#

Nevermind im so dumb

#

the whitespace in-between the command

flat solstice
#

Is there any way that I can edit msg from within the except? bc it doesn't seem to be getting edited rnpy try: await member.send(f"This server has raidmode **active** and requires users have a account that is older than **{data[15]}** days old and to have not joined more than **3** times. As your account is less than the servers threshold and you have joined {joincount[2]} times you have been banned.") except discord.Forbidden(response, message): msg.edit(embed = embed, content = "I was unable to DM {member} due to their DM's being closed.\nResponse: {response}\nMessage: {message}") and i'm getting this errorpy Traceback (most recent call last): File "/home/snowyjaguar/.local/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event await coro(*args, **kwargs) File "/home/modmail/cogs/events.py", line 220, in on_member_join except discord.Forbidden(response, message): NameError: name 'response' is not defined

fallow mauve
#

glad i could almost help

errant bramble
#

Thanks anyhow man EmojiCool

manic wing
#

@brazen seal do you use cogs?

brazen seal
manic wing
#

nvm

fallow mauve
#

how do i set my bot's status?

brazen seal
manic wing
#

@brazen seal what emojis are
Β¬``

#
await wiadomosc.add_reaction(party)
    await wiadomosc.add_reaction(question)
    await wiadomosc.add_reaction(x)
brazen seal
#

wait i didn't show you this variables wait a second

flat solstice
# manic wing where is `response` defined

well it's shown as something to include in the docs https://discordpy.readthedocs.io/en/stable/api.html?highlight=forbidden#discord.HTTPException, I've tried to remove it but that just gives me py Traceback (most recent call last): File "/home/snowyjaguar/.local/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event await coro(*args, **kwargs) File "/home/modmail/cogs/events.py", line 220, in on_member_join except discord.Forbidden(): TypeError: __init__() missing 2 required positional arguments: 'response' and 'message'

manic wing
#

except discord.Forbidden

fallow mauve
#

use those

manic wing
#

you can put the emojis in

fallow mauve
#

copy/paste those that i just sent into the code instead of the words

fallow mauve
#

question replaced with ❓

brazen seal
fallow mauve
#

x replaced with ❌

#

ok

brazen seal
fallow mauve
#

i meant like an status like mine is "πŸ‘€"

ocean hawk
#

how do you make your bot detect a mention?

fallow mauve
#

idk i just failed at figuring that out a few minutes ago lol

ocean hawk
#

oof

slate swan
ocean hawk
fallow mauve
#

@bot

#

@Whatever the bot's name is

high flame
#

no

#

each mention looks like this @dapper matrix

#

and not @name

full lily
high flame
#

now i'm mentioning you @fallow mauve

fallow mauve
#

@raven spindle

high flame
#

and respond to it

manic wing
#

@brazen seal im really tired so im gonna go to bed now: heres what i've done so far and I can help you in the morning further
https://hastebin.com/vomajepulo.py

I have;
1) added 4 ifs; for sorting if its a command, not a command, general help, and a cog. The cog will help you later, but you can ignore it for now. I havent made the formatting anything good at all, so it will look crap, but i've layed it out nicely so its easy for you to customise it
2) I added docstrings and comments so you can see whats going on at all times
3) I made it loop through all commands and sort it into embeds, and filter each page with list indexing
4) I used bot.get_cog and bot.get_command and bot.commands to help automate the help.
5) I used lambda instead of a def check
6) I didn't add a timeout because I dont think its needed here
7) I added a stop (the :X:)
8) the code is pretty neat and efficient so it wont confuse you as much
9) I just added names, aliases and typehints - you won't understand, thats fine, but its just it will look neater in the future
10) Indexing is extremely neat and an easy way to do pages, so thats what I did here

#

ask here if you get any errors, goodnight

brazen seal
#

so thank you again and goodnight ; )

main quarry
#

You can also do (if I remember correctly) something along the lines of discord.Game(string,type)

wide pike
#

umm does anyone know how to use slash commands with dpy 2.0 or with nextcord?

wide pike
#

ou

#

Dpy server

#

Okay

#

I'm already in it

#

lol

main quarry
# wide pike umm does anyone know how to use slash commands with dpy 2.0 or with nextcord?

https://github.com/EQUENOS/dislash.py this is what I use but I know there’s a something called discord.Interactions you can import

GitHub

A Python wrapper for discord slash-commands and buttons, designed to extend discord.py. - GitHub - EQUENOS/dislash.py: A Python wrapper for discord slash-commands and buttons, designed to extend di...

main quarry
#

Haven’t used it in a while so not 100% certain it works still. The guy who develops it just recently updated it so it should hopefully work

wide pike
#

Okay so it said that it works with dpy 2.0 too

#

And I'm using nextxord

#

So I think imma fork it and edit discord to nextcord

main quarry
#

Give it a shot

wide pike
#

Sadly I'm busy with studying and I have to sleep

main quarry
#

Sucks, if I have time later today I’ll hop on pc and test it for you

wide pike
#

It would be a great project to fork if it worked

wide pike
#

You can just replace all instances of discord to nextcord

#

Sadly it needs Python 3.7+

#

It's not a big deal ig

main quarry
#

Oh

wide pike
#

@main quarry actually there is an easier way

#

Instead of replacing instances just do
import nextcord as discord
from nextcord.ext import commands,tasks

instead of

import discord
from discord.ext import commands,tasks

#

so it's literally very easy

inland venture
#

how do i set status for my bot

flat solstice
#
ERROR:cogs.error_handler:TypeError: '_EmptyEmbed' object is not callable (In test_sug)
Traceback:
  File "/home/snowyjaguar/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/modmail/cogs/some_commands.py", line 24, in test_sug
    if search in message.embeds[0].title():```how can I remedy this issue, my code is```py
@commands.command(description = "Lets users locate a specfic suggestion via it's message ID or link.", usage = "sug <[messsage link|ID] | [phrase]>", aliases = ["find", "find-sug", "search", "search-sug"])
async def test_sug(self, ctx, search: Union[discord.Message, str]):
    suggestions = self.bot.get_channel(id = self.suggestions)
    if isinstance(search, discord.Message):
        await ctx.reply(embed = search.embeds[0].copy(),) # components = """Needs a button linking to the message"""
    else:
        with ctx.typing():
            matches = 0
            output = " "
            messages = await suggestions.history(limit = None, before = None, after = None, around = None, oldest_first = None).flatten()
            for message in messages:
                if search in message.embeds[0].title():
                    matches += 1
                    output = (output + f"[{message.embeds[0].title()}]({message.jump_url})")

            embed = Embed(title = f"I found `{matches}` suggestions matching `{search}`.", description = output)
            await ctx.reply(embed = embed)```
inland venture
#

how do i set status for my bot

patent lark
#

!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")
paper fern
#

does anyone happen to have a discord mass group leave program?

#

I found an old one on github but its outdated and does not seem to work anymore because of a module that was used

unkempt canyonBOT
#

5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.

dusk pumice
#

!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")
final iron
#

How would I send backticks in an embed without them turning into code format

vagrant brook
slate swan
vagrant brook
#

Hi

#

?

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

Wait someone did that already

#

Anyway

slate swan
vagrant brook
#

What is confusing

slate swan
#

\ ```

fallow mauve
#

how do i get the bot to edit it's message?

vagrant brook
#

ctx.send returns a discord.Message object

fallow mauve
#

?

vagrant brook
#

So you can assign it to something

fallow mauve
#

huh?

dapper cobalt
#

!d discord.Message.edit

unkempt canyonBOT
#

await edit(content=..., embed=..., embeds=..., attachments=..., suppress=..., delete_after=None, allowed_mentions=..., view=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Edits the message.

The content must be able to be transformed into a string via `str(content)`.

Changed in version 1.3: The `suppress` keyword-only parameter was added.
vagrant brook
#
msg = await ctx.send("...")
#

Then use Message.edit like Scoopy said

fallow mauve
#

ok

fallow mauve
slate phoenix
#
@bot.command()
async def test(ctx, message=None):
  msg = await ctx.send('test 1')
  await asyncio.sleep(1)
  await msg.edit(content="test 2")
fallow mauve
#

thx

unkempt canyonBOT
#

PEP 8 is the official style guide for Python. It includes comprehensive guidelines for code formatting, variable naming, and making your code easy to read. Professional Python developers are usually required to follow the guidelines, and will often use code-linters like flake8 to verify that the code they're writing complies with the style guide.

More information:
β€’ PEP 8 document
β€’ Our PEP 8 song! :notes:

flat solstice
#
ERROR:cogs.error_handler:TypeError: '_EmptyEmbed' object is not callable (In test_sug)
Traceback:
  File "/home/snowyjaguar/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/modmail/cogs/some_commands.py", line 24, in test_sug
    if search in message.embeds[0].title():```how can I remedy this issue, my code is```py
@commands.command(description = "Lets users locate a specfic suggestion via it's message ID or link.", usage = "sug <[messsage link|ID] | [phrase]>", aliases = ["find", "find-sug", "search", "search-sug"])
async def test_sug(self, ctx, search: Union[discord.Message, str]):
    suggestions = self.bot.get_channel(id = self.suggestions)
    if isinstance(search, discord.Message):
        await ctx.reply(embed = search.embeds[0].copy(),) # components = """Needs a button linking to the message"""
    else:
        with ctx.typing():
            matches = 0
            output = " "
            messages = await suggestions.history(limit = None, before = None, after = None, around = None, oldest_first = None).flatten()
            for message in messages:
                if search in message.embeds[0].title():
                    matches += 1
                    output = (output + f"[{message.embeds[0].title()}]({message.jump_url})")

            embed = Embed(title = f"I found `{matches}` suggestions matching `{search}`.", description = output)
            await ctx.reply(embed = embed)```
vagrant brook
#

Embed.title isn't a function

patent lark
#

!d discord.Embed.title

unkempt canyonBOT
flat solstice
#

okay thanks both

#

well now i'm getting this errorpy ERROR:cogs.error_handler:TypeError: argument of type '_EmptyEmbed' is not iterable (In test_sug) Traceback: File "/home/snowyjaguar/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped ret = await coro(*args, **kwargs) File "/home/modmail/cogs/some_commands.py", line 24, in test_sug if search in message.embeds[0].title:

hasty iron
#

the embed has no title

fallow mauve
#

is there a way to get the bot to list the roles of a specified user?

patent lark
vagrant galleon
#

there fore its not sending the same alert more than once

fallow mauve
#

ok

flat solstice
#

hmm, odd because the embed defiantly has a title, or maybe it's the author field πŸ€”

patent lark
#

!d discord.Member.roles

unkempt canyonBOT
#

property roles: List[Role]```
A [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "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.
flat solstice
# hasty iron the embed has no title

okay so I figured out it's not the title field but the author field, how would I go about getting the author name? message.embeds[0].author.name isn't working so i don't think i'm doing it right

hasty iron
#

message.author?

#

why would it belong to the embeds

flat solstice
#

no, i'm trying to get the name in the embed author field

hasty iron
#

!d discord.Embed.author

unkempt canyonBOT
#

property author: _EmbedAuthorProxy```
Returns an `EmbedProxy` denoting the author contents.

See [`set_author()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.set_author "discord.Embed.set_author") 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.
flat solstice
#

so would i put _EmbedAuthorProxy in instead?

hasty iron
#

embeds[0].author.name should work

#

what? thats the type

dapper cobalt
#

embeds[0].author.name should work as blanket said.

vocal cargo
flat solstice
# dapper cobalt `embeds[0].author.name` should work as blanket said.

okay I got that working, but now I'm getting this errorpy ERROR:cogs.error_handler:IndexError: list index out of range (In test_sug) Traceback: File "/home/snowyjaguar/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped ret = await coro(*args, **kwargs) File "/home/modmail/cogs/some_commands.py", line 24, in test_sug if search in message.embeds[0].author.name:

vocal cargo
dapper cobalt
#

!code

unkempt canyonBOT
#

Here's how to format Python code on Discord:

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

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

vocal cargo
#

it doesnt give error messages

#

but it wont send any of the wanted messages

dapper cobalt
dapper cobalt
vocal cargo
#
async def hot(ctx):
    coin=random.randint(1,2)
    if coin=='2':
        await ctx.send('https://thumbs.gfycat.com/GrimyBouncyDromaeosaur-size_restricted.gif')#tails
    if coin=='1':
        ctx.send('https://media.giphy.com/media/3oz8xAbE6jVnn6oorm/giphy.gif')#heads```
#

ok

dapper cobalt
#

Also, random.randint() returns an int.

#

And, it's await ctx.send(), not ctx.send().

vocal cargo
#

so how would i do it

#

i want to use random int to represent the coin

#

1 being heads 2 being tails

dapper cobalt
#

random.randint returns an integer, what do you think you are doing wrong?

#

!e

print("1" == 1)
unkempt canyonBOT
#

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

False
dapper cobalt
#

'1' is not equal to 1.

vocal cargo
#

ohhh

dapper cobalt
#

That's a string and that's an int.

vocal cargo
#

i see

simple kettle
#

So i used message.created_at and it returned 00:54:02.169000 I was wondering how i could convert that to eastern time?

vocal cargo
#

so it was because of the quotation

#

rip

#

thanks

dapper cobalt
#

!d discord.Message.created_at returns a datetime.datetime object which has a timestamp() method.

unkempt canyonBOT
dapper cobalt
#

!d datetime.datetime

unkempt canyonBOT
#

class datetime.datetime(year, month, day, hour=0, minute=0, second=0, microsecond=0, tzinfo=None, *, fold=0)```
The *year*, *month* and *day* arguments are required. *tzinfo* may be `None`, or an instance of a [`tzinfo`](https://docs.python.org/3.10/library/datetime.html#datetime.tzinfo "datetime.tzinfo") subclass. The remaining arguments must be integers in the following ranges...
dapper cobalt
#

Check if the current data is not equal to the new data then overwrite the current data with the new one.

#

!e

current_data = {"name": "Seif Wessam", "age": 15}
new_data = {"name": "Seif Wessam", "age": 16}
if (current_data != new_data):
  for key in current_data.keys():
    if current_data[key] != new_data[key]:
      unequal_key = key
  print(f"{unequal_key} is not the same!")
  current_data = new_data
  print(current_data)
unkempt canyonBOT
#

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

001 | age is not the same!
002 | {'name': 'Seif Wessam', 'age': 16}
vagrant galleon
#

whats wrong w this?

dapper cobalt
#

Is this in a cog?

vagrant galleon
#

in what?

dapper cobalt
#

A class?

vagrant galleon
#

no

#

update.start()

#

i also have that at the bottom

dapper cobalt
#
await update.start()

Try that.

vagrant galleon
#

"await" allowed only within async functionPylance

#

it has the red squigly undernetah

patent lark
#

add it under the on_ready event, but do something like wait_until_ready so the loop doesnt start before the bot is essentially ready

#

but i also dont think that is safe, since on_ready can be called multiple times.

vagrant galleon
#

why would i put that at the top

dapper cobalt
#

You can put the event anywhere, whether at the top or the bottom. It only matters if it's above the bot.run() and below the bot = commands.Bot() or not.

vagrant galleon
#
TypeError: updated() missing 1 required positional argument: 'ctx'```
#

still getting this error

#
async def on_ready():
  await client.change_presence(status=discord.Status.dnd, activity=discord.Game("DM Me Commands!"))
  print('Bot is ready.')
  await updated.start()``` and this is where i put it
#
async def updated(ctx):``` and i need ctx in updated because the bot is sending a message
dapper cobalt
#

Oh, nope. Don't put ctx there.

vagrant galleon
#

but how is the bot supposed to dm me

dapper cobalt
#

What is ctx?

vagrant galleon
#

await ctx.author.send(embed = late_embed)

#

i need it 4 that

dapper cobalt
#

How does the loop has an author?

vagrant galleon
#

wut?

dapper cobalt
#

Is this a command or an on_message event?

#

It's a loop, right?

vagrant galleon
#

its a tasks.loop

dapper cobalt
#

Then it doesn't have an author. You will need to use bot.get_user().

#

!d discord.ext.commands.Bot.get_user

unkempt canyonBOT
dapper cobalt
#
evan = client.get_user(your_id_here)
await evan.send("Hello")
#

Did you use a valid ID?

patent lark
#

did you put it as an int or string

dapper cobalt
#

Does your bot have member intents enabled?

vagrant galleon
#

dunno what that is

dapper cobalt
#

!intents

unkempt canyonBOT
#

Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default, discord.py has all intents enabled, except for the Members and Presences intents, which are needed for events such as on_member and to get members' statuses.

To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.

Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:

from discord import Intents
from discord.ext import commands

intents = Intents.default()
intents.members = True

bot = commands.Bot(command_prefix="!", intents=intents)

For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.

patent lark
#

!d discord.Intents.members

unkempt canyonBOT
#

Whether guild member related events are enabled.

This corresponds to the following events...

patent lark
#
intents = discord.Intents.all()
bot = commands.Bot(... intents = intents ...)```
#

be sure to enable intents on the dev app, under the bot tab.

#

because you didnt enable them.

dapper cobalt
#

Show me where you defined client.

#

Did you define intents after defining client or before it?

vagrant galleon
#

before

patent lark
#

if you use discord.Intents.all() theres no need for intents.members = Tue lol.

dapper cobalt
#

Try printing evan.

patent lark
#

your ID returns NoneType, so the bot isnt finding you

#

be sure you put the right id.

#

as expected

dapper cobalt
#

Hold on, if it returns None and you have intents enabled, it's possibly trying to get your user before the bot has started, which means, you aren't in the bot's cache yet.

#

Try await client.fetch_user(your_id).

#

Instead of client.get_user().

dapper cobalt
#

fetch_user() will send an API request to fetch your user, which should work.

patent lark
#

i think its a bit, uh, unnecessary to make an API call for that every minute.

dapper cobalt
#

!d discord.ext.commands.Bot.wait_until_ready

unkempt canyonBOT
#

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

Waits until the client’s internal cache is all ready.
patent lark
#

^

dapper cobalt
#
@client.event
async def on_ready():
  await client.wait_until_ready()
  # start the loop
patent lark
#

it works, but its so unnecessary

dapper cobalt
#

Do this and go back to evan = client.get_user().

#

Sending too many API requests might get you rate limited.

patent lark
#

discords

vagrant galleon
#

oh shi

dapper cobalt
#

That's why the bot's cache exist.

#

Show your code.

#

What's there after await client.wait_until_ready()?

slate swan
#

hello

vagrant galleon
#

nothing

#

thats the last thing in the @quaint axle.event

patent lark
#

get the user after the bot is ready

heavy radish
#

What's a good place to host my bot?

dapper cobalt
#
await client.wait_until_ready()
updated.start()
vagrant galleon
heavy radish
#

VPS

patent lark
#

you want to call it after.

#

i got myself mixed up

dapper cobalt
vagrant galleon
#

so im good now? we

#

we all chillin?

patent lark
dapper cobalt
pliant gulch
vagrant galleon
#

ok sweet, thank you guys so much!

pliant gulch
#

This does nothing

patent lark
#

if you aren't making an api call every minute for that.

dapper cobalt
#

Ah right, I didn't notice.

heavy radish
#

For these 2 VPS's. Do we have to run the code on our PC? Like i just want it all online like REPLIT

#

I upload my code and I run it there

dapper cobalt
dapper cobalt
patent lark
heavy radish
#

Well, EC2 seems like that. Upload and run was pretty hard

#

Keep Ping on Please

dapper cobalt
#

Both of these hostings use Pterodactyl panel so it shouldn't be hard at all.

pliant gulch
heavy radish
#

Hm

#

I'll check it out

patent lark
#

i guess it could be utilized outside of that, yeah

pliant gulch
#

since you know, on_ready is dispatched multiple times

#

thus you will be starting a task over and over again

#

which is by no means good

patent lark
#

right.

heavy radish
heavy radish
#

You're a staff there

dapper cobalt
#

Oh yeah, but it's not mine.

heavy radish
#

So how do I use the website

dapper cobalt
#

Well, consider reading what the bot sent once you joined in the general channel. πŸ™‚

heavy radish
#

It says daily points

#

So if I run out of points do I lose my server

dapper cobalt
#

No, it gets suspended. You can then open a ticket and ask the admins to temporarily un-suspend it for you so you can take your files if you would like to.

dapper cobalt
#

All servers cost coins, none are free.

heavy radish
#

Ohh On the website it says free..

dapper cobalt
#

Btw, we have a support channel. You can ask there instead of here as it's considered off-topic here. πŸ™‚

dapper cobalt
heavy radish
#

Ohh

#

How do I acclaim that

distant pagoda
#
@client.command(self= )
async def play(ctx, url : str):
    voiceChannel = discord.utils.get(ctx.guild.voice_channels, name='┃Chill Lounge')
#

what am i supposed to put for self

lilac galleon
#

my friend gave me his bot token

#

what to do now?

#

can anyone help me

distant pagoda
lilac galleon
supple thorn
lilac galleon
distant pagoda
slate swan
distant pagoda
lilac galleon
#

but i have no idea

distant pagoda
#

does he know how to work on it himself?

lilac galleon
#

now

distant pagoda
#

well do you know python?

lilac galleon
distant pagoda
#

then go make a bot with it

slate swan
#

Check channel topic for related links

distant pagoda
#

i dont understand tho does he not know any programming language i dont get why he just handed the token to you

lilac galleon
slate swan
distant pagoda
#

im guessing you know python you just dont know much about discord.py?

slate swan
lilac galleon
#

okay got it
but what with token

distant pagoda
#

thats basically a key

lilac galleon
#

where to paste it or?

slate swan
#

you would be using it in your code

distant pagoda
#

import discord and async and put it in a token variable

slate swan
#

in your py discord.Client.run() func

lilac galleon
#

okay
thanks

distant pagoda
#

i thought it was just client.run()

maiden fable
#

Yea it is

#

client is just an instance name

slate swan
#
Bot = discord.Client()
Bot.run()```
Depends on how you define your variable
It's ultimately your discord.Client instance
fast hedge
#

Hey guys I need a second pair of eyes on this. Having no issues with the description embed. Only having issues with the return on the bot.get_channel not responding to a test message. Bot online. No errors present

somber musk
#

u using replit?

fast hedge
somber musk
#

hmm leme see

#

so what is it not doing

fast hedge
somber musk
#

so is the embed showing

fast hedge
#

Yes. The embed is working perfectly fine. The repeat is the issue

slate swan
#

for the xsend command?

fast hedge
slate swan
#

maybe the bot cannot get the channel , and since you have channel.send in if statement it's not raising the error

boreal ravine
#

Maybe fetch the guild then the channel? guild = bot.get_guild() then channel = guild.get_channel = ()

slate swan
#

You will get the error

boreal ravine
#

Also I dont get why u need pass_context anymore

#

it got removed after 1.0

fast hedge
boreal ravine
#

πŸ‘

fast hedge
covert igloo
#

How does heroku work every month

slate swan
covert igloo
#

Wdym

boreal ravine
#

It only gives a trial

#

Then you'll need to pay I think

fast hedge
# slate swan Yeah

removing "if channel" only creates a await channel.send(message) error

slate swan
#

it runs free for just 20-23 days for free

covert igloo
#

My boy went down today and came back up without me doing anything

#

And it is around one month now of running it on heroku

slate swan
#

or something like this

slate swan
#

un-indent it.

somber musk
#

borax if it doesnt work send the code

#

again

fast hedge
#

When "if channel" is removed this is the error

somber musk
#

so we can see it as a whole

slate swan
somber musk
fast hedge
somber musk
boreal ravine
#

!eval

e = 5
if e == 5:
print('e is 5')
unkempt canyonBOT
#

@boreal ravine :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 3
002 |     print('e is 5')
003 |     ^
004 | IndentationError: expected an indented block
somber musk
#

@fast hedge does it work now

fast hedge
#

The unexpected indent error was caused by removing if channel lol. I was testing his theory

somber musk
#

so does it work

#

now

slate swan
fast hedge
somber musk
#

dude i think replit is different

slate swan
#

Not a replit issue , bot cannot see the channel

#

Nvm

somber musk
#

so borax what do you type to trigger the embed to come

slate swan
#

Why do you have channel id as a string? @fast hedge it will be an int

somber musk
#

its an integer not a string

#

@fast hedge copy paste the code here so we can attempt to edit it instead of ss's

fast hedge
somber musk
#
import discord
from discord.ext import commands

bot = commands.Bot(
    command_prefix='.',
    help_command=None,
)
@bot.event
async def on_ready():
    print(f"online as {bot.user}")

@bot.event
async def on_message(msg):
    await bot.process_commands(msg)

@bot.command()
async def stc(ctx, *, description='No desc provided'):
   await ctx.send(embed=discord.Embed(description=description, colour=discord.Colour.red()))

@bot.command()
async def bto(ctx, *, description='No desc provided'):
   await ctx.send(embed=discord.Embed(description=description, colour=discord.Colour.green()))

@bot.command()
async def xsend(ctx, *, message: str):
    await ctx.message.delete()
    channel = bot.get_channel("833449179840774184")
    if channel :
        await channel.send(message)
#

so i think instead of str write int bc the id is a int

somber musk
#
import discord
from discord.ext import commands

bot = commands.Bot(
    command_prefix='.',
    help_command=None,
)
@bot.event
async def on_ready():
    print(f"online as {bot.user}")

@bot.event
async def on_message(msg):
    await bot.process_commands(msg)

@bot.command()
async def stc(ctx, *, description='No desc provided'):
   await ctx.send(embed=discord.Embed(description=description, colour=discord.Colour.red()))

@bot.command()
async def bto(ctx, *, description='No desc provided'):
   await ctx.send(embed=discord.Embed(description=description, colour=discord.Colour.green()))

@bot.command()
async def xsend(ctx, *, message: int):
    await ctx.message.delete()
    channel = bot.get_channel("833449179840774184")
    if channel :
        await channel.send(message)
fast hedge
#

No change

somber musk
#

really?

#

thats hella strange

fast hedge
#

Typing test in separate channel shows no results in ID channel

slate swan
#

@commands.command()

slate swan
fast hedge
#

Im just as confused

slate swan
#

Change "id" to id

#

remove the quotes

fast hedge
#

Where are you seeing id?

somber musk
#

meaning the integer id(channel id) remove the "

slate swan
#

!d discord.Client.get_channel read it

unkempt canyonBOT
fast hedge
#

ahhhh I see. My bad

#

No luck

somber musk
fast hedge
#

.stc

somber musk
#

borax have you done

#
client = discord.Client()




client.run(os.environ['TOKEN'])
#

token can be an environmental variable

slate swan
#

They already sent the code , they use commands.Bot

fast hedge
#

the embeds are working perfectly fine

somber musk
#

ss

fast hedge
slate swan
#

light theme moment

fast hedge
somber musk
fast hedge
#

I only change int and the parentheses arounf the id

somber musk
#

leme test on replit

fast hedge
#

Not even an error when I try the test message

somber musk
#

strange

heavy radish
#

How do Ik how much Memory, Disk & CPU I need

somber musk
#
import discord
from discord.ext import commands

bot = commands.Bot(
    command_prefix='::',
    help_command=None,
)
@bot.event
async def on_ready():
    print(f"online as {bot.user}")

@bot.event
async def on_message(msg):
    await bot.process_commands(msg)

@bot.command()
async def stc(ctx, *, description='No desc provided'):
   await ctx.send(embed=discord.Embed(description=description, colour=discord.Colour.red()))

@bot.command()
async def bto(ctx, *, description='No desc provided'):
   await ctx.send(embed=discord.Embed(description=description, colour=discord.Colour.green()))

@bot.command()
async def xsend(ctx, *, message: str):
    await ctx.message.delete()
    channel = bot.get_channel(879876032751087698)
    if channel :
        await channel.send(message)
``` so borax ur code is exactly this other than the change of channel id correct?
fast hedge
#

"str" changed to int per your request

somber musk
#

doesnt work in my eyes

heavy radish
#

Why is ) there

#

remove the comma after None and close it. I think thats the error

little ether
heavy radish
#

Hmmmm

heavy radish
boreal ravine
#

its fine i think

fast hedge
somber musk
#

im trying

slate swan
#

Clearly , bot cannot acess the channel.

fast hedge
#

so strange

somber musk
#

alr it works in my replit, i dont see ur problem borax

#

also how did u make ur thing .bto

fast hedge
somber musk
#

oh icc

fast hedge
somber musk
#

yep

#

also is the point of ur thing to just say what the user says in embed form

fast hedge
#

Yes

somber musk
#

why

fast hedge
#

And to repeat to the requested channel

somber musk
#

so for eg?

fast hedge
#

?

somber musk
#

borax i think it works fine

#

but do u know how to make it so that lets say if you say: oj it says orange juice is good or smthn in embed form, cuz if so, speak cuz that will tell me if replit is different

fading harness
#

i want to make a command to disable other command

slate swan
#

Globally?

#

!d discord.ext.commands.Bot.remove_command

unkempt canyonBOT
#

remove_command(name)```
Remove a [`Command`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") from the internal list of commands.

This could also be used as a way to remove aliases.
fading harness
#

i want to disable command only in that guild

slate swan
#

Use a database , with a check

#

Store guild ids for which the command is disabled

fast hedge
slate swan
#

And verify it in the check

fast hedge
#

You even used the embed command?

somber musk
#

it will work regardless in the channel i send the command

fast hedge
#

wtf....

#

So weird

slate swan
#

How do I convert an emoji input eg farm_PikaHeart1 into the <:name:id> formart to insert into my db?

somber musk
# fast hedge So weird

i think it thinks that the command works in the server that channel is in, i dont see another solution

#

sorry

outer basalt
#

does TextChannelConverter only look for 1 channel?

boreal ravine
# fast hedge wtf....

I think he means even if you dont fetch the channel and you do ctx.send() it'll send the message to the channel where u invoked the command.

rugged tinsel
#

hey can anyone help me with my blacklisting system for my bot? I want something like when i do *Blacklist (user) the user i tagged won't be able to use any command i'm using client btw

#

thanks edit: sorry for my english english is not my first language 😟

outer basalt
#

use bot check

slate swan
#

!d discord.Client.get_emoji or use this to get it using id

unkempt canyonBOT
slate swan
#

Oh okay

#

Thanks

slate swan
#

!custom-checks

unkempt canyonBOT
#

Custom Command Checks in discord.py

Often you may find the need to use checks that don't exist by default in discord.py. Fortunately, discord.py provides discord.ext.commands.check which allows you to create you own checks like this:

from discord.ext.commands import check, Context

def in_any_channel(*channels):
  async def predicate(ctx: Context):
    return ctx.channel.id in channels
  return check(predicate)

This check is to check whether the invoked command is in a given set of channels. The inner function, named predicate here, is used to perform the actual check on the command, and check logic should go in this function. It must be an async function, and always provides a single commands.Context argument which you can use to create check logic. This check function should return a boolean value indicating whether the check passed (return True) or failed (return False).

The check can now be used like any other commands check as a decorator of a command, such as this:

@bot.command(name="ping")
@in_any_channel(728343273562701984)
async def ping(ctx: Context):
  ...

This would lock the ping command to only be used in the channel 728343273562701984. If this check function fails it will raise a CheckFailure exception, which can be handled in your error handler.

rugged tinsel
#

ok

rugged tinsel
#

actually nvm...

rugged tinsel
#

just wondering...

slate phoenix
#

technically yes but you shouldnt

rugged tinsel
#

why?

slate phoenix
#

you can store the user in a list but thats temporary, if the bot crashes all the users in the list are gone

rugged tinsel
#

thats fine with me

boreal ravine
#

Either use a db that you can update the list using commands or do it manually

rugged tinsel
#

it's fine if i don't use database...

#

i just don't know how to make the code

#

:/

boreal ravine
#
if ctx.author.id in list:
  return
#

something like that

slate swan
rugged tinsel
#

holy ooops

rugged tinsel
slate swan
#

Well then make an empty list

#

And append user IDs in it

rugged tinsel
#

ok

rugged tinsel
#

do i use {} or []

boreal ravine
#

what isnt

boreal ravine
#

:>

#

obv [] lol

#

{} are for dictionaries

visual island
#

and sets

rugged tinsel
viral prawn
#

Hello, I am here to ask for help making a bot that shows info like in the picture below

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
#

COME ON WORK

#

#bot-commands

#

No shut

#

what do you need?

#

i need on_command event

stark bobcat
#

!d discord.on_message

slate swan
#

Not on message

#

there's no such event .

#

Yes there is

viral prawn
#

I was asking how do I make like a bot that shows a pie chart with role info and percentage on command.

boreal ravine
green jacinth
#

hello guys i need a help regarding slash cmd with cogs i have made it without any error or so but when i go in discord and do / it is not showing me the cmd

slate swan
#

which library?

green jacinth
#

like this mine bot slash cmd is not coming

slate swan
#

!d discord.on_member_join

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.
boreal ravine
boreal ravine
stark bobcat
green jacinth
#
import os
import datetime
import asyncio
from discord.ext import commands
from discord_slash import cog_ext


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

    @commands.command()
    @commands.cooldown(1, 5, commands.BucketType.guild)
    async def ping(self, ctx):
        embed = discord.Embed(title=f"πŸ“Pong! {round(self.bot.latency * 1000)}ms", colour=discord.Colour.blue(), timestamp=datetime.datetime.utcnow())
        await ctx.reply(embed=embed)

    @cog_ext.cog_slash(name = 'Ping', description='Sends Ping')
    async def ping(ctx):
        await ctx.send('pong')```
green jacinth
green jacinth
boreal ravine
green jacinth
boreal ravine
#

then it work work?

green jacinth
#

In this video we are creating slash commands with the discord.py library and the slash commands library. I'll show you how to do this with and without cogs. This isn't too long either it's only 5 minutes!
Slash commands are a great way to elevate your python discord bot to the next level so make sure to watch.

What are slash commands: https://...

β–Ά Play video
boreal ravine
#

what lib tho

green jacinth
#

3:40 time

boreal ravine
#

ok

green jacinth
#

:))

viral prawn
green jacinth
viral prawn
#

and role member number/percentage

slate swan
unkempt canyonBOT
slate swan
#

How do I check if message.content has a user ID?

#

well ,any 18 digit long number can be a userid

#

Actually thats a really good idea

visual island
#

to check it just see if get_user(16_digit) is not None

slate swan
#

Wym

#

How would I check that in message.content for on_message?

visual island
#
if any(bool(bot.get_user(_id)) for _id in message.content.split() if _id.isdigit()):
  ... # the message contains valid id
slate swan
#

oop Thank you but how would I get the ID?

#

Actually isnt _id storing it in this case?

rugged tinsel