#discord-bots

1 messages · Page 675 of 1

barren oxide
#

how to make a discord bot?

boreal ravine
#

nope

sage otter
#

Todo is pretty nice

untold token
#

Did you select the bot scope?

upbeat otter
#

of course

untold token
#

and application.commands

sullen shoal
upbeat otter
untold token
#

Make sure you didn't check anything else

boreal ravine
#

but like i dont wanna spend hours making an ai just for a single command

untold token
sage otter
#

It’s pretty simple command concept too

#

List them, allow people to edit, remove, add them.

barren oxide
#

i am new to python

sage otter
#

If you want you can enforce a limit.

untold token
patent lark
upbeat otter
barren oxide
untold token
barren oxide
untold token
#

That's not supposed to happen

sage otter
unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

upbeat otter
sullen shoal
sage otter
#

Fricking playground channel

#

People just flexing their shit

boreal ravine
#

also, if i make a remind command and i set a reminder for like 30 days it wont work since im not running my bot 24/7

barren oxide
patent lark
zenith hare
#

I tried it and it worked, thank u

sage otter
#

Valid

untold token
sage otter
patent lark
#

i do.

sage otter
#

What do you do specifically for time.

#

I see people check db constantly to see if the persons timer is up.

#

I also see people do that with timed mutes, bans, etc

#

They have a task run every second that checks someone’s shit.

untold token
#

That sounds inefficient though

sage otter
#

Didn’t sound like the best way to me either.

#

I don’t really have anything timed on my bot that last for that long.

#

I got like a Loop.call_later() in one of my commands that lasts for like 1-2 minutes.

patent lark
#

well

boreal ravine
patent lark
#

it would be inefficient to check every x minutes though, say your timer is set for 10 minutes, and you check every 3 minutes. at some point you'll check with one minute left, therefore being 2 minutes late

boreal ravine
#

whats the best way of converting !remindme 24h, 24h to 24 hours?

sage otter
#

str.endswith("h"), slice, process

patent lark
#

i wrote a clean time converter function to handle that

sullen shoal
#

i just made it a slash command

sick birch
sage otter
#

or you could just do the funny way and just make a separate argument for each unit of time. omegalul

sick birch
#

regex 👍

untold token
boreal ravine
heavy folio
#

you can use robo danny's remind command as a ref

sage otter
#

That shit is like a smooth 10k lines long

heavy folio
sick birch
sick birch
heavy folio
#
time_regex = re.compile(r"(\d{1,5}(?:[.,]?\d{1,5})?)([smhd])")
time_dict = {"h":3600, "s":1, "m":60, "d":86400}

class TimeConverter(commands.Converter):
    async def convert(self, ctx, argument):
        matches = time_regex.findall(argument.lower())
        time = 0
        for v, k in matches:
            try:
                time += time_dict[k]*float(v)
            except KeyError:
                raise commands.BadArgument("{} is an invalid time-key! h/m/s/d are valid!".format(k))
            except ValueError:
                raise commands.BadArgument("{} is not a number!".format(v))
        return time
```if this is the one you mean
boreal ravine
#

o

boreal ravine
heavy folio
sage otter
#

I hear it was made as a learning bot or something? Example bot if you will?

slate swan
boreal ravine
#

well it was made by danny

heavy folio
#

can i ask for help with 3rd party libs here

boreal ravine
#

sure ig

#

must be related to discord-bots though

heavy folio
#

yeah

slate swan
#

anyone know how to create help cmd ?

heavy folio
slate swan
#

command :L

#

tnx

heavy folio
#

https://pypi.org/project/wikipedia/ so im using this and im just following the docs and stuff ```py
try:
summary = wikipedia.summary(search, sentences=1, chars=250)
except wikipedia.exceptions.DisambiguationError:
return await ctx.reply('Your search query returned a few results. Consider having more precise queries.')
else:
embed.description = f'Here's a summary for your search query:\n{summary}'

slate swan
#

no if you say async def help the server is get error

#

:L

#

yes

#

sure tnx

#

Just remove it
bot.remove_command("help")

#

Idrk

bitter perch
#

Subclass help

#

subclass commands.HelpCommand

slate swan
#

🕴️

#

!d discord.ext.commands.Bot.remove_command

unkempt canyonBOT
#

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

This could also be used as a way to remove aliases.
slate swan
#

Lol

#

Oh, You code a Discord Bot? Share your code with me hyperlemon

obsidian ledge
#

how do i make like the thing where if u send a command but u dont have a correct perms, the bot sends something that tells u that u are missing the permission

slate swan
slate swan
boreal ravine
obsidian ledge
slate swan
#

ok

slate swan
signal magnet
#

quick question

jade tartan
#

Would i be able to let the bot say that hes typing a message?

slate swan
#
git clone https://github.com/Rapptz/

Stealing the whole Profile.

jade tartan
#

Hello

slate swan
#

Hello baka uwu

slate swan
#

Furyo has been in the AFK channel for 8 days

slate swan
jade tartan
#

Would i be able to let the bot say that hes typing a message?

#

As in a @class.event

slate swan
heavy folio
slate swan
#

!tags ctx.trigger_typing

slate swan
heavy folio
#

a big mistake

slate swan
#

!tag ctx.trigger_typing

heavy folio
#

use this instead

slate swan
#

No

untold token
#

Not server_permissions

slate swan
#

ok

slate swan
signal magnet
#

the idea is to have it so that users can enter a title of any length (spaces and all), and optionally provide a page number of results to show

is it possible to have it so that the last argument, if provided as an int, will be passed in as a page number count?

this doesnt seem to work:

async def episodes(self, ctx, *, title, page:int=1)
untold token
#

!d discord.ext.commands.Context.trigger_typing

unkempt canyonBOT
#

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

Triggers a *typing* indicator to the destination.

*Typing* indicator will go away after 10 seconds, or after a message is sent.
slate swan
#

its !d finally

slate swan
signal magnet
untold token
signal magnet
untold token
#

But you need to pass a defaul value in the title argument

slate swan
#

you can make it if None

#

pages = 1

