#discord-bots

1 messages · Page 703 of 1

shrewd inlet
#

oh

slate swan
#

its a event

#

not a command

shrewd inlet
#
@bot.event
async def on_member_join(member):
  guild = bot.get_guild(917821802351308910)
  channel = guild.get_channel(917826956295303219)
  embed = discord.Embed(title=f"**{str(member)}** has joined the server.",color=0x2f3136)
  await channel.send(f"{member.mention} <@&917950907445039154>",embed=embed)
slate swan
#

without ()

visual island
#

dont call it

shrewd inlet
#

alr

visual island
#

@shrewd inlet do you have member intents enabled?

shrewd inlet
#

"Required for your bot to receive events listed under GUILD_MEMBERS."

visual island
#

okay good

mellow gulch
slate swan
shrewd inlet
#

how

slate swan
#
 embed19 = discord.Embed(
        title="",
        description="",
        color=,
        timestamp=)
shrewd inlet
#

o

shrewd inlet
#

someone joined and it didn’t work

slate swan
#

nvm

sick birch
#

what do you mean by "it didn't work"

shrewd inlet
sick birch
#

add a print statement to it and see if it gets called

#

if it doesn't we can diagnose it to an intent issue

#

if it does it's most likely with your code

shrewd inlet
#

where do i put print()

slate swan
#

after the event

shrewd inlet
#
@bot.event
print(async def on_member_join(member):
  guild = bot.get_guild(917821802351308910)
  channel = guild.get_channel(917826956295303219)
  embed = discord.Embed(title="**{str(member)}** has joined the server.",color=0x2f3136)
  await channel.send(f"{member.mention} <@&917950907445039154>",embed=embed))
#

so that??

sick birch
#

uh

#

no

shrewd inlet
#

i’m new to this srry

sick birch
#
@bot.event
async def on_member_join(...):
  print(...)
  ...
slate swan
#
@bot.event
async def on_member_join(member):
    print("works")
    guild = bot.get_guild(917821802351308910)
    channel = guild.get_channel(917826956295303219)
    embed = discord.Embed(title="**{str(member)}** has joined the server.",color=0x2f3136)
    print("works1")
    await channel.send(f"{member.mention} <@&917950907445039154>",embed=embed)
heavy folio
#

nvm

shrewd inlet
#

now do i make a member join

sick birch
#

yes

shrewd inlet
#

maybe i need to import something

sick birch
#

What happens when someone joins?

#

Did the print get called or not?

shrewd inlet
shrewd inlet
sick birch
#

Okay let's see your bot instance

#

It should look like

bot = commands.Bot(...)
slate swan
#

show your bot constructor and your intents vars

shrewd inlet
#
bot = commands.Bot(command_prefix=";",help_command=None)
sick birch
#

Makes sense

shrewd inlet
slate swan
#

lol

sick birch
#

You didn't pass in intents

slate swan
#

!intents

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.

sick birch
#
bot = commands.Bot(..., intents=discord.Intents.all())

for testing only

#

it gives you all intents, for production you should limit your intents to what you need

shrewd inlet
#

so intents=intents

#

???

sick birch
#

if you have something like

intents = discord.Intents.all()
bot = commands.Bot(..., intents=intents)

then yes

