#discord-bots

1 messages · Page 912 of 1

glossy hill
#

I'm Daniel and I'm doing python.

boreal ravine
#

Was the function async?

slate swan
boreal ravine
#

Hey daniel

boreal ravine
slate swan
glossy hill
#

What can I do here?

honest vessel
#

@glossy hilldonate money to ukraine

boreal ravine
slate swan
#

i did and then this error comes up

honest vessel
#

read it

boreal ravine
slate swan
hoary cargo
glossy hill
honest vessel
#

and try understand it trust me@slate swan

honest vessel
hoary cargo
boreal ravine
honest vessel
cold sonnet
#

racist

honest vessel
honest vessel
hoary cargo
slate swan
#

im so fokin dumb im so sorry for annoying u with this question

#

sometimes my brain just dies after 5 oclock

glossy hill
#

I'll tell you right away. I use google translator and I can't write fast.

honest vessel
#

@hoary cargoi mean u could have let him try figure it out

hoary cargo
#

i could

honest vessel
#

u now make em never read errors

#

cause ares gonna answer

glossy hill
#

and yes. I am a Russian person

slate swan
#

i only come here when i have brain damage

honest vessel
slate swan
#

so like tuesday's and 1 other day

hoary cargo
glossy hill
#

thanks

honest vessel
#

@glossy hillprivet

glossy hill
#

what if I write in Russian?

velvet tinsel
honest vessel
#

thats not good

#

what if we all spoke in our motherlanguage?

velvet tinsel
#

@honest vessel how are you mf

hoary cargo
#

imagine

honest vessel
#

@velvet tinselam good my mf how R u mf?

velvet tinsel
glossy hill
#

well good

hoary cargo
glossy hill
#

😔

velvet tinsel
honest vessel
#

@velvet tinselu chinese?

velvet tinsel
#

Yes

hoary cargo
#

xiao piaopiao

regal cove
glossy hill
#

a esli tak?

honest vessel
#

cool my drawing teacher was obsessed with japanse he taught us arrigato n stuff n bow n hold hands 🙏🏻

honest vessel
regal cove
velvet tinsel
#

Ok ok guys the fun is over

#

!rule 4

unkempt canyonBOT
#

4. Use English to the best of your ability. Be polite if someone speaks English imperfectly.

regal cove
#

god damn

honest vessel
#

@regal covetallar gör man på bröst, talar gör man med munnen

hoary cargo
#

!ot

unkempt canyonBOT
glossy hill
#

?

regal cove
#

i have no idea how i spelled that wrong in my own language haha

velvet tinsel
#

Lmao

honest vessel
#

hahahaha jösses

velvet tinsel
#

?

honest vessel
#

@regal covekul iaf svennejävel

#

now back to script

regal cove
#

yessir

velvet tinsel
#

Dead chat

honest vessel
#

@regal covewhat is role lovefest?

regal cove
#

its from valentines day

glossy hill
#

är det möjligt åtminstone på engelska?

honest vessel
#

aaah i had a backflash from WoW xD

glossy hill
#

is it possible at least in English?

regal cove
glossy hill
#

?

honest vessel
#

or spanish for that matter or france

regal cove
#

yes

glossy hill
#

got it

honest vessel
#

our second lang to use is python kek

velvet tinsel
#

Lmao

flat solstice
#

hey, how would I display the 🗑️ emoji in code, ik I need the Unicode version but I don't know what that is (I've found a few different codes) and I can't remember how to actually format the emoji in code

regal cove
#

i once heard a guy on tiktok say there is one universal language we could use to talk to aliens

cosmic agate
#

HEY

regal cove
#

math..

honest vessel
#

copy this \🗑️

regal cove
#

i got so mad when he said that

velvet tinsel
#

Like :flushed:

glossy hill
#

Can I ask you a question

cosmic agate
regal cove
honest vessel
#

@flat solsticea tips: do ur : get emoji then put a \ backslash infront of it n post it n u got ur unicode

regal cove
#

u dont need to ask to ask

honest vessel
glossy hill
regal cove
glossy hill
#

so

#

yes?

honest vessel
#

niet

regal cove
#

вперед, продолжать

honest vessel
#

niet para russka

regal cove
#

thats what go ahead means in russian

glossy hill
#

ok

cosmic agate
glossy hill
#

how do you feel about pirates?

regal cove
#

pirate movies are cool tho

hushed galleon
cosmic agate
glossy hill
#

I'm sorry, but I have Parental control on my computer.

#

😔

honest vessel
# glossy hill how do you feel about pirates?

Try before buy is a good thing i support. Who wanna buy clothes u cant test then it dosnt fit u. But hey no return here. I wish games did give out more demos. WOrld of warcraftg u dont donwload pirate u get a week to test it out no limits.

honest vessel
glossy hill
honest vessel
#

@glossy hillmaybe u should define pirates next time 🦜

slate swan
#

the heck is happening

sonic flax
#

im trying to use pebblehost to host my bot, but it says "module discord not found" even thought i did "pip install discord" in requirements.txt

glossy hill
honest vessel
#

@slate swannothing he asked if we support pirates? 🤷🏻‍♂️

slate swan
#

pirates are overrated

vocal plover
#

not discord and no pip install

slate swan
#

yeah and you need to specify the version

glossy hill
#

no. I'm not in that sense

slate swan
vocal plover
#

assuming you want 1.7.3 it would be discord.py==1.7.3

slate swan
#

yeah that as well

#

and it should be in a requirements.txt file

sonic flax
#

Now it says 'no module name requests'

slate swan
#

well add it lol

glossy hill
#

...

#

😑

velvet tinsel
#

@slate swan

#

Oh Nevermind

sonic flax
glossy hill
#

and what is there to do with Python?

honest vessel
#

code ur own girlfriend

glossy hill
#

I have 1 minute left. all pack

honest vessel
#

ccya in keiv - not

slate swan
slate swan
flat solstice
#
Traceback (most recent call last):
  File "C:\Users\Teagan\Documents\Coding\Zupie\env\lib\site-packages\discord\app_commands\tree.py", line 879, in call
    await command._invoke_with_namespace(interaction, namespace)
  File "C:\Users\Teagan\Documents\Coding\Zupie\env\lib\site-packages\discord\app_commands\commands.py", line 470, in _invoke_with_namespace
    raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command 'load' raised an exception: AttributeError: 'Interaction' object has no attribute 'command'```but interactions do have command attrs, unless I misunderstand this https://discordpy.readthedocs.io/en/master/interactions/api.html?highlight=app_commands#discord.Interaction.command
lusty sky
#

Anyone know how to fix this?

vocal plover
#

looks like you forgot the f at the start of f"{member.mention} ..."

#

not that the mention would work in the embed title anyway

flat solstice
# lusty sky Anyone know how to fix this?

you probs have somehting likepy embed(title="{member.mention} was unmuted")first off your going to want to wrap it as a f string py embed(title=f"{member.mention} was unmuted")and secondly mentions can't be titles, so just remove the .mention as it will show the user name and tag

sonic flax
#

why am i getting KeyError: 'token'

#

i made a .env file and put token = os.getenv('*')

slate swan
#

token isnt a key

#

!e print({1:2}[4])

unkempt canyonBOT
#

@slate swan :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | KeyError: 4
flat solstice
#

so I see @unkempt canyons snippet cog has support for GitHub gist links, I had a go with it in #bot-commands but couldn't seem to get it to snippet the gist, how does it work?
also how do I specify both a first and last line of a GitHub repo in the link, whenever i try to grab and link it just grabs one line

slate swan
#

!src

unkempt canyonBOT
slate swan
sonic flax
slate swan
sonic flax
#

it is correct tho

slate swan
#

so you're calling python a liarhmmcat

slate swan
#

check your spelling

#

if you misspell it ofc it would raise an error

sonic flax
#

i didn't

#

i copy pasted it

#

do i need anything in my main .py with the token

#

or just in the .env

manic wing
#

my pre-commit is so fucked what the fuck

flat solstice
velvet tinsel
manic wing
velvet tinsel
#

oh

manic wing
#

fucking hell

velvet tinsel
#

gl mate

slate swan
#

why is this working globally

#
@tree.command(description = "Add Money To people", guild=discord.Object(id=954052385309863998))
async def adminsetmoney(interaction: discord.Interaction, userid: discord.Member, amount:int):```
sonic flax
#