jade tartan
#
async def on_member_join(member):
        guild = client.get_guild(730651046459998218)
        channel = client.get_channel(885464532959526913)
        Myembed = discord.Embed(title= f"Welcome",
        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/)"))
        Myembed.add_field(name="Account Created at:", value=f"<t:{int(member.created_at.timestamp())}:R>" , inline=True)
        await channel.send(embed=Myembed)
        await member.send(embed=Myembed)
        roles_list = ["Unverified","•.¸¸.•:Colours:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Verification:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Age:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Gender:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Sexuality:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•",
        "•.¸¸.•:Distance:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Ethnicity:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Hobbies:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Relationship:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Location:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•",
        "•.¸¸.•::•.¸¸.•`Seeking`•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:DM:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Levels:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Games:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•"]
        for roles in roles_list:
            role = discord.utils.get(member.guild.roles, name=roles)
            await member.add_roles(role)
            def check(r: discord.Reaction, u: Union[discord.Member, discord.User]):
                return u.id == member.mention.id and r.message.channel.id == member.channel.id and \
               str(r.emoji) in ["\U00002705"]
        try:
            reaction, user = await client.wait_for(event = 'reaction_add', check = check, timeout = 45.0)
        except asyncio.TimeoutError:
            await member.send(f"{member.mention}, please react with :white_check_mark: on this message in 45 seconds")
            return
        else:
            if str(reaction.emoji) == "\U00002705":
                return 
            await member.send(f"**{member.mention}**, you didnt react with a ✅ in 45 seconds.")
            await member.kick()``` this didnt kick me off the server
slate swan
#

what the fuck

jade tartan
#

weird

untold token
#

Just pass page 1 by default

signal magnet
#

thats what it currently has

jade tartan
#

Is it await member.kick()

#

?

untold token
#

Yes it is...

signal magnet
#

wouldnt page:int=1 establish the value of one if page isnt given?

slate swan
#

i thought it was user.kick

untold token
#

It would pass 1 as the default value

#

!d discord.Member.kick

unkempt canyonBOT
#

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

Kicks this member. Equivalent to [`Guild.kick()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.kick "discord.Guild.kick").
signal magnet
#

right now the behavior is that the entire thing is interpreted as title

slate swan
#

i am on update 0.1

boreal ravine
#

!hm

signal magnet
#

and it defaults to 1 even if the last argument is a number

untold token
slate swan
#

really didnt have to do me like that

#

Sheeshh Gangster Hood 101

#

anyways

jade tartan
# unkempt canyon

What am trying to do is where it would kick the member if he/she didnt react to the emoji in a certain time frame. Is that right?

heavy folio
#

https://pypi.org/project/wikipedia/ so im using this and im just following the docs and stuff ```py
try:
summary = wikipedia.summary(search, sentences=1, chars=250)
except wikipedia.exceptions.DisambiguationError:
return await ctx.reply('Your search query returned a few results. Consider having more precise queries.')
else:
embed.description = f'Here's a summary for your search query:\n{summary}'

slate swan
#

give us the error bro

signal magnet
#

i guess my question is that if it's possible to have arguments after *, something

jade tartan
#

that doesnt seem right

slate swan
#

"

#

THE " BRO

jade tartan
#

haha am kidding

slate swan
#

Lmao

jade tartan
#

i knew that

slate swan
#

(reason="Really no brain")

jade tartan
#

i wasnt trying to test u

jade tartan
slate swan
#

lmfao

unkempt canyonBOT
#

Hey @heavy folio!

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

heavy folio
#

ok

slate swan
heavy folio
boreal ravine
#

it makes the arguments into keyword arguments and not positional arguments

jade tartan
slate swan
#

there is something wrong with lis = BeautifulSoup(html).find_all('li') but im not sure what it is

jade tartan
#

Will that work?

boreal ravine
#

no

#

get the member object first

slate swan
#

thats like kick no one

#

because you didnt mention who will get kicked

#

you just kick with a reason

jade tartan
jade tartan
#

ohh nvm

boreal ravine
#

it depends on what you mean

jade tartan
#

cuz am only defining member

#

member_kick = member.guild.get_member(user_id)

#

Like this?

boreal ravine
#

yes, then do await member_kick

jade tartan
#

Can i do it like this? member_kick = member.guild.get_member(member.mention)?

heavy folio
#

no

jade tartan
#

make sense

#

since it was User_id

undone wyvern
#

!d discord.Guild.get_member

unkempt canyonBOT
heavy folio
#

ye

undone wyvern
boreal ravine
jade tartan
red sundial
boreal ravine
#

yes

undone wyvern
#

Sure

red sundial
#

alright

slate swan
#

No jk jk

heavy folio
slate swan
#

whats your problem

jade tartan
red sundial
#

hi
im making a tic tac toe game on a bot, and i've checked my code about 10 times now and i can't find an error, if someone could help me i'd appreciate it. so its printing the board but not adding the reactions for the user but i have a while loop for adding the reactions. i don't get why its not working

heavy folio
#

bruh

boreal ravine
jade tartan
#

Yes

boreal ravine
#

you already have it

heavy folio
red sundial
jade tartan
#
async def on_member_join(member):
        guild = client.get_guild(730651046459998218)
        channel = client.get_channel(885464532959526913)
        Myembed = discord.Embed(title= f"Welcome",
        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/)"))
        Myembed.add_field(name="Account Created at:", value=f"<t:{int(member.created_at.timestamp())}:R>" , inline=True)
        await channel.send(embed=Myembed)
        await member.send(embed=Myembed)
        roles_list = ["Unverified","•.¸¸.•:Colours:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Verification:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Age:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Gender:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Sexuality:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•",
        "•.¸¸.•:Distance:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Ethnicity:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Hobbies:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Relationship:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Location:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•",
        "•.¸¸.•::•.¸¸.•`Seeking`•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:DM:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Levels:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Games:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•"]
        for roles in roles_list:
            role = discord.utils.get(member.guild.roles, name=roles)
            await member.add_roles(role)
            def check(r: discord.Reaction, u: Union[discord.Member, discord.User]):
                return u.id == member.mention.id and r.message.channel.id == member.channel.id and \
               str(r.emoji) in ["\U00002705"]
        try:
            reaction, user = await client.wait_for(event = 'reaction_add', check = check, timeout = 45.0)
        except asyncio.TimeoutError:
            await member.send(f"{member.mention}, please react with :white_check_mark: on this message in 45 seconds")
            return
        else:
            if str(reaction.emoji) == "\U00002705":
                return 
            await member.send(f"**{member.mention}**, you didnt react with a ✅ in 45 seconds.")
            member_kick = member.guild.get_member(member_id, /)

