#discord-bots

1 messages ยท Page 676 of 1

slate nymph
#

sorry,

tiny ibex
#

bs4 is used for web scraping

slate nymph
#

i mean

#

then what is it for?

tiny ibex
#

aiohttp is used for pulling API requests mainly
(Not saying you can't use it for other purposes)

slate swan
#

pls i've been stuck here for about 2 hours i just wanna get this over with

slate nymph
#

aight

slate swan
#

my laptop is about to die cry

slate nymph
#

where do i get discord api from?

#

lol

hazy agate
#

my cide

slate swan
tawdry perch
tiny ibex
slate nymph
#

tysm

hazy agate
#

import youtube_dl
import discord
from discord.ext import commands
import random
import ffmpeg

client = commands.Bot(command_prefix="?", intents = discord.Intents().all())
client.remove_command('help')

@client.event
async def on_ready():
await client.change_presence(status=discord.Status.online, activity=discord.Game('with ice!'))
print('Bot is ready')

@client.event
async def on_member_join(member):
welcomeEmbed = discord.Embed(title = "New member!", description = f"{member.mention} has joined the server! Be sure to read the rules!")
welcomeEmbed.thumbnail(url = f"{member.avatar_url}")
welcomeEmbed.set_footer(text="Made by NotSameer#0484")
await client.get_channel(915904247646814239).send(f"{member.mention} has joined the server!")

#

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

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

@client.command()
async def a(ctx):
await ctx.send("sheesh sheesh sheesh sheesh sheesh sheesh sheesh sheesh")

@client.command()
async def embed(ctx):

embed=discord.Embed(
    colour=discord.Colour.red(),
    title="Am poor",
    description="This is normal Embed"
)

embed.set_author(name=ctx.author.display_name, icon_url=ctx.author.avatar_url)    
embed.set_image(url="https://cdn.discordapp.com/attachments/919473237774200842/919675123592757278/e4b6b80d-dc19-412f-b1ab-88b07ddde171.png")
embed.add_field(name="sheesh", value="Sheesh mouth", inline=False)
embed.set_footer(text="This is a laptop")

await ctx.send(embed=embed)

@client.command()
async def help(ctx):

embed=discord.Embed(
    colour=discord.Colour.blue(),
    title="Help Session",
    description="View commands and their uses along other helping stuff"
)

embed.set_author(name="Albus", icon_url="https://cdn.discordapp.com/avatars/895369545735344128/b30ac058b8da96539e78f8273dc2e635.webp?size=100")
embed.add_field(name="Prefix", value="?")
embed.add_field(name="?Ban", value="Bans certain members", inline=True)
embed.set_footer(text="This is the help command!")

await ctx.send(embed=embed)

client.run("")

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.

hazy agate
#

bruh

#

ik python

slate swan
#

!code

unkempt canyonBOT
#

Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.

For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:

The following restrictions apply to your use of the Service. You are not allowed to:

1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service;  (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;

3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTubeโ€™s robots.txt file; (b) with YouTubeโ€™s prior written permission; or (c) as permitted by applicable law;

9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
tiny ibex
hazy agate
#

nope

#

i am going to js soon

tawdry perch
#

why not..?

#

use code block when you share code..

tiny ibex
hazy agate
#

i just dont wana

tawdry perch
#

!paste @hazy agate please instead of posting a large chayt wall paste the code here...

unkempt canyonBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

hazy agate
#

bruh

#

am not sus

tiny ibex
slate swan
tiny ibex
slate swan
#

anyone?

tiny ibex
visual island
tiny ibex
#

Just imported

#

lol

slate swan
valid galleon
#

damn this chat got invaded by 12 year olds

visual island
#

your action here is considered as automating user account which is against TOS, so we cant help you here sorry

visual island
#

no worries

shadow wraith
slate swan
#

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\Users\rrfda\OneDrive\Desktop\sublime pg version\main.py", line 56, in <module>
    bot.load_extension(f'commands.{filename[:-3]}')
  File "C:\Python39\lib\site-packages\discord\ext\commands\bot.py", line 732, in load_extension
    self._load_from_module_spec(spec, name)
  File "C:\Python39\lib\site-packages\discord\ext\commands\bot.py", line 662, in _load_from_module_spec
    del sys.modules[key]
KeyError: 'commands.mod_commands'
#

hm

tawdry perch
#

circular import, maybe

shadow wraith
#

i had to replace @bot.command() with

@bot.command()
@commands.guild_only()
slate swan
#

yeah whats that

shadow wraith
#

๐Ÿ’€ thanks to vscode

tawdry perch
#

not fault of vsc?

visual island
upbeat otter
shadow wraith
#

how do you edit a message sent with discord.Interaction

tawdry perch
#

!d discord.Interaction.edit_original_message

unkempt canyonBOT
#

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

Edits the original interaction response message.

This is a lower level interface to [`InteractionMessage.edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.InteractionMessage.edit "discord.InteractionMessage.edit") in case you do not want to fetch the message and save an HTTP request.

This method is also the only way to edit the original message if the message sent was ephemeral.
tawdry perch
#

wow I found docs of smth

shadow wraith
#

how do i tell it which message i want to edit

tawdry perch
#

message obj maybe

visual island
#

message will be

shadow wraith
#

message variable?

visual island
#

!d discord.Interaction.original_message

unkempt canyonBOT
#

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

Fetches the original interaction response message associated with the interaction.

If the interaction response was [`InteractionResponse.send_message()`](https://discordpy.readthedocs.io/en/master/api.html#discord.InteractionResponse.send_message "discord.InteractionResponse.send_message") then this would return the message that was sent using that response. Otherwise, this would return the message that triggered the interaction.

Repeated calls to this will return a cached value.
shadow wraith
#

o

visual island
#

this

shadow wraith
#

๐Ÿฅšzample? (example?)

upbeat otter
shadow wraith
#

wait is it just like

await interaction.original_message("๐Ÿ’€")
await interaction.response.edit_original_message("๐Ÿคจ")
visual island
#

no

shadow wraith
#

๐Ÿ’€

visual island
#

interaction.send_message()

#

and await it

shadow wraith
#

oh

visual island
#

interaction.original_message() is just to get the original message, not sending it

shadow wraith
#

o

#

i didn't know interaction.send_message existed too, i thought only interaction.response could do message related stuff

valid galleon
#

orelse it wont work

shadow wraith
#

๐Ÿ’€

#

wait what

valid galleon
#

its in the traceback right?

slate swan
#

interaction.reponse.edit_original_message it is

valid galleon
#

you need to get the message first

#

from the interaction

visual island
fading harness
#

hi

shadow wraith
#

wait so if do
interaction.response.send_message() will send something
interaction.original_message() fetches it
interaction.response.edit_original_message edits it

fading harness
valid galleon
#

and then edit

shadow wraith
#

well since i need to fetch a channel to send something innit, i think that would work

fading harness
shadow wraith
visual island
fading harness
shadow wraith
#

wait it's user == None

#

i thought the variable name is reason ๐Ÿ’€

#

idfk what will work if user == None doesn't

tawdry perch
#

@weary gale do not share it here

weary gale
#

sorry

#

was the link legit tho?

tawdry perch
#

contact @novel apex if the user was from this server

weary gale
#

no he wasnt

tawdry perch
cloud bison
#

how i can check if message author has reply to someone ?

jade jolt
#

messages have a reference value if its a reply

#

iirc

slate swan
#

yea

visual island
#

it's called attribute, not value

shadow wraith
jade jolt
#

you knew what i meant ---

valid galleon
#

or embed

shadow wraith
#

oh

slate swan
#

^

craggy cloak
#

How can i update my Discord.py Version?

shadow wraith
#

eh, 2.0 is just git clone https://github.com/Rapptz/discord.py

visual island
#

git clone isn't the best way

#

use pip

shadow wraith
#

it works tho

visual island
#

pip install git+the_link

shadow wraith
#

oh i didn't know you could do that with pip

upbeat otter
visual island
tawdry perch
#

how can I make help embed paginator, I have tried a few solutions alrd but they have fked up.

tawdry perch
#

buttons if possible

shadow wraith
upbeat otter
tawdry perch
#

I alrd took a look to pinned messages, and I'm using disnake

upbeat otter
#

0 reactions

craggy cloak
upbeat otter
#

!d disnake.ui.button

unkempt canyonBOT
#

disnake.ui.button(*, label=None, custom_id=None, disabled=False, style=<ButtonStyle.secondary: 2>, emoji=None, row=None)```
A decorator that attaches a button to a component.

The function being decorated should have three parameters, `self` representing the [`disnake.ui.View`](https://docs.disnake.dev/en/latest/api.html#disnake.ui.View "disnake.ui.View"), the [`disnake.ui.Button`](https://docs.disnake.dev/en/latest/api.html#disnake.ui.Button "disnake.ui.Button") being pressed and the [`disnake.MessageInteraction`](https://docs.disnake.dev/en/latest/api.html#disnake.MessageInteraction "disnake.MessageInteraction") you receive.

Note

Buttons with a URL cannot be created with this function. Consider creating a [`Button`](https://docs.disnake.dev/en/latest/api.html#disnake.ui.Button "disnake.ui.Button") manually instead. This is because buttons with a URL do not have a callback associated with them since Discord does not do any processing with it.
tawdry perch
#

I have a paginator for embeds, but it needs a list of embeds smh

visual island
tawdry perch
#

and converting the output of !help to list, if possible, would be good

visual island
shadow wraith
#

dk why tho lol

visual island
#

ah

upbeat otter
visual island
#

pip install discord.py==1.7.1

craggy cloak
#

Can you use buttons in 1.7.?

visual island
#

no

shadow wraith
upbeat otter
craggy cloak
#

How can i install 2.0?

shadow wraith
craggy cloak
#

ok thx i did that

shadow wraith
#

np

craggy cloak
#

but the version is not updated?

upbeat otter
shadow wraith
upbeat otter
craggy cloak
#

it is still 1.7.1

shadow wraith
shadow wraith
#

did you do the command i told you to do

craggy cloak
#

i cloned the file?

upbeat otter
#

you need to install it

#

using pip

shadow wraith
#

git clone works, only to your project

upbeat otter
craggy cloak
#

How i get this?

upbeat otter
shadow wraith
upbeat otter
shadow wraith
#

and i think we know who's dream it was

#

wait no i didn't just mention the cring youtuber

#

and i am still the worst discord.py programmer to ever exist

upbeat otter
#

anyways, kayle will help, bye

slate swan
#

lol

tawdry perch
#

is it possible to convert this to list of embeds (for paginator)

boreal ravine
#

@slate swan you use sql right?

upbeat otter
slate swan
slate swan
shadow wraith
tawdry perch
#

you welcome

tawdry perch
shadow wraith
#

what does defcon do btw

tawdry perch
#

!src defcon

unkempt canyonBOT
#
Command: defcon

Check the DEFCON status or run a subcommand.

Source Code
boreal ravine
#

!defcon

tawdry perch
#

anti raid*

boreal ravine
#

!defcon doc

#

!src defcon

unkempt canyonBOT
#
Command: defcon

Check the DEFCON status or run a subcommand.

Source Code
shadow wraith
shadow wraith
#

which, mongo or sql

tawdry perch
#

It's in my github as well

#

I used SQLite

shadow wraith
#

frig idk sql ๐Ÿ˜ญ

tawdry perch
#

it's quite easy

boreal ravine
tawdry perch
#

asqlite?

shadow wraith
#

btw how do i track the amount of times a discord.Button has been clicked

slate swan
boreal ravine
#

o

tawdry perch
#

no I use aiosqlite

slate swan
#

asqlite / asqlite3 / aiosqlite / aiosqlite3 are all usable

shadow wraith
#

one second im gonna learn how and statements work in 1 second

slate swan
#

asqlite by danny has not been released on pypi yet

#

!pypi asqlite3

unkempt canyonBOT
boreal ravine
unkempt canyonBOT
#

@shadow wraith :warning: Your eval job has completed with return code 0.

[No output]
boreal ravine
tawdry perch
#

oh that's what I have tried

slate swan
#

but you dont have any such ting which seperates the cogs

#

*thing

shadow wraith
#

!e

h = 'h'
e = 'e'

if e == 'e' and if h == 'h':
  print("complete")
#

oh

boreal ravine
#

@shadow wraith #bot-commands

tawdry perch
# slate swan but you dont have any such ting which seperates the cogs
class MyNewHelp(commands.MinimalHelpCommand):
    print("Is this ran?")
    async def send_pages(self):
        print("Is the function called?")
        destination = self.get_destination()
        print(mapping)
        embeds = []
        print(embeds)
        for page in self.paginator.pages:
            print("Is the loop ran?")
            emby = disnake.Embed(description=page)
            print(emby)
            print(embeds)
            print("Is this even ran?")
            embeds.append(emby)
        print(embeds)
        await destination.send(embed=emby)
        a = EmbedPaginator(self.Context, embeds=emby, timeout=180)
        await a.start()
``` I don't think so
velvet tinsel
#

Whatโ€™s the problem?

#

Is it the embeds thing again

tawdry perch
#

still with paginator stuff, ye

#

so.. I would loop all the cogs, get the cogs and add reaction/buttons

boreal ravine
#

yes

tawdry perch
#

I wanted to make it look a bit like the !help from this server that it has pages you can move on by

boreal ravine
#

!d discord.ext.commands.Cog.get_commands <= gets all the commands in a cog

unkempt canyonBOT
tawdry perch
#

!src help

unkempt canyonBOT
#
Help Command

An interactive instance for the bot help command.

Source Code
tawdry perch
#

oh my...

#

That is ehh..

boreal ravine
#

what

tawdry perch
#

confusing a bit

#

I get the general idea smh

slate swan
#

? what is problem friends ? ๐Ÿ˜‘

boreal ravine
#

just iterate through bot.cogs and get the commands

shadow wraith
tawdry perch
#

I think I can do that

shadow wraith
#

and i suggest subclassing your help command instead of removing it

tawdry perch
#

I do subclass it

shadow wraith
tawdry perch
#

Oh

shadow wraith
#

to dynou

tawdry perch
#

Ah

#

And thx alot, I'll try to do smth again.

sage otter
#

Imagine having to change your help command everytime you add a command to your bot. Thatโ€™s actually terrible.

boreal ravine
#

i mean dont most big bots do that?

slate swan
#

they still dont hard code it

sage otter
#

I meant that ^^^

shadow wraith
#

i use minimalhelpcommand()

sage otter
#

I honestly do whatever with mine

slate swan
#

12 more days for Christmas still cant feel it๐Ÿ•ด๏ธ

boreal ravine
#

!ot

arctic gyro
#
@bot.command(pass_context=True)
@commands.has_permissions(kick_members = True)
async def addrole(ctx):
    server = bot.get_guild(848937617982750760)
    user = ctx.message.author
    role = discord.utils.get(user.server.roles, name="ADMIN")
    await bot.add_roles(member, role)

Hey , can anyone tell me if something is wrong with this code?

unkempt canyonBOT
arctic gyro
sage otter
#

This must be something you copied off the internet

#

This is really old dpy stuff

#

Pass_context, server instead of guild.

untold token
#

The code is old and wrong

visual island
#

yeah

arctic gyro
#

ok thx guys i'll try changing this

boreal ravine
#

give command ideas

untold token
#

Get some

sage otter
#

You already finished the reminder?

#

Or you gave up on that?

boreal ravine
velvet tinsel
#

Hai Kayle and tylerr and a

boreal ravine
#

yo

velvet tinsel
#

Hi

boreal ravine
#

hi

tacit horizon
#
async def lea(ctx):
        channel = ctx.author.voice.channel
        await channel.disconnect()```
#

why this not working

boreal ravine
#

you cannot

#

disconnect a voice channel

boreal ravine
#

what code are you copying wtf

shadow wraith
#

!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

shadow wraith
#

this is basic explaination of indentation

boreal ravine
shadow wraith
#

and if you are making a music bot and using yt

#

wdym that's double indent for a single function?

boreal ravine
#

that'll literally work

shadow wraith
#

nah dawg idk indents sorry

shadow wraith
tacit horizon
#

bru

shadow wraith
#

they only indented it 1 level

#

because they are defining a func

boreal ravine
#

it'll still work though

shadow wraith
#

!e

def foo():
    print("test")

foo()
unkempt canyonBOT
#

@shadow wraith :white_check_mark: Your eval job has completed with return code 0.

test
shadow wraith
#

crap your right

quick gust
#

it's not the python code convention but it works

quick gust
shadow wraith
#

!e

def foo():
        print("test")

foo()
unkempt canyonBOT
#

@shadow wraith :white_check_mark: Your eval job has completed with return code 0.

test
shadow wraith
#

crap

quick gust
#

lmao

shadow wraith
#

ok so it wasn't indent

#

and imagine trying to maek a music bot with yt

#

!ytdl ๐ŸšŽ

boreal ravine
#

dude

#

its just a leave command

shadow wraith
#

ye

boreal ravine
#

chill out

shadow wraith
#

what would they use it for tho

#

ded chart'

tawdry perch
sage otter
#

just noticed that grammar mistake

tawdry perch
#

hmm

#

can I try copy pasting it, as it does not seem to be using any local functions

sage otter
#

Itโ€™s novus specific

tawdry perch
#

huh?

sage otter
#

on_component_interaction is a event specific to novus

tawdry perch
#

oh

sage otter
#

Since thereโ€™s no views.

boreal ravine
#

componet

tawdry perch
#

makes sense, I'll probably try rewriting from souce by now

sage otter
#

Youโ€™d have to remove the dropdown if you wanted to copy and paste

shadow wraith
#

how do i track the amount of times a button has been clicked

boreal ravine
#

use a variable

final iron
shadow wraith
#

!d discord.ext.commands.when_mentioned_or

unkempt canyonBOT
#

discord.ext.commands.when_mentioned_or(*prefixes)```
A callable that implements when mentioned or other prefixes provided.

These are meant to be passed into the [`Bot.command_prefix`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.command_prefix "discord.ext.commands.Bot.command_prefix") attribute.

Example

```py
bot = commands.Bot(command_prefix=commands.when_mentioned_or('!'))
```...
shadow wraith
#

oh this exists

upbeat otter
shadow wraith
#

guys how do i make the help command exclusive to a role, this is my code:

class MyNewHelp(commands.MinimalHelpCommand):
    def __init__(self):
        super().__init__()
        # make the minimalhelpcommand dmed 
        self.no_category = 'Commands'
        self.dm_help = True
    async def send_pages(self):
        destination = self.get_destination()
        for page in self.paginator.pages:
            Helpemby = discord.Embed(description=f"{page}", color=0xCD08FF)
            await destination.send(embed=Helpemby)
#

don't ask why the send_pages function exists

maiden fable
#

Wait how do u add a check in the help command ๐Ÿคจ

#

Ah nvm

#
class HelpCommand(commands.HelpCommand):
    def __init__(self):
        super().__init__()
        self.command_attrs = {
           ...
           'checks': [lambda ctx: ctx.channel.id == id_right_here]
        }โ€Š
#

!d discord.ext.commands.HelpCommand.command_attrs

unkempt canyonBOT
#

A dictionary of options to pass in for the construction of the help command. This allows you to change the command behaviour without actually changing the implementation of the command. The attributes will be the same as the ones passed in the Command constructor.

maiden fable
#

O

#

Didn't know this existed ngl

tawdry perch
#

I feel like writing a help command without sub classing but I don't yet know

#

I can't wrap my head around the paginator smh

boreal ravine
#

just steal someones help command

#

@tawdry perch did you even try the method sarthak/i suggested earlier?

tawdry perch
#

I tried to use the one in pinned messages but nothing happened

#

Yep I did try

#

It did not go well and I started doing it again

boreal ravine
boreal ravine
tawdry perch
#

I don't have it anymore, but it sent a empty embed

boreal ravine
tawdry perch
#

it was like that

boreal ravine
#

you just made that didnt you

tawdry perch
#

Yes I did

boreal ravine
tawdry perch
#

it does not exists

cinder horizon
#

can someone like give an idea for command

tawdry perch
#

I alrd started over

boreal ravine
#

dude just make it again then it takes like 10 lines

maiden fable
cinder horizon
tawdry perch
#

It was a not working command, why do I have to rewrite it when I remember just a bit of that

shadow wraith
#

ok so i added what hunter sent but i got this error ๐Ÿ’€

Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "help" is not found
#
class MyNewHelp(commands.MinimalHelpCommand):
    def __init__(self):
        super().__init__()
        # make the minimalhelpcommand dmed 
        self.no_category = 'Commands'
        self.dm_help = True
        roles_to_have = ['Admins']
        self.command_attrs = {
            'checks': [lambda ctx: ctx.author.roles in roles_to_have]
        }
    async def send_pages(self):
        destination = self.get_destination()
        for page in self.paginator.pages:
            Helpemby = discord.Embed(description=f"{page}", color=0xCD08FF)
            await destination.send(embed=Helpemby)



bot.help_command = MyNewHelp()
``` code
boreal ravine
#

why do you need to use skull on everything, it isnt even dramatic

tawdry perch
#

I did not...

loud junco
#
import dbl
import discord
from discord.ext import commands, tasks

import asyncio
import logging

class TopGG(commands.Cog):
  """Handles interactions with the top.gg API"""

  def __init__(self, bot):
    token = os.environ['TOKEN']
    self.bot = bot
    self.token = token # set this to your DBL token
    self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)

    # The decorator below will work only on discord.py 1.1.0+
    # In case your discord.py version is below that, you can use self.bot.loop.create_task(self.update_stats())

  @tasks.loop(minutes=30.0)
  async def update_stats(self):
    """This function runs every 30 minutes to automatically update your server count"""
    logger.info('Attempting to post server count')
    try:
      await self.dblpy.post_guild_count()
      logger.info('Posted server count ({})'.format(self.dblpy.guild_count()))
    except Exception as e:
      logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
```i google about the top.gg vote thing
is this correct?
sullen shoal
#

idk, error?

loud junco
#

undefined name 'logger'

#

idk what and how =.=

sullen shoal
#

make a logging module logger named logger?

loud junco
#

i imported logging

sullen shoal
#

thats not gonna make it work magically

loud junco
#

alright i fixed it idk how but its fixed

sullen shoal
#

we are not your python compilers

#

nor we can be

loud junco
#

lol

shadow wraith
sullen shoal
#

maybe you inserted it in the wrong place

#

you gotta show more of your code

shadow wraith
sullen shoal
brave flint
#

how to add " before and after a argument?

shadow wraith
#
for filename in os.listdir('/Users/sadancooler/Documents/Code/Python/bots/mystery/cogs'): 
    if filename.endswith('.py'):
        bot.load_extension(f'cogs.{filename[:-3]}')
``` wdym
#

i am not doin anythin wrong with my code

sullen shoal
#

!e print('"hello"')

unkempt canyonBOT
#

@sullen shoal :white_check_mark: Your eval job has completed with return code 0.

"hello"
loud junco
#
from discord.ext import commands
import discord.ext.commands
```are they the same?
brave flint
sullen shoal
shadow wraith
#

bru

loud junco
#

:D

shadow wraith
#

๐Ÿ’€

sullen shoal
#

ofc without that attribute

brave flint
#

i want to use like len(url), but i think i need to add " before and after my url

#

so i try counter and it cant tho

sullen shoal
#

i have no idea what you're talking about

shadow wraith
#

i think he means like

#

"url"

shadow wraith
sullen shoal
#

!e var = "my text"; print(repr(var))

unkempt canyonBOT
#

@sullen shoal :white_check_mark: Your eval job has completed with return code 0.

'my text'
shadow wraith
#

ok if self.command_attrs won't work then how else am i gonna tell the help command to run only when the author/user of the command has a specific role

brave flint
brave flint
shadow wraith
brave flint
shadow wraith
#
class MyNewHelp(commands.MinimalHelpCommand):
    def __init__(self):
        super().__init__()
        # make the minimalhelpcommand dmed 
        self.no_category = 'Commands'
        self.dm_help = True
    async def send_pages(self):
        destination = self.get_destination()
        for page in self.paginator.pages:
            Helpemby = discord.Embed(description=f"{page}", color=0xCD08FF)
            await destination.send(embed=Helpemby)
#

๐Ÿ’€

sullen shoal
#

!e

url = "google.com"
print(
    f'"{url}"'
)```
unkempt canyonBOT
#

@sullen shoal :white_check_mark: Your eval job has completed with return code 0.

"google.com"
brave flint
sullen shoal
shadow wraith
brave flint
shadow wraith
#

bru

brave flint
sullen shoal
#

not if you know OOP

#

also i think you have to use

shadow wraith
sullen shoal
#

!d discord.ext.commands.HelpCommand.add_check

unkempt canyonBOT
shadow wraith
#

o

#

so something like

self.command_attrs = blahblahblahblah
self.add_check
``` wouldw ork?
sullen shoal
#

what is the first line doing there

sullen shoal
#

it shouldn't include quotes

#

those are parsed by the argument parser

brave flint
sullen shoal
#

unless you're calling repr on it for some reason

brave flint
#

like

sullen shoal
#

use the len built-in function

brave flint
#

and it shown 10

brave flint
sullen shoal
unkempt canyonBOT
#

@sullen shoal :white_check_mark: Your eval job has completed with return code 0.

10
sullen shoal
#

!d len

unkempt canyonBOT
#
len

len(s)```
Return the length (the number of items) of an object. The argument may be a sequence (such as a string, bytes, tuple, list, or range) or a collection (such as a dictionary, set, or frozen set).

**CPython implementation detail:** `len` raises [`OverflowError`](https://docs.python.org/3/library/exceptions.html#OverflowError "OverflowError") on lengths larger than [`sys.maxsize`](https://docs.python.org/3/library/sys.html#sys.maxsize "sys.maxsize"), such as [`range(2 ** 100)`](https://docs.python.org/3/library/stdtypes.html#range "range").
brave flint
unkempt canyonBOT
#

@brave flint :x: Your eval job has completed with return code 1.

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

it has to be a string

brave flint
sullen shoal
#

it is already a string (basically)

brave flint
#

wut

#

wait

sullen shoal
#

you're very confused with what you're doing arent you

brave flint
sullen shoal
#

ok lets start from the beginning

#

what is a string

brave flint
#

lol

sullen shoal
#

in programming languages

brave flint
#

string is like "this is a string" right?

sullen shoal
#

yes

brave flint
#

ok XD

sullen shoal
#

the compiler knows it is a string because of the quotes

brave flint
sullen shoal
#

the command handler without any type hints, returns a string

#

so it should be a string

brave flint
#

okay

tawdry perch
#

to convert url to string can't just do str(the_url_variable_here) or url = "place_the_url_here"?

#

ah nvm

sullen shoal
#

the url has to be string theres just no other way to store the url (unless you're some weirdo that has some kind of converter of like binary to text or smth)

brave flint
#

ah now its work, thanks for ur help @sullen shoal

errant fern
#

Hey! Is there a good way to add something like a table in a discord embed without using table2ascii

sullen shoal
# brave flint quotes is the url right?

quotes are used by most languages to identify a string, like how long it is.
like here,
print(hello lol)
the compiler cant just guess that you dont want the ending ) in your string so we use quotes.
print("hello lol)")

slate swan
sullen shoal
#

ยฏ\_(ใƒ„)_/ยฏ

slate swan
vocal plover
#

<@&831776746206265384>

slate swan
#

That was a joke

vocal plover
#

Doesn't matter

#

That's totally unacceptable

slate swan
#

Please SwagPray

slate swan
#

That makes more sense

quick gust
#

What did you do ๐Ÿ˜”

ashen notch
#

!mute 521325126722125874 Investigating

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied mute to @slate swan until <t:1639410151:f> (59 minutes and 59 seconds).

ashen notch
#

I found the deleted message, just verifying if there was anything else

#

Carry on

quick gust
#

I'm curious what they did

slate swan
#
    spec.loader.exec_module(lib)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "c:\Users\rrfda\OneDrive\Desktop\sublime pg version\commands\mod_commands.py", line 9, in <module>
  File "c:\Users\rrfda\OneDrive\Desktop\sublime pg version\buttons.py", line 28, in <module>
    class Help_view(View):
  File "c:\Users\rrfda\OneDrive\Desktop\sublime pg version\buttons.py", line 35, in Help_view
    @discord.ui.view(label="modding", style=discord.ButtonStyle.primary,emoji=Emojis.mod_button)
TypeError: 'module' object is not callable

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

Traceback (most recent call last):
  File "c:\Users\rrfda\OneDrive\Desktop\sublime pg version\main.py", line 56, in <module>
    bot.load_extension(f'commands.{filename[:-3]}')
  File "C:\Python39\lib\site-packages\discord\ext\commands\bot.py", line 732, in load_extension
    self._load_from_module_spec(spec, name)
  File "C:\Python39\lib\site-packages\discord\ext\commands\bot.py", line 663, in _load_from_module_spec
    raise errors.ExtensionFailed(key, e) from e
discord.ext.commands.errors.ExtensionFailed: Extension 'commands.mod_commands' raised an error: TypeError: 'module' object is not callable```
#

confused tbh

bitter depot
bitter depot
slate swan
#

oh let me try

#

matter of fact , let me visit the docs

bitter depot
#

(your capitalisation is wrong somewhere)

sullen shoal
#

i dont think thats gonna fix it

bitter depot
slate swan
#

oh its discord.ui.button lmao

#

the class itself is already the view

bitter depot
#

There we go

slate swan
bitter depot
#

Docs save the day again lemon_blush

slate swan
#

docs and you hapepey

full valley
#

is it important to store asyncio tasks?

#

after I make one

slate swan
#
class Help_view(View):
    """
    A class for the help command view.
    """
    def __init__(self,ctx : commands.Context , *, timeout: Optional[float] = 180) -> None:
        super().__init__(timeout=timeout)
        self.ctx = ctx
    @discord.ui.button(label="modding", style=discord.ButtonStyle.primary,emoji=Emojis.mod_button)
    async def callback(self,interaction) -> Coroutine:
        """
        A function that edits the help message and shows the modding commands
        """
        if self.ctx.author.id != interaction.user.id:
            return await interaction.send_message(f"{random.choice(Replies.error_replies)} {random.choice(Emojis.pepe_sad_emojis)}",ephemeral=True)
        embed = discord.Embed(title="Mod helping command",inline=False)
        embed.add_field(name="Ban", value='-Ban')

        await interaction.edit_original_message(embed=embed)```

Ignoring exception in view <Help_view timeout=180 children=1> for item <Button style=<ButtonStyle.primary: 1> url=None disabled=False label='modding' emoji=<PartialEmoji animated=False name='moderator' id=857241458889195571> row=None>:
Traceback (most recent call last):
File "C:\Python39\lib\site-packages\discord\ui\view.py", line 359, in _scheduled_task
await item.callback(interaction)
TypeError: callback() takes 2 positional arguments but 3 were given```

normal wadi
#

I wanna make a embed for my discord bot where it displays a video that you can watch inside discord. like if you were to link a youtube video in chat and it embed the whole video so you can watch it inside discord. i havent figured out how to do it, please help

slate swan
#

you cant iirc

#

Send the video link and it makes exactly what you want to do...

#

yea

full valley
#

You cant display videos in embeds

#

only images and gifs I believe

normal wadi
#

damn

quick gust
shadow wraith
#

guys how do you make the command available to only a specific role, this is my code:

class MyNewHelp(commands.MinimalHelpCommand):
    def __init__(self):
        super().__init__()
        # make the minimalhelpcommand dmed 
        self.no_category = 'Commands'
        self.dm_help = True
    async def send_pages(self):
        destination = self.get_destination()
        for page in self.paginator.pages:
            Helpemby = discord.Embed(description=f"{page}", color=0xCD08FF)
            await destination.send(embed=Helpemby)

apparently self.command_attrs just made the help command nonexistent and i kept getting help command not a thing unless i removed it

stray sequoia
#

:D

slate swan
#
Traceback (most recent call last):
  File "C:\Python39\lib\site-packages\discord\ui\view.py", line 359, in _scheduled_task
    await item.callback(interaction)
  File "c:\Users\rrfda\OneDrive\Desktop\sublime pg version\buttons.py", line 45, in callback
    await interaction.edit_original_message(embed=embed)
  File "C:\Python39\lib\site-packages\discord\interactions.py", line 325, in edit_original_message
    data = await adapter.edit_original_interaction_response(
  File "C:\Python39\lib\site-packages\discord\webhook\async_.py", line 189, in request
    raise NotFound(response, data)```
brisk helm
#

How to send message as file

oak warren
#

it accepts discord.File form

sour gulch
#

I made a spam bot for discord

oak warren
unkempt canyonBOT
#

class discord.File(fp, filename=None, *, spoiler=False)```
A parameter object used for [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send") for sending file objects.

Note

File objects are single use and are not meant to be reused in multiple [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send")s.
slate swan
#

i fixed it

sullen shoal
oak warren
#

so mostly it must be emoji

#

unless the view was not found

slate swan
#

still wrong , the emoji is there my method of edited the message was wrong

oak warren
#

oh ok

#

whatever you didnt give the code

#

atleast i didnt see it

tiny ibex
#

How to solve this

slate swan
#

how is that related to discord bots

tiny ibex
slate swan
#

how can i get the physical memory consumption my bots using and send it as a value?

slate swan
#

no need to do that shit

#

just use @commands.has_role check

shadow wraith
#

can't ๐ŸšŽ cus idk

sullen shoal
#

actually this is the second time im linking this to them but fine,
try, discord.ext.commands.HelpCommand.add_check

slate swan
#

How do I get all the permission overwrites of the category of a channel?

It sends it in a list right?

sullen shoal
#

did you try that when i linked that shit

shadow wraith
#

ok ik self.add_check() exists

#

but when i did self.add_check(lambda ctx: ctx.author.roles in thelistofrolestheyshouldhave) it didn't work :c

sullen shoal
#

you get ctx by HelpCommand.context

#

!d discord.ext.commands.HelpCommand.context

unkempt canyonBOT
slate swan
#

your using postgres ?

slate swan
#

oh okay

shadow wraith
#

so lambda HelpCommand.context should work

sullen shoal
#

the function accepts no arguments otherwise it would have been documented

sullen shoal
#

why would that work

shadow wraith
#

dk ๐ŸšŽ

sullen shoal
#

make a lambda function with no argument and just do the shit

#

return False if you dont wanna invoke

#

!e print((lambda: "hello")())

unkempt canyonBOT
#

@sullen shoal :white_check_mark: Your eval job has completed with return code 0.

hello
shadow wraith
sage otter
#

parenthesis*

shadow wraith
#

parentheses*

sullen shoal
#

lambda: thats basically how you make a lambda func without any parameters

#

or arguments whatever

sage otter
shadow wraith
#

but it's in the dictionary ๐ŸšŽ

#

jk

sage otter
#

Actually nevermind. Thereโ€™s two different ones. Said the same way.

vocal plover
sage otter
slate swan
#

parenthesis
plural noun: parentheses...

sullen shoal
#

alright i scored 100 in english now lets move on

sage otter
#

I hate English so much now.

vocal plover
shadow wraith
shadow wraith
sullen shoal
#

thats the class bro

#

self.context

shadow wraith
#

o

#

im a dummy

shadow wraith
#

๐Ÿ’€

#

the help command dm

sullen shoal
#

then the check isn't returning False

#

or maybe again you inserted it in the wrong places

#

idk

shadow wraith
#

idk

#

wait how is the bot gonna know what role it needs

#

i mean the user needs

#

through a list, a string, ๐Ÿ’€

slate swan
#

uh

shadow wraith
#

it's a pypi project i think

sullen shoal
#

its a third party package

slate swan
#

!pypi psutil

unkempt canyonBOT
#

Cross-platform lib for process and system monitoring in Python.

slate nymph
#

how would u make ur own api wrapper?

sullen shoal
#

read the discord api docs

#

if you're talking about discord api wrapper ofc

slate nymph
#

i mean what is api?

proven osprey
#

guys what command i should use if i want to type like "if user joined current voice channel"

slate nymph
#

is it a link?

#

how do i get access to discord api?

sullen shoal
#

its a thing you should google

#

it has nothing to do with dc bots

slate nymph
#

huh

sullen shoal
#

i mean yeah the discord api thing does kinda belong here

#

but you asked what is an api which isnt

slate nymph
#

well i mean

slate swan
#

using psutil.virtual_memory() does that give the amount of memory the task is taking? im trying to retrieve the amount of ram that my bots taking

slate nymph
#

it just doesnt get into my mind-

#

and i dont know how to access apis

sullen shoal
#

just read some articles on sending http requests

slate nymph
#

isnt that related to web?

sullen shoal
#

it is?

slate nymph
#

bots arent related to web are they?

sullen shoal
#

the entire damn thing is just receiving and sending http requests basically

slate nymph
#

oh

sullen shoal
slate nymph
#

so i have to make an api request using aiohttp to their api?

slate swan
#

Send http requests isnt quite web related

sullen shoal
silk rock
slate nymph
sullen shoal
#

which cam be done with aiohttp

slate swan
slate nymph
#

where to start from?

slate swan
#

Start what?

sullen shoal
#

idk its just comes naturally at some point

slate nymph
#

making an api wrapper

sullen shoal
#

like make advanced shit

slate swan
#

When your ready ig

slate nymph
#

ofc i m not

slate swan
#

Ask andy

slate nymph
#

but at some point, everyone was a beginner

slate swan
#

Hes making a api wrapper for dpy

slate nymph
#

where did they start from?

sullen shoal
#

zero

slate nymph
#

ayt i ll ask andy

sullen shoal
#

and a python tutorial

slate nymph
#

theres not much articles about it in google too

slate swan
sullen shoal
slate swan
full valley
#

Can I not use ctx in functions?

slate swan
#

Btw myxi nice pfp love the show

full valley
#

that arent bot commands?

slate swan
#

Message for a event ig

sullen shoal
#

idek the show, just some random picture i found on my memes folder

#

gotta look for it someday

slate swan
#

The show is really good ngl

full valley
#
async def qtimer(ctx, timedplayer, gameid, qsizee):
    await asyncio.sleep(15)
    if gameid not in games:
        try:
            playerqueue.remove(timedplayer.mention)
            lobby.remove(timedplayer.id)
            if len(playerqueue) > 0:
                embed = discord.Embed(
                    title=f"**{len(playerqueue)} of {qsizee} players are in the queue**",
                    description=str(timedplayer.mention) + " was kicked from the queue! (Timeout)",
                    color=0xE74C3C)
            else:
                embed = discord.Embed(
                    title="**There are no players remaining in the queue**",
                    description=str(timedplayer.mention) + " was kicked from the queue! (Timeout)",
                    color=0xE74C3C)
            embed.set_footer(text=f"CBell 6 Mans | Created by Heptix",
                             icon_url="https://i.imgur.com/1utxX7d.png")
            await ctx.channel.send(embed=embed)
        except Exception:
            print(traceback.format_exc())
    else:
        return```

How do I use ctx?
slate swan
#

Wdym?

full valley
#

in a bot command I called the function with


await qtimer(timedplayer, game_id, qsize)
slate swan
#

In a command context doesnt need to be called ctx its just a positional argument

spring flax
#

how do i clone a role?
right now i have this

@bot.command()
async def clone(ctx, role : disnake.Role):
    new_role = copy.copy(role)
    await ctx.guild.create_role(new_role)
sullen shoal
full valley
slate swan
#

Im so confused lol

full valley
#

Ok ill explain lmao

slate swan
silk rock
normal wadi
#

how do i make a bot send a normal text and embed in one message?

slate swan
#

Never tried it before tho lol

full valley
#

Ok so lets say I have a bot command right

@bot.command(name="test", aliases=["t"], description="Test command")
async def test(ctx):
  var1 = 5
  var2 = 'hello'
  await qtimer(var1, var2)

then the qtimer command:

async def qtimer(ctx, var1, var2):
  await ctx.channel.send('Test')

So, my question is:
How can I use context in a function outside of the bot command?

slate swan
#
await channel.edit(sync_permissions=True)

I added a print statement before and after, both print but the channel still remains unsynced

valid barn
#

hi can someone help me, this doesn't work, and it doesnt show an error either@client.event async def on_member_join(member): channel = client.get_channel(919176763249156139) memcount = len([m for m in member.guild.members if not m.bot]) embed=discord.Embed(description=f"**Welcome to {member.guild.name}!**\n\nใƒป verify your__s__elf : {client.get_channel(919221774858723398)}\nใƒป get roles : {client.get_channel(919271662048935986)}\nใƒป start bonding in our community! : {client.get_channel(919286754752733224)}\n\n**incase of any problems, ping {member.guild.owner.name}") embed.set_thumbnail(url=member.avatar_url) embed.set_footer(text=f"{member.name} | {memcount}") await channel.send(embed=embed) await member.send("hi!")

normal wadi
full valley
slate swan
valid barn
full valley
full valley
#

since my example there will just tell me im missing arg's

normal wadi
#

the normal text is a link to a youtube video, i want the link to be above the embedded message but the embedded preview video below the embedded message if that makes any sense

#

@slate swan

valid barn
slate swan
#

oh wait myb

valid barn
#

and my commands work fine

normal wadi
slate swan
#

Do you have intents enabled @valid barn ?

slate swan
#

The yt vid you want to send just send the link

#

Have you enabled it in your code?

valid barn
slate swan
unkempt canyonBOT
#

Using intents in discord.py

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

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

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

from discord import Intents
from discord.ext import commands

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

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

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

slate swan
#

^^

silk rock
valid barn
#

ty

slate swan
#

Whats the line for all intents kinda forgot it

tawdry perch
#

intents.all?

#

hm

quick gust
#

discord.Intents.all() I believe

slate swan
#

Yes thank you

#

Lol

proven osprey
#

guys could you tell me pls how to give a user permission that will give him opportunity to edit the channel

stark lintel
#

Aaa

tawdry perch
#

!d discord.TextChannel.overwrites

unkempt canyonBOT
#

property overwrites: Dict[Union[Role, Member], PermissionOverwrite]```
Returns all of the channelโ€™s overwrites.

This is returned as a dictionary where the key contains the target which can be either a [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role") or a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") and the value is the overwrite as a [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/master/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite").
tawdry perch
#

maybe this

proven osprey
#

what permission i should type here?

tawdry perch
#

ah

#

manage_channels

proven osprey
#

thank you!

tawdry perch
#

it's a permission, not a document

proven osprey
tawdry perch
#

string maybe?

proven osprey
#

thanks

fading harness
#

how can i check

slate swan
#

can i have a view check ?
like it checks x thing when a button is pressed thinkCat

fading harness
#

if a member have a following role by id (even in another server)?

#

using dpy 2.0

tawdry perch
tawdry perch
slate swan
#

sure that could work , but it would be alot more clean if it had a view check

fading harness
tawdry perch
tawdry perch
full valley
#
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x000001D366560AF0>
Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2544.0_x64__qbz5n2kfra8p0\lib\asyncio\proactor_events.py", line 116, in __del__
    self.close()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2544.0_x64__qbz5n2kfra8p0\lib\asyncio\proactor_events.py", line 108, in close
    self._loop.call_soon(self._call_connection_lost, None)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2544.0_x64__qbz5n2kfra8p0\lib\asyncio\base_events.py", line 746, in call_soon
    self._check_closed()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2544.0_x64__qbz5n2kfra8p0\lib\asyncio\base_events.py", line 510, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x000001D366560AF0>
Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2544.0_x64__qbz5n2kfra8p0\lib\asyncio\proactor_events.py", line 116, in __del__
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2544.0_x64__qbz5n2kfra8p0\lib\asyncio\proactor_events.py", line 108, in close
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2544.0_x64__qbz5n2kfra8p0\lib\asyncio\base_events.py", line 746, in call_soon
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2544.0_x64__qbz5n2kfra8p0\lib\asyncio\base_events.py", line 510, in _check_closed
RuntimeError: Event loop is closed
Task exception was never retrieved
future: <Task finished name='Task-43' coro=<Command.__call__() done, defined at C:\Users\~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\core.py:358> exception=TypeError('qtimer() takes 2 positional arguments but 4 were given')>
Traceback (most recent call last):
  File "C:\Users\~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\core.py", line 374, in __call__
    return await self.callback(*args, **kwargs)
TypeError: qtimer() takes 2 positional arguments but 4 were given

Process finished with exit code 0
#

My task doesnt seem to be doing its job

#

no idea why its saying it takes 2 arguments, when ive made it take four

tawdry perch
#

show the code of function?

tawdry perch
#

oo

full valley
# tawdry perch show the code of function?
async def qtimer(timedplayer, gameid, qsizee, channel):
    await asyncio.sleep(15)
    try:
        if gameid not in games:
            playerqueue.remove(timedplayer.mention)
            lobby.remove(timedplayer.id)
            if len(playerqueue) > 0:
                embed = discord.Embed(
                    title=f"**{len(playerqueue)} of {qsizee} players are in the queue**",
                    description=str(timedplayer.mention) + " was kicked from the queue! (Timeout)",
                    color=0xE74C3C)
            else:
                embed = discord.Embed(
                    title="**There are no players remaining in the queue**",
                    description=str(timedplayer.mention) + " was kicked from the queue! (Timeout)",
                    color=0xE74C3C)
            embed.set_footer(text=f"CBell 6 Mans | Created by Heptix",
                             icon_url="https://i.imgur.com/1utxX7d.png")
            await channel.send(embed=embed)
    except Exception:
        print(traceback.format_exc())
#

heres making the task:

qtimer_tasks[game_id].append(asyncio.create_task(qtimer(timedplayer, game_id, qsize, channel)))
tawdry perch
#

and what did you pass?

#

oh

full valley
#

timedplayer, game_id, qsize, channel

slate swan
#

prob with indentation

tawdry perch
slate swan
#

idk what is the prob

tawdry perch
#

what does the console say?

slate swan
slate swan
slate swan
tawdry perch
tawdry perch
fading harness
#

this is my code:

async def get_bot_flags(userss: typing.Union[discord.Member, discord.User], server) -> str:

    
    bot_flags = []
    if userss.id == 716134528409665586:
        bot_flags.append(':maskbot:')
        
    if server.get_role(TIER_1_STANDARD_ROLE) in server.userss.roles:
        bot_flags.append(':tier1_standard:')
    
    if server.get_role(TIER_2_STANDARD_ROLE) in server.userss.roles:
        bot_flags.append(':tier2_standard:')
    
    if server.get_role(TIER_3_STANDARD_ROLE) in server.userss.roles:
        bot_flags.append(':tier3_standard:')
    
    if server.get_role(TIER_4_STANDARD_ROLE) in server.userss.roles:
        bot_flags.append(':tier4_standard:')
    
    if server.get_role(TIER_5_STANDARD_ROLE) in server.userss.roles:
        bot_flags.append(':tier5_standard:')
    
    return " ".join(bot_flags)```
slate swan
fading harness
#
@commands.command(aliases=["ui"])
    async def userinfo(self, ctx, member: typing.Union[discord.Member, discord.User]=None):
        if member is None:
            member = ctx.author
        embed = discord.Embed(
            title=f"{member.name}#{member.discriminator}'s info",
            description=discord.Embed.Empty,
            colour=discord.Colour.green(),
        )
        server = self.bot.get_guild(914163721704726588)
        emojis = await flags.get_bot_flags(member, server)
        embed.add_field(name=f"{INFORMATION_EMOJI_UI} Basic Information:", value=
            f"**ID**: {member.id} "
            f"\n[Badges](na): {emojis}"
        )
     
        await ctx.send(embed=embed)```
tawdry perch
proven osprey
#

anybody now what i did wrong? it must create a room when i join the channel id which i indicated in code

slate swan
tawdry perch
#

good ๐Ÿ‘

slate swan
#

thnx

tawdry perch
#

If that does not work I have no time to expalin another metthods, sorry

valid barn
#

how to do autorole?

full valley
maiden fable
unkempt canyonBOT
#

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

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

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

!d discord.Member.add_roles

unkempt canyonBOT
#

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

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

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the added [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
tacit horizon
#
@client.event()
async def on_command_error(ctx, error):
    if isinstance(error, commands.MissingPermissions):
        await ctx.send("You cant use that.")```
#

TypeError: event() missing 1 required positional argument: 'coro'

shadow wraith
#

it's @client.event remove the parentheses (aka these 2 characters ())

tacit horizon
#

ohh

shadow wraith
#

what's the event name for when a role is created

proven osprey
#

ะดะฐ

wheat heart
#

ะพ

maiden fable
unkempt canyonBOT
#

discord.on_guild_role_create(role)``````py

discord.on_guild_role_delete(role)```
Called when a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild") creates or deletes a new [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role").

To get the guild it belongs to, use [`Role.guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role.guild "discord.Role.guild").

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

@tacit horizon What are you trying to do?

tacit horizon
#

trying to make a command only i can use

upbeat otter
tacit horizon
#

;-;

slate swan
tacit horizon
#

๐Ÿ˜…

#

how

shadow wraith
unkempt canyonBOT
#

@discord.ext.commands.is_owner()```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that checks if the person invoking this command is the owner of the bot.

This is powered by [`Bot.is_owner()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.is_owner "discord.ext.commands.Bot.is_owner").

This check raises a special exception, [`NotOwner`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NotOwner "discord.ext.commands.NotOwner") that is derived from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
tacit horizon
#

can i do with user id

slate swan
tacit horizon
slate swan
#

To or the decorator

shadow wraith
tacit horizon
#

ya

shadow wraith
#

you know basic python so i won't help you with if and else statements and stuff

slate swan
#

Lol

tacit horizon
#

idk

upbeat otter
tacit horizon
#
async def lol(ctx, member: discord.Member, count: int):
    if ctx.author.id == your_id:
        c = 0 
        while True:
            nuke_r = random.choice(list_data.nuke_list)
            await ctx.send(f"{member.mention} {nuke_r}")
            c +=1
            if c == int(count):
                break
            else:
                continue```
#

so its gonna work ?

slate swan
#

Of your id

tacit horizon
#

its worked

tacit horizon
#

._.

#

not that much noob

slate swan
#

Then why hide it?

tacit horizon
#

nvm

slate swan
#

499973767846428694 your id lol

tacit horizon
#

637458038915203127 your id lol

slate swan
#

I cant do anything with your id lol

#

So why hide it

tacit horizon
#

ik lol

#

ahh if the other member use that commend why its not showing error

#
@lol.error
async def asfjasl;dfkj;asldkfjl;(ctx, error):
    if isinstance(error, commands.MissingPermissions):
        await ctx.send("You cant use that.")```
slate swan
#

Cause they arent missing perms

tacit horizon
#

but the terminal not showing any error

#

thats why i cant add the error name

slate swan
#
if #check....
else: 
    await ctx.send("You arent the bot owner")
slate swan
tacit horizon
#

but why its sending 2

slate swan
slate swan
upbeat otter
tacit horizon
slate swan
upbeat otter
upbeat otter
slate swan
tacit horizon
upbeat otter
#

I just make fun of myself everytime

slate swan
tacit horizon
upbeat otter
#

Smh

tacit horizon
#

Eevee's about me works

upbeat otter
slate swan
tacit horizon
#

ikr ๐Ÿ˜„

upbeat otter
slate swan
#

!ot

unkempt canyonBOT
tacit horizon
#

its sending 2

#

also my bot reviled

slate swan
#

Send code

tacit horizon
slate swan
#

!code

unkempt canyonBOT
#

Here's how to format Python code on Discord:

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

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

tacit horizon
#
@client.command()
async def sapinuke(ctx, member: discord.Member, count: int):
    if ctx.author.id == 499973767846428694:
        c = 0 
        while True:
            nuke_r = random.choice(list_data.nuke_list)
            await ctx.send(f"get nuked {member.mention} {nuke_r}")
            c +=1
            if c == int(count):
                break
            else:
                continue
    else: 
        await ctx.send("You can't use that. smh")   
slate swan
#

Why the while loop?

upbeat otter
#

Why not

#

Lol

tacit horizon
#

its good smh

slate swan
#

What are you trying to do?

#

Whats the list(list_data.nuke_list)

tacit horizon
#

its list

#

;-;

slate swan
#

Whats in it

tacit horizon
#

nop

upbeat otter
#

Wha...

slate swan
#

seems like its agaisnt tos

tacit horizon
#

why its sending 2

#

msg everytime

slate swan
#

Whats in the list

shadow wraith
#

!d discord.on_guild_update

unkempt canyonBOT
#

discord.on_guild_update(before, after)```
Called when a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild") updates, for example:

โ€ข Changed name

โ€ข Changed AFK channel

โ€ข Changed AFK timeout

โ€ข etc...
upbeat otter
#

Huh?

tacit horizon
#

huh

shadow wraith
#

o

slate swan
slate swan
shadow wraith
#

thx i was just gonna use it for stuff

slate swan
upbeat otter
#

@tacit horizon am I just gonna get ignored?

tacit horizon
slate swan
tacit horizon
#

ya

slate swan
#

Use the member arg

upbeat otter
#

Best of luck getting rate limited

slate swan
#

Since its a member obj just mention it with the .mention attr

slate swan
slate swan
#

Reset your token

upbeat otter
#

Just regen your token ,-,

slate swan
#

Your probably running your bot 2 times

upbeat otter
slate swan
tacit horizon
#

;-;

upbeat otter
tacit horizon
#

but my api reply me once

slate swan
#

Wdym?

upbeat otter
#

@tacit horizon try using another command

tacit horizon
tacit horizon
#

its working fine

#

only that command gives 2

upbeat otter
#

Nvm im not going to say anything

tacit horizon
#

smh

upbeat otter
#

Best of luck finding out

tacit horizon
#

lets just reset token

#

huh

#

my heroku will crash tho

slate swan
#

Makes sense now

#

Your running your bot on heroku and self hosting it are you?

shadow wraith
#

i was gonna say he had 2 instances of the bot runnin

tacit horizon
#

noo

shadow wraith
#

but i had a feeling my point was invalid

tacit horizon
#

self host other one

shadow wraith
tacit horizon
#

noo

upbeat otter
#

Lol

quick gust
valid barn
upbeat otter
unkempt canyonBOT
slate swan
#

@quick gust would this work never tried it before?

await ctx.send(member.mention*amount)
quick gust
slate swan
#

Yeah i figured

quick gust
#

ye

upbeat otter
tacit horizon
quick gust
#

they are just curious

#

if something like that would work

slate swan
shadow wraith
upbeat otter
quick gust
slate swan
#

^

tacit horizon
slate swan
#

!e

print("okimii"*5)
unkempt canyonBOT
#

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

okimiiokimiiokimiiokimiiokimii
slate swan
quick gust
slate swan
upbeat otter
quick gust
upbeat otter
#

Lol

tacit horizon
#

just leave it

upbeat otter
slate swan
#

And will get you rate limited

tacit horizon
slate swan
#

Yeah

tacit horizon
#

but its still so fast

#

to pinnnnnnnnnnnnnn

slate swan
#

Still against tos

tacit horizon
#

*tos

slate swan
#

?

tacit horizon
#

?

cloud dawn
slate swan