#discord-bots

1 messages · Page 725 of 1

sullen shoal
#

what

quaint epoch
#

i made a bookmark cmd

#

brb

sullen shoal
#

im saying youre fetching or getting a member object for no reason

#

if ctx.guild is not None, ctx.author will be a member object

#

as you have done ctx.guild
your command wont work in dms

#

what you will get is an AttributeError

blazing lynx
#

` cd /home/fazeexotic224/Wicked ; /usr/bin/env /bin/python3 /home/fazeexotic224/.vscode/extensions/ms-python.python-2021.12.1559732655/pythonFiles/lib/python/debugpy/launcher 42139 -- /home/fazeexotic224/Wicked/main.py
File "/home/fazeexotic224/Wicked/main.py", line 15

^

SyntaxError: unexpected EOF while parsing`

simple gulch
#

How can you list all of the servers that the bot is in? Or would that require one of the intents? I'm trying to stay away from intents as much as possible.

slate swan
unkempt canyonBOT
slate swan
#

And it does not require any privileged intents so you can use it freely

slate swan
blazing lynx
#

kk

woven ingot
#

It is if i remove the input filed line

quaint epoch
#

Nvm

#

I fetched, the author for the message ID the member sent

sullen shoal
#

!indent

unkempt canyonBOT
#

Indentation

Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.

Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.

Example

def foo():
    bar = 'baz'  # indented one level
    if bar == 'baz':
        print('ham')  # indented two levels
    return bar  # indented one level

The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.

Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines

More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation

sullen shoal
#

looks like you're trying to get rid of a database, which you really shouldn't

#

store the data in database where the key would be the user id

final iron
#

Just wondering, who does the hidden kwarg in the command decorator restrict from using the command?

#

Would it be everyone except the owner and people the people passed in to the owner_id kwarg in the bot constructor?

slate swan
#

How can I have an embed look like this?

#

Items you will give can be between 1-4

lucid gazelle
#

@cyan sleet

#

this

oak warren
#

inlines

#

you need to do something there

#

@slate swan

#

you can use an embed visualiser to see it

woven ingot
#

Im getting an indentation error but I dont understand why if everything is indented correctly

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

Nevermind

alpine vault
#

How do I do something like this?

import discord
import os
from discord.ext import commands

bot_1 = commands.Bot(command_prefix=">", help_command=None)
bot_2 = commands.Bot(command_prefix="?", help_command=None)


@bot_1.event
async def on_ready():
    print(f"Sucessfully logged in as {bot_1.user}")


@bot_2.event
async def on_ready():
    print(f"Sucessfully logged in as {bot_2.user}")


bot_1.run(os.getenv("DISCORD_TOKEN_MAIN"))
bot_2.run(os.getenv("DISCORD_TOKEN_SUB")) 

I want these two bots to work synchronously, how do I run two bots in a single program?

woven ingot
#

How can I add an input field without a title?

#

Give me an error unles I add something in name