:D

slate swan
#

?

flat solstice
#

I'm getting this errorpy File "C:\Users\Teagan\Documents\Coding\Zupie\env\lib\site-packages\discord\message.py", line 1504, in add_reaction await self._state.http.add_reaction(self.channel.id, self.id, emoji) File "C:\Users\Teagan\Documents\Coding\Zupie\env\lib\site-packages\discord\http.py", line 502, in request raise HTTPException(response, data) discord.errors.HTTPException: 400 Bad Request (error code: 10014): Unknown Emojiwhich I think is being caused by thispy try: await message.add_reaction(":wastebasket:") except NotFound:

rough finch
#

why does it not import slash commands for me?
from discord_slash import SlashCommand from discord_slash.utils.manage_commands import create_option

flat solstice
#

are you getting any errors

final iron
#

Makes 0 sense

slate swan
#

^^^

rough finch
#

thx

slate swan
#

👌

final iron
#

But why

#

dpy literally has slash commands

rough finch
#

slash = SlashCommand(bot, sync_commands = True)
"SlashCommand" is not defined Pylance(reportUndefinedVariable)

slate swan
#

just use main smh

sonic flax
#
    while True:
      string = (dtag)
      tag, discrim = string.split("#")
      taglist.clear()
      altFinder = requests.get(f"http://api.antisniper.net/discord/query?key={akey}&name={tag}&number={discrim}")
      altjson = json.loads(altFinder.text)
      if altjson['success'] is True:
        taglist.clear() 
        for x in altjson['results']:
          taglist.append(x['ign'])
      embed = discord.Embed(title=f"Accounts linked to {dtag}", description="\n".join(taglist))
      embed.set_footer(text="dewier private bot")
      await ctx.send(embed=embed)
      break```
why does it send a message twice
rough finch
final iron
sonic flax
slate swan
slate swan
sonic flax
#

it works now, but what do u mean by freezing

final iron
sonic flax
final iron
unkempt canyonBOT
#
async-with aiohttp.request(method, url, *, params=None, data=None, json=None, headers=None, cookies=None, auth=None, allow_redirects=True, max_redirects=10, encoding='utf-8', ...)```
Asynchronous context manager for performing an asynchronous HTTP request. Returns a [`ClientResponse`](https://aiohttp.readthedocs.io/en/stable/client_reference.html#aiohttp.ClientResponse "aiohttp.ClientResponse") response object.
final iron
#

!pypi aiohttp

unkempt canyonBOT
lusty sky
#

how do I make my bot actually check someone is banned when it unbans

#

instead of just "unbanning them in chat"

final iron
unkempt canyonBOT
#

discord.on_member_ban(guild, user)```
Called when user gets banned from a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").

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

!d discord.Guild.unban

unkempt canyonBOT
#

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

Unbans a user from the guild.

The user must meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.

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

on_member_ban gives you a user object and a guild object

#

You can use the unban method of the guild object to unban the user

sick birch
#

I wasn’t aware it gave you a guild object

#

Since you can get guild from member.guild anyway

lusty sky
#

I mean like for example

#

I wasnt actually banned in the first place

final iron
lusty sky
#

I want it instead to realize im not actually on the ban list

final iron
#

Oh

sick birch
#

Oh we’ll get guilds.bans()

final iron
#

So it can return a member object

sick birch
#

Then check if the banned member was in the banned members

#

Or vice versa for unbans

#

Same concept though

glossy hill
#

are there any rules here?

pliant gulch
unkempt yacht
#
@commands.commands(name='decancer', aliases=["dc"])
@commands.guild_only()
@commands.has_permissions(manage_nicknames=True)
async def decancer(self, ctx, member: Member = None):
      """Decancers a user's nickname."""
    if not member:
        member = ctx.author
        name = member.display_name
    while name.startswith(tuple("!\"#$%&'()*+,-./:;<=>?@")):
        name = name[1:]
        if not name:
            name = "Decancered Name."
        await member.edit(nick=name, reason="Decancer")
        await ctx.send(f"{member.mention} was decancered by {ctx.author}. Their new nickname is {name}.")```
 
I get an error of indent but the indents seem fine to me, can someone double check them?
glossy hill
#

ok

slim ibex
glossy hill
#

what language is it?

unkempt yacht
sonic flax
#
if altjson['success'] is True:
        taglist.clear() 
        for x in altjson['results']:
          taglist.append(x['ign'])
      embed = discord.Embed(title=f"Accounts linked to {dtag}", description="\n".join(taglist))
      embed.set_footer(text="dewier private bot")
      await ctx.send(embed=embed)
      break```
How do I make it so if they enter an invalid player it doesn't display an error
sick birch
unkempt yacht
slim ibex
unkempt yacht
#

ya

glossy hill
#

I only know python!

slim ibex
#

then indent it

sonic flax
#
@bot.command()
@commands.has_any_role("Guild Master", "Warden", "~", "dewier bot perms")
async def tagfinder(ctx, *, dtag):
    while True:
      string = (dtag)
      tag, discrim = string.split("#")
      taglist.clear()
      altFinder = requests.get(f"http://api.antisniper.net/discord/query?key={akey}&name={tag}&number={discrim}")
      altjson = json.loads(altFinder.text)
      if altjson['success'] is True:
        taglist.clear() 
        for x in altjson['results']:
          taglist.append(x['ign'])
      embed = discord.Embed(title=f"Accounts linked to {dtag}", description="\n".join(taglist))
      embed.set_footer(text="dewier private bot")
      await ctx.send(embed=embed)
      break```
How do i make it so if the user doesnt have one of the required roles it displays an error messgae
slim ibex
unkempt yacht
#

Now i get an await outside function error

#

same line

slim ibex
#

??? show the new code

sonic flax
#

oh

#

do i put it before the if stateent

slim ibex
#

do you know what a try..except block is?

glossy hill
#

🤯

#

AAAAAAAAAA

slim ibex
#

and I don't think you want to not warn the user about an error...

glossy hill
#

my brain is boiling!

slim ibex
#

okimii moment

slate swan
#

smh

#

SMH

slim ibex
#

!except

unkempt canyonBOT
#

A key part of the Python philosophy is to ask for forgiveness, not permission. This means that it's okay to write code that may produce an error, as long as you specify how that error should be handled. Code written this way is readable and resilient.

try:
    number = int(user_input)
except ValueError:
    print("failed to convert user_input to a number. setting number to 0.")
    number = 0

You should always specify the exception type if it is possible to do so, and your try block should be as short as possible. Attempting to handle broad categories of unexpected exceptions can silently hide serious problems.

try:
    number = int(user_input)
    item = some_list[number]
except:
    print("An exception was raised, but we have no idea if it was a ValueError or an IndexError.")

For more information about exception handling, see the official Python docs, or watch Corey Schafer's video on exception handling.

slate swan
#

bro

slim ibex
#

bro

slate swan
#

try and except statements

slim ibex
#

||im making my own Rust backend stack, @slate swan ||

slate swan
#

which can be called a try and except block

slim ibex
#

tech stack

unkempt yacht
# slim ibex ??? show the new code
@commands.commands(name='decancer', aliases=["dc"])
@commands.guild_only()
@commands.has_permissions(manage_nicknames=True)
async def decancer(self, ctx, member: Member = None):
      """Decancers a user's nickname."""
    if not member:
        member = ctx.author
        name = member.display_name
    while name.startswith(tuple("!\"#$%&'()*+,-./:;<=>?@")):
        name = name[1:]
        if not name:
            name = "Decancered Name."
            await member.edit(nick=name, reason="Decancer")
            await ctx.send(f"{member.mention} was decancered by {ctx.author}. Their new nickname is {name}.")```
slate swan
#

🏃

slim ibex
#

lmaoooo

pliant gulch
#

bottom stack is a what the heck moment

slim ibex
#

shit andy is here

slate swan
slim ibex
#

ehh i guess

flat solstice
#
Traceback (most recent call last):
  File "C:\Users\Teagan\Documents\Coding\Zupie\env\lib\site-packages\discord\app_commands\tree.py", line 879, in call
    await command._invoke_with_namespace(interaction, namespace)
  File "C:\Users\Teagan\Documents\Coding\Zupie\env\lib\site-packages\discord\app_commands\commands.py", line 470, in _invoke_with_namespace
    raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command 'load' raised an exception: AttributeError: 'Interaction' object has no attribute 'command'```but interactions do have command attrs, unless I misunderstand this https://discordpy.readthedocs.io/en/master/interactions/api.html?highlight=app_commands#discord.Interaction.command
flat solstice
#
    @cogs_group.command(name="unload", description="unloads a cog")
    @app_commands.describe(cog="the cog to unload.")
    @app_commands.choices(cog=[app_commands.Choice(name=cog.split('.')[1].title(),value=cog) for cog in bot.config.initial_extensions])
    async def unload_slash(self, interaction: Interaction, cog: str):
        try:
            await self.bot.unload_extension(cog)
            embed.color=Colour.green()
            embed.title=(f"__Cog {interaction.command.name.title()}ed__")
            ephemeral=False
        except Exception as e:
            embed.title=f"__{interaction.command.name.title()} Error__"
            embed.description=(f"There was an error trying to {interaction.command.name.lower()} `{cog.split('.')[1].title()}`")
            embed.color=(Colour.red())
            embed.add_field(name="Traceback", value=f"``py\n{format_exc()}``")
            ephemeral=True
        embed.set_footer(text=f"{transaction.user}", icon_url=transaction.user.display_avatar.url)
        await interaction.response.send_message(embed=object_arg, ephemeral=ephemeral)
        await self.bot.tree.sync(guild=Object(id=interaction.guild_id))```
slim ibex
#

error is from line 1 i assume

slate swan
#

today i went to a tour for my tech course and maybe im gonna learn cpp and or java in it and python which i already know it

slim ibex
#

c# > java

slate swan
#

idk chief i cant really say anything about it

slim ibex
#

I can 🗿

pliant gulch
manic wing
flat solstice
slate swan
#

Is there a function where I can pass in a User ID and it would return a username?

manic wing
#

java is so irrelevant and useless for what

slate swan
#

whats wrong with javahmmcat

#

hey now >:(

slim ibex
slate swan
#

you will not say anything about java

slate swan
slim ibex
#

its not modern

#

c# is wa more modern

slate swan
#

oh heckkkkkkkk nawwwwwwwwwwwwwwwwww

#

java is better :)

slim ibex
#

first time i've seen a java advocate ngl

slate swan
#

I love Java

#

its my main and it is easy

slim ibex
#

then you should love C#

manic wing
slate swan
#

I tried it

slate swan
slate swan
#

im fine with Kotlin and Java and Java is always better lol

#

the C fam is the best

slate swan
#

good thing im gonna learn cpp which i want to learn it personally and im gonna learn it in the course so pog

manic wing
slate swan
#

saw its syntax and it made me puke

slate swan
slate swan
slate swan
slim ibex
#

its way better than cpp

slate swan
#

bro shit posting rn🗿

#

cap

slim ibex
#

!ot shall we continue here

unkempt canyonBOT
slim ibex
#

i got some code to compare

glossy hill
#

what's happening?

slate swan
#

something

pliant gulch
# slate swan anyway can someone help me here?

!d discord.Client.get_user, you may also use fetch_user which is a coro, you pass in the id, then the ret is a discord.User object. With this you can access the name attribute via dotnotation

unkempt canyonBOT
#
Certainly not.

No documentation found for the requested symbol.

slate swan
#

the comma!

pliant gulch
#

!d discord.Client.get_user

unkempt canyonBOT
#

Sorry, an unexpected error occurred. Please let us know!

ServerDisconnectedError: Server disconnected

slim ibex
#

LMAO

pliant gulch
#

Guess it's not just the comma

slim ibex
#

!code

slate swan
#

andy really got ratiod

jaunty sparrow
#

!d discord.Client.get_user

unkempt canyonBOT
#

get_user(id, /)```
Returns a user with the given ID.

Changed in version 2.0: `id` parameter is now positional-only.
slim ibex
#

an admin 🗿

glossy hill
#

I know one person who is very well versed in programming. he can help you.

slim ibex
#

??

slate swan
glossy hill
#

Владимир Журавлёв#1316

slate swan
#

anyone know how to fix this problem

#

i open the terminal in Visual studio code

#

and it closes with that error

slim ibex
velvet tinsel
#

whats kotlin for

#

💀

slim ibex
velvet tinsel
#

i'll go google

slim ibex
#

android dev

velvet tinsel
#

thanks google

hoary cargo
#

MR_uncanny_1 why guild.owner returns none? my disappointment is immeasurable and my day is ruined

terse blade
#
        async def meme(ctx):
          memeAPI = urllib.request.urlopen('https://ww.reddit.com/r/memes.json')
          
          memeData = json.load(memeAPI)

          memeUrl = memeData['url']
          memeName = memeData['title']
          memePoster = memeData['author']
          memeSub = memeData['subreddit']
          memeLink = memeData['postLink']

          embed = disnake.Embed(title=memeName, colour=disnake.orange())
          embed.set_image(url=memeUrl)
          embed.set_footer(text=f'Meme by: {memePoster} | Subreddit: {memeSub} | Post: {memeLink} ')
          await ctx.send(embed=embed)
#

why url no open

slim ibex
#

the error is clear

final iron
velvet tinsel
#

Error is obvious

final iron
#

snake_case is all lower case

hoary cargo
#

PEP8 is made to be broken by people

terse blade
hoary cargo
#

meme_data

final iron
terse blade
#

Probs dunno

#

Is there a diff link that link don't work

hoary cargo
#

it's about readability

hoary cargo
dull terrace
#

the way im caching user info is bugged to fuck

#

fml

#

whoever convinced me to switch to dbs i hate you 😤

hoary cargo
dull terrace
#

after just google how to detect when someone joins a server and you're done

hoary cargo
#

or just could've

#

!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") join or leaves 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.
slate swan
hoary cargo
# slate swan U need members intent
intents = discord.Intents.default()
Intents.members = True


bot = commands.AutoShardedBot(command_prefix="s!", intents=intents, sync_permissions=True, case_insensitive=True)

NadekoAnnoyed it's not like i don't have them already

hardy wing
#

what kind of amazon web service server would you need to host a discord bot on

hoary cargo
#

whatTf i didn't started to code discord bots a day ago

slate swan
#

Well

#

maybe the bot isnt fully ready

hoary cargo
#

it is mikedone

hoary cargo
#

anyway it's weird bc it shouldn't return none lol

slate swan
#

Ik this might not be the right place since the bot is both Reddit and Discord combiend

#

But here I go

#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: Subreddit.submit_image() got an unexpected keyword argument 'image'

This is the error and

#

Here is the code

@client.command()
async def post(ctx):
    def checkbot(message: discord.Message) -> bool:
        if message.user == client.user:
            return
    await ctx.send("Insert Title Here")
    title = await client.wait_for("message")
    title=title.content

    await ctx.send("Insert Image Link Here")
    image_discord_url = await client.wait_for("message")
    image_discord_url = image_discord_url.content

    image_url = requests.get(image_discord_url)
    image = Image.open(BytesIO(image_url.content))
    image.save("redditpost.png")

    reddit.subreddit("IslamicHistoryMeme").submit_image(title, image = discord.File("redditpost.png"))```
hoary cargo
#

unexpected keyword argument 'image' means that you used it where you shouldn't or used it wrong

dull terrace
#

should be image_path by looks of it

slate swan
#

i dont understand documentaiton ☠️

#

too noob to understand

dull terrace
#

reddit.subreddit("IslamicHistoryMeme").submit_image(title, image_path = "path/to_image.png")

slate swan
#

ah

#

wait lemme give it a shot thanks man

dull terrace
#

never done that with praw so might be wrong idk

slate swan
unkempt canyonBOT
#

Hey @slate swan!

You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.

slate swan
dull terrace
hardy wing
#

is there a way to connect your discord bot on replit to an AWS EC2 server so it won't get ratelimited and can run 24/7

dull terrace
hardy wing
#

like instead of uploading a file to the AWS I just connect the replit thing to it

dull terrace
#

if i remember correctly, replit is that website where you write your code and run it directly, just copy the code to a py file on your aws

#

i doubt it

hardy wing
#

and all the dependencies + secrets will go with it?

dull terrace
#

no, just install them..

#

install python with google search on your aws and get pip and then it's as simple as opening command prompt and typing "pip install >package name<"

pliant gulch
#

Well, repl.it uses poetry, a depedency manager

#

So just install all of the files, including pyproject.toml and poetry.lock

#

then install poetry, then do poetry install

#

This will then install all the dependencies you had on repl.it

#

You'd run your file by doing poetry run python file.py

#

You'd still need to manually add the secrets, this is done by exporting

#

export SECRET="foo"

hardy wing
#

and I'd have to re-upload the files every time I have to update the bot right?

pliant gulch
#

Correct, yes

#

If you setup a github repo, you can just add a command to your bot that clone the repo and updates

hardy wing
#

so if I'm running the bot on the server and run it on replit to test at the same time will the commands double and like glitch out or will it be fine

pliant gulch
#

Meaning you'd only need to upload to github after updating instead of doing an FTP or some other way into your AWS server

lusty sky
#
@client.command()
async def Help(ctx):
    embed=discord.Embed(title="**Help Menu**",
    colour=0x979c9f, timestamp=datetime.utcnow())
    embed.add_field(name="**{Prefix}Ping**",
    value="**Tests The, Bots Response, Time**", inline=True)
    embed.add_field(name="**{Prefix}Basic_Command**",
    value="**Responds With Hello World**", inline=True)
    embed.add_field(name="**{Prefix}Servers**",
    value="**How Many Servers, The Bots Currently In**", 
    inline=True)      
    embed.add_field(name="**{Prefix}Code**",
    value="**What Language, The Bot Is Coded In**", inline=True)

    embed.set_footer(text = ctx.author.name, icon_url = ctx.author.avatar_url)
    await ctx.send(embed=embed)```
pliant gulch
lusty sky
#

Anyone know why im getting this error?

terse blade
#

is there a way to take all cogs out of a folder instead of it manually

slate swan
#

tskk it says invalid grant but the details are correct

terse blade
dull terrace
#

no idea how i did it but i think i fixed my cache issue 🥳

hardy wing
#

if I just upgraded my replit account's membership could I not get ratelimited by discord or would that still be a problem

terse blade
dull terrace
dull terrace
#

commands take the function name as the command name if you don't specify

terse blade
# hardy wing damn

I get rate limited on python but it still runs the bot fine replit's shitty

hardy wing
#

it'd be easier if I could just keep using replit since I can run/update things in real time and I already know how to use it

dull terrace
#

why even use replit

hardy wing
#

cause it's what I learned on

terse blade
dull terrace
#

fight the inertia and learn to do it without

hardy wing
#

also that it's more flexible

dull terrace
#

so much better

terse blade
#

replits limited asf

hardy wing
#

does atom get ratelimited

terse blade
#

no atom is a way to edit your stuff like replit

hardy wing
#

the only issue I have rn is the ratelimit thing happens constantly

terse blade
#

but its all pc based

hardy wing
#

but wouldn't I have to keep my pc on 24/7 to do that

dull terrace
#

you could set up an amazon web server which is extremely fast and free if you're only running a lil bot

terse blade
#

ye but you can do everything like making commands etc then put the files into replit then run it all night

#

is there a way to load all cogs in a folder
instead of

['commands.help',
 'commands.ping',
 'commands.slap',
 'commands.nick',
 'commands.meme']```
pliant gulch
#

🤔 repl.it and atom are not the same thing

#

repl.it is an HOSTED ide, atom is a regular IDE, not hosted

hardy wing
terse blade
#

simple

hardy wing
#

but wouldn't i not be able to type the commands into discord and happen then

#

like testing on pc is diff I'm p sure

terse blade
#

what?

dull terrace
pliant gulch
#

AWS has integrations with github, allowing for auto deployments on commits

terse blade
#

is there a way to load all cogs in a folder
instead of

['commands.help',
 'commands.ping',
 'commands.slap',
 'commands.nick',
 'commands.meme']```
#

answer plox

rocky trench
#

Yeah, using os.lostdir

dull terrace
#

also github but idk how that works

terse blade
rocky trench
terse blade
#

mk

hardy wing
#

yeah github was another solution I heard

#

like connect the vscode file to github then connect github to AWS?

pliant gulch
#

!e ```py
import os
print(os.listdir())

unkempt canyonBOT
#

@pliant gulch :white_check_mark: Your eval job has completed with return code 0.

['Pipfile.lock', 'Pipfile', 'config', 'snekbox', 'user_base', 'tests', 'LICENSE']
pliant gulch
#

Use this to get all the file name in the directory

terse blade
#

also dont rely on repl.it my friend is using it and it crashes sometimes

dull terrace
#

idk, i just keep a test bot on my home pc and one on amazon, when i've done enough updates on my test i merge it over to amazon server

#

different tokens so i don't disrupt service

#

anyone here have experience with discord slash

#

i'm trying to add buttons on an action row without having to redo the entire action row, i remember trying it a while back and getting stuck

#
if player.generated > 100:
  return [
    ActionRow(
      Button(style=2, label="Back", custom_id=f"bac{end}"),
      Button(style=2, label="Reset Game", custom_id=f"res{end}"),
    ),
  ]
else:
  return [ActionRow(Button(style=2, label="Back", custom_id=f"bac{end}"))]```
#

instead of doing this doing

terse blade
pliant gulch
dull terrace
#
buttoons = (Button(style=2, label="Back", custom_id=f"bac{end}"),)
if player.generated > 100:
  buttoons += (Button(style=2, label="Reset Game", custom_id=f"res{end}"),)
return [ActionRow(buttoons)]```
#

doing that instead but lemme double check that doesn't work

slate swan
#

how can you add buttons and dropdown in the same message?

dull terrace
slate swan
#

alright thanks

dull terrace
#

dropdown has to have its own

silent ermine
#

How do I kick someone on a on_message?
is it await message.author.kick(user=message.author)?

lusty sky
#

only got 2

#

and its only in that command

pliant gulch
#

Inside of your bot constructor, you'd pass help_command=None

dull terrace
# dull terrace ```python buttoons = (Button(style=2, label="Back", custom_id=f"bac{end}"),) if ...
  File "C:\Users\Olie\Desktop\SaltMiner\salt mines\salt_miner.py", line 737, in back
    return [ActionRow(buttoons)]
  File "C:\Python\Python39\lib\site-packages\discord_slash\utils\manage_components.py", line 24, in create_actionrow
    ComponentType.select in [component["type"] for component in components]
  File "C:\Python\Python39\lib\site-packages\discord_slash\utils\manage_components.py", line 24, in <listcomp>
    ComponentType.select in [component["type"] for component in components]
TypeError: tuple indices must be integers or slices, not str```
lusty sky
silent ermine
lusty sky
#

changed command name

slate swan
slate swan
#

like reason="hi"

silent ermine
slate swan
#

yes

silent ermine
silent ermine
dull terrace
#

oh wait will it work if i just unpack

dull terrace
#

woo figured it out

silent ermine
pliant gulch
slate swan
flat solstice
unkempt canyonBOT
#

bot/exts/info/code_snippets.py lines 23 to 27

GITHUB_GIST_RE = re.compile(
    r'https://gist\.github\.com/([a-zA-Z0-9-]+)/(?P<gist_id>[a-zA-Z0-9]+)/*'
    r'(?P<revision>[a-zA-Z0-9]*)/*#file-(?P<file_path>[^#>]+?)(\?[^#>]+)?'
    r'(-L(?P<start_line>\d+)([-~:]L(?P<end_line>\d+))?)'
)```
dull terrace
#

that feeling when you half the amount of lines a function takes hyperlemon

slate swan
#

its just worksonmymachine

slate swan
pliant gulch
slate swan
#

yes

#

arl said development will continue

vocal plover
#

^ that

#

Both disnake and nextcord have no intent of halting development, we believe that discord.py can no longer be trusted to stick around or be stable, so we see no reason to stop development

slate swan
#

hey vco in your yt vids you got a cool accent😳

pliant gulch
#

Still that gist must have been a pretty hard hitter

vocal plover
#

Bit annoying but it didn't really change much

#

As I say, we don't really have any trust that discord.py will stick around now, so there's no compelling reason for us to use or recommend it in case it goes away

vocal plover
pliant gulch
#

I was gonna impl my next project's websocket with anyio TCP connection but I don't wanna go insane

vocal plover
#

Lol websockets are somewhat scary to implement

pliant gulch
#

If your using anything other than aiohttp

#

The anyio streams got me fucked up, couldn't figure out handshaking with the wsproto connection

#

Gave up after that cause I was getting end of stream error

slate swan
desert heart
# flat solstice so I've had a poke around at <@!409107086526644234>'s https://github.com/python-...

It's a regular expression. You can do match = GITHUB_GIST_RE.search(string) to find the URL in some string. It returns an re.Match object, so you could do match["start_line"] to get the starting line number and match["end_line"] to get the end (notice this name matches what's in the angle brackets for (?P<end_line>\d+)). But you may want to adjust the regular expression slightly so that it requires line numbers in the URL (the current regex matches without them too)

