#discord-bots

1 messages · Page 645 of 1

worthy wagon
#

??

upbeat otter
#

.

worthy wagon
#

I've already done that bro

upbeat otter
#

Bro......nvm

worthy wagon
#

I've tried literally all the common fixes I'd usually try before coming here for help

upbeat otter
#

Send the code again

#

Im too lazy to scroll up again

worthy wagon
#

I don't know why you're getting mad, you chose to come in here and try and help while robin and AM were, you're blaming me for getting toxic now when no one got toxic.

#

It's not needed

#

I'll get the code one sec

upbeat otter
#

I'll leave then baiii

sick birch
#

that's probably the oddest thing i've seen all day today

worthy wagon
#

I've had something weirder than this occur surprisingly

sick birch
#

you mustn't be having a good day haha

wicked atlas
#

Honestly, I'm a little stumped, because usually when you have missing access, it's that it dosen't have access to the channel

sick birch
#

I am too

#

I feel like this might be cause for a bug report

#

Starting to think it's genuinely a bug on their end

wicked atlas
#

On what?

sick birch
#

No, the servers

#

it is an API call after all

slate swan
#
async def on_member_join(member):
    guild = ctx.message.guild
    await guild.create_text_channel('cool-channel')

how would I get this to work bc ctx isn't defined

prisma spoke
#

..

sick birch
prisma spoke
slate swan
#

alr ty

prisma spoke
#

anyone?

sick birch
#

"This isn't working" isn't very helpful. We'll need a few things to fully understand & diagnose the problem:

  1. What do you want it to do?
  2. What does it do?
  3. Are there errors in console?
wicked atlas
#

@worthy wagon Maybe check your channel ID again? Idk at this point

sick birch
#

best bet would be to check the ID and give it a day

prisma spoke
#

that shud be done

sick birch
#

Off the top of my head you're running the while loop for every, you never modify h or p

#

Also this is going to get you rate limited fast and most likely API banned

upbeat otter
#

@worthy wagon oheyo, try using exceptions in your code

sick birch
#

We know what the problem is

#

Well actually no we don't

#

but we kinda do if that makes any sense

#

we know that we get a 403 forbidden error, except the bot definitely has access to the channel, we've checked everything

#

so we're quite stumped

sick birch
#

yeah sorry

wicked atlas
#

They deleted the error message for some reason, but it said "Missing Access" as well

upbeat otter
#

What does it not have acces to

sick birch
#

the channel being fetched

upbeat otter
#

Good luck

sick birch
#

except it has access to it

#

so im just going ??

upbeat otter
lethal bloom
#

@civic fractal you speak spanish?

civic fractal
#

un poco

lethal bloom
lethal bloom
#

I have time on hold and no Helper answers me

jade tartan
#

Hi if i want my bot to mention who is joining my server on the terminal what code is it?

#

like while the code is running

lethal bloom
jade tartan
#

to let the bot mention a member is it {member.mention}?

#

like does this seem right

#