tribal sundial
#
@client.command(aliases = ["911"])
async def emergency(ctx):
    channel = ctx.guild.get_channel(828004847574843482)
    voice = await channel.connect()

    def convert_to_audio(text):
        my_audio = gTTS(text)
        my_audio.save('hello.mp3')

    convert_to_audio(f"Incoming call from {ctx.author.display_name} saying {ctx.message.content}")

    def my_after(finish):
        coro = voice.disconnect()
        fut = asyncio.run_coroutine_threadsafe(coro, client.loop)

    try:
        fut.result()
    except:
        # an error happened sending the message
        pass

    source = FFmpegPCMAudio("hello.mp3")
    player = voice.play(source, after=my_after)```
#

hey guys, how would i make the channel be different if the command channel id was a specific id?

reef trail
reef trail
# woven ingot ```py @client.command() async def cher(ctx): embed = discord.Embed( title ...
@client.command()
async def cher(ctx):
    embed = discord.Embed(
        title='Cherry Network',
        description="The Cherry Project is a Decentralized Autonomous Organization developing a layer one blockchain network optimized for data operations.",
        colour=discord.Colour.orange()
    )
    embed.add_field(name='sapo', value='sapo', inline=False)
    await ctx.send(embed=embed)```
 press tab instead of space next time
slate swan
late mauve
tawdry perch
#

Depends of the site

unique breach
#

how

sage otter
unique breach
#

toremove

#

interation failed

late mauve
#

Oh

unique breach
#

from buttons without reply

late mauve
#

How to make your bot run forever without been on the coding environment

sage otter
#

A vps

late mauve
#

Which one

unique breach
sage otter
#

A vps

late mauve
#

What is. avps

unique breach
unique breach
sage otter
#

A vm that’s hosted by someone

late mauve
#

Ahhh

#

How to get it

#

Or where u see vps

sage otter
#

You usually pay for them.

late mauve
#

Ahh

#

Okay

unique breach
#

u cld use replit if u want free

#

now someone tell me about interaction failed thing in buttons

sage otter
#

Definitely don’t do that.

late mauve
unique breach
late mauve
#

Don't know why

sage otter
#

Repl.it is not a host. It’s just a coding environment.

late mauve
#

Yes

sage otter
#

It’s just meant to be used to write and test code

late mauve
#

And uptimerobot is the host

reef shell
#

Use heroku instead of repl

unique breach
#

yes but if u use uptimer to keep it on...

late mauve
#

Ahhg

sage otter
#

Uptimerobot is definitely not a host

late mauve
#

Heroku

reef shell
slate swan
#

Check this for a VPS

sage otter
#

Which you should totally do

sage otter
#

Free hosting without catches doesn’t exists.

slate swan
#

Without code we can't help at all 🤷

#

Saying "I have an error" doesn't give us information to help you.

late mauve
#

100$ObBoredPenguin

slate swan
#

And considering you have 8+ years of experience, you should know saying "I have an error" is not enough information for help.

#

How do I create a purge command using nextcord?

#

I tried using ctx.channel.purge(limit=limit), but it won't work.

shadow wraith
#

why am i getting this when i am trying to use bored api:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/disnake/client.py", line 505, in _run_event
    await coro(*args, **kwargs)
  File "/Users/sadancooler/Documents/Code/Python/bots/infinity/lounge.py", line 198, in on_message
    BoredAPI = await session.json()
AttributeError: 'ClientSession' object has no attribute 'json'
rapid walrus
#

how to edit message on dropdown menu click ?

shadow wraith
#

this is in my code (in an on_message event)

elif message.content in imbored:
        async with aiohttp.ClientSession() as session:
            link = await session.get(
                "https://www.boredapi.com/api/activity?type=recreational"
            )
            BoredAPI = await session.json()

        someEmbed = disnake.Embed(
            title="I'm bored, what should I do?",
            description=BoredAPI["activity"],
            color=disnake.Color.random(),
        )
        await message.reply(embed=someEmbed)
patent lark
slate swan
slate swan
#

this is my code

#

it won't work

patent lark
sage otter
slate swan
patent lark
sage otter
#

You're probably thinking of ClientResponse

#

!d aiohttp.ClientResponse.json

rapid walrus
#

how to edit message on dropdown menu click ??:V?:V

unkempt canyonBOT
#

coroutine json(*, encoding=None, loads=json.loads, content_type='application/json')```
Read response’s body as *JSON*, return [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.10)") using specified *encoding* and *loader*. If data is not still available a `read` call will be done,

If *encoding* is `None` content encoding is autocalculated using [cchardet](https://aiohttp.readthedocs.io/en/stable/glossary.html#term-cchardet) or [charset-normalizer](https://aiohttp.readthedocs.io/en/stable/glossary.html#term-charset-normalizer) as fallback if *cchardet* is not available.

if response’s content-type does not match content\_type parameter [`aiohttp.ContentTypeError`](https://aiohttp.readthedocs.io/en/stable/client_reference.html#aiohttp.ContentTypeError "aiohttp.ContentTypeError") get raised. To disable content type check pass `None` value.
slate swan
patent lark
#

are you sure your bot is listening for commands?

#

perhaps you have an on_message event and are not processing commands?

slate swan
patent lark
#

may i see it?

slate swan
#

what do I do?

#

alr

#
@client.event
async def on_message(message):
    msg = message.content
    channel = message.channel
    if msg.lower() in bad_words:
        await message.delete()
        await channel.send("You used foul language.", delete_after=True)
patent lark
#

theres your issue

slate swan
#

do I need an else?

patent lark
#

under the on_message function, process commnds using await bot.process_commands(message)

sage otter
#

not really. you just need to process commands.

patent lark
#

or use an event listener

slate swan
patent lark
#

its a decorator

slate swan
#

I see

patent lark
#

rather than @bot.event it would be @bot.listen()

slate swan
#

wait so why didn't it work?

patent lark
#

!d discord.ext.commands.Bot.listen

unkempt canyonBOT
#

@listen(name=None)```
A decorator that registers another function as an external event listener. Basically this allows you to listen to multiple events from different places e.g. such as [`on_ready()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_ready "discord.on_ready")

The functions being listened to must be a [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine "(in Python v3.9)").

Example...
patent lark
slate swan
#

thank you

patent lark
#

you're welcome.

slate swan
patent lark
#

yes, unless its an event listener

slate swan
#

Oh i see i see

#

can you give me an example of how to use an event listener?

patent lark
#

an event listener would look something like this

@bot.listen()
async def on_message(message):
  pass```

or if you'd like to name the function to something else

```py
@bot.listen("on_message")
async def anything_you_want_to_call_this_function(message):
  pass```
slate swan
#

Oh I see I see

#

thank you so much

patent lark
#

no problem.

slate swan
#

I have been trying to figure out what the problem was for 30mins

patent lark
#

haha, yeah thats an issue i see a lot.

#

at least you've got it working now. uwukitty

slate swan
#

yeahh broo, you're the man.

patent lark
#

👍

patent lark
# slate swan yeahh broo, you're the man.

another thing i noticed about your code, it really isnt an error but just a tip, you are using discord.ext.commands.Bot which is a bot object, but your bot constructor variable is client. thats also common to see, but its incorrect, givin that discord.Client() is a thing, its odd to have a client object and a bot object, yet name the bot object "client".

#

its bad practice

#

(strongly assuming you're using discord.py)

slate swan
#

I noticed that as well

patent lark
#

ah you’re using nextcord, alright

slate swan
#

Do you know how to code an economy bot using discord.py?

meager creek
patent lark
#

channel is returning None

#

meaning the channel either doesnt exist, or isnt in the bots cache

lucid gazelle
#

Hi!!!

#

what is the format code for cooldown?

visual island
patent lark
#

ah, i didnt notice it was in a string

#

my apologies.

lucid gazelle
patent lark
#

!d discord.ext.commands.cooldown

unkempt canyonBOT
#

@discord.ext.commands.cooldown(rate, per, type=discord.ext.commands.BucketType.default)```
A decorator that adds a cooldown to a [`Command`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command")

A cooldown allows a command to only be used a specific amount of times in a specific time frame. These cooldowns can be based either on a per-guild, per-channel, per-user, per-role or global basis. Denoted by the third argument of `type` which must be of enum type [`BucketType`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.BucketType "discord.ext.commands.BucketType").

If a cooldown is triggered, then [`CommandOnCooldown`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CommandOnCooldown "discord.ext.commands.CommandOnCooldown") is triggered in [`on_command_error()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.discord.ext.commands.on_command_error "discord.discord.ext.commands.on_command_error") and the local error handler.

A command can only have a single cooldown.
lucid gazelle
#

thankss

#

what's the meaning of default @patent lark ?

alpine vault
#

I have an member object. How do I get the avatar url (not the bytelike object one) of the member object? (In pycord)

shadow wraith
#

anyone have an idea how to make a command which runs python code because i have done:

h = exec(code)
await ctx.send(h)

but that just says "cannot send empty msg"

lucid gazelle
#

hiiii

#

how to have this in cooldown?

lucid gazelle
#

like this

placid skiff
#

0 integer returns False in if statement right?

lucid gazelle
#

idk, im new to this

twin moon
#

how do I use datetime.timedelta for the cooldown?

#

ohh lol

twin moon
placid skiff
#

Guys how can I recognize errors from custom checks? I have two checks that are used by an entirely cog and I want to handle them by a single error handler but i don't know how I can know which check raised the error

twin moon
placid skiff
placid skiff
twin moon
#

no

placid skiff
#

So how do I do it?

twin moon
placid skiff
#

Which one hahah
I can't just type raise error xD

velvet tinsel
#

lol

#

what do you need?

this slowmode's killing me

#

<@&831776746206265384> this chat is inactive make slowmode back to 3 seconds or just 2 seconds 😠

#

@placid skiff what do you need help with? Can you elaborate, or provide code?

#

(pseudo or something)

unkempt canyonBOT
#
Bad argument

3 is not a valid duration string.

#
Command Help

!slowmode set [channel] <delay>
Can also use: slowmode s

Set the slowmode delay for a text channel.

bitter depot
unkempt canyonBOT
#
Bad argument

3 is not a valid duration string.

#
Command Help

!slowmode set [channel] <delay>
Can also use: slowmode s

Set the slowmode delay for a text channel.

bitter depot
#

What

unkempt canyonBOT
bitter depot
#

Smfh

velvet tinsel
#

lolll

#

ty

boreal ravine
bitter depot
boreal ravine
#

wait i didint mean to send that yet

velvet tinsel
#

markk....

boreal ravine
#

ok

thorn ore
#

Helo

#

Can I get help pls

bitter depot
analog nova
#

can a bot activate another? what I mean by that is:

could my bot send a command like this:

$tip @user 1 doge

and the other bot will tip the user one doge coin?

nextcord/python bot

velvet tinsel
velvet tinsel
placid skiff
placid skiff
#

Btw you can use the on_message event to trigger something like that, but you have to make sure that your bot does not response to himself

rapid walrus
#

how to edit message on dropdown menu click ?:V

velvet tinsel
#

elaborate, please.

knotty gazelle
shadow wraith
#

how can you change a bot's prefix in a cog 🤔

knotty gazelle
#

get a function in main

#
def get_prefix(bot: commands.Bot, message: discord.Message):
  ...
knotty gazelle
shadow wraith
#

i dont 💀

knotty gazelle
#

json?

shadow wraith
#

bro i dont use a db

knotty gazelle
#

without you cant

knotty gazelle
analog nova
#

oh that

#

kk

shadow wraith
analog nova
shadow wraith
#

what you mean

#

oh, tip.cc i know now. i'm not an expert in cryptocurrency tho

analog nova
#

there's a bot called tip.cc, a multi crypto bot, an i want my bot to activate tip.cc to tip a user some currency

shadow wraith
#

a bot can't use a bot unless it can, the more you know the more you know.

honest vessel
#

make your own ?

#

use some api

west barn
slate swan
#

how do I get data from websites, and put them on my discord bot?

velvet tinsel
slate swan
velvet tinsel
slate swan
# slate swan

You need to shard your bot, it's in over 2500 guilds.

slate swan
velvet tinsel
slate swan
#

Error 4011

velvet tinsel
velvet tinsel
#

Btw youre back ❤️

shy swift
#

Hi so I am trying to make a game for my discord bot and i wanted to ask how I can proceed. I wanted to use reactions for the player to control the game any tips ? Appreciate it 🙂

velvet tinsel
slate swan
#

So what am I supposed to do now?

slate swan
#

Shard your bot.

velvet tinsel
#

You get the info and apply them to your bot

slate swan
slate swan
#

use AutoShardedBot

velvet tinsel
#

@slate swan wanna join a project?

#

With Caeden and icy and others

slate swan
#

the only thing original about it is the controlled randomizer

velvet tinsel
#

Ok

slate swan
# slate swan okey

Instead of discord.ext.commands.Bot, use discord.ext.commands.AutoShardedBot

#

but it's heavily influenced by yagpdb's.

#

Nothing more needed, and no need to edit any of your code.

shy swift
#

@slate swan @velvet tinsel Hi so I am trying to make a game for my discord bot and i wanted to ask how I can proceed. I wanted to use reactions for the player to control the game any tips

slate swan
#

!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**...
slate swan
#

And wait for a user reaction add

#

See the second example in the documentation.

honest vessel
#

learn python read the documentation ? maybe too big of a project if cant find simple info theres plenty of examples in the documentation for reactions

shy swift
#

lets take TicTacToe as an example

#

i dont want to program it so that the player enters his turn and its prints the board

#

do you understand ?

honest vessel
#

then maybe check into buttons

slate swan
#

Have you already done a tic tac toe in Python, without a bot?

shy swift
#

yeah of course

slate swan
shy swift
#

Ok

#

you guys know about sokoban bot i think is how it is called

honest vessel
#

no

shy swift
#

one sec

slate swan
#

I wouldn't send a link if I were you.

#

Pretty sure there is a filter.

shy swift
#

oh god

slate swan
shy swift
#

ok

slate swan
#

There is an example.

honest vessel
shadow wraith
#

what is happenin

slate swan
#

discord.py 2.0 has buttons, you can use them if you want there.

dusk trout
#

I need help

shy swift
#

Ok thanks a million @honest vessel @slate swan

dusk trout
#

can someone help me

slate swan
#

No, not if you don't give more information.

dusk trout
#

some broken code

honest vessel
#

@dusk trout dont ask to ask for help

slate swan
#

Then maybe share it?

#

Sadly we can't see your screen like you see yours.

shy swift
#

😆

dusk trout
#

here is the line

slate swan
#

oice_client, you firstly maybe want voice_client

#

Send it in text

dusk trout
#

ctx.voice_client.play(discord.PCMVolumeTransformer(discord.FFmpegPCAudio(url)), after=lambda error: self.bot.loop.create_task(self.checkqueue(ctx)))
ctx.voice_client,source.volume=0.5

#

SyntaxError: invalid syntax
PS C:\Users\kurcp\Desktop\Python> python -u "c:\Users\kurcp\Desktop\Python\susb\music.py"
File "c:\Users\kurcp\Desktop\Python\susb\music.py", line 33
ctx.oice_client.play(discord.PCMVolumeTransformer(discord.FFmpegPCAudio(url)), after=)

dusk trout
honest vessel
#

remove loop

dusk trout
#

thanks

#

import discord
from discord.ext import commands
from music import Player

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

bot= commands.bot(command_prefix="?", intents=intents)

@bot.event
async def on_ready():
print(f"{bot.user.name} is up and running and it hopefully wont crash.")

bot.add_cog(Player(bot))
bot.run("Token")

#

Traceback (most recent call last):
File "main.py", line 3, in <module>
from music import Player
File "/home/runner/CulturedAgonizingArchive/music.py", line 8, in <module>
class Player(commands.cog):
TypeError: module() takes at most 2 arguments (3 given)

KeyboardInterrupt

KeyboardInterrupt

#

yeah I broke this

slate swan
#

Bot, not bot

#

There are actually multiple case issues.

#

Not using capitalization when needed.

tidal hawk
#

How is it possible to execute sqlinjection through the discord chat?

slate swan
#

Just like a normal sql injection

tidal hawk
#

like u type some sql query into chat and bot thinks its a real query?

slate swan
#

Yes

honest vessel
#

kek

#

sql is sql

tidal hawk
#

lol

#

How frequent is that to be happened

slate swan
honest vessel
#

'OR '1'='1--

#

😄

tidal hawk
#

like it requires skill to pass ctx into sql query

slate swan
#

It's not rocket science, anyone with a decent knowledge of SQL can do it.

honest vessel
#

drop table

#

@tidal hawk set up ur own test bot with simple select and sqlinject it

dusk trout
#

thanks for all your help

#

but one more question

#

from discord.ext import commands

#

how many arguments does this have

#

it has 2 right

tidal hawk
slate swan
honest vessel
#

@tidal hawk ye

slate swan
#

That's not where the issue is.

dusk trout
#

just forget it

#

I am actually brain dead

honest vessel
#

@tidal hawk well not a quary u need to inject it google sqlinjection

#

but in a sense yes a quary that u want it to execute

velvet tinsel
shy swift
#

yup

slate swan
#

You might want to remake the screenshot, just so that the message you got goes away.

honest vessel
#

lol

somber crown
#

ill get the updated time

#

@slate swan

slate swan
#

Not this picture, the other one.

somber crown
#

oh its recent

#

like, 20 mins ago

#

40*

slate swan
#

Unless you want everyone to read the, I guess, private message you got.

#

^

somber crown
#

OH

honest vessel
#

😄

slate swan
#

:)

honest vessel
#

monday frisky

somber crown
#

ive got an extremely stupid issue involving time, and have no clue how to fix it. ive got 2 screenshots to go with it so whoever's interested just dm me for the screenshots

getting an issue i know hardly anything about, ive checked the time slots for the checks and they all seem valid


                if datetime.now() - relativedelta(days=182) >= member.premium_since.replace(tzinfo=None) <= datetime.now() - relativedelta(days=91):
                    boost = " ![3MonthBoost](https://cdn.discordapp.com/emojis/912062351526727781.webp?size=128 "3MonthBoost")"
                    
                if datetime.now() - relativedelta(days=272) >= member.premium_since.replace(tzinfo=None) <= datetime.now() - relativedelta(days=183):
                    boost = " ![6MonthBoost](https://cdn.discordapp.com/emojis/912062351971332106.webp?size=128 "6MonthBoost")"```
i then tried to get the raw data of specific dates using
```py

                print("boosted",member.premium_since.replace(tzinfo=None))
                print("delta : ",datetime.now()-relativedelta(days=184))```
(output is in an image 1)
these are the stats for a user who is only boosting 1 server with both of their boosts, and i know this for a fact, and theyve been boosting since July 2nd 2021 (185 days ago) (image 2)
#

there

somber crown
river kindle
#

I am creating a command that allows you to assign a commission to the developer, only that when I specify the user sends it in DM to me and not to him and, marks my name and not his. How can I fix?

my code:

async def assign(ctx, user):
  embed = discord.Embed(title="Assegnata!", description= f'Ho assegnato la commissione a {ctx.author.mention}')
  await ctx.author.send(f"Hey {ctx.author.mention} ti è stata assegnata una commissione!")
  await ctx.send(embed=embed)
  if not ctx.author.guild_permissions.manage_messages:
    await ctx.message.delete()
    return await ctx.send(f"{ctx.author.mention} non disponi i permessi/ruoli per eseguire il comando!")```
hoary crest
#

How can i get list of role id of the author?

slate swan
#

!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.
slate swan
#

Loop over it using, for example, a for loop. Then print the id attribute of each element in the list.

hoary crest
#

How can i do it though list comprehension?
Struggling abit

slate swan
#

It's a simple for loop over ctx.author.roles

hoary crest
#

I'm getting this [<Role id=923825480006766632 name='@everyone'>, <Role id=924673466836320316 name='Rex'>]

slate swan
#

As I said, it's a list and therefore you need a loop.

#

!e
list = [1, 2, 3]
for element in list:
print(f"Current element: {element}")

unkempt canyonBOT
#

@slate swan :white_check_mark: Your eval job has completed with return code 0.

001 | Current element: 1
002 | Current element: 2
003 | Current element: 3
honest vessel
#

for role in ctx.author.roles:
roles = ' '.join(role.name)

#

or something

slate swan
#

No

pale zenith
honest vessel
#

maybe can put list in join

slate swan
#

Also no

pale zenith
#

its str.join(iterable) - and the iterable must composed only of strings

honest vessel
#

ah

covert turret
pale zenith
#

yes

covert turret
dusk trout
#

import discord
from discord.ext import commands
from music import Player

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

Bot= commands.Bot(command_prefix="./", intents=intents)

@Bot.event
async def on_ready():
print(f"{Bot.user.name} is up and running and it hopefully wont crash.")

async def setup():
await Bot.wait_until_ready()
Bot.add_cog(Player(Bot))

Bot.add_cog(Player(Bot))
Bot.run

#

Traceback (most recent call last):
File "main.py", line 3, in <module>
from music import Player
File "/home/runner/CulturedAgonizingArchive/music.py", line 8, in <module>
class Player(commands.cog):
TypeError: module() takes at most 2 arguments (3 given)

#

anyone got an idea of this error?

slate swan
#

Again, it's not a cog

#

So remove the entire setup function.

#

And all type of add_cog calls.

#

Just keep bot.run("your token")

dusk trout
#

that doesnt do anything

#

same error

slate swan
#

What is your current code?

#

!code and use this please

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.

dusk trout
#

like what am I coding?

#

If so I am coding a music bot

edgy sphinx
#

what have you written so far

slate swan
#

Using youtube_dl I suppose blaze

dusk trout
#

yes

slate swan
#

!rule 5

unkempt canyonBOT
#

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

severe edge
#

hi everybody I have made a bot that returns the list of historical data from wikipedia. the code works but when I enter the command output doesnot comes

if message.content.startswith('$history'):
          #Input Format : $history 12 7
          msg = message.content
          lst=msg.split(' ')
          l=len(lst)
          date = lst[(l-1)]
          month = lst[(l-2)]
          history = dates.get_data(month,date)
          await message.channel.send(history)```
edgy sphinx
# unkempt canyon

use this format and copy paste your code where it says print("HelloWorld")

slate swan
#

We can't help you for projects that are breaching YouTube's terms of service.

velvet tinsel
#

hello

velvet tinsel
#

instead of startswith yert

severe edge
velvet tinsel
#

They don’t even teach stuff very accurately, how depressing 💀

severe edge
#

i know what it does, but not completely

#

can you tell me about @native granite ?

velvet tinsel
#

guy just pinged somebody 💀

velvet tinsel
severe edge
severe edge
#

brother @velvet tinsel can you tell why the output isnot displayed in the server?

velvet tinsel
#

?

#

Elaborate, please.

slate swan
velvet tinsel
severe edge
#

i am passing a date and month to the function called get_data() (which works fine when I manually enter the values in it) but the bot doesnot give any output

slate swan
storm steppe
#

does anyone know how to log into an account on fortnite and get the display name using requests im trying using some docs but i keep getting response 409

severe edge
#

which code the function get_data?

#
import requests
import json

def get_data(date, year):
    url = "http://history.muffinlabs.com/date/%s/%s"%(date, year)
    response = requests.get(url)
    data = json.loads(response.text)
    req_data = {}
    for i in data["data"]["Events"]:
        if i["year"] in req_data:
            req_data[i["year"]].append(i["text"])
        else:
            req_data[i["year"]]= [i["text"]]   
    return req_data

if __name__ == "__main__":
    data = get_data(7, 12)
    for i in data:
        for j in data[i]:
            print(i, ":", j)```
blazing lynx
#

ExtensionFailed: Extension 'cogs.general' raised an error: AttributeError: module 'disnake.ext.commands' has no attribute 'commmand'

storm steppe
velvet tinsel
velvet tinsel
#

Wait

#

We can 💀

slate swan
blazing lynx
#
from disnake.ext import commands```
velvet tinsel
#

Did you install disnake? jam_cavedude I have a feeling I’m doing something wrong here

storm steppe
slate swan
#

Fortnite doesn't have an API.

slate swan
#

So you can't gather any information from Fortnite.

#

No API = no data

storm steppe
slate swan
#

As I said, Fortnite doesn't have an API.

forest mortar
#

Hi, so I am coding a mod bot and I ran into a problem,
so my ban command that I use the most of the time isn't working properly, the console says: Missing Permissions but the bot has the administrator role in the server where I test it,
Thanks for the help

slate swan
#

So you can't make any requests since there is no API.

slate swan
velvet tinsel
forest mortar
#

It is at the same rank

slate swan
#

Make sure the role of the bot is higher.

velvet tinsel
forest mortar
velvet tinsel
slate swan
velvet tinsel
#

Maybe you’re running from the wrong file

blazing lynx
blazing lynx
slate swan
#

Put the bot role higher than the user you're trying to ban.

velvet tinsel
velvet tinsel
blazing lynx
#

Traceback (most recent call last): File "/home/fazeexotic224/Wicked/cogs/general.py", line 6, in <module> class General(commands.Cog): File "/home/fazeexotic224/Wicked/cogs/general.py", line 10, in General @commands.commmand() AttributeError: module 'disnake.ext.commands' has no attribute 'commmand'

velvet tinsel
#

You’re doing something wrong, but I’ve never used classes before. @slate swan help

#

Maybe it’s self.command?

blazing lynx
#

its not

dapper cobalt
slate swan
#

Fortnite-API is a non-official API and not endorsed by Epic Games in any way.
It's an non official API, and therefore wouldn't trust it. Especially if you want to login with your account on it. But yeah, I've seen also it, just a trust issue.

slate swan
velvet tinsel
#

ok

slate swan
#

And can't really see what's wrong, since

from disnake.ext import commands

is the right import. Eventually not saved the file before running the bot?

shadow wraith
blazing lynx
#

want the code to my whole cog?

slate swan
blazing lynx
#

it is

slate swan
#

Oh wait

#

You have 3 m's

#

It's command, not commmand

blazing lynx
#

oh

#

omg

#

thats why it was unoticiable thanks

slate swan
#

beergopher happens to everyone

velvet tinsel
#

Wow

blazing lynx
#

one more question for rn

#

how to make buttons?

#

like where is the docs to dpy buttons'

velvet tinsel
#

Disnake has some

blazing lynx
#

Soundcloud > Spotify

unkempt canyonBOT
#

Hey @dire steeple!

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

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

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

https://paste.pythondiscord.com

quick gust
unkempt canyonBOT
#

class discord.ui.Button(*, style=<ButtonStyle.secondary: 2>, label=None, disabled=False, custom_id=None, url=None, emoji=None, row=None)```
Represents a UI button.

New in version 2.0.
dire steeple
#

I want my bot to play a audio file when it connects to a call, but it doesn't work. VSCode gives me this warning: "FFmPegPCMAudio" is not defined
The error takes place at line 50. Please help me

My code:
https://paste.pythondiscord.com/ocorakidiz.py

fluid spindle
#

How does one generate a unique number? You know, something like a ticket id to give to a user?

dapper cobalt
unkempt canyonBOT
#

random.randint(a, b)```
Return a random integer *N* such that `a <= N <= b`. Alias for `randrange(a, b+1)`.
fluid spindle
dire steeple
#

okay!

shadow wraith
#

why am i getting this error: TypeError: Aliases of a command must be a list or a tuple of strings. when i have aliases, this is my code:

 @commands.command(aliases=["wyr", "wouldyourather"])
 @commands.guild_only()
    async def WouldYouRather(self, ctx):
        async with aiohttp.ClientSession() as session:
            link = await session.get(
                "https://would-you-rather-api.abaanshanid.repl.co/"
            )
            linkJSON = await link.json()

        embed = disnake.Embed(
            title="Would you rather...",
            description=linkJSON["data"],
            color=disnake.Colour.random(),
        )
        await ctx.send(embed=embed)
#

yes this is in a cog.

fluid spindle
fluid spindle
dapper cobalt
#

!pypi uuid

unkempt canyonBOT
#

UUID object and generation functions (Python 2.3 or higher)

dapper cobalt
#

!d uuid.uuid4

unkempt canyonBOT
dire steeple
steel void
#

hey

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

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

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

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

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

    elif 'should' in message.content and 'upgrade' in message.content:
        await message.channel.send(' As a reminder make sure youre fully maxed defence, troops, heroes, and spells before you upgrade. **We do not allow rushing, if you rush we will ban you unless if you get direct permission from Vondy.** Rushing is stupid 98% of the time.')
    await client_main.process_commands(message)
``` how do it make it where it mentions the user who triggers the key words
slate swan
#

im making a warn system on my discord bot, but everytime i try to warn someone it doesn't work.

async def warn(self, ctx, member: discord.Member, *, reason ):
    if member.id in [ctx.author.id, self.bot.user.id]:
        return await ctx.send("You can't warn yourself or the bot")

    current_warn_count = len(
        await self.bot.warns.fond_many_by_custom(
            {
                "user_id": member.id,
                "guild_id": member.guild.id
            }
        )
    ) + 1


    warn_filter = {"user_id": member.id, "guild.id": member.guild.id, "number": current_warn_count}
    warn_data = {"reason": reason, "timestamp": ctx.message.created_at, "warned_by": ctx.author.id}

    await self.bot.warns.upsert_custom(warn_filter, warn_data)

    embed = discord.embeds(
        title="get warned",
        description=f"__**Reason**__:\n{reason}",
        colour=discord.Colour.red(),
        timestamp=ctx.message.created_at
    )
    embed.set_aurthor(name=ctx.guild.name, icon_url=ctx.guild.icon_url)
    embed.set_footer(text=f"Warn: {current_warn_count}")


    try:
        await member.send(embed=embed)
        await ctx.send("User got warned in dm's")
    except discord.HTTPException:
        await ctx.send(member.mention, embed=embed)
steel void
#

maybe even delay the messages by like 3 seconds

slate swan
#

-> fond_many_by_custom

shadow wraith
slate swan
#

There are typos.

fluid spindle
slate swan
#

is it supposed to be uppercase's

#

set_aurthor should be set_author and fond_many_by_custom should be find_many_by_custom

#

oh

#

thank you

fluid spindle
fluid spindle
fluid spindle
steel void
#

thanks will try

bitter kite
#

Question how can I start the bot and execute the code below as well?

bot.run( ... ) # blocks further input.
other_stuff()  # needs to run after bot.

thank you.

fluid spindle
steel void
#

also thanks

#

youre very smart /h elpful

slate swan
bitter kite
#

sure possible but that's not what I want to do, as it is independent of discord.

brazen raft
#

When the bot stops running, the function should run

slate swan
bitter kite
slate swan
rancid ermine
brazen raft
#

Then run it in on_ready as valk suggested

bitter kite
#

on_ready is the workarround but I don't like it😫

slate swan
fluid spindle
slate swan
brazen raft
bitter kite
#

I might sound strange but let's imagine something like this:

def run():
   bot.run()
   return value

x = run()

I need x to be set, so passing over bot.run() and complete execute the script and the bot still runs.

#

So start in some kind of background schedule

pseudo lake
small igloo
#

how to get the user's name but with user's id

red sundial
small igloo
red sundial
slate swan
#

Hello can anyone tell me which event to use so I can send one message after every hour in that channel

small igloo
red sundial
small igloo
slate swan
#

no

#

@client.event
async on_ready or whT?

red sundial
red sundial
small igloo
slate swan
small igloo
red sundial
small igloo
#

do u mean like forever or what

slate swan
#

Wait nvm. I got it

small igloo
#

and what u want

small igloo
small igloo
#

oh idle, ok

red sundial
#

idk how to do it tbh

#

haven't worked with databases a lot

small igloo
honest vessel
#

do what?

small igloo
red sundial
#

no idea

#

google it

honest vessel
#

use the discord.py fetch user by id? get username/nickname?

small igloo
small igloo
small igloo
red sundial
honest vessel
#

await bot.fetch_user(ID)

#

then u have user object and you can grab the nickname

small igloo
drifting arrow
#

Can I do web scraping with a discord bot? lol

#

Like, would that even work? 🤔

small igloo
small igloo
#

🤷‍♂️

drifting arrow
#

\o/

#

A possible workaround to my issues

honest vessel
#

webscraping is webscraping discord bot is discord bot 😄 but sure u can build it into same dunno why u would not wanna seperate thm tho n have a db to communicate between instead

fluid spindle
#

@undone cairn Are you trying to get the member name after a command is run or is it outside a command?

honest vessel
#

webscraping is basicly just grab data from a website, with like beatifulsoap

drifting arrow
drifting arrow
#

So now I'm resorting to web scraping

undone cairn
#

@fluid spindle u tag the wrong soap lol

drifting arrow
#

TAG ALL THE SOAPS

small igloo
drifting arrow
#

;D

honest vessel
#

i would suggest use aiohttp if you wanna scrape inside a bot

undone cairn
small igloo
fluid spindle
undone cairn
#

Soap from mw cod bræh

honest vessel
#

Dont drop the soap.

small igloo
pseudo lake
honest vessel
#

you dont wanna bend down... they say

fluid spindle
# small igloo wym?

Like, when are you trying to get the id? After a command is run by the user?

honest vessel
small igloo
#

@fluid spindle

kek

small igloo
honest vessel
#

ctx.author.nickname etc

small igloo
#

hi @sage otter

honest vessel
#

i dont know em in head, but realname, username, nickname check the docs under member object😄

small igloo
#

uh wrong tylerr?

sage otter
#

It’s just nick

fluid spindle
# small igloo ye

Then that command would have ctx passed into it, then you could just use

member_obj = ctx.guild.get_member(user_id)
member_name = member_obj.name```
small igloo
#

no it isnt

sage otter
#

!d discord.Member.nick

unkempt canyonBOT
sage otter
#

If get failed.

#

That means that member isn’t in the guild or he’s just not cached.

honest vessel
small igloo
small igloo
supple summit
#

you can use bot.get_user(id)

small igloo
supple summit
sage otter
#

I thought you wanted nickname

fluid spindle
small igloo
fluid spindle
small igloo
cloud dawn
small igloo
small igloo
fluid spindle
#

yeah

supple summit
#

if in cog you can do ctx.bot... or self.bot... i think

small igloo
#

k, leme try #2

cloud dawn
#

It indicates that you are using the function in a command.

supple summit
#

but thanks for recommendation

fluid spindle
#

idk why we're involving the bot at all, if the user is sending a command, they're also passing ctx, why can't just that be used?

supple summit
#

also i have my own bot

#

updating it everyday btw

small igloo
#

database code

def check_village_owner(village):
    village = str(village)
    cur.execute("SELECT OWNER from village where NAME = ?", (village,))
    check = cur.fetchone()
    owner = check[0]
    return owner

code in main

v = database.check_village(name)
    if v == "n":
        await ctx.send("u haven't joined any village! `sal! join [village name]` to join a village or `sal! create village [village name]` to create ur own village!")
    else:
        o = database.check_village_owner(v)
        o = bot.get_user(o).name
        draw = ImageDraw.Draw(bg)
        font = ImageFont.truetype("big_noodle_titling.ttf", 12)
        draw.text((362, 5), v, (0, 0, 0), font=font)
        draw.text((365, 19), o, (0, 0, 0), font=font)
        bg.save(f"{v}_village.png")
        await ctx.send(file = discord.File(f"{v}_village.png"))

error

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

there ;-;

cloud dawn
#

Mostly use bot in tasks etc.

supple summit
supple summit
#

and the bot is used in like 10 lines

small igloo
fluid spindle
small igloo
cloud dawn
small igloo
small igloo
cloud dawn
supple summit
#

who needs scare database with 34234328 lines

cloud dawn
#

Same as i'm saying right now that your database isn't asynchronous.

supple summit
#

i use built-in database in replit

small igloo
supple summit
small igloo
cloud dawn
#

I agree repl.it is not meant for Discord bots but it doesn't "suc" it has another purpose.

supple summit
#

i use replit to have database and 24/7 bot work

small igloo
supple summit
#

im poor i have no money for servers

#

and other advanced stuff

cloud dawn
small igloo
fluid spindle
supple summit
dire folio
#

i have this

@client.event
async def on_raw_reaction_remove(payload):
    for role_id, msg_id, emoji in client.reaction_roles:
        if msg_id == payload.message_id and emoji == str(payload.emoji.name.encode("utf-8")):
            guild = client.get_guild(payload.guild_id)
            await guild.get_member(payload.user_id).remove_roles(guild.get_role(role_id))
            return

i get this error

Ignoring exception in on_raw_reaction_remove
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "main.py", line 380, in on_raw_reaction_remove
    await guild.get_member(payload.user_id).remove_roles(guild.get_role(role_id))
AttributeError: 'NoneType' object has no attribute 'remove_roles'
cloud dawn
velvet tinsel
cloud dawn
#

Repl.it is meant to host small open sources sites. I won't recommend Repl.it but i won't discard it for people who can't/don't want to pay for a VPS.

honest vessel
#

@small iglooyou sure this returns discord_id of the user? owner = check[0]
return owner

dire folio
supple summit
fluid spindle
cloud dawn
velvet tinsel
cloud dawn
honest vessel
#

@small iglooalso what happens if theres few in ur server with same names? ```py
def check_village_owner(village):
village = str(village)
cur.execute("SELECT OWNER from village where NAME = ?", (village,))
check = cur.fetchone()
owner = check[0]
return owner

cloud dawn
fluid spindle
cloud dawn
#

It's more meant for debugging and testing.

#

But if you choose like 1/2 cores and 1gb ram it will take the whole year to spend 100 bucks.

dire folio
cloud dawn
#

You can get a lot as student, but some people don't bother to use/look for it.

fluid spindle
#

And some schools would really like the students to not know about it

#

idk how it works, maybe they charge the schools & universities or something

velvet tinsel
cloud dawn
#

I've been helping here for a pretty while now and i see so many projects where they limit their students in saying they can't use certain functions.

drifting arrow
#

why is this not working?

import requests, json

apikey = 'apikey'
steamid = steamid
    
search_url = f'https://rustbanned.com/api/eac_ban_check.php?apikey={apikey}&steamid64={steamid}'
response = requests.get(search_url)
json.dumps(response.json())

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) <-error

cloud dawn
drifting arrow
#

is requests not async? D:

brazen raft
cloud dawn
brazen raft
#

Neither is json

fluid spindle
drifting arrow
# cloud dawn It is not we use aiohttp

Moved to aiohttp.. same issue.

async def main():
    async with aiohttp.ClientSession() as session:
        async with session.get('https://rustbanned.com/api/eac_ban_check.php?apikey={apikey}&steamid64={steamid}') as resp:
            print(resp.status)
            
asyncio.run(main())
``` 🤔  I know the URL works normally when I paste into my browser.
cloud dawn
drifting arrow
#

I'm not using steam api.

magic ore
#

the url string isn't an f string (you probably want it to be one)

#

this also doesn't seem related to the channel

blazing lynx
slate swan
blazing lynx
#

so the command im trying to make i want it to make users have to use "wd?ban <@user> ?r <reason>" but im not sure how

#

i thought you could just do

#
if ctx.message.content == "wd?ban {member.mention} ?r":
<code here>
#

but that didnt work

boreal ravine
brazen raft
tawdry perch
boreal ravine
#

@tawdry perch wanna contrib to jarvide?

tawdry perch
#

what?

boreal ravine
#

DMs

cloud dawn
slate swan
#

@tawdry perch NO dont its hellpithink

tawdry perch
slate swan
boreal ravine
#

jarvide looks fine

blazing lynx
slate swan
blazing lynx
slate swan
cloud dawn
slate swan
blazing lynx
slate swan
tawdry perch
slate swan
#

more related to python

blazing lynx
cloud dawn
slate swan
#

very nice thing to read

cloud dawn
#

!arg-kwargs

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

cloud dawn
slate swan
blazing lynx
#

how to make it like normal lmao

boreal ravine
blazing lynx
#

not the whole message

slate swan
cloud dawn
#

snowy had been kinda hard lately

slate swan
untold widget
#

color=discord.Color.green() whats wrong with this

slate swan
cloud dawn
slate swan
slate swan
slate swan
#

742colors to be exactyert

blazing lynx
#

ExtensionFailed: Extension 'cogs.moderation' raised an error: TypeError: has_permissions() takes 0 positional arguments but 1 was given

#
        if ctx.author.has_permissions("BAN_MEMBERS"):
velvet tinsel
#

you passed an arg

#

it's supposed to be a kwarg

blazing lynx
#

so ```py
@commands.has_permissions(administrator=True)

velvet tinsel
#

yep

blazing lynx
#

how do i make my own error? if they dont have admin

#

like a embed error

slate swan
blazing lynx
#

lmao

velvet tinsel
slate swan
blazing lynx
velvet tinsel
slate swan
unkempt canyonBOT
#

@discord.ext.commands.has_permissions(**perms)```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member has all of the permissions necessary.

Note that this check operates on the current channel permissions, not the guild wide permissions.

The permissions passed in must be exactly like the properties shown under [`discord.Permissions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions "discord.Permissions").

This check raises a special exception, [`MissingPermissions`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingPermissions "discord.ext.commands.MissingPermissions") that is inherited from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
slate swan
velvet tinsel
#
def foo(*arg):
  print(arg)

foo("hello", "bob")

def bar(**something):
  print(something)

bar(something="hello")

no?

#

@slate swan

#

tell me 😠

cloud dawn
#

!e ```py
def func(*args, **kwargs):
print(args)
print(kwargs)

func('ddud' ,w='lol', k='w')

unkempt canyonBOT
#

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

001 | ('ddud',)
002 | {'w': 'lol', 'k': 'w'}
slate swan
velvet tinsel
#

!e

def foo(*arg):
  print(arg)

foo("hello", "bob")

def bar(**something):
  print(something)

bar(something="hello")
unkempt canyonBOT
#

@velvet tinsel :white_check_mark: Your eval job has completed with return code 0.

001 | ('hello', 'bob')
002 | {'something': 'hello'}
velvet tinsel
#

ok

slate swan
#

it doesnt need to be called the same thing

velvet tinsel
#

I thought kwargs were (x=y)

#

and args were ("...")

#

😦

#

:sadge:

cloud dawn
velvet tinsel
#

:kek:

velvet tinsel
slate swan
#

kwargs get stored as dicts

velvet tinsel
#

o k

#

thanks for clarifying

thats why I admire you ❤️

cloud dawn
#

I don't like this word puzzle

velvet tinsel
#

lol I'll stop sorry 😦

slate swan
velvet tinsel
slate swan
slate swan
velvet tinsel
#

never gonna let you

down

slate swan
velvet tinsel
slate swan
cloud dawn
#

@ moderators

slate swan
#

Well uhh

cloud dawn
slate swan
#

!ot

unkempt canyonBOT
velvet tinsel
cloud dawn
#

😨

slate swan
velvet tinsel
#

wait, iirc you cant ping if you edit a message

slate swan
velvet tinsel
#

@slate swan

slate swan
velvet tinsel
#

did you get pinged

slate swan
#

yes i did

#

i think im not sure

cloud dawn
#

Is winrar in jarvide?

slate swan
#

no dont think so

#

he should be in the cult

velvet tinsel
#

ok

#

@velvet tinsel

#

I got pinged

slate swan
#

of ** ** jarvide

#

It appears yellow, but you don't get a ping notification or red 1.

#

yeah

#

thats why i said im not sure

velvet tinsel
#

@slate swan can you test

slate swan
#

it did

#

ping me

cloud dawn
#

@slate swan You interested in joining? It's basically all the active people from this channel in a server.

cloud dawn
slate swan
cloud dawn
#

@manic wing

manic wing
#

no

cloud dawn
#

😂

manic wing
#

whats happening

cloud dawn
#

I saw that xD

manic wing
#

@cloud dawn he joined then left cus mark was a dickhead

cloud dawn
#

I can kind of understand that.

manic wing
#

i want him to rejoin

cloud dawn
#

!pypi async_cse

unkempt canyonBOT
manic wing
#

no

#

my bot has that

#

do it in jarvide

cloud dawn
#

No why

#

At this rate we will get the same import list as you got in your bot xD

blazing lynx
#

how to make the creation date less detailed. i used member.created_at

fervent shard
#
@bot.command(aliases['b']) 
@commands.has_premissions(ban_members=True)
async def ban(ctx, member : discord.Mmeber,*,reason=None): 
  if member == ctx.author:
    em=discord.Embed(description=f"**you** cannot `ban` yourself", colour=discord.Colour.red())
    await ctx.send(embed=em)
  else:
    em2 = discord.Embed(description=f"**{member}** has been `banned` for **{reason}**", colour=discord.Colour.green())
    em3 = discord.Embed(description=f"**you** have been `banned` for **{reason}**", colour=0)
  await ctx.send(embed=em2)
  await member.send(embed=em3)
  await ctx.member.ban(reason=reason)```

help?
blazing lynx
#

aliases = ["b"]

#
@bot.command(aliases=['b']) 
@commands.has_premissions(ban_members=True)
async def ban(ctx, member : discord.Member,*,reason=None): 
  if member == ctx.author:
    em=discord.Embed(description=f"**you** cannot `ban` yourself", colour=discord.Colour.red())
    await ctx.send(embed=em)
  else:
    em2 = discord.Embed(description=f"**{member}** has been `banned` for **{reason}**", colour=discord.Colour.green())
    em3 = discord.Embed(description=f"**you** have been `banned` for **{reason}**", colour=0)
  await ctx.send(embed=em2)
  await member.send(embed=em3)
  await ctx.member.ban(reason=reason)
#

@fervent shard

fervent shard
#

tyy

blazing lynx
#

yw

blazing lynx
#

wym

#

was i right?

#

ohhh

#

and you misspelled member @fervent shard

#

wrong ping 💀

slate swan
#

!d datetime.datetime.strftime

unkempt canyonBOT
#

datetime.strftime(format)```
Return a string representing the date and time, controlled by an explicit format string. For a complete list of formatting directives, see [strftime() and strptime() Behavior](https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior).
slate swan
#

you can format it according to yourself

blazing lynx
#

huh

#

may i have a example 💀

slate swan
#

!e ```py
from datetime import datetime

current = datetime.now()
print('non edited : ' , current )
print('formatted : ' , current.strftime('%d %B %Y'))```

unkempt canyonBOT
#

@slate swan :white_check_mark: Your eval job has completed with return code 0.

001 | non edited :  2022-01-03 18:13:15.319665
002 | formatted :  03 January 2022
slate swan
blazing lynx
#

so

#

i replace current var with "member.created_at"?

#

@slate swan

slate swan
#

you can

blazing lynx
#

"<PublicUserFlags value=64>"?

#

i used "member.public_flags"

tawdry perch
#

!d discord.Member.public_flags

unkempt canyonBOT
#

property public_flags```
Equivalent to [`User.public_flags`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.public_flags "discord.User.public_flags")
tawdry perch
#

hm

blazing lynx
#

maybe i have to use

#

member.public_flags()?

#

lemme try

#

well that doesnt work

#

now im just confused

blazing lynx
final iron
blazing lynx
#

"Discord Badges: {member.public_flags}"

ebon island
#

What's the easiest way to take a tagged user eg @ebon island as an argument and convert it into a discord Member object?

blazing lynx
#

using len or str

slate swan
#

none of them

#

if i were u . id do a list comprehension

slate swan
#

confused what you want

patent lark
#

no

blazing lynx
slate swan
#

oh u need member

ebon island
#

user is fine

slate swan
#

No, type hint it

ebon island
#

if it works

#

ooh, type hint as Member?

slate swan
#

if its a command , sure

slate swan
ebon island
#

oooh

#

that's smart 🙂

slate swan
#

aka it converts the member arg to a member obj

ebon island
#

I misunderstood that example when okimii first posted it, puny brain didn't comprehend that was type hinting and not a lambda or something

slate swan
#

🏃‍♂️ dpy basically does the same

slate swan
#

horrible explanation btw

slate swan
#

Indeed horrible explanation

ebon island
#

what was a horrible explanation lol

slate swan
#

lambda is just a function lol

honest vessel
#

@slate swan no one pays for winrar u kno that

slate swan
#

I do, so you're wrong.

ebon island
#

😛

slate swan
# slate swan wdym

the "aka it converts the member arg to a member obj",dpy just get_'smember or fetch'esmember from the message.content to get the mentions

ebon island
#

the best trial period ever