flat solstice
desert heart
#

I don't understand the question. Are you asking how a user can generate a gist URL that includes line numbers?

flat solstice
#

yep

desert heart
#

Just click the line number

#

Optionally shift-click on another line number to select a range

terse blade
#

how to make a button?

flat solstice
desert heart
#

That seems to be the case. GitHub treats some file extensions specially

flat solstice
#

cool thanks for helping me understand

desert heart
#

I think your best solution is to get the entire markdown content and search for the header

#

And look for the next header as the point to stop

terse blade
#
class memeCog(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

        @bot.slash_command(description=  'Displays a meme!')
        async def meme(interaction):
          memeapi = urllib.request.urlopen('https://meme-api.herokuapp.com/gimme')

          memedata = json.load(memeapi)

          memeurl = memedata['url']
          memename = memedata['title']
          memeposter = memedata['author']
          memesub = memedata['subreddit']
          memelink = memedata['postLink']

          embed = disnake.Embed(title=memename, color=disnake.Colour.blue(),)
          embed.set_image(url=memeurl)
          embed.set_footer(text=f'User: {memeposter} | Subreddit: {memesub}')

          MyButton = disnake.ui.button(label="Next Meme", style=disnake.ButtonStyle.green)
          class MyButton(disnake.ui.Button):
              def __init__(interaction):
                  super().__init__()

          async def callback(interaction):
            await interaction.response.edit_message(embed = embed)```
#

why dosent this show the embed?

slate swan
#

it should be UpperWord

terse blade
#

where

#

memeCog?

slate swan
#

yes

#

and all your commands are missing self lol

terse blade
#
import discord
import disnake
from disnake.ext import commands
import datetime
import json
import os
import urllib

bot = commands.Bot(command_prefix="w-", test_guilds=[772968562054660107])


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

        @bot.slash_command(description=  'Displays a meme!')
        async def meme(self, interaction):
          memeapi = urllib.request.urlopen('https://meme-api.herokuapp.com/gimme')

          memedata = json.load(memeapi)

          memeurl = memedata['url']
          memename = memedata['title']
          memeposter = memedata['author']
          memesub = memedata['subreddit']
          memelink = memedata['postLink']

          embed = disnake.Embed(title=memename, color=disnake.Colour.blue(),)
          embed.set_image(url=memeurl)
          embed.set_footer(text=f'User: {memeposter} | Subreddit: {memesub}')

          MyButton = disnake.ui.button(label="Next Meme", style=disnake.ButtonStyle.green)
          class MyButton(disnake.ui.Button):
              def __init__(self, interaction):
                  super().__init__()

          async def callback(interaction: disnake.MessageInteraction):
            await interaction.response.edit_message(embed = embed)


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

this?

slate swan
#

all your methods are missing self

terse blade
#

i jsut added self

rocky trench
#

Methods

#

Not just commands

terse blade
#

where?

rocky trench
#

async def

terse blade
#

oh yh

slate swan
#

bro really said where

#

🗿

rocky trench
#

🪑

flat solstice
#

seems dpy 1.7.3 will survive for just a little longer

API versions & deprecations update
Based on a review of bot usage and discussion with developers, we are postponing the decommission of API v7 until early 2023
The API v6 decommission will continue as planned. The last officially supported date is Tuesday, May 3.
Additionally, we’ve gotten some questions around what the decommission process looks like. We've provided further details on what to expect here: https://github.com/discord/discord-api-docs/discussions/4657
Thanks to all community members for their feedback and input!
#697138785317814292 message

terse blade
#

ok now what

#

cause it still dosent send

rocky trench
#

Send code

terse blade
#
import discord
import disnake
from disnake.ext import commands
import datetime
import json
import os
import urllib

bot = commands.Bot(command_prefix="w-", test_guilds=[772968562054660107])


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

        @bot.slash_command(description=  'Displays a meme!')
        async def meme(self, interaction):
          memeapi = urllib.request.urlopen('https://meme-api.herokuapp.com/gimme')

          memedata = json.load(memeapi)

          memeurl = memedata['url']
          memename = memedata['title']
          memeposter = memedata['author']
          memesub = memedata['subreddit']
          memelink = memedata['postLink']

          embed = disnake.Embed(title=memename, color=disnake.Colour.blue(),)
          embed.set_image(url=memeurl)
          embed.set_footer(text=f'User: {memeposter} | Subreddit: {memesub}')

          MyButton = disnake.ui.button(label="Next Meme", style=disnake.ButtonStyle.green)
          class MyButton(disnake.ui.Button):
              def __init__(self, interaction):
                  super().__init__()

          async def callback(self, interaction: disnake.MessageInteraction):
            await interaction.response.edit_message(embed = embed)


def setup(bot):
    bot.add_cog(MemeCog(bot))
vital steeple
#

getting an error in this code

#

i`mport discum

bot = discum.Client(token="")

def close_after_fetching(resp, guild_id):
if bot.gateway.finishedMemberFetching(guild_id):
lenmembersfetched = len(bot.gateway.session.guild(guild_id).members)
print(str(lenmembersfetched) + ' members fetched')
bot.gateway.removeCommand({'function': close_after_fetching, 'params': {'guild_id': guild_id}})
bot.gateway.close()

def get_members(guild_id, channel_id):
bot.gateway.fetchMembers(guild_id, channel_id, keep='all', wait=1)
bot.gateway.command({'function': close_after_fetching, 'params': {'guild_id': guild_id}})
bot.gateway.run()
bot.gateway.resetSession()
return bot.gateway.session.guild(guild_id).members

members = get_members('897172510221672458', '897172510741782624')
memberslist = []

for memberID in members:
memberslist.append(memberID)
print(memberID)

f = open('users.txt', "a")
for element in memberslist:
f.write(element + '\n')
f.close()`

buoyant igloo
terse blade
#
import discord
import disnake
from disnake.ext import commands
import datetime
import json
import os
import urllib

bot = commands.Bot(command_prefix="w-", test_guilds=[772968562054660107])


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

        @bot.slash_command(description=  'Displays a meme!')
        async def meme(self, interaction):
          memeapi = urllib.request.urlopen('https://meme-api.herokuapp.com/gimme')

          memedata = json.load(memeapi)

          memeurl = memedata['url']
          memename = memedata['title']
          memeposter = memedata['author']
          memesub = memedata['subreddit']
          memelink = memedata['postLink']

          embed = disnake.Embed(title=memename, color=disnake.Colour.blue(),)
          embed.set_image(url=memeurl)
          embed.set_footer(text=f'User: {memeposter} | Subreddit: {memesub}')

          MyButton = disnake.ui.button(label="Next Meme", style=disnake.ButtonStyle.green)
          class MyButton(disnake.ui.Button):
              def __init__(self, interaction):
                  super().__init__()

          async def callback(self, interaction: disnake.MessageInteraction):
            await interaction.response.edit_message(embed = embed)


def setup(bot):
    bot.add_cog(MemeCog(bot))
#

why wont the embed show?

vital steeple
buoyant igloo
vital steeple
buoyant igloo
vital steeple
buoyant igloo
#

And define guilds

vital steeple
#

yes

lusty sky
vital steeple
lusty sky
#

should fix it

vital steeple
#

same thing

supple thorn
vital steeple
buoyant igloo
#

I didn’t even know discum even existed

lusty sky
supple thorn
#

Discum?

supple thorn
supple thorn
vital steeple
novel aurora
#

Do you guys host your discord bots off of your own pc or from a hosting service?

vital steeple
novel aurora
#

24/7?

supple thorn
buoyant igloo
supple thorn
buoyant igloo
#

To save data

#

And uptime robot

supple thorn
#

That's bad

buoyant igloo
#

Yeah but idc

novel aurora
#

do you keep the pc on all night?

supple thorn
#

No

novel aurora
#

so not 24/7

buoyant igloo
#

The best I could do is Replit and the only good kinda-database I could use is JSON

supple thorn
#

Oh you mean the virtual pc

buoyant igloo
supple thorn
#

Yeah ofcourse it's 24/7

supple thorn
novel aurora
#

replit keeps it open for 30min

supple thorn
#

Yeah

buoyant igloo
#

Yeah but replit is the best IDE I can use

vital steeple
#

can someone help me or nagh

supple thorn
#

Uptime robot helps it be online

buoyant igloo
supple thorn
vital steeple
supple thorn
#

So it's a dict?

vital steeple
supple thorn
#

Not a import problem

buoyant igloo
#

ye define

vital steeple
#

how do i fix it

slate swan
vital steeple
buoyant igloo
slate swan
slate swan
#

!pypi discum

unkempt canyonBOT
#

A Discord API Wrapper for Userbots/Selfbots written in Python.

slate swan
#

so yeah we can't help with that

#

ye i see

lusty sky
#

Anyone know why ```py
@client.event
async def on_message(message):

if message.author == client.user:
    return

if message.content =='test':
   await message.channel.send('tested successfully')```
#

breaks all my other client.command(s)

supple thorn
#

Or just do @bot.listen

slate swan
#

I'm so confused

#

Can someone pls help me

hoary cargo
#

artistic_hmm maybe install flask

worldly bane
slim ibex
#

or choose an interpreter

slate swan
hoary cargo
slate swan
#

I thought I did it

#

I did pip install flask and I supposed it installed

#

Also I use visual studio code

hoary cargo
#

vsc detected support rejected

slate swan
#

: (

hoary cargo
slate swan
#

what's this?

vital steeple
#

can someone give me a hand

worldly bane
vital steeple
#

im getting an error here is my code

`import discum

bot = discum.Client(token="")

def close_after_fetching(resp, guild_id):
if bot.gateway.finishedMemberFetching(guild_id):
lenmembersfetched = len(bot.gateway.session.guild(guild_id).members)
print(str(lenmembersfetched) + ' members fetched')
bot.gateway.removeCommand({'function': close_after_fetching, 'params': {'guild_id': guild_id}})
bot.gateway.close()

def get_members(guild_id, channel_id):
bot.gateway.fetchMembers(guild_id, channel_id, keep='all', wait=1)
bot.gateway.command({'function': close_after_fetching, 'params': {'guild_id': guild_id}})
bot.gateway.run()
bot.gateway.resetSession()
return bot.gateway.session.guild(guild_id).members

members = get_members('897172510221672458', '897172510741782624')
memberslist = []

for memberID in members:
memberslist.append(memberID)
print(memberID)

f = open('users.txt', "a")
for element in memberslist:
f.write(element + '\n')
f.close()`

worldly bane
#

we will not help you

vital steeple
worldly bane
#

since this is a selfbot library

vital steeple
worldly bane
worldly bane
unkempt canyonBOT
#

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

vital steeple
#

I have an question, in my discord server i cant see my offline members in the member list

#

is there an fix for that?

worldly bane
vital steeple
#

how do i scrape member ids from a certain role

slate swan
#

bro kenzo stop

worldly bane
#

🗿

slate swan
#

ive seen you since like an hour ago asking for help for a self bot please stop the conversation or else i will ping mods we dont break tos here.

daring olive
slate swan
#

thank you mina02smilepeek

final iron
#

Speaking of self bots, how does the discord api handle user tokens?

#

Like instead of a bot token

#

Because what's stopping them from doing a simple check and seeing if the token is a user token

#

Then they could eliminate self Botting

#

Or am I getting this completely wrong

#

I never said I wanted to self bot?

#

I'm literally just asking about how the discord api handles user tokens

#

?

#

Again, I never said I wanted to self bot

#

I'm asking about the api

#

They handle a bot token and user token the exact same way?

#

Why though. Self Botting is against their tos so why would they allow people to do it?

static epoch
final iron
static epoch
#

how do you think that the web and desktop clients sends messages to discord?

#

spoiler alert: that's what the user token is for

final iron
#

Ah

#

So basically they can't stop it

#

They can't stop it but they can limit it

#

i.e as Name said not allowing commands

lusty sky
#
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: type object 'datetime.datetime' has no attribute 'datetime'```
#

reason?

#
@client.command()
async def Ping(ctx):
    ping=round (client.latency * 100)
    time = datetime.datetime.utcnow()
    e=discord.Embed(title='**Pong, My Current Latency Is**', description=f'**`{ping}ms`**', colour=0x979c9f)
    e.set_footer(text = ctx.author.name, icon_url = ctx.author.avatar_url)
    await ctx.send(embed=e)```
visual island
#

you probably did from datetime import datetime, should be just import datetime

visual island
#

show your imports

lusty sky
#
import discord
import datetime
from datetime import datetime
from discord import embeds
from discord import guild
from discord import message
from discord import permissions
from discord import Member
from discord.ext.commands import has_permissions, MissingPermissions
import random
from multiprocessing.connection import Client
from discord.ext import commands```
visual island
#

remove from datetime import datetime this line

lusty sky
#

no error now but doesnt show the time in embed

visual island
#

can you show how the embed looks?

lusty sky
worldly bane
#

that's some good ping tho

lusty sky
worldly bane
visual island
worldly bane
#

!d discord.Embed

unkempt canyonBOT
#

class discord.Embed(*, colour=None, color=None, title=None, type='rich', url=None, description=None, 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.

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

Changed in version 2.0: `Embed.Empty` has been removed in favour of `None`.
lusty sky
#

its missing py time = datetime.datetime.utcnow()

visual island
#

you didn't put time to the embed

worldly bane
#

put timestamp=time

#

in the embed

visual island
lusty sky
#

XD

worldly bane
#

he imported datetime only

lusty sky
#

thanks all

slate swan
lusty sky
#

its 104ms quite bad for a bot?

silent ermine
#

I am trying to get the guild id of a list on a bulk delete
code; py @commands.Cog.listener() async def on_bulk_message_delete(self, messages:list): with open("./databases/auditLogChannel.json", "r") as f: auditLogJson = json.load(f) auditLogChan = auditLogJson[str(messages.guild.id)]['channel'] newLog = int(auditLogChan) if auditLogChan is None or auditLogChan == "" or auditLogChan == "\n" or auditLogChan == None: return else: channel = self.bot.get_channel(newLog) embed = nextcord.Embed( title="Bulk Message Delete", description=f"Bulk message delete in <#{messages.channel.id}>" ) fields = [("Messages Deleted: ", f"{len(messages)}", False)] for name, value, inline in fields: embed.add_field(name=name, value=value, inline=inline) await time.sleep(3) await channel.send(embed=embed)

error: py auditLogChan = auditLogJson[str(messages.guild.id)]['channel'] AttributeError: 'list' object has no attribute 'guild'

oblique laurel
#

So you cant use .guild

silent ermine
oblique laurel
silent ermine
oblique laurel
#

Just access any of the items then

#

Prob the first one for simplicity’s sake

lusty sky
#

I dont see any delay but apparently 104ms is bad that guy was saying but online 100-200ms is apparently good and under 100 is amazing

silent ermine
oblique laurel
silent ermine
oblique laurel
#

list[index]

silent ermine
oblique laurel
#

Index is a number

silent ermine
#

so list[1]

oblique laurel
#

0->len(list)-1

oblique laurel
silent ermine
#

right

silent ermine
oblique laurel
#

That would apply the len func to the first item in the list

slim ibex
#

^

oblique laurel
#

How long have you been using python btw?

slim ibex
#

len(list) - 1 gets the length of the last element iirc

oblique laurel
#

Wait

silent ermine
oblique laurel
#

The index of the last item

oblique laurel
silent ermine
oblique laurel
#

Not to be rude, but accessing items in a list isnt exactly expert tier

#

But anyways, the fix to ur problem would essentially be to add [0] after messages. Id recommend you look into a course tho

silent ermine
oblique laurel
#

I havent used it. Personally i just used one from freeCodeCamp to get off the ground

oblique laurel
#

Np

spring flax
#

by cog isn't being loaded likely with an error how do i see this error?

lusty sky
#

is this the correct way to unpin a message?

await discord.unpin_message(reaction.message)```
unkempt canyonBOT
#

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

Unpins the message.

You must have the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission to do this in a non-private channel context.
supple thorn
worldly bane
supple thorn
#

Oh you replied

#

That's why

frigid pendant
#
      role = message.guild.get_role(943243423446605834)
      for i in role.members:
        user = i.userid
        print(user)

im just tryna get the user id of all the users wit this role

#

how could i do this?

slate swan
#

I have this respond trigger text command and how can i make it trigger the exact words only?

    if message.content.startswith('hola'):
        reply = [
            f"Holaa {message.author.mention} !",
            f"Bonjour {message.author.mention} !"
        ]
        await message.channel.send(random.choice(reply))
gaunt ice
#

m

visual island
daring olive
maiden fable
#

👀

inner epoch
#

Hey I have this async function

async on_message(message):
  #something here
  #I wanna define a function here too with await message.channel.send   but when I do that I recieve an error of defining await

How can I do that?

final iron
boreal ravine
keen talon
final iron
daring olive
#

i'm going thru the disnake guide docs

inner epoch
boreal ravine
inner epoch
#

Umm within the function?

inner epoch
boreal ravine
inner epoch
sick birch
daring olive
#

this is indeed my first / command

#

and maybe my.. third command ever lol

final iron
#

Slash commands are so nice with autocomplete

inner epoch
inner epoch
boreal ravine
final iron
#

Has the dev team ever came up with the idea of implementing a slash version of the pypi command that autocompletes with package names?

boreal ravine
inner epoch
sick birch
inner epoch
#

I even passed still gives error

boreal ravine
#

What

#

show your code

#

also why are you using replit to host a discord bot?

daring olive
slate swan
#

how can i make a per send embed message it count? like this

daring olive
#

btw no autocomplete for these?

inner epoch
daring olive
sick birch
final iron
sick birch
#

pops up that way

#

or disnake.Interaction

daring olive
#

yessss ty

#

so that's the case for all libraries i guess then, not just bot frameworks

#

hm

boreal ravine
daring olive
#

but i think i had autocomplete when using other libraries before i learned type hinting

sick birch
boreal ravine
sick birch
#

Yeah sorry not sure how disnake does it but yeah

#

Pretty similar

daring olive
#

the docs do say ApplicationCommandInteraction

sick birch
#

Then typehint to that rather than interaction, ApplicationCommandInteraction probably has additional properties

final iron
#

It's discord.Interaction with discord slash commands

boreal ravine
inner epoch
final iron
#

Different implementation in all the forks

boreal ravine
sick birch
inner epoch
boreal ravine
#

My bad then worry_frog

inner epoch
final iron
#

We celebrate a ton of holidays

inner epoch
#

Something like that

sick birch
inner epoch
#
RuntimeWarning: coroutine 'on_message.<locals>.abc' was never awaited
  abc("abc")
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
#

It gives me this error

inner epoch
sick birch
unkempt canyonBOT
#

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

This function processes the commands that have been registered to the bot and other groups. Without this coroutine, none of the commands will be triggered.

By default, this coroutine is called inside the [`on_message()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message "discord.on_message") event. If you choose to override the [`on_message()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message "discord.on_message") event, then you should invoke this coroutine as well.

This is built using other low level tools, and is equivalent to a call to [`get_context()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.get_context "discord.ext.commands.Bot.get_context") followed by a call to [`invoke()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.invoke "discord.ext.commands.Bot.invoke").

This also checks if the message’s author is a bot and doesn’t call [`get_context()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.get_context "discord.ext.commands.Bot.get_context") or [`invoke()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.invoke "discord.ext.commands.Bot.invoke") if so.
inner epoch
#

Umm wait I guess I got it let me try that one

#

Thanks a lot @sick birch @boreal ravine it worked!!

#

Means a lot thanks for helping me out!!

boreal ravine
inner epoch
sick birch
#

Just a word of advice it's best not to nest functions inside of each other and in this case no need for a one line function

inner epoch
#

Just change wherever needed

#

I just wanted to reduce some code

maiden osprey
#

Hey
Can anyone tell me how to make this in infinite seconds
for testing i putted 300 but now i want to make it infinite

sick birch
#

Reasonable but you're still typing the function name anyway

maiden osprey
#

What to type for infinite

sick birch
#

It's best to leave it as is

sick birch
maiden osprey
inner epoch
maiden osprey
#

like 21000 sec
30000

sick birch
#

Those are > 300 so just raise an error

maiden osprey
#

if secondint < 0 @sick birch

#

should i type like this?

sick birch
#

Sure to disallow negatives

#

You could probably write a custom converter for this

maiden osprey
sick birch
#

Why? That's good as is

maiden osprey
#

Ok

maiden osprey
sick birch
#

That number is greater than 300 so it will say "too long"

maiden osprey
daring olive
#

and now i make a cog

maiden osprey
#

it will take any digit below this

sick birch
#

Well you can't have infinite you need a minimum and a maximum

#

So maybe minimum can be 0, max can be say 5000 if you want

maiden osprey
#

Ya so i will put this number in place of 300

sick birch
sick birch
maiden osprey
sick birch
#

What's the command for?

final iron
sick birch
#

Not that I'm aware of

maiden osprey
final iron
#

Oh that's annoying

daring olive
sick birch
daring olive
maiden osprey
sick birch
#

Wish d.py has slash command cogs :(

maiden osprey
#

:(

sick birch
#

Or just use asyncio.sleep()?

maiden osprey
sick birch
#

Oh, yeah you're going to get ratelimited then

maiden osprey
#

6

#

like this

sick birch
#

Yeah I see that

#

Problem is you'll get ratelimited fast

maiden osprey
sick birch
#

Use a timestamp like <t:1647500658:R>

#

It updates live

maiden osprey
#

Okay

sick birch
#

Or like <t:1647576000:R>

slate swan
maiden osprey
#

def convert(time):
pos = ['s', 'm', 'h', 'd']

time_dict = {"s": 1, "m": 60, "h": 3600, "d": 3600*24}

unit = time[-1]

if unit not in pos:
return -1
try:
val = int(time[:-1])
except:
return -2

return val * time_dict[unit]
@sick birch i used this but it showed error idk_sus

daring olive
sick birch
#

What error?

maiden osprey
maiden fable
#

Well, that's basically what Cogs are

daring olive
#

is a "cog" a discord bot thing?

sick birch
#

Yeah

slate swan
maiden fable
maiden osprey
slate swan
unkempt canyonBOT
#

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

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

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

You can also think of them as Python classes but for commands, you can have a "moderation" cog with commands like: ban, unban, kick, mute, temp ban, etc

maiden fable
#

Yes, but they are used to basically make command categories

slate swan
#

its just a class that works like a template which you then subclass

maiden fable
slate swan
#

imagine

maiden fable
maiden osprey
#

Slash commands are good but sometimes they are annoying

maiden fable
#

It should be async def, not def

maiden fable
lusty sky
#

Code

@client.command()
async def load(ctx, extension):
    client.load_extension(f'cogs.{extension}')

@client.command()
async def unload(ctx, extension):
    client.unload_extension(f'cogs.{extension}')```

Error I get ```py
Traceback (most recent call last):
  File "C:\Users\Secret\AppData\Roaming\Python\Python310\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\Secret\AppData\Roaming\Python\Python310\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\Secret\AppData\Roaming\Python\Python310\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ExtensionNotLoaded: Extension 'cogs.ping22' has not been loaded.```
lusty sky
#

Anyone know why first time using cogs

maiden fable
maiden fable
lusty sky
#

like the commands work

#

but when I try unload it wont

maiden osprey
maiden fable
#

Ooo

lusty sky
#

make sure the functions work as intended

maiden osprey
maiden osprey
lusty sky
#
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ExtensionNotFound: Extension 'cogs.ping22' could not be loaded.```
#

but just getting this error :p

#

when i try unload/load

maiden osprey
lusty sky
#

indeed it is

maiden osprey
lusty sky
#

yeah

maiden osprey
#

Its too complicated compared to visual studio code

#

Ok ig i messed

lusty sky
#

Im using VS Code

maiden osprey
maiden osprey
#

Lol

summer thunder
#

im so lost on this.

c:\Users\thebe\Downloads\Mecha\src\main.py:100: RuntimeWarning: coroutine 'BotBase.load_extension' was never awaited
  bot.load_extension(f"cogs.{filename[:-3]}")

when i use await it just gives me more errors
im using dpy 2.0.0, ive only had this problem on my own pc. if i test using something like replit, its fine. any fixes?

worldly bane
#

if it only doesn't work in you're computer try using a virtual environment