myEmbed = discord.Embed(title = f"Welcome {member.mention}",

#

@lethal bloom

maiden fable
#

The mention won't work in the title

jade tartan
#

ok well that sucks

lethal bloom
#

description

jade tartan
#

ok then

prisma spoke
#

p+=1?

lethal bloom
prisma spoke
#

also how to divide an embed into pages? ```py
@client.command()
@commands.has_permissions(administrator=True)
async def inrole(ctx, r_id: int):
g = ctx.guild
r = nextcord.utils.get(g.roles, id=r_id)
names = [m.name for m in r.members]
try:

    embed=nextcord.Embed(title=f"Displaying members with that role", description='\n'.join(names))
    await ctx.send(embed=embed)
        

except:
    await ctx.send("The embed size is too large!")```i read some docs but didnt quite understand it
jade tartan
#

description= f"Welcome {member.mention},

#

Is this right?

prisma spoke
#
class MyEmbedDescriptionPageSource(menus.ListPageSource):
    def __init__(self, data):
        super().__init__(data, per_page=6)

    async def format_page(self, menu, entries):
        g=self.guild
        r = nextcord.utils.get(g.roles, id=r_id)
        names = [m.name for m in r.members]
        embed = Embed(title="Members in that role", description="\n".join(names))

        embed.set_footer(text=f'Page {menu.current_page + 1}/{self.get_max_pages()}')
        return embed


@bot.command()
async def button_embed_description(ctx, r_id:int):
    data = [f'Description for members #{num}' for num in range(1, 51)]
    pages = menus.ButtonMenuPages(
        source=MyEmbedDescriptionPageSource(data),
        disable_buttons_after=True,
    )
    await pages.start(ctx)```?
prisma spoke
#
Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 168, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\Users\admin\Downloads\ROG.py", line 1378, in inrole
    await pages.start(ctx)
  File "C:\Python310\lib\site-packages\nextcord\ext\menus\menu_pages.py", line 102, in start
    await super().start(ctx, channel=channel, wait=wait)
  File "C:\Python310\lib\site-packages\nextcord\ext\menus\menus.py", line 593, in start
    self.message = msg = await self.send_initial_message(ctx, channel)
  File "C:\Python310\lib\site-packages\nextcord\ext\menus\menu_pages.py", line 95, in send_initial_message
    kwargs = await self._get_kwargs_from_page(page)
  File "C:\Python310\lib\site-packages\nextcord\ext\menus\menu_pages.py", line 72, in _get_kwargs_from_page
    value: PageFormatType = await nextcord.utils.maybe_coroutine(self._source.format_page, self, page)
  File "C:\Python310\lib\site-packages\nextcord\utils.py", line 514, in maybe_coroutine
    return await value
  File "c:\Users\admin\Downloads\ROG.py", line 1363, in format_page
    names = [m.name for m in r.members]
AttributeError: 'NoneType' object has no attribute 'members'

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

Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\nextcord\client.py", line 351, in _run_event
    await coro(*args, **kwargs)
  File "c:\Users\admin\Downloads\ROG.py", line 658, in on_command_error
    raise error
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\bot.py", line 995, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 895, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 177, in wrapped
    raise CommandInvokeError(exc) from exc
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'members'```
jade tartan
prisma spoke
jade tartan
#
async def on_member_join(member):
        guild = client.get_guild(730651046459998218)
        channel = guild.get_channel(885464532959526913)
        myEmbed = discord.Embed(title = f"Welcome", 
        description= f"Welcome {member.mention}, You are member {guild.member_count}. \n Enjoy your stay here and dont forget to read the await [#904279966693355550](/guild/267624335836053506/channel/904279966693355550/)", color=0x0ff00)
        await channel.send(embed=myEmbed)
        role = guild.get_role(832120561848156180)
        await member.add_roles(role)```
prisma spoke
#

error?

jade tartan
#

Nope just isnt appearing on my embed

prisma spoke
#

use utils

jade tartan
#

Nope it works fine

civic fractal
#

officially made the funny

jade tartan
#

nvm it works now just had to restart the bot

prisma spoke
#

u didnt restart the bot?

#

wow

jade tartan
#

yk what am dyslexic

#

so please dont hate on me

upbeat otter
prisma spoke
#

waiting for an answerr

maiden fable
#

O can I see the code?

prisma spoke
#
class MyEmbedDescriptionPageSource(menus.ListPageSource):
    def __init__(self, data):
        super().__init__(data, per_page=6)

    async def format_page(self, menu, r_id):
        g=client.get_guild(855423177324363816)
        r = g.get_role(r_id)
        names = [m.name for m in r.members]
        embed = Embed(title="Members in that role", description="\n".join(names))

        embed.set_footer(text=f'Page {menu.current_page + 1}/{self.get_max_pages()}')
        return embed


@client.command()
@commands.has_permissions(administrator=True)
async def inrole(ctx, r_id:int):
    g=client.get_guild(855423177324363816)
    r = g.get_role(r_id)
    names = [m.name for m in r.members]

    pages = menus.ButtonMenuPages(
        source=MyEmbedDescriptionPageSource(names),
        disable_buttons_after=True,
    )
    await pages.start(ctx)```
#

enhanced a bit

#
Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 168, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\Users\admin\Downloads\ROG.py", line 1381, in inrole
    await pages.start(ctx)
  File "C:\Python310\lib\site-packages\nextcord\ext\menus\menu_pages.py", line 102, in start
    await super().start(ctx, channel=channel, wait=wait)
  File "C:\Python310\lib\site-packages\nextcord\ext\menus\menus.py", line 593, in start
    self.message = msg = await self.send_initial_message(ctx, channel)
  File "C:\Python310\lib\site-packages\nextcord\ext\menus\menu_pages.py", line 95, in send_initial_message
    kwargs = await self._get_kwargs_from_page(page)
  File "C:\Python310\lib\site-packages\nextcord\ext\menus\menu_pages.py", line 72, in _get_kwargs_from_page
    value: PageFormatType = await nextcord.utils.maybe_coroutine(self._source.format_page, self, page)
  File "C:\Python310\lib\site-packages\nextcord\utils.py", line 514, in maybe_coroutine
    return await value
  File "c:\Users\admin\Downloads\ROG.py", line 1362, in format_page
    r = g.get_role(r_id)
  File "C:\Python310\lib\site-packages\nextcord\guild.py", line 805, in get_role
    return self._roles.get(role_id)
TypeError: unhashable type: 'list'

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

Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\nextcord\client.py", line 351, in _run_event
    await coro(*args, **kwargs)
  File "c:\Users\admin\Downloads\ROG.py", line 658, in on_command_error
    raise error
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\bot.py", line 995, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 895, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 177, in wrapped
    raise CommandInvokeError(exc) from exc
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: unhashable type: 'list'```
#

new error with tht code

maiden fable
prisma spoke
maiden fable
#

Can I see how u r invoking the command?

prisma spoke
#

removee the () with the role id

maiden fable
#

O

#

Uhhhhhh

#

Try printing what r_id prints

prisma spoke
#

one sec

prisma spoke
#

role id...

#

nvm fixed it

lethal bloom
#

@maiden fable hey

prisma spoke
#

how to get role name by id?

maiden fable
unkempt canyonBOT
#

discord.utils.get(iterable, **attrs)```
A helper that returns the first element in the iterable that meets all the traits passed in `attrs`. This is an alternative for [`find()`](https://discordpy.readthedocs.io/en/master/api.html#discord.utils.find "discord.utils.find").

When multiple attributes are specified, they are checked using logical AND, not logical OR. Meaning they have to meet every attribute passed in and not one of them.

To have a nested attribute search (i.e. search by `x.y`) then pass in `x__y` as the keyword argument.

If nothing is found that matches the attributes passed, then `None` is returned.

Examples

Basic usage...
maiden fable
prisma spoke
lethal bloom
# maiden fable Hi

modify a little what you gave me, now only the invitation will come out.

How do I add a text next to the link?

maiden fable
prisma spoke
lethal bloom
#

ok

maiden fable
#

Or str(role)

unkempt canyonBOT
prisma spoke
# maiden fable !d discord.Role.name
    def __init__(self, data):
        super().__init__(data, per_page=20)

    async def format_page(self, menu, names, r):

        embed = Embed(title=f"Members in that {r.name}", description="\n".join(names))

        embed.set_footer(text=f'Page {menu.current_page + 1}/{self.get_max_pages()}')
        return embed


@client.command()
@commands.has_permissions(administrator=True)
async def inrole(ctx, r_id:int):
    print(r_id)
    g=client.get_guild(855423177324363816)
    r = g.get_role(r_id)
    names = [f"{m.name}#{m.discriminator}" for m in r.members]

    pages = menus.ButtonMenuPages(
        source=MyEmbedDescriptionPageSource(names),
        disable_buttons_after=True,
    )
    await pages.start(ctx)```
maiden fable
#

?

#

Where u using the role name

prisma spoke
#

this is my role var

lethal bloom
maiden fable
lethal bloom
#

;-;

jade tartan
#
async def on_member_join(member):
        guild = client.get_guild(730651046459998218)
        channel = await client.fetch_channel(885464532959526913)
        description=(f"Welcome {member.mention}, You are member {guild.member_count}. \n Please enjoy your stay here and dont forget to read the await [#904279966693355550](/guild/267624335836053506/channel/904279966693355550/)"),
        await channel.send(f'Welcome to server **{member.mention}**.')
        role = guild.get_role(832120561848156180)
        await member.add_roles(role)
``` is this the right code to show who joins ur server in ur code editor on a terminal?
rocky mist
#

can any1 help?

tawdry perch
#

Uuuh

#

You maybe meant ==

lethal bloom
maiden fable
#

Sorry was watching yt

lethal bloom
lethal bloom
#

error

maiden fable
#

Welp gotta reinstall Spotify ;-;

maiden fable
lethal bloom
maiden fable
#

ctx.author.mention

lethal bloom
#

?

maiden fable
#

No

#

Just ctx.author.mention

lethal bloom
#

ok

rocky mist
#

don't use the if statements

tawdry perch
#

Hunter do you ever sleep?

lethal bloom
#

work 100% 👍

rocky mist
#

I have deleted all of my bot's code because of the if statements

lethal bloom
#

lol

rocky mist
lethal bloom
rocky mist
lethal bloom
#

lol

rocky mist
# lethal bloom lol

i didnt code much, if you want, though, i could send you some of my bot's code in dm (after the changes)

maiden fable
lethal bloom
tawdry perch
#

you slept bout 7.5h?

lethal bloom
maiden fable
maiden fable
tawdry perch
#

lucky I slept only 6h

prisma spoke
#
@bot.command()
async def brackets(ctx,p:int):
 
    while 0!=p:
        a = (random.sample(my_list, k=2))
        b=a[0]
        s=a[1]
        await ctx.send(f"{b} vs {s}")
        
        p=p+1``` this keeps sending it
#

even if i giv the p as 2

vocal plover
#

if p is 0 or greater that while will never exit

lament mesa
#

Wait nvm, 0 is always unequal to p so the statement is always True

prisma spoke
#

while 0=p:
?

maiden fable
#

It's checking if p isn't equal to 0 which is gonna happen literally everytime

#

@prisma spoke

#

while p==0

#

You need this (:

sullen shoal
#

it will run until p is 0

prisma spoke
sullen shoal
#

tbh we are just guessing what you want to do

prisma spoke
#

but now ```py
my_list = [k for k in users]

@bot.command()
async def brackets(ctx,p:int):

while 0!=p:
    a = (random.sample(my_list, k=2))
    b=a[0]
    s=a[1]
    await ctx.send(f"{b} vs {s}")
    
    p-=1``` iwant like any of the elementsof the 2nd choice shudnt be equal to the 1st one
#

now how to do that

sullen shoal
#

what are the elements

#

how many should both list contain

prisma spoke
prisma spoke
sullen shoal
#

how many are there in total

prisma spoke
sullen shoal
#

user id

#

basically the length of the list

prisma spoke
#

6

sullen shoal
#

because you just want 2, you could itertools.pairwise ig

#

!d itertools.pairwise

unkempt canyonBOT
#

itertools.pairwise(iterable)```
Return successive overlapping pairs taken from the input *iterable*.

The number of 2-tuples in the output iterator will be one fewer than the number of inputs. It will be empty if the input iterable has fewer than two values.

Roughly equivalent to:

```py
def pairwise(iterable):
    # pairwise('ABCDEFG') --> AB BC CD DE EF FG
    a, b = tee(iterable)
    next(b, None)
    return zip(a, b)
```...
prisma spoke
#

huh? whats this

sullen shoal
#

it will make sublists of the list each containing 2 elements

#

!e

from itertools import pairwise
ids = map(str, [1,2,3,4,5,6])
print(list(pairwise(ids)))```
unkempt canyonBOT
#

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

[('1', '2'), ('2', '3'), ('3', '4'), ('4', '5'), ('5', '6')]
sullen shoal
vocal plover
#

!d more_itertools.chunked

unkempt canyonBOT
#

more_itertools.chunked(iterable, n, strict=False)```
Break *iterable* into lists of length *n*:

```py
>>> list(chunked([1, 2, 3, 4, 5, 6], 3))
[[1, 2, 3], [4, 5, 6]]
```  By the default, the last yielded list will have fewer than *n* elements if the length of *iterable* is not divisible by *n*:

```py
>>> list(chunked([1, 2, 3, 4, 5, 6, 7, 8], 3))
[[1, 2, 3], [4, 5, 6], [7, 8]]
```  To use a fill-in value instead, see the [`grouper()`](https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.grouper "more_itertools.grouper") recipe...
sullen shoal
#

is it built-in module

vocal plover
#

no but its a simple install with pip install more-itertools

sullen shoal
#

oh

prisma spoke
#

hi big fan

sullen shoal
#

yep i also wanna be a professional json engineer

prisma spoke
vocal plover
prisma spoke
#

he is one of the devs of nc

sullen shoal
#

ik

prisma spoke
solemn citrus
#

un expected indent

prisma spoke
#

where u copied that code from?

solemn citrus
solemn citrus
prisma spoke
solemn citrus
#

😐

#

im commenting on it and im learning it

#

im j not copying

prisma spoke
# solemn citrus 😐

if u wud tell me u dont know python i wud have helped u but u told uk python.. and u didnt copy the code.. if uk python thn u must know what indent is

#

aanyways its an indentation error

hazy agate
#

hi guys

hazy agate
#

how can we make modmail bot?

prisma spoke
prisma spoke
hazy agate
#

i finally made tictactoe

solemn citrus
#

ik that...

hazy agate
#

bot\

solemn citrus
#

do i -1 or tab 1

hazy agate
#

wat

prisma spoke
sullen shoal
#

modmail should be easy if you made tictactoe

prisma spoke
#

ur indents are all wrong

solemn citrus
#

oh

hazy agate
#

see wait

solemn citrus
#

fixed it!

hazy agate
#

i will paste my code

#

u can alos read

unkempt canyonBOT
#

Hey @hazy agate!

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

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

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

https://paste.pythondiscord.com

hazy agate
#

bruh

#

player1 = ""
player2 = ""
turn = ""
gameOver = True

board = []

winningConditions = [
[0, 1, 2],
[3, 4, 5],
[6, 7, 8],
[0, 3, 6],
[1, 4, 7],
[2, 5, 8],
[0, 4, 8],
[2, 4, 6]
]

@client.command()
async def tictactoe(ctx, p1: discord.Member, p2: discord.Member):
global count
global player1
global player2
global turn
global gameOver

if gameOver:
    global board
    board = ["⬜", "⬜", "⬜",
             "⬜", "⬜", "⬜",
             "⬜", "⬜", "⬜"]
    turn = ""
    gameOver = False
    count = 0

    player1 = p1
    player2 = p2

    # print the board
    line = ""
    for x in range(len(board)):
        if x == 2 or x == 5 or x == 8:
            line += " " + board[x]
            await ctx.send(line)
            line = ""
        else:
            line += " " + board[x]player1 = ""

player2 = ""
turn = ""
gameOver = True

board = []

winningConditions = [
[0, 1, 2],
[3, 4, 5],
[6, 7, 8],
[0, 3, 6],
[1, 4, 7],
[2, 5, 8],
[0, 4, 8],
[2, 4, 6]
]

@client.command()
async def tictactoe(ctx, p1: discord.Member, p2: discord.Member):
global count
global player1
global player2
global turn
global gameOver

if gameOver:
    global board
    board = ["⬜", "⬜", "⬜",
             "⬜", "⬜", "⬜",
             "⬜", "⬜", "⬜"]
    turn = ""
    gameOver = False
    count = 0

    player1 = p1
    player2 = p2

    # print the board
    line = ""
    for x in range(len(board)):
        if x == 2 or x == 5 or x == 8:
            line += " " + board[x]
            await ctx.send(line)
            line = ""
        else:
            line += " " + board[x]
#

my commanmd

#

determine who goes first

    num = random.randint(1, 2)
    if num == 1:
        turn = player1
        await ctx.send("It is <@" + str(player1.id) + ">'s turn.")
    elif num == 2:
        turn = player2
        await ctx.send("It is <@" + str(player2.id) + ">'s turn.")
else:
    await ctx.send("A game is already in progress! Finish it before starting a new one.")

@client.command()
async def place(ctx, pos: int):
global turn
global player1
global player2
global board
global count
global gameOver

if not gameOver:
    mark = ""
    if turn == ctx.author:
        if turn == player1:
#

mark = "🇽"
elif turn == player2:
mark = "🅾️"
if 0 < pos < 10 and board[pos - 1] == "⬜" :
board[pos - 1] = mark
count += 1

            # print the board
            line = ""
            for x in range(len(board)):
                if x == 2 or x == 5 or x == 8:
                    line += " " + board[x]
                    await ctx.send(line)
                    line = ""
                else:
                    line += " " + board[x]

            checkWinner(winningConditions, mark)
            print(count)
            if gameOver == True:
                await ctx.send(mark + " wins!")
            elif count >= 9:
                gameOver = True
                await ctx.send("It's a tie!")

            # switch turns
            if turn == player1:
                turn = player2
            elif turn == player2:
                turn = player1
        else:
            await ctx.send("Be sure to choose an integer between 1 and 9 (inclusive) and an unmarked tile.")
    else:
        await ctx.send("It is not your turn.")
else:
    await ctx.send("Please start a new game using the !tictactoe command.")

def checkWinner(winningConditions, mark):
global gameOver
for condition in winningConditions:
if board[condition[0]] == mark and board[condition[1]] == mark and board[condition[2]] == mark:
gameOver = True

@tictactoe.error
async def tictactoe_error(ctx, error):
print(error)

#

if isinstance(error, commands.MissingRequiredArgument):
await ctx.send("Please mention 2 players for this command.")
elif isinstance(error, commands.BadArgument):
await ctx.send("Please make sure to mention/ping players (ie. @signal grotto).")

@place.error
async def place_error(ctx, error):
if isinstance(error, commands.MissingRequiredArgument):
await ctx.send("Please enter a position you would like to mark.")
elif isinstance(error, commands.BadArgument):
await ctx.send("Please make sure to enter an integer.")

vocal plover
#

!paste

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
#

KLOL

#

!bot urn on code

unkempt canyonBOT
#
Command Help

!bot
Bot informational commands.

hazy agate
#

!u r bot

unkempt canyonBOT
#
Bad argument

Could not convert "user_or_message" into Member, User, or Message.
Message "r" not found.

#
Command Help

!user [user_or_message]
Can also use: member_info, member, u, user_info

Returns info about a user.

hazy agate
#

uf

upbeat otter
hazy agate
solemn citrus
#

ik but im learning from other websites to

solemn citrus
#

bruh i have usaco in 10 days :((((

hazy agate
#

yea

sullen shoal
#

replit is shit

upbeat otter
solemn citrus
#

vs code >repl

upbeat otter
#

notepad > vs code, boomer advice

prisma spoke
solemn citrus
#

word doc> notepad>vs code

prisma spoke
#

like choice1 vs choice2

sullen shoal
#

idk what youre talking about

prisma spoke
sullen shoal
#

u

prisma spoke
# sullen shoal u

i mean i want the choices to be displayed like this:-

   choice3here vs choice4here
#

like that

sullen shoal
hazy agate
upbeat otter
hazy agate
#

!discord welcome

maiden fable
#

???

hazy agate
#

bruh

maiden fable
#

O

#

!d discord.on_member_join

unkempt canyonBOT
#

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

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

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

bruh

sullen shoal
#

idk how to explain more than that. you have to use your brain

prisma spoke
#
my_list = [k for k in users]

@bot.command()
async def brackets(ctx,p:int):
 
    while 0!=p:
        a = (list(pairwise(my_list)))


        await ctx.send(a)
        
        p-=1``` @sullen shoal
#

this gave all values from the list

sullen shoal
#

okay ¯\_(ツ)_/¯

prisma spoke
sullen shoal
#

shuffle the list then

prisma spoke
#

how to shuffle?

sullen shoal
#

!d random.shuffle

unkempt canyonBOT
#

random.shuffle(x[, random])```
Shuffle the sequence *x* in place.

The optional argument *random* is a 0-argument function returning a random float in [0.0, 1.0); by default, this is the function [`random()`](https://docs.python.org/3/library/random.html#random.random "random.random").

To shuffle an immutable sequence and return a new shuffled list, use `sample(x, k=len(x))` instead.

Note that even for small `len(x)`, the total number of permutations of *x* can quickly grow larger than the period of most random number generators. This implies that most permutations of a long sequence can never be generated. For example, a sequence of length 2080 is the largest that can fit within the period of the Mersenne Twister random number generator.

Deprecated since version 3.9, will be removed in version 3.11: The optional parameter *random*.
prisma spoke
#

and then do i have to remove itertools?

sullen shoal
#

!e

from random import shuffle
foo = [1,2,3,4,5,6,7,8]
shuffle(foo)
print(foo)
unkempt canyonBOT
#

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

[3, 2, 4, 8, 5, 1, 6, 7]
prisma spoke
#

it wudnt print it twice?

sullen shoal
#

shuffle doesn't return the list instead it replaces the orignal list

prisma spoke
sullen shoal
#

im not helping with this more, this is basic python and and im not here to teach python

prisma spoke
#

did u even get my question?

sullen shoal
#

it is basic

prisma spoke
#

u didnt even get my question wow

sullen shoal
#

i did get your question and provided all the stuff you need for it. i will not spoonfeed

sullen shoal
#

you want to shuffle the list, make sublists of it each containing 2 items then pretty print the list

sullen shoal
#

get a random item from the list? that wasnt in your question or it wasn't clearly said

prisma spoke
sullen shoal
#

what do you want

prisma spoke
sullen shoal
#

isnt that basically shuffling the list?

prisma spoke
#

replaces with a new one..

sullen shoal
#

so what

prisma spoke
#

nd u also didnt tell that how to make pairs of 2

slate swan
sullen shoal
#

thats where the basics of python come to play

prisma spoke
#

thing

sullen shoal
#
>>> import random
>>> import itertools
>>> foo = list(range(0, 10))
>>> random.shuffle(foo)
>>> list(itertools.pairwise(foo))
[(6, 5), (5, 0), (0, 2), (2, 8), (8, 9), (9, 3), (3, 1), (1, 4), (4, 7)]
>>>
slate swan
#

Shuffle the list then make pairs, he basically already told you how

#

And now he spoonfeed you 😔🖐️

sullen shoal
#

bro i cant control myself, its too painful

slate swan
#

True 😔

sullen shoal
#

bruh

slate swan
#

Bruh

#

Range is one of the first things you learn when getting into python 😭

sullen shoal
#

it wasnt even the question, they already had a list

prisma spoke
#

ik it was in rand.choice but not itertools

sullen shoal
#

i used range to create the list to give the example

slate swan
#

He used itertools to pair the items

shadow wraith
#

how do i make the bot dm the help

#

i use MinimalHelpCommand btw

sullen shoal
#

!d discord.User.send

unkempt canyonBOT
#

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

Sends a message to the destination with the content given.

The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.

To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") objects. **Specifying both parameters will lead to an exception**.

To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
sullen shoal
#

or discord.Member.send

shadow wraith
#

no i have my minimal help command in a class

sullen shoal
#

so what

shadow wraith
#
class MyNewHelp(commands.MinimalHelpCommand):
    async def send_pages(self):
        destination = self.get_destination()
        for page in self.paginator.pages:
            emby = discord.Embed(description=page)
            await destination.send(embed=emby)
        async def on_help_command_error(error):
            await destination.send("We had an error. Try running the command again.")```
slate swan
#

Iirc there's the context attribute

#

Weird

shadow wraith
#

:troll:

slate swan
#

Must've been another class then

sullen shoal
#

!d discord.ext.commands.HelpCommand.context

unkempt canyonBOT
slate swan
#

Yeah that

sullen shoal
#

Minimal one is subclass of this one

shadow wraith
#

subclass help command = pog

velvet tinsel
#

hai myxi

#

hai kraots

sullen shoal
#

hello

slate swan
#

Hi dp

#

I regret saying that

velvet tinsel
#

....dp....

slate swan
#

download python

#

I didn't mean the other thing 😭

sullen shoal
#

pp

velvet tinsel
#

oh no

slate swan
#

Y'all dirty minded 😔🖐️

velvet tinsel
#

😳

sullen shoal
#

python programming

velvet tinsel
#

😂

#

I like pp as well

slate swan
upbeat otter
sullen shoal
upbeat otter
#

I enter and see this lmao

tawdry perch
#

can I get a docs for using pagination

velvet tinsel
#

python programming

tawdry perch
#

really funny

upbeat otter
velvet tinsel
#

I also like d's
wanna see my d?

slate swan
tawdry perch
#

ooh

#

hm this will be interesting task

unkempt canyonBOT
#

Hey @velvet tinsel!

It looks like you tried to attach file type(s) that we do not allow (.jfif). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a, .csv, .json.

Feel free to ask in #community-meta if you think this is a mistake.

velvet tinsel
#

f
my d ;-;

sullen shoal
#

i made my paginator once and now i can copy paste it anywhere i want ez life

velvet tinsel
#

my d is nice 🙂

vocal plover
#

I'd like to express my deepest condolences for anyone who has had the misfortune of writing:

  • a paginator
  • a scheduler
upbeat otter
velvet tinsel
#

whats a paginator

upbeat otter
velvet tinsel
#

oh
sweet
thats easy

sullen shoal
prisma spoke
#

@sullen shoal i dont need range..

        a =random.shuffle(my_list)
        b = list(itertools.pairwise(a))
        await ctx.send(a)
        await ctx.send(b)```
upbeat otter
velvet tinsel
velvet tinsel
#

I always thought I was the same with other people?

upbeat otter
velvet tinsel
tawdry perch
#

so.. to make a paginator I need a check function, reactions and event to wait for reaction?

upbeat otter
prisma spoke
sullen shoal
#

buttons are easier to manage

velvet tinsel
#

yay

sullen shoal
#

my paginator is just around 150 lines, it was ez

vocal plover
tawdry perch
vocal plover
prisma spoke
sullen shoal
vocal plover
#

I reckon I can do it in 50 lines mmLol

sullen shoal
tawdry perch
vocal plover
#

nah one is just painful

prisma spoke
#

!OT

unkempt canyonBOT
sullen shoal
#

it isnt offtopic tbh

slate swan
sullen shoal
#

nice

tawdry perch
#

I don't even know where to start ;-;

#

should I make it to be a class or smth

boreal ravine
boreal ravine
#

maybe

prisma spoke
#

@bot.command()
async def brackets(ctx,p:int):
 
    while 0!=p:
        a =random.shuffle(my_list)
        b = list(itertools.pairwise(a))
        await ctx.send(a)
        await ctx.send(b)
        
        p-=1```
#
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'NoneType' object is not iterable
prisma spoke
manic wing
#

just so you know, the while loop does nothing

#

its a while True

slate swan
slate swan
#

a is None

prisma spoke
prisma spoke
slate swan
#

As you've already been told, random.shuffle does not return the list, but replaces it

#

So assigning it to a variable will basically be assigning that variable None

prisma spoke
prisma spoke
#

then how to assign a var to it

slate swan
#

idk ¯\_(ツ)_/¯

#

That's all the help I'll give you

#

The rest is pure, basic python

tawdry perch
#

Paginators are weird af

coral flame
#

i have no clue what they are lol

slate swan
tawdry perch
#

not a opinion /j

sullen shoal
#

it was even more weird, now its easy asf

slate swan
#

Paginators are relatively easy

#

All they do is index a list of items and edit the message with the current item

#

And the buttons simply increase or decrease the index

tawdry perch
#

those tasks are hard

coral flame
slate swan
#

Mhm, they're extremely easy

coral flame
#

indeed

boreal ravine
slate swan
#

Yours only has 3 buttons that's why 😔🖐️

sullen shoal
#

instead of making multiple paginators, i just added something that would help me turn off and on some buttons if i dont need

boreal ravine
#

Nice

tawdry perch
slate swan
#

😭

#

It's mostly just basic python 😔🖐️

tawdry perch
#

no I don't consider that as basics

#

how do you even use that paginator?

slate swan
#

💀

slate swan
upbeat otter
boreal ravine
tawdry perch
slate swan
#

?

#

It is

#

But sometimes it's just one embed

#

So there's no need to apply the paginator

tawdry perch
#

visible confusion

rigid torrent
#

How to make a bot that will create channels and manage permission of that channel?

slate swan
#

heyyy

#

im trying to send images before texts

#
await channel.send(f"{member.mention} Welcome to our server. Check out {rules.mention} and {roles.mention}", file = file)
#

but i can't

sullen shoal
#

send the image first then send the message

prisma spoke
#

how to get the number of ppl in a voice channel?

slate swan
#

it looks really awkward

sullen shoal
#

try embed then

prisma spoke
#

i didnt?

slate swan
#

my frnd said he doesn't need embed

slate swan
sullen shoal
#

then you cant

#

its just discord's ui thats trash

slate swan
slate swan
sullen shoal
#

theyre doing the same thing, sending the image first

slate swan
#

ohhh so sending the image first?

sullen shoal
#

yeah

slate swan
#

ok anyways

#

thanks for ur help

sullen shoal
#

np

prisma spoke
rigid torrent
#

@sullen shoal

sullen shoal
sullen shoal
unkempt canyonBOT
slate swan
#

hey so i am trying to make a named !start to be used by 1 player in a lifetime
and i have a sql database to store info its just its creating a new record for each user

@bot.command()
async def start(ctx):
    player = ctx.author
    conn = sqlite3.connect('test.sql')
    c = conn.cursor()
    c.execute(f"INSERT INTO data VALUES ('{player.id}', 100, 0, 0, 0,'TRUE')")
    c.execute(f'UPDATE data SET start_used = start_used+TRUE WHERE ID = {player.id}')
    conn.commit()
    await ctx.send('you have started your journey with **100:nexus:** in your balance')
    if c.execute(f"SELECT * FROM data WHERE start_used=TRUE"):
        return await ctx.reply("Command already used by this member.")
    conn.close()
#

it made multiple records for the same user

coral flame
#

make it so that it returns if they are already in there

sullen shoal
#

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

sullen shoal
#

include whats not working more specifically

slate swan
rigid torrent
#

Undefined named ctx ...

slate swan
rigid torrent
coral flame
rigid torrent
#

Did

slate swan
upbeat otter
slate swan
sullen shoal
slate swan
#

look at dis

2 ID's here are same because he typed the command 2 times

narrow notch
sullen shoal
narrow notch
#

Thx

sullen shoal
#

if isinstance(ctx.author, guild.owner)

slate swan
#

try it

#

i actually never used guild.owner

prisma spoke
#

no ig

sullen shoal
#

yes

#

!d isinstance

unkempt canyonBOT
#

isinstance(object, classinfo)```
Return `True` if the *object* argument is an instance of the *classinfo* argument, or of a (direct, indirect, or [virtual](https://docs.python.org/3/glossary.html#term-abstract-base-class)) subclass thereof. If *object* is not an object of the given type, the function always returns `False`. If *classinfo* is a tuple of type objects (or recursively, other such tuples) or a [Union Type](https://docs.python.org/3/library/stdtypes.html#types-union) of multiple types, return `True` if *object* is an instance of any of the types. If *classinfo* is not a type or tuple of types and such tuples, a [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "TypeError") exception is raised.

Changed in version 3.10: *classinfo* can be a [Union Type](https://docs.python.org/3/library/stdtypes.html#types-union).
narrow notch
#

Same here

slate swan
#

tbh i never use that also

#

its just there was no need for me to dm or make a command for guild.owner

#

for my discord bot

slate swan
#

Because the .author is an instance of Member and so is .owner

#

I'd just check if each of their ids is the same

sullen shoal
#

oh yeah, i just realised

#

@slate swan compare the id instead

#

you can use == if you want to compare id

velvet tinsel
velvet tinsel
tawdry perch
velvet tinsel
#

Good for you

tawdry perch
#

The whole system is hard

velvet tinsel
#

💀

tawdry perch
#

I can only create a very bad imaginary example that will not even work

#

pass list of embeds -> use reaction event -> change the index of list. Would it work in theory?

slate swan
#

thats what pagination is.

tawdry perch
#

oh..

#

then it should be pretty easy, just a class, a function (+ some random stuff).

slate swan
#

what are you trying to do tho?

sullen shoal
#

which imo isnt as good as button paginators

tawdry perch
tawdry perch
sullen shoal
#

and easier to manage

tawdry perch
#

Hmm I will ask in server where the bot is in at to know which one they prefer

rocky mist
#

what have i done?

velvet tinsel
#

Something

#

It seems like you put a colon

#

And didn’t put anything beneath

rocky mist
velvet tinsel
#

Now that you said that I regret helping you

rocky mist
velvet tinsel
#

Idk I don’t think you can do that

icy ledge
#

how do I get messages I was mentioned/replied to in while my bot was offline? (similar to the red circle with a number of mentions on it on user accounts)

sullen shoal
#

!d discord.TextChannel.history

unkempt canyonBOT
#

async for ... in history(*, limit=100, before=None, after=None, around=None, oldest_first=None)```
Returns an [`AsyncIterator`](https://discordpy.readthedocs.io/en/master/api.html#discord.AsyncIterator "discord.AsyncIterator") that enables receiving the destination’s message history.

You must have [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permissions to use this.

Examples

Usage...
sullen shoal
#

n/100 = api calls

#

where n is the limit you provide

#

@icy ledge

prisma spoke
#

!d discord.VoiceChannel.members

unkempt canyonBOT
icy ledge
#

@sullen shoal bruh am I supposed to do this on all channels only to check for the mentions in them?

prisma spoke
sullen shoal
#

it was offline, thats our fault

icy ledge
#

that doesn't make sense, discord gets me all the mentions even if they were one month old and very deep in the chat

#

that red circle with the num of mentions on it

sullen shoal
#

bots are limited to see history of only like 20 days

tiny ibex
#
Ignoring exception in on_command_error
Traceback (most recent call last):
  File "c:\Users\phoen\OneDrive\Desktop\some-random-shit\main.py", line 1217, in help
    desc = help.get(cmd)
AttributeError: 'Command' object has no attribute 'get'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\phoen\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\core.py", line 175, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\Users\phoen\OneDrive\Desktop\some-random-shit\main.py", line 1221, in help
    desc = help.get(cmd)
AttributeError: 'Command' object has no attribute 'get'```
#

Can someone help

icy ledge
#

what I'm saying this is that would take forever especially if you are on a lot of big servers
there must be a method to do it

prisma spoke
sullen shoal
tiny ibex
icy ledge
#

oh u mean there is a method but it's only for user accounts not for bots?

prisma spoke
#

what are u tryn to do

tiny ibex
sullen shoal
lament mesa
tiny ibex
prisma spoke
lament mesa
tiny ibex
#

Tysm

#

I changed it and it works

#

TYSM

prisma spoke
#

@sullen shoal channel = client.get_channel(864103846494470154, 882287663875502152)1 is this way to get channels correct?

sullen shoal
#

you have to iterate through the list of channel id

prisma spoke
# sullen shoal no

channel = 864103846494470154, 882287663875502152 members = channel.members if len(members) <3: await ctx.message.add_reaction('⏭') ctx.voice_state.skip()?

sullen shoal
#

channel is a tuple there

#

and it wont work

tiny ibex
#

ctx.guild.owner

sullen shoal
#

what do you have

#

guild.owner

#

oh

#

!d discord.Guild.owner

unkempt canyonBOT
#

property owner: Optional[discord.member.Member]```
The member that owns the guild.
sullen shoal
#

show the declaration of guild

prisma spoke
# sullen shoal you have to iterate through the list of channel id

channel = client.get_channel(864103846494470154) channel2 = client.get_channel(882287663875502152) members = channel.members if len(members) <3: await ctx.message.add_reaction('⏭') ctx.voice_state.skip() members2 = channel2.members if len(members2) <3: await ctx.message.add_reaction('⏭') ctx.voice_state.skip()
?

tiny ibex
#

Oof

sullen shoal
#

doesn't work that way my guy

#

none of your tokens will work until the ratelimit is over

#

it doesn't care about ip once its ratelimited

kindred drum
#

yo

#

anyone got any ideas as to why this doesn't output anything? @bot.event async def on_reaction_add(reaction, user): if reaction.emoji == ':thumbsup:': print("he")

slate swan
#

because your if statement is not fulfilled

#

use str(reaction.emoji) instead

kindred drum
#

outputs this @bot.event async def on_reaction_add(reaction, user): if reaction.emoji == ':thumbsup:': print("he") which I don't understand - I removed user btw as it doesn't make sense to be there for now

#

outputs this ```TypeError: on_reaction_add() takes 1 positional argument but 2 were given

slate swan
#

helpt pls

sullen shoal
#

let the error raise

#

it will provide useful information to debug

kind topaz
#

Is there an effective way to continuously play music from a queue? I have tried loops and realized they don't necessarily wait for the current song to finish before playing the next song.

#

That is, it should be able to play each song at a time and wait for the current song to finish before playing the next.

#

So far I have only figured out how to append the song a person choses to the queue using a "play" command

prisma spoke
#
    embed = nextcord.Embed(title=f"Match Records for {match}", colour = nextcord.Color.red())
    embed.add_field(name="MAP", value=mapformatch, inline=True)
    embed.add_field(name="MODE", value=matchmode,inline=False)
    embed.add_field(name="1ST TEAM PLAYERS",value=teamonename, inline=True)
    embed.add_field(name="2ND TEAM PLAYERS", value=teamtwoname, inline=True)
    embed.add_field(name="WINNER", value=winner, inline=False)
    await channel.send(embed=embed)```
is there any way i can move the MODE Text to near the Map text and Then the next line will have the 1stteam 2nd tea, players then next line will have the winners
#

is there any way i can make the embed structure like that?

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)
kindred drum
#
async def on_reaction_add(reaction):
    if reaction.emoji == ':thumbsup:':
        print("he")```
 
outputs this 
```TypeError: on_reaction_add() takes 1 positional argument but 2 were given```
slate swan
#
admin_role = get(guild.roles, name="Admin")
#

is that fine? it says get is not defined

sullen shoal
velvet tinsel
#

“Just play with it” should be the new slogan to replace “just do it”

#

I need a Christmas profile picture

prisma spoke
slate swan
#

the code:
admin_role = get(guild.roles, name="Admin")
fetches this error:
NameError: name 'get' is not defined

prisma spoke
sullen shoal
velvet tinsel
#

Myxi

sullen shoal
#

?

velvet tinsel
#

Hi

sullen shoal
#

hello

slate swan
velvet tinsel
#

Time to code 👨‍💻

slate swan
#

iirc there's another one for "raw reactions" which doesn't need the cache or anything, use that event instead

upbeat otter
velvet tinsel
slate swan
velvet tinsel
#

World Annotation Organisation?

slate swan
#

no

#

wao

upbeat otter
slate swan
#

damn

velvet tinsel
#

Wet air oxidation?

upbeat otter
#

lol

shadow wraith
#

💀

velvet tinsel
#

Wild animal orphanage

shadow wraith
#

working auto oxygen

kindred drum
#

AttributeError: 'NoneType' object has no attribute 'send'

kindred drum
#
async def on_ready():
    Channel = bot.get_channel('915552800350535750')
    Moji = await Channel.send("se")
    await bot.add_reaction(Moji, emoji='🏃')```
shadow wraith
#

💀

velvet tinsel
#

Does the channel exist?

kindred drum
#

yes

upbeat otter
upbeat otter
velvet tinsel
#

It’s a string

#

It will return None I think

shadow wraith
#

it's a string..

#

ye @velvet tinsel is right

#

use int not str

#

bot.get_channel(id_here)

velvet tinsel
#

It’s supposed to be an int

shadow wraith
#

not bot.get_channel('id_here')

velvet tinsel
#

@upbeat otter are you there to correct me

#

😭

velvet tinsel
slate swan
#

!e

velvet tinsel
#

It’s supposed to be an int I think

#

Am I right Eevee

upbeat otter
#

yes

velvet tinsel
#

Yay

kindred drum
#
async def on_ready():
    Channel = bot.fetch_channel(915552800350535750)
    Moji = await Channel.send("se")
    await bot.add_reaction(Moji, emoji='🏃')
@bot.event
async def on_reaction_add(reaction, user):
    Channel = user.fetch_channel(915552800350535750)
    if reaction.message.channel.id != Channel:
        return
    if reaction.emoji == "🏃":
      Role = discord.utils.get(user.server.roles, name="Verified")
      await bot.add_roles(user, Role)``` 
RuntimeWarning: coroutine 'Client.fetch_channel' was never awaited
  pass
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
shadow wraith
#

how do i make minimalhelpcommand dm user the minimal help command :troll:

shadow wraith
#

wait client.fetch_channel?

velvet tinsel
#

Why not get_channel

kindred drum
kindred drum
velvet tinsel
#

Did he just all of a sudden change the code

shadow wraith
#

i dont see that in your cod

#

bru

velvet tinsel
#

;-;

#

didnt listen innit

kindred drum
#

i did

shadow wraith
#

it's get_channel im pretty sure

kindred drum
#

but then I looked at previous code

#

which uses fetch

shadow wraith
#

crab game

kindred drum
#
AttributeError: 'Bot' object has no attribute 'add_reaction'```
velvet tinsel
#

crab...game?

kindred drum
#
async def on_ready():
    Channel = bot.get_channel(915552800350535750)
    Moji = await Channel.send("se")
    await bot.add_reaction(Moji, emoji='🏃')
@bot.event
async def on_reaction_add(reaction, user):
    Channel = user.get_channel(915552800350535750)
    if reaction.message.channel.id != Channel:
        return
    if reaction.emoji == "🏃":
      Role = discord.utils.get(user.server.roles, name="Verified")
      await bot.add_roles(user, Role)
shadow wraith
velvet tinsel
#

yeah get_channel should work

shadow wraith
#

:troll:

velvet tinsel
#

!d discord.get_channel

kindred drum
#

the channel works

velvet tinsel
#

hurrrr

kindred drum
#

but the adding the reaction doesn't

slate swan
#
    await guild.create_text_channel(f'{member} ID: {member.id}', overwrites=overwrites)

How do I get the ID of the channel that has just been created?

velvet tinsel
#

@unkempt canyon goddammit

slate swan
velvet tinsel
kindred drum
#

oof which is

velvet tinsel
#

it's because you have to do bot.wait_for

kindred drum
#

😕

velvet tinsel
#
member = ctx.author
await member.send()

something like this @shadow wraith

slate swan
velvet tinsel
slate swan
#
async def on_member_join(member):
    guild = member.guild
    role_id = 915916789152641046
    admin_role = guild.get_role(role_id)
    overwrites = {
    guild.default_role: discord.PermissionOverwrite(read_messages=False),
    member: discord.PermissionOverwrite(read_messages=True),
    admin_role: discord.PermissionOverwrite(read_messages=True)
}
    await guild.create_text_channel(f'{member} ID: {member.id}', overwrites=overwrites)
    #await channel.send("hi")
velvet tinsel
slate swan
#

need the channel ID to send the message

shadow wraith
# velvet tinsel it should work
class MyNewHelp(commands.MinimalHelpCommand):
    async def send_pages(self):
        destination = self.get_destination()
        for page in self.paginator.pages:
            emby = discord.Embed(description=page)
            await destination.send(embed=emby)
        async def on_help_command_error(error):
            await destination.send("We had an error. Try running the command again.")

bot.help_command = MyNewHelp()
velvet tinsel
shadow wraith
#

ignore on_help_command_error

#

it still works

#

even tho that is there but how do i make the bot dm the user

velvet tinsel
#

you didn't apply ctx.author

#

or am I just bad at classes

shadow wraith
#

wait so ctx works in class 🤔

velvet tinsel
#

idk

shadow wraith
#

grab my code and check if that works

velvet tinsel
#

maybe dont make a class

shadow wraith
#

that will send it in the current channel but i want it to dm

kindred drum
velvet tinsel
kindred drum
#

which is

velvet tinsel
shadow wraith
#

how tf am i gonna get the bot to dm the user who used command

#

if i only hav 2 solutions

velvet tinsel
#

Crab game was a game made by Dani

kindred drum
#

do I need to do like await bot.wait_for(Moji)?

velvet tinsel
#

No

#

“reaction” and also make a check

kindred drum
#

await bot.wait_for(reaction)

#

what am I checking for? if the message is there?

#

or

velvet tinsel
#

No

#

I’ll give you some doc

#

Funny doc

kindred drum
#

you want me to read it all/

velvet tinsel
#

The link should specify to wait for

#

Just do CTRL f

slate swan
#
@bot.event # Autobanning members and or assigning roles function!
async def on_member_join(member):
    guild = member.guild
    role_id = 915916789152641046
    admin_role = guild.get_role(role_id)
    overwrites = {
    guild.default_role: discord.PermissionOverwrite(read_messages=False),
    member: discord.PermissionOverwrite(read_messages=True),
    admin_role: discord.PermissionOverwrite(read_messages=True)
}
    create_channel = guild.create_text_channel(f'{member} ID: {member.id}', overwrites=overwrites)
    await(create_channel)
    channelID = create_channel.id
    await channelID.send("hi")

AttributeError: 'coroutine' object has no attribute 'id'

#

anyone know how to fix, ik whats wrong

kindred drum
slate swan
#

ok how do I fetch the ID

#

it should return it as long as it was awaited

#

so that should be create_channel.id

#
    create_channel = await guild.create_text_channel(f'{member} ID: {member.id}', overwrites=overwrites)
    channelID = create_channel.id
    await channelID.send("hi")
#

so like that?

#

ah, don't send messages to the channel id

#

whenever you do create_text_channel, it returns the entire channel object itself

#

so instead do await create_channel.send("hi")

#

alr lemme try

#

the id isn't really needed in this case

#

yuh it worked, ty g

#

np

kindred drum
#

yo @slate swan you know a practical solution to this @bot.event async def on_ready(): Channel = bot.get_channel(915552800350535750) Moji = await Channel.send("se") await bot.add_reaction(Moji, emoji='🏃') @bot.event async def on_reaction_add(reaction, user): Channel = user.get_channel(915552800350535750) if reaction.message.channel.id != Channel: return if reaction.emoji == "🏃": Role = discord.utils.get(user.server.roles, name="Verified") await bot.add_roles(user, Role)

#

the error comes up that bot doesn't have the attribute add reaction

slate swan
#

ah

#

on_reaction_add is wonky af iirc

#

try checking discord.py's api ref for on_raw_reaction_add

#

it's a bit of a pain to work with but it should work perfectly

#

i've had to use it before to restrict reactions on a joke bot

visual island
unkempt canyonBOT
#

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

Add a reaction to the message.

The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji").

You must have the [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission to use this. If nobody else has reacted to the message using this emoji, the [`add_reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.add_reactions "discord.Permissions.add_reactions") permission is required.
slate swan
#

i'm more surprised they got on_reaction_add working lol, i can never get it working right

visual island
#

that means the message isn't in cache

#

possibly because the message is sent before the bot's online

slate swan
#

yeah, i had to figure that out the hard way

kindred drum
#
AttributeError: 'Member' object has no attribute 'get_channel'```
visual island
#

instead of user

#

oh wait, user is Member object, you can do user.guild then

slate swan
#
await create_channel.send(input1 = input("Hello Please type somethign"))

How do I get something like this to work

prisma spoke
#

how to get the list of how many commands are present in the bot?

kindred drum
#

make a command and manually type them

#

🆒

prisma spoke
#

for commands in commands.Bot

slate swan
prisma spoke
velvet tinsel
#

It’s built in

#

Like !help

prisma spoke
#

i made a dynamic help cmd..

visual island
#

!d discord.ext.commands.Bot.commands

unkempt canyonBOT
#

property commands: Set[discord.ext.commands.core.Command[discord.ext.commands.core.CogT, Any, Any]]```
A unique set of commands without aliases that are registered.
supple thorn
unkempt canyonBOT
#

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

Waits for a WebSocket event to be dispatched.

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

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

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

This function returns the **first event that meets the requirements**...
steel oasis
#

I want it to search for a name in the site

#

here's my code so far

#
@bot.command()
async def checklb(ctx, player):
    lbb = requests.get(url)
    lbb = checklb.json()
    lbchecker=lbb['duelelo'][player]
tawdry perch
#

absolutely not stolen and modified pagination

steel oasis
slate swan
#

guys, help?
errorAttributeError: module 'discord' has no attribute 'Intents'

steel oasis
#

;-;

visual island
visual island
tawdry perch
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
tawdry perch
#

hmm

steel oasis
#

maybe like ```py
thithing = discord

sage otter
#

that’s not what he meant….

steel oasis
kindred drum
#

AttributeError: 'Guild' object has no attribute 'role'

#
      Role = discord.utils.get(user.guild.role, name="Verified")
      await user.add_role(user, Role)```
slate swan
#
@bot.event # Autobanning members and or assigning roles function!
async def on_member_join(member):
    guild = member.guild
    role_id = 915916789152641046
    admin_role = guild.get_role(role_id)
    overwrites = {
    guild.default_role: discord.PermissionOverwrite(read_messages=False),
    member: discord.PermissionOverwrite(read_messages=True),
    admin_role: discord.PermissionOverwrite(read_messages=True)
}
    create_channel = await guild.create_text_channel(f'{member} ID: {member.id}', overwrites=overwrites)
    await create_channel.send("Hello Please type somethign")
    computer = random.randint(1, 10)
    await create_channel.send('Guess my number')
    def check(msg):
        return msg.author == member.author and msg.channel == member.channel and int(msg.content) in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    msg = await bot.wait_for("message", check=check)
    if int(msg.content) == computer:
        await create_channel.send("Correct")
    else:
        await create_channel.send(f"Nope it was {computer}")

Fetches this error

AttributeError: 'Member' object has no attribute 'author'

steel oasis
vale jasper
#

!helpç

kindred drum
#
AttributeError: 'Member' object has no attribute 'add_role'```
await user.add_role(user, Role)
steel oasis
#
Ignoring exception in command checklb:
Traceback (most recent call last):
  File "C:\Users\subha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\Users\subha\Desktop\Good code\MAINBOT.py", line 351, in checklb
    lbchecker=lbb['duelelo'][player]
TypeError: 'Response' object is not subscriptable

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

Traceback (most recent call last):
  File "C:\Users\subha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\subha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\subha\AppData\Local\Programs\Python\Python39\lib\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: TypeError: 'Response' object is not subscriptabl
``` error
```py
@bot.command()
async def checklb(ctx, player):
    lbb = requests.get(url)
    lbb.json()
    lbchecker=lbb['duelelo'][player]
    await ctx.send(lbchecker)
``` my cmd
smoky bloom
#

Hi
I wanted to ask what is the best ide for discord.py?

steel oasis
sage otter
#

That’s not an IDE

steel oasis
#

best for everything

sage otter
#

That’s a text editor

steel oasis
sage otter
sage otter
smoky bloom
#

Alright im gonna try that
Thx

sage otter
#

VSC is just a wannabe IDE

steel oasis
#

lmao

slate swan
steel oasis
#
Ignoring exception in command checklb:
Traceback (most recent call last):
  File "C:\Users\subha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\Users\subha\Desktop\Good code\MAINBOT.py", line 351, in checklb
    lbchecker=lbb['duelelo'][player]
TypeError: 'Response' object is not subscriptable

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

Traceback (most recent call last):
  File "C:\Users\subha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\subha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\subha\AppData\Local\Programs\Python\Python39\lib\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: TypeError: 'Response' object is not subscriptabl
``` error
```py
@bot.command()
async def checklb(ctx, player):
    lbb = requests.get(url)
    lbb.json()
    lbchecker=lbb['duelelo'][player]
    await ctx.send(lbchecker)
``` my cmd
sage otter
steel oasis
kindred drum
#
discord.errors.NotFound: 404 Not Found (error code: 10011): Unknown Role``` But I know the role is correct - ``` Role = discord.utils.get(user.guild.roles,name="Verified")```
steel oasis
#
Ignoring exception in command checklb:
Traceback (most recent call last):
  File "C:\Users\subha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\Users\subha\Desktop\Good code\MAINBOT.py", line 351, in checklb
    lbchecker=lbb['duelelo'][player]
TypeError: 'Response' object is not subscriptable

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

Traceback (most recent call last):
  File "C:\Users\subha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\subha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\subha\AppData\Local\Programs\Python\Python39\lib\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: TypeError: 'Response' object is not subscriptabl
``` error
```py
@bot.command()
async def checklb(ctx, player):
    lbb = requests.get(url)
    lbb.json()
    lbchecker=lbb['duelelo'][player]
    await ctx.send(lbchecker)
``` my cmd
tawdry perch
#

print lbb

steel oasis
#

ohhh rightt

#

same error

slate swan
#

try something like this:

lbb = requests.get(url).json

## or this

lbb = requests.get(url)
lbb = lbb.json()```
#

Now raises this:
Code:

async def on_member_join(member):
    guild = member.guild
    role_id = 915916789152641046
    admin_role = guild.get_role(role_id)
    overwrites = {
    guild.default_role: discord.PermissionOverwrite(read_messages=False),
    member: discord.PermissionOverwrite(read_messages=True),
    admin_role: discord.PermissionOverwrite(read_messages=True)
}
    create_channel = await guild.create_text_channel(f'{member} ID: {member.id}', overwrites=overwrites)
    await create_channel.send("Hello Please type somethign")
    computer = random.randint(1, 10)
    await create_channel.send('Guess my number')
    def check(msg):
        return msg.author == member and msg.channel == member.channel and int(msg.content) in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    msg = await bot.wait_for("message", check=check)
    if int(msg.content) == computer:
        await create_channel.send("Correct")
    else:
        await create_channel.send(f"Nope it was {computer}")

Error: AttributeError: 'Member' object has no attribute 'channel'

tawdry perch
#

member is a guild user like you, it does not have a channel

smoky bloom
# sage otter PyCharm is widely used. It’s also what I use as well.

Hey idk why i am getting this error with pycharm
aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host discord.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')]
Do you know how to fix this?

slate swan
#

I have this error in all the codes: AttributeError: module 'discord' has no attribute 'Intents'

kindred drum
#

discord.errors.NotFound: 404 Not Found (error code: 10011): Unknown Role

      await user.add_roles(user, Role)```
sage otter
smoky bloom
tawdry perch
slate swan
sage otter
kindred drum
#

I know its correct

tawdry perch
#

try again, re check it

sage otter
#

Make sure that’s the right guild, the role exists, caps matter.

slate swan
kindred drum
#

it is

kindred drum
#

still didn't work

#

same error

tawdry perch
#

you sure you are giving the correct ID?

kindred drum
#

ye

tawdry perch
#

do <@&roleid> and see if it gives role

#

manually in channel*

kindred drum
#

it returns

#

Unknown user but its copied and pasted

tawdry perch
#

if you did <@&roleid> it should give you a role mention in there, else it will say smth like "invalid role" ig

#

if you pass wrong role ID

slate swan
#

perhaps try grabbing the role and using guild.get_role?

roleObj = user.guild.get_role(roleID)

await user.add_roles(roleObj)```
velvet tinsel
#

Cyberweapon being a pro

tawdry perch
#

how come?

kindred drum
velvet tinsel
#

Cyberweapon still being a pro

slate swan
#

so you can be absolutely sure you're grabbing the right one

boreal ravine
#

died

rigid torrent
#

!

slate swan
rigid torrent
#

!role

velvet tinsel
#

I don’t know what’s happening so I’m just going to watch

tawdry perch
#

@kindred drum what did you want to do again?

slate swan
#

Hi guysyert

#

but utils.get wasn't working out apparently so i suggested guild.get_role and adding it to the user object

boreal ravine
#

!d discord.Member.add_roles <= @kindred drum

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.
tawdry perch
#

try: ```py
role = ctx.guild.get_role(ID_OF_ROLE)

slate swan
#

so i assumed it was a member obj

boreal ravine
velvet tinsel
velvet tinsel
slate swan
#

bro my brain just shut down and i could not figure out what that second emote was lmfaoooo

#

1st one tho 👀

velvet tinsel
#

🍺

slate swan
slate swan
slate swan
velvet tinsel
#

I drink milk a lot

slate swan
#

i'm lactose intolerant

tawdry perch
slate swan
velvet tinsel
slate swan
velvet tinsel
#

With my breakfast cereal

slate swan
#
roleObj = user.guild.get_role(roleID)

await user.add_roles(roleObj)```
boreal ravine
#

cringe variable naming

slate swan
slate swan
sage otter
#

pep8 song - camelCase is not for Python

slate swan
#

AGHGHGHHHHGHGHHAHHAAAAAAAAAAAintensescreamingsoundscontinue = 1

tawdry perch
boreal ravine
slate swan
#

i can't stand anything but camelCase

tawdry perch
#

I prefer ςץ๒єгฬєคק𝖔ภ case

sage otter
#

that’s like js/json naming conventions.

slate swan
#

and i love it

sage otter
#

Python you use snake_case

slate swan
tawdry perch
slate swan
#

i just use it cause it looks nice lmao

kindred drum
#
async def on_reaction_add(reaction, user):
    Channel = 915552800350535750
    if reaction.message.channel.id != Channel:
        print(Channel)
        print("invalid channel")
        print(reaction.message.channel.id)
        return
    if reaction.emoji == "🏃":
      role = discord.utils.get(user.guild.roles,name="Verified")
      await user.add_roles(user, role)```
tawdry perch
#

str(reaction.emoji)

slate swan