boreal ravine
#

why did you send your code

jade tartan
red sundial
# jade tartan Send the error
  File "C:\Users\SOUMITRI\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\Users\SOUMITRI\Desktop\discordGameBot\main.py", line 85, in game
    await load_games(ctx, client)
  File "c:\Users\SOUMITRI\Desktop\discordGameBot\game.py", line 34, in load_games
    await tic_tac_toe(ctx, client)
  File "c:\Users\SOUMITRI\Desktop\discordGameBot\game.py", line 61, in tic_tac_toe
    await msg.add_reaction(emojis[i])
  File "C:\Users\SOUMITRI\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\message.py", line 1223, in add_reaction
    await self._state.http.add_reaction(self.channel.id, self.id, emoji)
  File "C:\Users\SOUMITRI\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 254, in request
    raise HTTPException(r, data)
discord.errors.HTTPException: 400 Bad Request (error code: 10014): Unknown Emoji

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

Traceback (most recent call last):
  File "C:\Users\SOUMITRI\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke   
    await ctx.command.invoke(ctx)
  File "C:\Users\SOUMITRI\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke  
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\SOUMITRI\AppData\Local\Programs\Python\Python310\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: HTTPException: 400 Bad Request (error code: 10014): Unknown Emoji
slate swan
#

Unknown Emoji

jade tartan
red sundial
#

but i copied the emoji from emojipedia

#

so why is it not working

jade tartan
slate swan
#

maybe use :rofl: instead 🤣

jade tartan
#

one

red sundial
#