shrewd inlet
#
Traceback (most recent call last):
  File "main.py", line 10, in <module>
    bot = commands.Bot(command_prefix=";",help_command=None, intents=discord.Intents.all)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 98, in __init__
    super().__init__(**options)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 1107, in __init__
    super().__init__(*args, **kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 248, in __init__
    self._connection = self._get_state(**options)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 265, in _get_state
    return ConnectionState(dispatch=self.dispatch, handlers=self._handlers,
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/state.py", line 152, in __init__
    raise TypeError('intents parameter must be Intent not %r' % type(intents))
TypeError: intents parameter must be Intent not <class 'method'>
 
sick birch
#

Just pick whatever you like better

#

What's your code

shrewd inlet
sick birch
#

It might be intents=discord.Intents().all()

#

.all() is a @classmethod so I suppose that makes sense

#

Also may I suggest you put your gracie_* variables inside a seperate .json file

shrewd inlet
#
Traceback (most recent call last):
  File "main.py", line 110, in <module>
    bot.run(os.getenv('TOKEN'))
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 723, in run
    return future.result()
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 702, in runner
    await self.start(*args, **kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 666, in start
    await self.connect(reconnect=reconnect)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 601, in connect
    raise PrivilegedIntentsRequired(exc.shard_id) from None
discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.
 172.18.0.1 - - [24/Dec/2021 00:26:10] "GET / HTTP/1.1" 200 -
sick birch
#

Yeah go to your bot's dev portal and enable it

shrewd inlet
#

alr enabled

sick birch
#

now try

shrewd inlet
#

alr

#

wait can u join it, no one is responding

#

u can leave after dw

sick birch
#

Sure

shrewd inlet
#

oh nvm someone joined tysm

shrewd inlet
sick birch
#

So I assume it worked

shrewd inlet
#

yep

#

just the member thingy that didn’t

sick birch
#

use an f string for the embed title

#

also you don't need to do str(member)

#

just member will do

shrewd inlet
sick birch
#

correct

dapper cobalt
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.

shrewd inlet
sick birch
# shrewd inlet

you don't need the parenthesis, this will do:

print(f'{member} joined the server')
#

discord.Member has a __repr__ dunder which allows you to do that

shrewd inlet
#

oh it finally worked :D thanks!

sick birch
#

__repr__ seems to do the same thing as well

#

!e

class MyClass:
  def __repr__(self):
    return "Test"
print(MyClass())
unkempt canyonBOT
#

@sick birch :white_check_mark: Your eval job has completed with return code 0.

Test
sick birch
#

!e

class MyClass:
  def __str__(self):
    return "Test"
print(MyClass())
unkempt canyonBOT
#

@sick birch :white_check_mark: Your eval job has completed with return code 0.

Test
sick birch
#

¯_(ツ)_/¯

#

I assume the difference in functionality shows up once you start having string concatenation and f strings and str()

unkempt canyonBOT
#

discord/user.py lines 90 to 94

def __repr__(self) -> str:
    return (
        f"<BaseUser id={self.id} name={self.name!r} discriminator={self.discriminator!r}"
        f" bot={self.bot} system={self.system}>"
    )```
pliant gulch
#

Well, __str__ and __repr__ both do the same thing, and that is to return a string representation of whatever. The only difference is repr is mostly used for debugging whilst str is used for regular user use

visual island
#

that's what __repr__ returns

sick birch
#

pithink I see

#

Good to know I was always confused on those 2

sick birch
#

makes sense

#

Though does __str__ take precedence over __repr__? I don't think I remember seeing that little segment when printing a user object

pliant gulch
#

E,g if you did repr(class) it would call __repr__, if you called str(class) it would call __str__, if you called print(class) it would call __str__

#

And for the last case, i.e the print it would call __repr__ if no __str__ dunder is implemented on the class

#

Otherwise it would call __str__ first

#

So in the case of the User object, __str__ takes precedence over __repr__ when printing

visual island
#

yea, if __str__ is provided then python will use __str__, else they will use __repr__, so __str__ should take precedence over __repr__

pliant gulch
#

What does it exactly mean to take precedence here

#

It would depend on what you call in order to call __str__ or __repr__

#

E.g repr would call __repr__, str would call __str__

#

There is no real hierarchy to see

visual island
#

maybe like __new__ and __init__, __new__ takes precedence over __init__

pliant gulch
#

Yea, but __new__ and __init__ aren't __str__ and __repr__ are they?

visual island
#

.. No..

pliant gulch
#

Yes, and the hierarchy with __new__ and __init__ are different from __str__ and __repr__

#

__new__ creates the instance, __init__ initializes the instance

#

Meaning __new__ HAS to be called first, it isn't like __str__ and __repr__

hot cobalt
#

There isn't really a hierarchy with __str__ and __repr__. Whichever one gets called is called

pliant gulch
visual island
#

so what do they mean..

pliant gulch
#

__str__ and __repr__ don't take precedence over another, it depends on what you call

#

E.g print -> str -> repr

hot cobalt
#

__str__ produces a user-friendly string representation of an object, while __repr__ as a general rule should be more detailed and should allow you to 'remake' the object from the string

pliant gulch
#

print will call __str__ if it exists, else __repr__ if it exists and __str__ doesnt

#

But that's only due to print any other call can have different effects

#

Thus they don't have a hierarchy

slate swan
#
if msg.author.id == id:
    return

what would this return?
and what if its false?

visual island
#

None

#

for both questions

slate swan
#

i see

#

but why the return?

hot cobalt
#

To end the function

slate swan
#

but if its true it would continue right?

visual island
#

if it's False

patent lark
visual island
#

if it's True then it will execute return

slate swan
#

and if its false nothing would happen right?

visual island
#

if you dont have other code after that if statement then no

#

but if you really dont, then the if statement would be useless

slate swan
#

but what if i do and the if statement is false?

visual island
#

then go to the next code

pliant gulch
#

And if there is no next code it just returns None

slate swan
#
@bot.event
async def on_message(message):
    if message.author.id == id:
        return
    await channel.send("ok")

ok so this would respond to any message and if the if statement is true it will continue but how so if return ends the execution of a function and if its not true it doesnt do anything thats whats raising my question mostly

patent lark
#

!e py def foo(x): if x == 1: return print("X was not 1") foo(2)

unkempt canyonBOT
#

@patent lark :white_check_mark: Your eval job has completed with return code 0.

X was not 1
patent lark
#

the if statement returned false so it executed the "next code" which was my print statement.

slate swan
#

yeah i know but i dont understand what i said on the top

patent lark
slate swan
visual island
#

yes

patent lark
#

yep

slate swan
#

then why in dpy if the if statement is correct it will continue the code as if the if statement were false but if the if statement is false then it would just stop the execution as if the if statement were true

patent lark
#

thats not a discord.py related issue, python is python in any library.

#

and it doesnt, if that if statement returned true then it would execute the return

#

why do you think its doing the opposite of whats supposed to happen?

slate swan
#

well if the author of the msg is the bot it would continue right like a check but if it were false it wouldnt do that why so

patent lark
#

you have if message.author.id == id in this case, what is id?

patent lark
#

if the bot is the author is should return

#

but there is a more simple way to do this

#

a simple if message.author.bot would also work

crude crater
mellow gulch
#

if i have a for loop that is inside of a function can i do return to stop the for loop but not the funcion

patent lark
#

why so?

slate swan
#

oh wait your right

visual island
#

if message.author == bot.user:

visual island
slate swan
#

@patent lark @visual island sorry guys i had a massive brain fart again jeez im stupid

visual island
slate swan
patent lark
#

but that probably wasnt the best example since it would do more than what they're asking for

mellow gulch
visual island
#

yes

#

!e

for i in range(100):
     if i == 2:
          break 
     print(i)
unkempt canyonBOT
#

@visual island :white_check_mark: Your eval job has completed with return code 0.

001 | 0
002 | 1
maiden fable
#

Yooo guess what

slate swan
maiden fable
#

HunAI got verified lessgooooo

slate swan
#

congrats

maiden fable
#

Thanks!!!

slate swan
mellow gulch
slate swan
#

.add_roles(guild.get_role(12345))

#

@mellow gulch ^

#

also.. you could store the ids in a dict and call them instead of having a bunch of elifs?

slate swan
#

!d dict

unkempt canyonBOT
#

class dict(**kwargs)``````py

class dict(mapping, **kwargs)``````py

class dict(iterable, **kwargs)```
Return a new dictionary initialized from an optional positional argument and a possibly empty set of keyword arguments.

Dictionaries can be created by several means:

• Use a comma-separated list of `key: value` pairs within braces: `{'jack': 4098, 'sjoerd': 4127}` or `{4098: 'jack', 4127: 'sjoerd'}`

• Use a dict comprehension: `{}`, `{x: x ** 2 for x in range(10)}`

• Use the type constructor: `dict()`, `dict([('foo', 100), ('bar', 200)])`, `dict(foo=100, bar=200)`
mellow gulch
#

imma not make a class so...

slate swan
#

I want to get the cooldown of a command that the user is requesting help for. If the user uses the command "!help dice_roll" and if dice_roll has a cooldown, I want that to be displayed in the response embed for my subclassed help command. How do I get that?

visual island
#

command._buckets._cooldown gets the cooldown of a command

#

you can get either rate, per, or type

slate swan
visual island
#

yes

#

but you should get it's attribute which is rate, per, or type. Or you will get CooldownMapping object

slate swan
#

What’s that?

visual island
#

the internals

#

command._buckets._cooldown.per for example of getting the per

slate swan
#

Oohh

#

Ok

#

Ty :)

arctic gyro
#
@bot.command()
@commands.has_permissions(ban_members=True)
async def mute(ctx,member: disnake.Member,time: float = None ,*,reason=None):
  
  if reason == None: 
    reason = 'Spamming! '
  if time == None:
    time = 900
  muted = (f'You have been muted in ' + f'{ctx.guild.name}' + ' for ' + str(time) + ' seconds' + ' because of ' + reason)
  await member.send(muted)
  await ctx.channel.purge(limit = 1)
  await member.timeout(duration=time,reason=reason)
  if time >= 60:
    time = time/60
    await ctx.channel.send(f"{member} has been muted for {time} minutes because of {reason}")
  else:
    await ctx.channel.send(f"{member} has been muted for {time} seconds because of {reason}")

This is a timeout command that works perfectly

visual island
#

it's better to use timestamp imo

#
await ctx.send(f"{member} has been muted until <t:{int(datetime.datetime.now().timestamp() + time)}:R>")
crude crater
visual island
slate swan
#

😂

brave vessel
#

the new timestamps are awesome

vast gale
slate swan
#

and even if your comparing, is None should be used

visual island
#

just provide directly in the params

slate swan
#

that too

#

what is that f string formatting

sage otter
# visual island

Honestly this guy(Wiser) has just been being a nuisance all day. Hes been "helping people" or trying. and everytime he would say something it would either be "yes" or "no" and when prompted for an explanation he refused.

#

Basically hes trolling

visual island
#

ooh

sage otter
#

Someone actually trying to help would say something and he would always disagree and say "no thats wrong" or "no its not" and not say anything after that.

#

honestly tho timestamps are better tho. As far as ux

pliant gulch
#

That way if reason is not truthy, E.g None, it will set reason to "Spamming!"

slate swan
#
@bot.command()
@commands.has_permissions(timeout_members=True)
async def mute(ctx, member: disnake.Member, time: float=None, *, reason="No Reason Provided."):
    muted_till = f"<t:{int(datetime.datetime.now().timestamp() + time)}:R>"
    await member.send(f'You have been muted in {ctx.guild.name} till {muted_till} for {reason}')
    await ctx.message.delete()
    await member.timeout(duration=time,reason=reason)
    await ctx.channel.send(f"{member.name} has been muted till {muted_till}")
#

(indentation might be off, wrote it here itself)

slate swan
slate swan
#

so much await blobpain

slate swan
#

so if the time isnt given it will unmute him

#

might be a little confusing though, for example if you just want to mute them for once and think about time later

#

unmute command: am i a joke to you?

slate swan
arctic gyro
#

Ig this one's better

bot.command()
@commands.has_permissions(ban_members=True)
async def mute(ctx,member: disnake.Member,time: float = None ,*,reason=None):
  
  if reason == None: 
    reason = 'Spamming! '
  if time == None:
    time = 900
  
  await ctx.channel.purge(limit = 1)
  await member.timeout(duration=time,reason=reason)
  if time >= 60:
    timee = time/60
    rem = time % 60
    time2 = math.floor(timee)
    await ctx.channel.send(f"{member} has been silenced in the class for {time2} minutes and {rem} seconds because of {reason}")
    await member.send(f'You have been muted in ' + f'{ctx.guild.name}' + ' for ' + str(time2) + ' minutes ' + str(rem) + ' seconds because of ' + reason)
  else:
    await member.send(f'You have been muted in ' + f'{ctx.guild.name}' + ' for ' + str(time) + ' seconds' + ' because of ' + reason)
    await ctx.channel.send(f"{member} has been silenced in the class for {time} seconds because of {reason}")

strong sluice
slate swan
slate swan
strong sluice
#

my python version is 3.10.1

strong sluice
pliant gulch
slate swan
#

just nove the text out of curly braces

#

*move

slate swan
# strong sluice WHY?
  1. use a bot instance
  2. tabs and spaces cant be used inter-changeably
    - either indent everything in tabs, or everything in spaces
  3. in f-strings, {} should contain only a variable, not a string to actually print
    - so you need to do, as sarthak showed, pass de rais! outside the }
pliant gulch
#

mmm yes it was added when it got released so I didn't know what to name it

#

but yes very very modern, you don't need a database and a tasks.loop anymore

#

Plus mutes are persistent so you won't have to hook member join event

slate swan
#

yeah its pretty good
no db, no problem if bot goes down, no problem if user leaves/rejoins

#

yes

pliant gulch
#

They also support X-Audit-Log-Reason

#

So that means all mutes can be fully stored in the audit logs

strong sluice
#

WAIT

slate swan
#

nice

pliant gulch
#

It would also be quick to query the audit log since you can filter the ID and the audit log action type

prisma spoke
#

Demn koala here too

pliant gulch
#

So in some cases faster than a DB

slate swan
#

Andy , you implemented .ext.commands like stuff in lefi?
I mean cogs and stuff

#

your making your own wrapper? blurryeyes

arctic gyro
#

is there any like untimeout command?

pliant gulch
slate swan
#

Cool

prisma spoke
pliant gulch
#

I implemented ext commands like the first thing in my wrapper lol

slate swan
#

Oh i see , Plugin

pliant gulch
#

Meaning you can get what you want from the audit log endpoint

#

Thus the speed would depend on the speeds of your internet

strong sluice
#

worked

pliant gulch
#

Audit log stuff is only slow due to the library abstraction discord.py has probably

slate swan
pliant gulch
#

Just as paginators, iterators etc

slate swan
#

like requests/time

pliant gulch
strong sluice
#

how to create a music bot?

slate swan
#

lmao

pliant gulch
#

Because unlike theirs I use Semaphores instead of Locks per bucket

#

Meaning concurrent requests support!

#

And each semaphore per bucket is set to X-Ratelimit-Limit

#

Meaning you get the most possible

patent lark
slate swan
#

cool

strong sluice
#

youfard learn totorals

pliant gulch
#

I'll check what the ratelimit is on audit logs again

#

I might be super high or something I can't remember

slate swan
slate swan
pliant gulch
#

I'll send a request

pliant gulch
#

Very doable,

brave flint
#

why it trow An error occurred: Command raised an exception: TypeError: 'in <string>' requires string as left operand, not int

pliant gulch
#

They don't have a specific X-Ratelimit

#

Thus they fall under the global ratelimit

#

Which means you could do 50 requests

slate swan
pliant gulch
#

Per second

slate swan
#

ay thats more than enough imo

pliant gulch
#

Yep

mellow gulch
#

what does this mean

strong sluice
#

gg

brave flint
#

it arl say Missing Permissions

slate swan
patent lark
mellow gulch
#

but it has admin tho

strong sluice
#
Ignoring exception in on_message
Traceback (most recent call last):
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Usuario\Desktop\Bot.PY", line 19, in on_message
    channelvc = message.author.voice.voice_channel
AttributeError: 'VoiceState' object has no attribute 'voice_channel'```
#
@client.event
async def on_message(message):
    if message.content.startswith('>entrar'):
        channelvc = message.author.voice.voice_channel
        await client.join_voice_channel(channelvc)```
mellow gulch
#

it has admin meaning it can remove roles right???

torn sail
#
await message.remove_reaction(payload.emoji, payload.member)

Does anyone know why this wouldn't be working. I'm not getting any error so I have no idea whats happening

torn sail
patent lark
mellow gulch
torn sail
patent lark
#

if the role is above the bots top role, it will raise that error.

slate swan
patent lark
#

the role cannot be managed by the bot

mellow gulch
patent lark
mellow gulch
patent lark
#

if the role you're trying to remove is higher than the bots highest role, it will raise that error

strong sluice
#

xd

shrewd inlet
#

how do i make a command without the prefix

#

like i want to make a normal command but i don’t want to use the prefix that i already set

patent lark
#

you want to invoke a command without using the prefix?

shrewd inlet
#

i just want it to be a trigger without the prefix

patent lark
#

as far as i'm aware, you cant do that.

shrewd inlet
slate swan
patent lark
#

you could invoke a command while invoking another command, (call a command inside a command). but if you just want to randomly invoke a command, i dont see that happening

mellow gulch
brave flint
#

can anyone help me with my yaml files?

slate swan
pliant gulch
slate swan
#

That would affect every command though

patent lark
#

i guess i misunderstood the task?

#

i thought they wanted a command to just randomly invoke.

pliant gulch
#

They only want one specific command then yea?

#

I'm probably misunderstanding

strong sluice
#

Ignoring exception in on_message
Traceback (most recent call last):
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "C:\Users\Admin\Desktop\index.py", line 19, in on_message
channelvc = message.author.voice.voice_channel
AttributeError: 'VoiceState' object has no attribute 'voice_channel'

#

how to resolve this

pliant gulch
#

If you want one command to have no prefix then yea, your probably have to change process_commands

#

Although you need to mess with more internals as discord.py validates Context if the start contains the prefix and a valid command name iirc

shrewd inlet
#

okay this is my 3rd day coding so i’m gonna pretend i never asked 😃

strong sluice
#

@client.event
async def on_message(message):
if message.content.startswith('>entrar'):
channelvc = message.author.voice.voice_channel
await client.join_voice_channel(channelvc)

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.

mellow gulch
#

it says that the bot has no permission to remove a role from someone that does not have admin yet bot have admin

strong sluice
patent lark
strong sluice
#
@client.event
async def on_message(message):
    if message.content.startswith('>entrar'):
        channelvc = message.author.voice.voice_channel
        await client.join_voice_channel(channelvc)```
```py
Ignoring exception in on_message
Traceback (most recent call last):
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Admin\Desktop\index.py", line 19, in on_message
    channelvc = message.author.voice.voice_channel
AttributeError: 'VoiceState' object has no attribute 'voice_channel'```
patent lark
#

the bot is unable to manage that role.

shrewd inlet
#

how do i make an “add role” command

#

and a “remove role” command

patent lark
#

!d discord.Member.add_roles

unkempt canyonBOT
#

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

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

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the added [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
shrewd inlet
#

ty

torn sail
#
await message.remove_reaction(payload.emoji, payload.member)

Im trying to make a reaction role bot. so if the reaction isnt what its supposed to be i remove the reaction. But its not removing the reaction and im not getting any errors so i dont know whats wrong

shrewd inlet
# patent lark use member.add_roles()

i saw a bot that can do one command for both. so basically the same command can add and remove geh command.

example:

,role @slate swan admin
— added role

,role @slate swan admin
— removed role

torn sail
shrewd inlet
#

i would like to do that

slate swan
torn sail
strong sluice
#

print('fard')

patent lark
strong sluice
#

member.remove_roles

slate swan
strong sluice
patent lark
slate swan
#

yup ty

pliant gulch
slate swan
#

yeah

visual island
#

in is basically iterating it too pithink

shrewd inlet
#

can someone please a send a code for it, in “bot.commands” ? i’m on my phone rn ;-;

shrewd inlet
#

rip 😭

#

alright

slate swan
#

noone will
other than youtube tuts m_smh_ducky

patent lark
#

its about learning, give it a try and if you run into issues, come back.

shrewd inlet
#

alrighty :)

strong sluice
#
@client.event
async def on_message(messege):
 try:
    if message.content.startswith('>entrar'):
        channelvc = message.author.voice.voice_channel
        await client.join_voice_channel(channelvc)
     expect discord.erros.InvalidArgument:
     await client.send_message(messege.channel, "Você necessita estar conectado em um canal de voz!")```
#

why error?

strong sluice
patent lark
#

the syntax is incorrect, and im pretty sure thats old code

#

try learning python, copying code isnt a great start to that either.

strong sluice
#

wait

pliant gulch
strong sluice
#

idle 3.1.0.1 bugged

torn sail
patent lark
#

that code is very outdated.

strong sluice
#

yes

patent lark
#

nor is it even written correctly

strong sluice
patent lark
#

and the syntax is incorrect

torn sail
#

except spelled wrong and in the wrong indentation

strong sluice
#

dont skid

#

its wrong

#

write codes sincere

slate swan
slate swan
strong sluice
boreal ravine
#

👀

strong sluice
#

sus

boreal ravine
#

because you discord

visual island
#

a good story

slate swan
#

its just not being maintaned

boreal ravine
strong sluice
#

---->Cartao <---- credit card!!11 nitro

slate swan
slate swan
boreal ravine
#

I dont get why umbra/maya in the dpy server didnt maintain it; they're literally the smartest people I know

slate swan
#

hi i have a question how do made that bot dosent count bots in the member count coomand

#

cuz my command counts bots too

boreal ravine
slate swan
boreal ravine
#

!d discord.Member.bot

unkempt canyonBOT
#

property bot```
Equivalent to [`User.bot`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.bot "discord.User.bot")
slate swan
boreal ravine
#

!d nextcord.Guild.humans @slate swan lol

unkempt canyonBOT
#

property humans: List[nextcord.member.Member]```
A list of user accounts that belong to this guild.

Warning

Due to a Discord limitation, in order for this attribute to remain up-to-date and accurate, it requires [`Intents.members`](https://nextcord.readthedocs.io/en/latest/api.html#nextcord.Intents.members "nextcord.Intents.members") to be specified.

New in version 2.0.
slate swan
#

alright

visual island
boreal ravine
#

I doubt hes using nextcord though

slate swan
slate swan
boreal ravine
slate swan
#

ah my bad

#

cuz i just to count humans not bots

#

only

slate swan
prisma spoke
#

Bruh

#

Appreciate the fact u had to potential to write a full story

visual island
slender perch
#

is it possible to make a discord bot that finds names starting with a !

slate swan
#

but how i made in the command thing thats checks if the member is bot

slate swan
slate swan
slender perch
#

gaming, thanks

mellow gulch
#

user_id is a global variable and works fine but when I empty the user_id list it becomes a local variable so how do i keep it as a global one

slate swan
boreal ravine
# slate swan oh

you could do something like this, not the most efficient way lol

members = []
for m in ctx.guild.members:
  if m.bot is False:
    members.append(m)
return len(members)
slate swan
#

ok

torn sail
boreal ravine
#

you dont need to tell me stuff I already know

bitter perch
visual island
unkempt canyonBOT
#

Hey @strong sluice! I noticed you posted a seemingly valid Discord API token in your message and have removed your message. This means that your token has been compromised. Please change your token immediately at: https://discordapp.com/developers/applications/me

Feel free to re-post it with the token removed. If you believe this was a mistake, please let us know!

boreal ravine
#

¯\_(ツ)_/¯

torn sail
visual island
#

fastest way

boreal ravine
unkempt canyonBOT
#

Hey @strong sluice! I noticed you posted a seemingly valid Discord API token in your message and have removed your message. This means that your token has been compromised. Please change your token immediately at: https://discordapp.com/developers/applications/me

Feel free to re-post it with the token removed. If you believe this was a mistake, please let us know!

torn sail
strong sluice
#

OT

boreal ravine
#

i never asked why they're not maintaing it

slate swan
boreal ravine
#

🤦‍♂️

slate swan
# boreal ravine you could do something like this, not the most efficient way lol ```py members =...

can be used in my code of the command i mean cuz i dont wonna made something not working propely @bot.command() async def statyinfo(ctx, info): server = ctx.guild if info == "memberCount": await ctx.send(server.member_count) elif info == "numberOfChannel": await ctx.send(len(server.voice_channels) + len(server.text_channels)) elif info == "name": await ctx.send(server.name) elif info == "rolesCount": await ctx.send(len(server.roles)-1) else: await ctx.send("Dziwne... tego nie wiem")

mellow gulch
torn sail
visual island
#

lol no nitro moment

slate swan
upbeat otter
# mellow gulch Where

So I suppose you have already defined the user_lizt variable and are defining it again so as to clear it, right?

slate swan
mellow gulch
#

Is there a different way to do that

visual island
upbeat otter
slate swan
visual island
#

eating it now

slate swan
pliant gulch
slate swan
#

Your more a pig

slate swan
#

😳

visual island
upbeat otter
pliant gulch
visual island
slender perch
#

another question

boreal ravine
slender perch
#

how do i make a bot change someones nickname from a list i make

slender perch
#

like i want to make a txt file and put names i would want it to change to

upbeat otter
mellow gulch
#

what do i do because of this lmao i dont understand

upbeat otter
heavy folio
#

you cannot append stuff for strings

mellow gulch
upbeat otter
mellow gulch
#

🤦‍♂️

pliant gulch
#

@visual island

heavy folio
upbeat otter
#

You can concatenate strings but only append stuff into dicts or lists

heavy folio
#

!e ```py
myvar = ''
myvar.append('e')

unkempt canyonBOT
#

@heavy folio :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 2, in <module>
003 | AttributeError: 'str' object has no attribute 'append'
mellow gulch
#

sorry i 🤦‍♂️ myself

heavy folio
#

!e ```py
myvar = []
myvar.append('e')
print(myvar)

unkempt canyonBOT
#

@heavy folio :white_check_mark: Your eval job has completed with return code 0.

['e']
upbeat otter
slender perch
#

what wront with code

visual island
slender perch
#

!e

for member in ctx.guild.members:
    if member.name.startswith("a!"):
        await after.edit(nick="fart lol")
unkempt canyonBOT
#

@slender perch :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 3
002 | SyntaxError: 'await' outside function
boreal ravine
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.

boreal ravine
#

learn basic python first

slender perch
#
while True:
     print("chicken butt")
pliant gulch
#

what

#

when?

#

and in python true isn't correct, its True

slender perch
#

i swore there was a when in python
i didnt use it in a while till this week

#

oh no im thinking of lua nvm

pulsar shell
#

Oh you were thinking of lua? Haha

fading granite
#

Which is the alternative repo for development of discord bots in python? What are their advantages?

slate swan
manic wing
shadow wraith
#

how can you fetch a message by it's id?

slate swan
#

!d discord.TextChannel.fetch_message

unkempt canyonBOT
#

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

Retrieves a single [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") from the destination.
shadow wraith
#

thx, does it require a bot.get_channel type of variable

#

like for example does it go like this

txtchannel = bot.get_channel(54378958347948357) # replace with channel id
await txtchannel.fetch_message(489335485348)
slate swan
#

yea sure

#

lmao

#

why do people overcomplicate linux

pliant gulch
#

not even like that

mellow gulch
#

I have it so that a class in a different py file is called after a msg being sent, how would i be able to use things like await without having to trigger smth like on_message to use it but only calling the class

silent portal
#

How can I get 2.0 ?

heavy folio
#

run this statement in your terminal

silent portal
#

🥶

heavy folio
#

then too bad

silent portal
#

nvm it works there aswell

#

Do I have to import smth?

manic wing
#

import discord

slender perch
#

i thought i found the issue but now im in deeper shit

import discord
import os

token = input("discord token?: ")

@bot.event 
async def on_ready():
  for member in ctx.guild.members:
      if member.name.startswith("!"):
          await after.edit(nick="fart lol")
#

the issues are with @bot.event ctx.guild.members and after.edit(nick="fart lol")

slate swan
#

ctx is not defined :p

manic wing
manic wing
#

oh lol

#

thank fuck, i thought pycord was good for a second

slate swan
#

its bad

manic wing
#

|| i fucking hate pycord so much disnake is the best module WE LOVE EQUENOS ||

slate swan
#

^

slate swan
manic wing
#

we love em all

slate swan
#

Yes

sinful pasture
#

how do you make a bot create a channel in a specific category?

manic wing
#

!d discord.Guild.create_text_channel

unkempt canyonBOT
#

await create_text_channel(name, *, reason=None, category=None, position=..., topic=..., slowmode_delay=..., nsfw=..., overwrites=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Creates a [`TextChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel "discord.TextChannel") for the guild.

Note that you need the [`manage_channels`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to create the channel.

The `overwrites` parameter can be used to create a ‘secret’ channel upon creation. This parameter expects a [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") of overwrites with the target (either a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")) as the key and a [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/master/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite") as the value.

Note

Creating a channel of a specified position will not update the position of other channels to follow suit. A follow-up call to [`edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel.edit "discord.TextChannel.edit") will be required to update the position of the channel in the channel list...
manic wing
#

category=

sinful pasture
#

ty

#

for nsfw do I remove it entirely or set it to false?

manic wing
#

depends, if you want the channel to be nsfw then you set it to True otherwise you set it to False

sinful pasture
#

k thanks

manic wing
# unkempt canyon

this says channel: discord.CategoryChannel but idk how the fuck you're supposed to get an instance of discord.CategoryChannel without doing discord.abc.Messageable.category pithink

#

no get_category afaik

boreal ravine
#

get_channel exists

manic wing
manic wing
sinful pasture
#

what is the module with has create_text_channel

#

im using disnake

slate swan
sinful pasture
#

well, it says that it doesnt exist

slate swan
#

Should be

await bot.create_text_channel("channelname")
sinful pasture
#

more specificall, unresolved reference: guikd

#

oh bruv I should be using bot

slate swan
#

Yes

sinful pasture
#

ty

slate swan
#

Yw

#

Gn guys

sinful pasture
#

AttributeError: 'Bot' object has no attribute 'create_text_channel'

boreal ravine
#

imagine his bot variable

#

was a guild object

slate swan
sinful pasture
slate swan
#

bruh

#

you need a guild instance

#

where do you want to create the server?

sinful pasture
#

i thought it creates the channel is the guild it was used in

#

ooof

slate swan
#

.... just use ctx.guild.create_text_channel 😐

shadow wraith
#

how do y'all make your help cmd

#

i use commands.MinimalHelpCommand()

#

yes i subclass it xd

slate swan
#

commands.HelpCommand 🏃‍♂️

cerulean osprey
#

So quick question. When discord adds a new feature (in this case, timeouts) how long does it take for discord.py to get such a feature? Is it instant?

slate swan
brazen raft
#

Never. It's unmaintained.

slate swan
#

!d disnake.Member.timeout disnake added it already

unkempt canyonBOT
#

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

Times out the member from the guild; until then, the member will not be able to interact with the guild.

Exactly one of `duration` or `until` must be provided. To remove a timeout, set one of the parameters to `None`.

You must have the [`Permissions.moderate_members`](https://docs.disnake.dev/en/latest/api.html#disnake.Permissions.moderate_members "disnake.Permissions.moderate_members") permission to do this.

New in version 2.3.
sage otter
#

It used to be pretty fast when it was maintained tho PB_cry Danny always kept up.

slate swan
#

true , except for slash commands

#

the main reason for the development being stopped

brazen raft
slate swan
#

mhm

prime marten
#
async def on_message(message):
    message.content = message.content.lower()
    if message.author == client.user:
        return
    if message.content.startswith("sheep"):
        await message.channel.send("Hello Sheep")```
#

could anyone maybe help me as to why this isnt working :(
I dont get any errors but it doesn't work either way

sinful pasture
#
@bot.command()
async def hylo(ctx):
    if ctx.message.author.id == '873139718450188328':
        await ctx.message.channel.send('Greetings, father')

it doesnt respond to me :c

#

i tested it by adding an else statement and sure enough it did the else

sage otter
#

You compared an int with a string

lunar quail
sinful pasture
#

damn im dumb

lunar quail
#
@bot.command()
async def hylo(ctx):
    if ctx.message.author.id == 873139718450188328:
        await ctx.message.channel.send('Greetings, father')

Will do.

sinful pasture
#

yep i fixed it thanks

sinful pasture
prime marten
#

yes

sinful pasture
prime marten
#

hmm

sinful pasture
#

put them in the same event

prime marten
shadow wraith
#

so this is my code and i was wondering if the message content was something, return a response, if the message content was something else, return a diff response

#
@lets.command()
async def play(ctx):
  randomnum = random.randint(0, 10)
  await ctx.reply("Alright, I've got guessingGame and that's it, wanna play it?")
  def check(m: discord.Message):
    return m.author.id == ctx.author.id and m.channel.id == ctx.channel.id and m.content == randomnum
  try:
    await ctx.reply("I just chose a number between 0 and 10. guess it whilst you can")
    await bot.wait_for(event='message', check=check, timeout=30.0)
  except asyncio.TimeoutError:
    await ctx.reply("you are afk i guess")
  else:
    await ctx.reply("y won?")
sinful pasture
#
@client.event
async def on_message(message):
 if message.author == client.user:
  return
 if message.content.startswith('sheep')
  await message.channel.send('Hello Sheep')
 if message.content.startswith
  ....
sinful pasture
shadow wraith
lunar quail
#

When bot adds 30+ emotes to an guild the bot cannot add anymore emotes to the guild after ~15 emotes. I assume this is because the bot is getting ratelimited (?)
What would be the way to go about this other than introducing an asyncio.sleep(...) internally in the bot?

shadow wraith
#

elif statements best statement

sinful pasture
#

yeah but from what I gather Llama is a beginner so not yet

shadow wraith
lunar quail
shadow wraith
sinful pasture
#

idk

shadow wraith
boreal ravine
#

ur wait_for method takes 1 kwarg

#

pass it beside your wait_for method

#
msg = ...
odd walrus
#

is it possible to log deleted images or just generally any image sent

boreal ravine
#

!d discord.Message.attachments

unkempt canyonBOT
boreal ravine
#

you can use the url property on that

#

!d discord.Asset.url

unkempt canyonBOT
visual island
#

attachments return list of discord.Attachment not Asset

boreal ravine
#

o

#

thats a class?

visual island
#

!d discord.Attachment

boreal ravine
#

I never knew that existed

unkempt canyonBOT
#

class discord.Attachment```
Represents an attachment from Discord.

str(x) Returns the URL of the attachment.

x == y Checks if the attachment is equal to another attachment.

x != y Checks if the attachment is not equal to another attachment.

hash(x) Returns the hash of the attachment.

Changed in version 1.7: Attachment can now be casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") and is hashable.
visual island
#

now you know 😉

shadow wraith
boreal ravine
shadow wraith
#

lmfao english moment

#

so what happens if i just do msg=randomnum

boreal ravine
shadow wraith
#

reread code

boreal ravine
#

it'll be a random.randint object then

shadow wraith
#

oh

#

does the msg kwarg just check the message content or are there more steps required

boreal ravine
#

the msg kwarg is the message object

#

it doesn't "check" the message content

#

you'll have to do that yourself

shadow wraith
#

doing that in a command is tough especially with a await bot.wait_for 😓

#

because that's literally my question, how would i check the msg content

boreal ravine
shadow wraith
#

so i can't use await

boreal ravine
#
message = await bot.wait_for(**kwargs)

if message.content == ...:
  ...
shadow wraith
#

fuck that makes sense

boreal ravine
#

yes

lunar quail
#

I am going to do one push up every time I forget to await something.

slate swan
#

how i make anime gif command ( api send anime gifs)

sinful pasture
#

ok so this is a pretty dumb question but i've got this command: rule 1 but ive got commands like that up to rule 15 and whenever I do 10,11,12,13,14 and 15 it shows rule 1 too, so how can I prevent that from happening?

#
if message.content.startswith('rule 1'):
 stuff
...
visual island
sinful pasture
#

:0 i forgot that order exists

#

nope doesnt work, it still shows rule 1

slate swan
#

@visual island pls help

zealous dagger
#

how do I modify

#

My help command

slate swan
sinful pasture
#
@bot.command()
async def foo(message):
    if message.channel == message.author.dm_channel:
        if message.content.startswith('foofoo'):
          await message.author.send('foofoofoo')

doesnt work

sinful pasture
sinful pasture
slate swan
#

What are you even trying to do

sinful pasture
#

trying to get it to respond in dms

slate swan
#

you can use isinstance or dm_only check

sinful pasture
#

hmm

slate swan
#

!d discord.ext.commands.dm_only use this decorator and the command will work only in dms

unkempt canyonBOT
#

@discord.ext.commands.dm_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 DM context. Only private messages are allowed when using the command.

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

New in version 1.1.
sinful pasture
#

thx

prime marten
#

How would i write an event that when a bot gets invited to a new server, it should automatically create its own role in that server

slate swan
#

you mean the roles that bot get similar to their name?

prime marten
#

yeah

slate swan
#

if you invite bot with any perms. The bot will get the role

sinful pasture
#

@slate swan the dm_only thing didnt work, is it cuz I use disnake

slate swan
sinful pasture
prime marten
#

strange, will check on the perms then, cuz mine doesnt create a role for itself

slate swan
#

Show code

slate swan
#

not add perms after adding it

prime marten
#

oh i see

sinful pasture
#
@disnake.ext.commands.dm_only()
async def foo(message):
    if message.content.startswith('foofoo'):
        await message.author.send('foofoofoo')

I dmed the bot saying foofoo but not response

prime marten
sinful pasture
#

if there is a mistake, i assume it's in the await

slate swan
#

why did you remove the @bot.command decorater?

sinful pasture
#

i didnt, i just didnt include in message

#

oh bruv I mispelled command

#

i wrote commamd...

#

yeah still nothing

slate swan
#

And yea why will the message.content.startwith with foofooo when u use it with prefix

boreal ravine
heavy folio
shadow wraith
heavy folio
#

hm

maiden fable
#

So my bot got verified and with it, it also got Members and Messages Intents!!!

#

(Tho I use Members intent only for bot.users)

upbeat otter
#

congratulations :dogepray:

velvet tinsel
#

yay

velvet tinsel
upbeat otter
velvet tinsel
#

in England?

upbeat otter
slate swan
upbeat otter
visual island
boreal ravine
#

!ot

slate swan
upbeat otter
upbeat otter
slate swan
tough lance
#

Lol

maiden fable
#

Ping

visual island
#

Pong 🏓 ! 104 ms

shadow wraith
#

0 ms

tough lance
shadow wraith
#

💀

abstract kindle
#

hey

#

just curious, how would I handle different CheckFailures?

#
if isinstance(error, commands.CheckFailure):
#

This just handles ALL Check Failures

visual island
#

you would make custom error inherited from CheckFailure

#

so for example

class MyCheckFailure(commands.CheckFailure):
  pass

def my_check(...):
  if True:
    ...
  else:
    raise MyCheckFailure
```or something like that
#

then in your error handler

if isinstance(error, MyCheckFailure):
  ...
abstract kindle
#

I see. And I would just make a new class for each type of check

visual island
#

yes

abstract kindle
#

Cool thank you very much

visual island
#

👍

tough lance
abstract kindle
#

I was just getting stuck on that lol

#

Thanks

visual island
#

I...

#

fixed

#

sorry 😔

boreal ravine
#

@visual island your github username reminds me of a very toxic server owner

fading granite
red sundial
#

hi can anyone help me with deferring and the followup webhook

proper acorn
#

Help me pls why i cant pip install

red sundial
#

its pip install discord.py

tiny ibex
#

Or pip doesn't even exist

tiny ibex
red sundial
#

yeah install python

proper acorn
tiny ibex
red sundial
red sundial
proper acorn
#

@tiny ibex so how to fix?

tiny ibex
#

!pypi discord

unkempt canyonBOT
tiny ibex
#

discord exists

proper acorn
tiny ibex
proper acorn
#

Re-install?

red sundial
tiny ibex
red sundial
tiny ibex
proper acorn
tiny ibex
#

Or locate pip

red sundial
tiny ibex
#

Wait first try to locate pip

proper acorn
tiny ibex
#

If you can't find it then reinstall

tiny ibex
#

1 min

red sundial
proper acorn
red sundial
#

btw do you know python?

proper acorn
#

@tiny ibex

tiny ibex
proper acorn
#

How to uninstall py

tiny ibex
#

C:\Users\your-username\AppData\Local\pip

#

It should be here

#

@proper acorn

proper acorn
tiny ibex
lunar quail
#

Is it normal that guild.create_custom_emoji does not raise any error when the guild cannot accept any new emojis?

proper acorn
#

Wait

tiny ibex
#

It wasn't there?

tiny ibex
#

Use python in cmd

proper acorn
#

@tiny ibex

tiny ibex
proper acorn
#

Still cant

#

Old bug

tiny ibex
#

Just run the python installer

#

Then choose uninstall python

#

Then run again and install

#

Make sure to add it in path\

proper acorn
#

I mean i just re-install but still cant

tiny ibex
proper acorn
#

Lemme try ur

tiny ibex
#

Which python version installer do you have?

#

@proper acorn

proper acorn
#

I forgot

tiny ibex
#

You are using windows 7 right?

#

@proper acorn

proper acorn
#

@tiny ibex

tiny ibex
#

Python 3.9 and above doesn't support windows 7

#

That's your issue

proper acorn
#

Can i have link?

tiny ibex
#

@proper acorn

proper acorn
#

Tysm lemme try

tiny ibex
#

Hmm

proper acorn
#

@tiny ibex

#

which

#

Still cant although i downloaded ..3.7.3

abstract kindle
#

Ok I'm runnin into some trouble with my custom error handler

shadow wraith
#

or pip3 install discord

proper acorn
shadow wraith
#

try pip3 install discord then

boreal ravine
#

their name is flame

#

hes a partnered server owner

visual island
#

wait, you're kayle I've just realized it

proper acorn
#

@shadow wraith still cant

shadow wraith
#

bro try py -m pip install discord then

dapper cobalt
boreal ravine
sour lodge
#
  @commands.command(aliases = ["eightball", "eightBall", "Eightball", "8ball"])
  async def eightBall(self, ctx, *, question):
    embed = discord.Embed(title = "8ball result", description = "Result of the 8ball command", color = discord.Colour.random())
    embed.add_field(name = "Question:", value = question, inline = True)
    embed.add_field(name = "Reply:", value = self.eightball(), inline = True)
    await ctx.send(embed = embed)
``` why is the aliases not working, it shows command not found in the console when I write "8ball" even though its in the aliases
boreal ravine
sour lodge
#

yup

#

ok i fixed it

#

thanks for replying anyways

dapper cobalt
#

By the way, you can pass case_sensitive=False in your bot's constructor. That'll let you avoid adding aliases in multiple cases.

sour lodge
#

alright, thanks

boreal ravine
#

!d discord.ext.commands.Bot case_insensitive

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.
dapper cobalt
sour lodge
#

thanks

stark geyser
#

how do it fix this ?

dapper cobalt
sour lodge
#

what the hell is bot module

dapper cobalt
#

It's an actual package.

#

!pypi bot

unkempt canyonBOT
sour lodge
#

wow

boreal ravine
silk mauve
#

Could someone help I rlly dont know what error this is

#

{admin.mention}\n\n➥<@!{656938345716383777}>\n\n➥<@!{906350757169733722}>\n\n➥<@!{386879253494366208}>

#

It is this one

red sundial
#

send the code

silk mauve
#

If I remove a user

#

It works

boreal ravine
#

@silk mauve not related to discord bots

silk mauve
#

{admin.mention}\n\n➥<@!{656938345716383777}>\n\n➥<@!{906350757169733722}>

#

Like this

silk mauve
#

It pings the role

#

And then the user

#

like it mentions it

red sundial
#

okay

silk mauve
#

it cant ping

red sundial
#

okay

#

whats the error then?

silk mauve
#

okay

#

this

red sundial
#

send your code

silk mauve
#

whole code?

red sundial
#

no just the part where its throwing an error

silk mauve
#

{admin.mention}\n\n➥<@!{656938345716383777}>\n\n➥<@!{906350757169733722}>\n\n➥<@!{386879253494366208}>

red sundial
#

thats not code lol

silk mauve
#

it is

red sundial
#

sure run that in a python comipler

#

see what it returns lol

silk mauve
#

bruzh

#

It is in my embed description

#

Its not showing an error

#

if I run it it does

boreal ravine
red sundial
#

yeah that too

#

its an encoding error

silk mauve
#

mhm

red sundial
#

it probably needs to be set to utf-8

#

r!tag toaster

#

no r!tag here smh

silk mauve
#

I fixed it

maiden fable
#

H

boreal ravine
#

!ot

slate swan
#
async def get_pre(bot, message) -> str:
    """
    i've got some questions, first of all whats bot ? and when is it getting passed same thing with message
    and how would i pass the server id inside of the function arguements 
    and lastly whats even message
    """
    return "guild prefix"
slate swan
cedar stream
#

!d discord.ext.commands.Bot

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.
cedar stream
#

!d discord.Message

unkempt canyonBOT
#

class discord.Message```
Represents a message from Discord.

x == y Checks if two messages are equal.

x != y Checks if two messages are not equal.

hash(x) Returns the message’s hash.
slate swan
#

Can I update my bot’s code without restarting my bot..?

velvet tinsel
#

No

slate swan
velvet tinsel
#

Because

#

Uh 😒

#

The code won’t be saved cos it’s running

slate swan
#

That wasn’t the answer I was looking for

slate swan
velvet tinsel
slate swan
velvet tinsel
#

Yay

#

Good morning Okimii

slate swan
#

Okay, Now I understand

velvet tinsel
slate swan
#

It’s 3:47pm