but i need the number emojis :(

#

are there any other number emojis?

red sundial
jade tartan
red sundial
#

1️⃣

boreal ravine
#

just get the unicode emoji

red sundial
#

2️⃣

slate swan
#

yeah

boreal ravine
slate swan
#

unicode or name of the emoji

red sundial
#

yeah i used this lol

boreal ravine
#

\1️⃣

red sundial
#

the unicode emoji

slate swan
#

then let the code speak

boreal ravine
red sundial
#

@boreal ravine @jade tartan what should i do then?

jade tartan
#

member_kick = ctx.guild.get_member(user_id) like this?

slate swan
#

oh okay

jade tartan
#

well u need to explain to be able to help out

jade tartan
#

we cant help if we dont know

slate swan
#

we can help you dw

jade tartan
#

ok

boreal ravine
#
async def on_member_join(member): # <= just use member
    ...

    await member.kick()
``` no need to fetch the member again @jade tartan
red sundial
#

help me :(

#

i've been stuck on this for the whole night :(

jade tartan
#

then

boreal ravine
jade tartan
#

well i did that before i wrote the reason but it still didnt work

marble oak
#

I'm getting this error.

guild_id = int(data['guild']['id'])
TypeError: string indices must be integers
slate swan
jade tartan
#

before i changed it to the reason one

#

like defining the reason

red sundial
marble oak
# marble oak I'm getting this error. ```py guild_id = int(data['guild']['id']) TypeError: str...

from this code ```py
@client.event
async def on_ready():
guilds = client.guilds
count=0
for guild in guilds:
t = guild.text_channels
v = guild.voice_channels
for tchannel in t:
for vchannel in v:
tchannelr=tchannel.id
vchannelr=vchannel.id
tchannelr= await client.fetch_channel(tchannelr)
vchannelr= await client.fetch_channel(vchannelr)
if len(t) > 0: invite = await tchannelr.create_invite()
if len(v) > 0: invite = await vchannelr.create_invite()
else:
print(f"Couldn't create an invite for {guild.name}")
continue
count+=1
print(invite)
with open("invites.txt", "a+") as file:
file.write(f"{invite.url}\n")
await asyncio.sleep(5)
print(f"Done with guild {count+1}: {guild.name}")

slate swan
#

you can use unicode or this

red sundial
slate swan
#

unicde is supposed to work if its right

marble oak
boreal ravine
marble oak
jade tartan
#

So

slate swan
#

if :one: doesnt work try \:one:

marble oak
boreal ravine
unkempt canyonBOT
slate swan
#

@slate swan you can use print(f"In Charge As {bot}") instead of .format

marble oak
#

ok

slate swan
#

in the good old days, 1788. i used to develop facebook before selling it to Mark. you should be ashamed i made it without using google!

jade tartan
#

Are you sure that's right?

red sundial
#

is it a problem with my code then

slate swan
#

what does it send

#

or does it give a error

red sundial
#

In emoji_id: Value "one:" is not snowflake.

slate swan
#

hm

red sundial
#

just sends the board but not the reactions

slate swan
#

1 min

#

code?

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

yeah the code

red sundial
red sundial
slate swan
#

whats your code now

red sundial
#

wait

slate swan
#

wait

#

\:a: \:b:

#

use those

red sundial
red sundial
slate swan
#

No you did not

red sundial
#

then it sends the board

#

and shows this error

slate swan
#

you did the half part

#

are they custom emojis?

#

what about this part

red sundial
slate swan
#

okay ima check it again

jade tartan
# boreal ravine !d discord.on_member_join read it
async def on_member_remove(member):
    guild = client.get_guild(730651046459998218)
    channel = client.get_channel(885464532959526913)
    await channel.send(f"{member} has left the server")
    await member.kick()
    await member.send(f"**{member.mention}**, Sorry you got kicked")```
#

Right?

red sundial
slate swan
#

hey kayle help

slate swan
#

1️⃣

jade tartan
#

await member.kick() on member join or member leave?

jade tartan
slate swan
#

:2:

#

2️⃣

#

<:one::919835940518785076:>

#

try this for one uh

#

and use the emoji id and name

red sundial
slate swan
#

<1️⃣:919835940518785076:>

#

1️⃣:919835940518785076:

jade tartan
#

Cuz ive tried everything

#

and it still dont work

boreal ravine
slate swan
#

\1️⃣

boreal ravine
slate swan
#

/***2,.,.1️⃣\/***2,.,.

#

now it works

jade tartan
jade tartan
slate swan
#

@boreal ravine help

jade tartan
#

Thats what i thought as well

boreal ravine
slate swan
#

why

red sundial
#

i think its just a problem with my code

slate swan
#

then i think there is another problem

#

not only with the emojis

red sundial
jade tartan
#

U see it has not kicked me yet

#

from the server

#

so the code aint work

#

ing

boreal ravine
#

if your the owner

#

how is it supposed to kick you

jade tartan
#

no i am logged on to another acc which is not an owner acc

boreal ravine
#

hm

jade tartan
#

Would you like to try?

slate swan
#

Does the bot have admin perms?

jade tartan
#

Yes

#

for all classes

#

yes

#

@commands.has_permissions(administrator=True)

slate swan
#

@orchid falcon

#

What are you using?

#

@slate swan

#

Main?

#

No like dpys main branch

#

Idk if it has buttons tho

#

Are you using dpy or a third party lib?

#

Dang I would help you if you had disnake

#

But idk much about others with buttons

#

Disnake?

#

Best fork of dpy in my opinion

#

use pip install disnake

#

i know about it

#

Has good easy buttons and slash commands and the syntax is the same as dpy

oblique cobalt
slate swan
#

That easy

#

Everything that has discord change it to disnake

slate swan
#

In the same file or different files?

slate swan
#

Nah you cant but you can have discord.py and disnake installed and use it where you wish

slate swan
slate swan
#

I was just recommending a good and mature forkpithink

#

Wdym?

#

Dont tell me.....

#

Don't tell me you copied the code block and pasted in your files..

oblique cobalt
#

Yeah, but DPY has point for having rules related to forks,
For example, one person said (i dont remember name):
"Not everybody has time to read source code to see if there is malicious code while updating"

slate swan
#

🚶

#

Knew it

#

Yes.

slate swan
#

why not just py import disnake as discord in your code if you really need it?

oblique cobalt
slate swan
#

1# fork out their made by equenos

slate swan
oblique cobalt
#

Probability is always a thing.

slate swan
#

It's open source, why would people put malicious code in it. That's just dumb from the developers and you know it.

#

^

oblique cobalt
#

Alright then.

slate swan
#

Many good devs that contribute to it

slate swan
slate swan
#

Disnake isnt a wrapper made by anyone

#

Just replace every discord with disnake

#

It's not that complicated.

upbeat otter
#

just press, ctrl+h and do replace all ,-,

slate swan
#

Yeah that depends the IDE

upbeat otter
slate swan
#

For me it's Ctrl+Alt+R

#

I do it manually pithink

upbeat otter
slate swan
#

i just ctrl+f in vsc and use replace all..

upbeat otter
slate swan
#

I just do alt f4 but my vsc crashes for some reason

#

So i dont use it

slate swan
upbeat otter
slate swan
#

I don't use VSC 🤷

upbeat otter
slate swan
upbeat otter
slate swan
slate swan
slate swan
upbeat otter
slate swan
oblique cobalt
slate swan
slate swan
#

Textpad for the win

slate swan
slate swan
oblique cobalt
#

👍

slate swan
#

My theme is really good the only downside is that str are kinda grey but comments are grey so epic

upbeat otter
#

Y'all inferior

slate swan
slate swan
upbeat otter
slate swan
#

Anybody got any command ideas so when i wake up tomorrow i can do something🕴️

slate swan
#

Ah yes

#

Using youtube_dl of course

#

a command which kicks all such users who didnt vote your bot

oblique cobalt
slate swan
#

Make something original

#

Why am i asking for commands when tomorrow i need to learn sql🕴️

oblique cobalt
slate swan
#

Make commands where you can use it, such as configurations etc.

#

brainmon you didnt start yet?

slate swan
#

I think im going to make a notepad/bm command

boreal ravine
#

why am i getting a keyerror but the item exists in the dict

slate swan
#

joe_8bit my bot is way too dependent on database

oblique cobalt
slate swan
boreal ravine
slate swan
boreal ravine
#
            next_rank = data['level'] + 1
            new_xp = data['xp'] + base_xp
``` my code
#

🗿

boreal ravine
oblique cobalt
boreal ravine
oblique cobalt
#

what key does it give keyerror on

boreal ravine
#

level

slate swan
#

Im still crying because i dont have a eval command🚶

boreal ravine
slate swan
#

🕴️

#

!pypi jishaku

unkempt canyonBOT
oblique cobalt
slate swan
#

Thank you guys now i will cry more🚶

oblique cobalt
#

or cog

slate swan
#

disnake-jishaku exists too in case you use disnake

#

Ok good🚶

slate swan
oblique cobalt
slate swan
#

Well then

#

Maybe use [0]["level"]

#

Or use .find_one()

boreal ravine
#

hm

slate swan
#

using list['level'] wont raise a keyerror tho ig

#

same for tuples

boreal ravine
oblique cobalt
slate swan
oblique cobalt
#

by data i mean object ur using to get those level from

slate swan
boreal ravine
#

okay

oblique cobalt
slate swan
#

Just use find_one

#

You don't expect multiple things returned.

boreal ravine
# oblique cobalt how about you print the data you have ?
Ignoring exception in on_message
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/disnake/client.py", line 505, in _run_event
    await coro(*args, **kwargs)
  File "/home/runner/bonbons-1/cogs/levels.py", line 36, in on_message
    next_rank = data['level'] + 1
KeyError: 'level'
{'_id': 656073353215344650, 'level': 0, 'xp': 7}
oblique cobalt
#

data looks fine to me

slate swan
red sundial
#

@slate swan GOT IT TO WORK THANK YOU SO MUCH

slate swan
#

Used find_one or find

oblique cobalt
#

give it a try

boreal ravine
slate swan
#

Print it?

boreal ravine
#

i am using find_one, im just using find in eval

oblique cobalt
#

oh

boreal ravine
slate swan
boreal ravine
oblique cobalt
boreal ravine
# oblique cobalt how about you send the whole code around it so we can see what is wrong better ?
        data = await self.db.find_one({'_id': message.author.id})
        base_xp = randint(1, 5)

        if not data:
            await self.db.insert_one({
                '_id': message.author.id,
                'level': 0,
                'xp': base_xp,
            })

        if data:
            new_data = await self.db.find_one({'_id': message.author.id})
            next_rank = new_data['level'] + 1
            new_xp = data['xp'] + base_xp

            if new_xp >= self.levels[str(next_rank)]:
                await self.db.update_one(
                    {'_id': message.author.id}, {"$set": {"level": next_rank, "xp": 0}}
                    )
``` okay ig
oblique cobalt
#

damn codeblock in phone is pain to read

boreal ravine
#

shrug

slate swan
#

Question in jsk what happens when you run a given code were does it run your shell right and what happens if you get given a malicious code will jsk limit it or smth?

manic wing
#

sudo rm -rf / would delete all if sudo password was cached

#

malicious code will not be filtered

#

thats why jsk is owner_only

slate swan
boreal ravine
manic wing
boreal ravine
slate swan
#

Only i can use it?

manic wing
#

yes

#

assuming your id is in owner_id/owner_ids

oblique cobalt
slate swan
#

Thank you guyspithink

slate swan
slate swan
slate swan
boreal ravine
unkempt canyonBOT
#

class discord.ext.commands.Bot(command_prefix, help_command=<default-help-command>, description=None, **options)```
Represents a discord bot.

This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") you can do with this bot.

This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.
slate swan
#

Oh you ment bot class🕴️

slate swan
slate swan
slate swan
#

how can i get the guild avatar on on_member_join(member) event?

#

guild.avatar

slate swan
#

i was kidding

boreal ravine
unkempt canyonBOT
#

property icon: Optional[discord.asset.Asset]```
Returns the guild’s icon asset, if available.
boreal ravine
#

!d discord.Member.guild <=

unkempt canyonBOT
slate swan
#

thanks

ocean leaf
#

i get TypeError: string indices must be integers. Why does it happen?

#
@client.command()
async def reroll(ctx, msg_id: int = None):
    if not ctx.author == client.gw_trigger:
        await ctx.send("Only the person hosting the giveaway can reroll it!")
    else:
        msg_to_reroll = await ctx.channel.fetch_message(msg_id)
        msg_to_reroll.embeds[0].description["Hosted"]
        if msg_to_reroll.embeds[0].title == "Giveaway ended!" or msg_to_reroll.embeds[0].title == "No one reacted and the giveaway ended!":
            await ctx.send("Can't reroll as the giveaway mentioned has ended")
        else:
            if msg_to_reroll.embeds[0].description.startswith("Hosted by"):
                user_list = [
                    user for user in await msg_to_reroll.reactions[0].users().flatten()
                    if user != client.user
                ]
                if len(user_list) == 0:
                    await ctx.send("Can't reroll as no one joined!")
                else:
                    prize = msg_to_reroll.embeds[0].title
                    winner = random.choice(user_list)
                    win_embed = discord.Embed(
                        title='Giveaway rerolled!',
                        description=
                        f'Hosted by - {ctx.author.mention}\nWinner - {winner.mention}\nPrize - {prize}',
                        colour=ctx.author.color)
                    await msg_to_reroll.edit(embed = win_embed)
            else:
                await ctx.send("Please provide the message ID of a valid giveaway")
#

this is my code

manic wing
#

msg_to_reroll.embeds[0].description["Hosted"]

#

what are you trying to do here?

#

!d discord.Embed.description || its an str

unkempt canyonBOT
ocean leaf
#

oh got it

#

i fixed that

#

tysm

slate swan
#

how to get discord presence in pycharm

#

Install the plugin

#

ok

manic wing
untold token
#

Very cool plugin

upbeat otter
tawdry perch
#
class MyNewHelp(commands.MinimalHelpCommand):
    async def send_bot_help(self, mapping):
        destination = self.get_destination()
        print(mapping)
        embeds = []
        print(embeds)
        for page in self.paginator.pages:
            emby = disnake.Embed(description=page)
            print(emby)
            print(embeds)
            print("Is this even ran?")
            embeds.append(emby)
        print(embeds)
        await destination.send('test', view=EmbedPaginator(self.context, embeds, timeout=180))
``` this is what I currently have, but it does not print anything/paginate the embed, why?
untold token
#

Its a plugin for pycharm for discord integration, its very good

shadow wraith
#

i only came here to see what you all are up to with discord bots, i need ideas :c

tawdry perch
#

command ideas?

tawdry perch
#

nothing

shadow wraith
tawdry perch
#

there is nothing being print, even the text is not printed

shadow wraith
#

embeds list is empty???

tawdry perch
#

nothing is printed

shadow wraith
#

i don't use disnake tho 💀

#

i use official discord

shadow wraith
shadow wraith
tawdry perch
slate swan
#

Notepad will be my main IDE

shadow wraith
#

nooooo, syntax highliting when

boreal ravine
shadow wraith
#

guys how do you think this code should be improved:

@bot.command()
async def eliminate(ctx, member: discord.Member):
    guild = member.guild
    SSCompetitor_Role = guild.get_role(919570782185750578)
    if ctx.channel.id == 919563757204693103:
        if guild.get_role(919571300467474543) in ctx.author.roles:
            if guild.get_role(919570782185750578) in member.roles:
                await member.remove_roles(SSCompetitor_Role)
                await ctx.send("{0} was eliminated! R.I.P".format(member.name))
    else:
        await ctx.message.delete()
tawdry perch
shadow wraith
#

what's the error

tawdry perch
#

there is no tracebacks

boreal ravine
shadow wraith
boreal ravine
tawdry perch
#

it sends the embed, yes but no pagination

shadow wraith
manic wing
boreal ravine
boreal ravine
tawdry perch
#

it just sends this

manic wing
boreal ravine
manic wing
#

debug just means figure out the problem and fix it

#

did you figure out your problem?

boreal ravine
#

no

slate swan
#

Fpray read the bottom for issue

tawdry perch
#

still nothing

#

I have a print statement for every other line

slate swan
boreal ravine
#

ask caeden to help

#

¯_(ツ)_/¯

slate swan
#

@manic wing super sorry to bother you but could you please help, my friend (kayle) said to ask you

manic wing
#

try print(bot.get_emoji(id))

slate swan
shadow wraith
#

give it emoji intents :troll:

manic wing
slate swan
#

do i do
from discord import intents first?

manic wing
#

no

shadow wraith
#

its unnecessary to do that

slate swan
#

still no errors but still no emojis

#

i put the intent thing under
token =

#

you sure it's the right emoji I'd?

#

since you told earlier you just got the code from a GitHub repo

slate swan
#

Idk , avg IQ maybe

upbeat otter
slate swan
#

https://cdn.discordapp.com/emojis/919622543877501008.png?size=160

#

919622543877501008

#

is the id. , In the code too?

slate swan
upbeat otter
slate swan
#

@slate swan 919622543877501008 this is the id for the emoji , use it

#

You just provided a wrong id

#

weird

#

for me when i copied id

#

it's 919859281661141015

#

how did you copy it?

manic wing
#

copying emojis is cancer

#

put a \ before it

slate swan
#

it's the message id

#

Lol

manic wing
#

put a \ before it and it does this

slate swan
#

@slate swan still no emojis VibeCatFast

#

yert restarted the bot?
Emoji is in int form?
Bot is in the server emoji is from?

#

You didn't update the emoji Id yet

quick gust
#

Id*

slate swan
#

Yea

#

FFK

#

Alright imma go learn some.chemistry , bye

quick gust
#

good luck

slate swan
#

YES IT WORKED

#

CAN I GET A CUSTOM ROLE CALLED IDIOT OF THE WEEK

manic wing
#

yes.

tawdry perch
#

making a help embed paginator is confusing af

tiny ibex
#
Traceback (most recent call last):
  File "c:\Users\phoen\OneDrive\Desktop\screenshot expiremtnt\screenshot.py", line 5, in <module>
    driver = webdriver.Chrome()
  File "C:\Users\phoen\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 70, in __init__
    super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog",
  File "C:\Users\phoen\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 93, in __init__
    RemoteWebDriver.__init__(
  File "C:\Users\phoen\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 268, in __init__
    self.start_session(capabilities, browser_profile)
  File "C:\Users\phoen\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 359, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "C:\Users\phoen\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 424, in execute
    self.error_handler.check_response(response)
  File "C:\Users\phoen\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 247, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary```
#

How to solve thiss

maiden fable
#

Damn my bot is in 90 servers now

maiden fable
tawdry perch
#
class MyNewHelp(commands.MinimalHelpCommand):
    print("Is this ran?")
    async def send_bot_help(self, mapping):
        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 had a print statement for every other line and nothing was printed
#

I made it look like this, and this still sends the embed```py
class MyNewHelp(commands.MinimalHelpCommand):
print("Is this ran?")
async def send_bot_help(self, mapping):
print("Is the function called?")

#

;-; this is way too confusing

slate swan
#

does anyone have a bot with a button i could test because i wanna know if buttons work more than once, cause right now it seems like it only works once..

tawdry perch
slate swan
tawdry perch
#

oh you wanted to test it..?

slate swan
#

i just wanna know if the button works more than once because for me it only works once..

tawdry perch
#

well they do for me, and I can't invite you to that server

slate swan
shadow wraith
slate swan
#

first time:

#

second time:

shadow wraith
#

wtf

tawdry perch
# shadow wraith wdym by "well they do for me"

uhh? They told that their buttons works only once and wanted to tets it on my bot, but I'm unable to invite them to my testing server and just said that for me the buttons works for more than 1 time

tawdry perch
#

it can be built from source but that part of code is not open sourced as it's just a test command

shadow wraith
#

wait one second let me see if this exists

tacit horizon
#

how to make @bot.command() function only i can use

tawdry perch
shadow wraith
shadow wraith
#

are you the owner of the server you're testing in

tacit horizon
#

ya

shadow wraith
#

wait one second let me see if this exists

#

!d discord.ext.commands.is_owner

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").
shadow wraith
#

do @commands.is_owner() 🚎

tacit horizon
#

ok

tacit horizon
#

😅

shadow wraith
#

k

#
@bot.command()
@commands.is_owner()
async def ping(ctx):
  await ctx.send("pong")
slate swan
#
        await ctx.send(embed=embed, components=[
            [Button(style=ButtonStyle.grey, label="Refresh", emoji=bot.get_emoji(919862920551219200))]])
        interaction = await bot.wait_for("button_click", check=lambda i: i.component.label.startswith("Refresh"))
        await interaction.send(content=value=f"```py\n{round(bot.latency * 1000)} ms```")
tacit horizon
#

why this not working

shadow wraith
#

;-;

#

it's @<command_name>.error

shadow wraith
#

why'd you think it was is_owner at first, is_owner is a decorator, not a command 💀

tacit horizon
#

;-;

upbeat otter
slate swan
maiden fable
#

which library you using

#

U need to pass those buttons to a kwarg, like u do with embeds

#

That's totally not the way how u do it

#
view = View(...) 
view.add_item(Button(...)) 
await ctx.send("Button Incomming!!!", view=view) 
#

!d discord.ui.View

unkempt canyonBOT
#

class discord.ui.View(*, timeout=180.0)```
Represents a UI view.

This object must be inherited to create a UI within Discord.

New in version 2.0.
maiden fable
#

!d discord.ui.Button

unkempt canyonBOT
#

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

New in version 2.0.
vocal plover
#

discord.ui is a part of discord.py, not an external lib

tiny ibex
#

discord.ui is part of dpy 2.0

#

pip install -U git+https://github.com/Rapptz/discord.py

#

discord.ui is for buttons only

#

What are you trying to do?

upbeat otter
tiny ibex
#

so use it

upbeat otter
#

is your bot written in dpy 1.7.3 or 2.0?

#

!d discord.ui.button

unkempt canyonBOT
#

discord.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 [`discord.ui.View`](https://discordpy.readthedocs.io/en/master/api.html#discord.ui.View "discord.ui.View"), the [`discord.ui.Button`](https://discordpy.readthedocs.io/en/master/api.html#discord.ui.Button "discord.ui.Button") being pressed and the [`discord.Interaction`](https://discordpy.readthedocs.io/en/master/api.html#discord.Interaction "discord.Interaction") you receive.

Note

Buttons with a URL cannot be created with this function. Consider creating a [`Button`](https://discordpy.readthedocs.io/en/master/api.html#discord.ui.Button "discord.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.
tiny ibex
#

Error please

#

Install git

#

No

#

If it's a linux terminal

#

You can

#

Not possible in windows cmd

#

If it's a debian based disro

sudo apt install git-all```
#

Basically helps you with everything related to github

#

noo

tiny ibex
#
pip install -U git+https://github.com/Rapptz/discord.py 
#

What's the error

#

You have discord.ui that's an invalid syntax error

slate swan
#

what's time.sleep for discordpy?

tiny ibex
#

Never use time.sleep

slate swan
#

await asyncio.sleep(-) ?

tiny ibex
slate swan
#

yeah

hot cobalt
maiden fable
#

!blocking for more information (:

unkempt canyonBOT
#

Why do we need asynchronous programming?
Imagine that you're coding a Discord bot and every time somebody uses a command, you need to get some information from a database. But there's a catch: the database servers are acting up today and take a whole 10 seconds to respond. If you do not use asynchronous methods, your whole bot will stop running until it gets a response from the database. How do you fix this? Asynchronous programming.

What is asynchronous programming?
An asynchronous program utilises the async and await keywords. An asynchronous program pauses what it's doing and does something else whilst it waits for some third-party service to complete whatever it's supposed to do. Any code within an async context manager or function marked with the await keyword indicates to Python, that whilst this operation is being completed, it can do something else. For example:

import discord

# Bunch of bot code

async def ping(ctx):
    await ctx.send("Pong!")

What does the term "blocking" mean?
A blocking operation is wherever you do something without awaiting it. This tells Python that this step must be completed before it can do anything else. Common examples of blocking operations, as simple as they may seem, include: outputting text, adding two numbers and appending an item onto a list. Most common Python libraries have an asynchronous version available to use in asynchronous contexts.

async libraries
The standard async library - asyncio
Asynchronous web requests - aiohttp
Talking to PostgreSQL asynchronously - asyncpg
MongoDB interactions asynchronously - motor
Check out this list for even more!

slate swan
#

understood

#

!d help

cinder horizon
#

how do we get tht "this message can only seen by you"

cinder horizon
#

ehemeral

tiny ibex
cinder horizon
#

...thenks you...uhh

#

welp aight lmao

tiny ibex
#

While responding to interaction

cinder horizon
#

like await ctx.send("blablablalbla", ephemeral=True)?

tiny ibex
#

ephemeral messages can only be used on interactions

cinder horizon
#

oh..

cinder horizon
tiny ibex
cinder horizon
#

peace

#

thenks

tiny ibex
cinder horizon
tiny ibex
slate swan
#

dumb question, how do i create a channel under a specific category

stiff nexus
#
        for member in members:
            try:
                await member.add_roles(role, reason=reason)
            except discord.HTTPException:
                failed += 1
            m = member

        await ctx.success(f'Muted {m} members.\n')
```this does not send all the members but it only send 1 member whyy?
slate swan
#

await ctx.success?

slate swan
tiny ibex
unkempt canyonBOT
#

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

A shortcut method to [`Guild.create_text_channel()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.create_text_channel "discord.Guild.create_text_channel") to create a [`TextChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel "discord.TextChannel") in the category.
slate swan
#

also i dont know what .success is , you use some fork with that method?

tiny ibex
#

I fcking hate flask

stiff nexus
slate swan
#

you want to send all members in a single message?

slate swan
#

if i wanted to create a voice channel under the category 'x', what do i type after the comma in await ctx.guild.create_voice_channel("name", )

#

category = CategoryChannel

#

thanks

#

wait would that be the category name as a str or its id

#

it would be CategoryChannel object

#

you can get it using bot.get_channel(id)

#

example : py await _ctx.guild.create_text_channel(name='m', category = _bot.get_channel(919888933880487976))

#

awesome, but what if i had the bot create a category and then under the same command, create a text channel under that category, how would i get the id of it

slate swan
#

easier

#

wonderful, thanks so much :D

#

yw

#

in the link @tawdry perch

tawdry perch
#

You have opened [ but never closed it?

tiny ibex
#

Very good looking token

#

OTE4ODIyMTE2MDg0ODQyNTE3.YbM1xw

slate swan
#

yeah, i deleted 10 digits

#

have fun guessing

tawdry perch
#

Why would I even use others token smh

tiny ibex
#

:]

tawdry perch
#

Uh?

slate swan
slate swan
tiny ibex
tawdry perch
#

If you open [ close it as well, I have no idea where are you supposed to close it because I have no time to read it completely

slate swan
#

i left that server 2 minutes ago BECAUSE I F"U"CKING ASKED THEM FOR HELP THEN THEY'RE LIKE: Rule 11, figure out the error urself

tiny ibex
tiny ibex
slate swan
#

noooo 27% battery remaining and i dont have a charger

tiny ibex
#

It allows you to create buttons

slate swan
tiny ibex
#

It will show you the version

tawdry perch
#

You need to install 2.0 from github

tiny ibex
slate swan
#

is there like a

#

pip install discord.py2.0?

tawdry perch
#

No

tiny ibex
slate swan
slate swan
#

if i was to do category perms, would it be better to do set_permissions() or use overwrites

#

C:\Users\ADMIN>pip install -U git+https://github.com/Rapptz/discord.py
Collecting git+https://github.com/Rapptz/discord.py
Cloning https://github.com/Rapptz/discord.py to c:\users\admin\appdata\local\temp\pip-req-build-xp6o41bk
Running command git clone -q https://github.com/Rapptz/discord.py 'C:\Users\ADMIN\AppData\Local\Temp\pip-req-build-xp6o41bk'
Resolved https://github.com/Rapptz/discord.py to commit 45d498c1b76deaf3b394d17ccf56112fa691d160
ERROR: Error [WinError 2] The system cannot find the file specified while executing command python setup.py egg_info
ERROR: Could not install packages due to an OSError: [WinError 2] The system cannot find the file specified

WARNING: You are using pip version 21.2.4; however, version 21.3.1 is available.
You should consider upgrading via the 'C:\Users\ADMIN\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe -m pip install --upgrade pip' command.

C:\Users\ADMIN>
C:\Users\ADMIN>

GitHub

An API wrapper for Discord written in Python. Contribute to Rapptz/discord.py development by creating an account on GitHub.

shadow wraith
#

!d discord.ext.commands.guild_only

unkempt canyonBOT
#

@discord.ext.commands.guild_only()```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that indicates this command must only be used in a guild context only. Basically, no private messages are allowed when using the command.

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

oh cool this exists

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.

slate swan
#

it's not code

#

it's console..

slate swan
tiny ibex
valid galleon
#

does any1 know how to modify this code to make it so that the bot responds to the command passed AFTER pinging it?(ignore the mongodb stuff at the start)

@client.event
async def on_message(message):

    pcol = mdb["prefix"]


    if client.user.mentioned_in(message) and message.mention_everyone is False:
        result = pcol.find_one({"guild_id": message.guild.id})
        result = result.get("prefix")

        await message.channel.send(f"My prefix is ``{result[0]}``")
    elif client.user.mentioned_in(message) and message.mention_everyone is False:
        await message.channel.send(f"My prefix is ``!``")


    await client.process_commands(message)
tiny ibex
#

Then try reinstalling the git version

tawdry perch
slate swan
#

Could someone vouch for him cause something tells me that’s a command to uninstall discord app

slate swan
#

yea!

valid galleon
#

pip is a package manager for python

tiny ibex
valid galleon
#

so it will delete discord.py(which is the module that you import at the start of your file)

slate swan
#

oo my discord py is 1.7.3

valid galleon
#

not the discord app

slate swan
#

my bad

valid galleon
#

bro what

valid galleon
#

ok

tiny ibex
#

Imagine pip uninstalling discord(app)😂🤣

valid galleon
# tiny ibex Exactly

igs he's confused between the sudo apt thing(sorry i dont know the command, i dont use linux)

slate swan
#
C:\Users\ADMIN>pip install -U git+https://github.com/Rapptz/discord.py
Collecting git+https://github.com/Rapptz/discord.py
  Cloning https://github.com/Rapptz/discord.py to c:\users\admin\appdata\local\temp\pip-req-build-gzkez5fi
  Running command git clone -q https://github.com/Rapptz/discord.py 'C:\Users\ADMIN\AppData\Local\Temp\pip-req-build-gzkez5fi'
  Resolved https://github.com/Rapptz/discord.py to commit 45d498c1b76deaf3b394d17ccf56112fa691d160
    ERROR: Error [WinError 2] The system cannot find the file specified while executing command python setup.py egg_info
ERROR: Could not install packages due to an OSError: [WinError 2] The system cannot find the file specified

WARNING: You are using pip version 21.2.4; however, version 21.3.1 is available.
You should consider upgrading via the 'C:\Users\ADMIN\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe -m pip install --upgrade pip' command.

C:\Users\ADMIN>
tiny ibex
tiny ibex
slate swan
valid galleon
#
  1. py -m pip uninstall discord
  2. install from the repo
#

or just use a fork, idk why you wanna use the og one, its not gonna be updated too

valid galleon
tiny ibex
#

They just want buttons

#

Why convert to fork?

valid galleon
tiny ibex
valid galleon
tiny ibex
valid galleon
tiny ibex
#

lol

valid galleon
#

their support is better compared to other forks tho

#

but before it was the opposite

tiny ibex
#

YouTube made PyCord famous

valid galleon
#

i remember once when i went to the nextcord server to get help for py-cord and it actually worked lmao

slate swan
#

is there a way to check if i have the file ( just wanna make sure if i downloaded it correctly )

tiny ibex
valid galleon
#

and then a few weeks later i admitted to that in the py-cord server, then turns out there was a nextcord mod lurking in the chat, and 2 secs later i got banned frm nextcord

slate swan
tiny ibex
valid galleon
tiny ibex
#

They all are connected with dpy 2

tiny ibex
#

That's not the way you get emojis

slate swan
tiny ibex
#

<:emoji_name:emoji_id>

slate swan
#

\:theemoji:

#

without a space

#

\👀

tiny ibex
slate nymph
#

whats the official way of creating discord bot without using any library?

tawdry perch
slate nymph
#

but how?

tawdry perch
#

you will need to use modules

tiny ibex
slate swan
slate nymph
#

yeah

tiny ibex
slate nymph
#

i ll make my own api wrapper?

tawdry perch
#

if you use API you will still use request modules etc?

tiny ibex
slate swan
tiny ibex
tawdry perch
#

what?

slate nymph
#

i ll use aiohttp

lament mesa
slate swan
#
C:\Users\ADMIN\PycharmProjects\Fluxo>python main.py
  File "C:\Users\ADMIN\PycharmProjects\Fluxo\main.py", line 28
    [Button(style=ButtonStyle.blue, label="Refresh", emoji=bot.get_emoji(919862920551219200)), Button(style=ButtonStyle.red, label="Delete", emoji=bot.get_emoji(919862920551219200)))]]
                                                                                                                                                                                     ^
SyntaxError: closing parenthesis ')' does not match opening parenthesis '['
tawdry perch
tiny ibex
slate nymph
#

well, but how?

tiny ibex
tawdry perch
#

take a look at the API docs

slate swan
slate nymph
tiny ibex
slate nymph
#

what?