#discord-bots

1 messages · Page 949 of 1

astral fossil
#

Ok

spring flax
#

you can compare integers too

astral fossil
#

I thought it return the id in weird var type

maiden fable
#

@astral fossil bro I meant command name

#

the command function name open is overriding the in built function named open

astral fossil
#

It probably from discord modules

maiden fable
#

......?

spring flax
#

so, I want to make a command where it searches for messages in a channel with a certain keyword.
Would the best thing for this to be inserting the messages into a DB? It's just for one server

maiden fable
#

well u can use channel.history but it is gonna be slow asf

maiden fable
#

w h a t

astral fossil
#

Ima tried running the code on other device

maiden fable
#

Bro

astral fossil
#

If it worked on other device im burning this raspberry pi

spring flax
maiden fable
#

Okay I hate my writing now

astral fossil
#

Ooooh

#

Why don't you tell me its overrided

maiden fable
#

Understand now? pithink

#

DUDE

maiden fable
astral fossil
slate swan
astral fossil
#

It worked

maiden fable
pure sparrow
#

Nice thx

slate swan
supple thorn
slate swan
jolly karma
#

hello

#

can anyone help me?

#

@lyric needle

maiden fable
#

Imagine pinging randoms

jolly karma
jolly karma
maiden fable
#

Bro they are all volunteers

jolly karma
#

oo

maiden fable
#

Its not like they are getting paid or smth to help u

jolly karma
#

ic can you help me?

maiden fable
#

Post yr code and problem

jolly karma
#

i wanna know how can i make a bot join a vc when the code is run

#

without any commands

maiden fable
#

!d discord.VoiceChannel.connect

unkempt canyonBOT
#

await connect(*, timeout=60.0, reconnect=True, cls=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Connects to voice and creates a [`VoiceClient`](https://discordpy.readthedocs.io/en/master/api.html#discord.VoiceClient "discord.VoiceClient") to establish your connection to the voice server.

This requires [`voice_states`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.voice_states "discord.Intents.voice_states").
jolly karma
#
async def join_vc(ctx):
    channel="959704295903748137"
    await client.join_voice_channel(channel)
maiden fable
#

No

jolly karma
#

?

maiden fable
#
channel = client.get_channel(id-here)
await channel.connect()
jolly karma
#

let me try

maiden fable
#

also id is int

jolly karma
#

am a nub

maiden fable
#

its fine, everyone starts from somewhere

jolly karma
#
@client.event
async def on_ready():
    print("bot online") #will print "bot online" in the console when the bot is online
async def join_vc(ctx):
    channel = client.get_channel(959704295903748137)
    await channel.connect()
#

didnt join the vc

#

;-;

#

lol

maiden fable
#

is client a commands.Bot instance?

maiden fable
#

then u can tell him, go on

jolly karma
#

client = discord.Client()

client = commands.Bot(command_prefix = '!')

slate swan
#

what if the id is of a text channel

jolly karma
slate swan
#

lmao

maiden fable
#

ahem ahem

jolly karma
#

lemme check ;-;

slate swan
#

oh wait wrong reply

#

and you shouldnt define client twice

jolly karma
#

okay its a vc

slate swan
#

just use commands.Bot

#

since you're just overwriting the client variable

jolly karma
jolly karma
#
client = commands.Bot(command_prefix = '!'), discord.Client()
#
import discord
import os
import time
import discord.ext
from discord.utils import get
from discord.ext import commands, tasks
from discord.ext.commands import has_permissions,  CheckFailure, check

client = commands.Bot(command_prefix = '!'), discord.Client()

@client.event
async def on_ready():
    print("bot online")
async def join_vc(ctx):
    channel = client.get_channel(959704295903748137)
    await channel.connect()


@client.command()
async def ping(ctx):
    await ctx.send("pong!") 

async def kick(ctx, member : discord.Member):
    try:
        await member.kick(reason=None)
        await ctx.send("kicked "+member.mention)
    except:
        await ctx.send("bot does not have the kick members permission!")


client.run(os.getenv("token")) 
maiden fable
#

!code thanks

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.

jolly karma
slate swan
#
import discord
from discord.ext import commands

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

@bot.event
async def on_ready():
  print("online uwu")

@bot.command()
async def join(ctx):
  channel = bot.get_channel(channel_id)
  if not channel:
    return
  try:
    channel.connect()
  except discord.Forbidden:
    return await ctx.send("missing access")
bot.run(token)
#

this is how it should look like

jolly karma
#

lemme try

slate swan
#

dont copy paste though

#

😔

supple thorn
slate swan
#

and you need PyNaCl for VCs

slate swan
maiden fable
#

just do pip install discord.py[voice] and u r done

supple thorn
# slate swan lmao

It's like throw stake to a bunch of lions and telling them not to devour it

maiden fable
#

who is a lion here now Indeed

supple thorn
#

Also i was mostly expecting you to name bot to uwu

maiden fable
#

Don't make her remember that its already annoying

pure sparrow
jolly karma
maiden fable
#

await channel.connect

supple thorn
#

It's a coroutine

slate swan
maiden fable
#

and what is Module here

jolly karma
#
Ignoring exception in command join:
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "main.py", line 18, in join
    await channel.connect()
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/abc.py", line 1150, in connect
    voice = cls(client, self)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/voice_client.py", line 199, in __init__
    raise RuntimeError("PyNaCl library needed in order to use voice")
RuntimeError: PyNaCl library needed in order to use voice

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

Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 902, in invoke
    await ctx.command.invoke(ctx)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 864, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/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: RuntimeError: PyNaCl library needed in order to use voice
#

;-;

slate swan
maiden fable
#

Ah gotcha

jolly karma
#

bruh python is hard

maiden fable
jolly karma
#

c was easy

maiden fable
#

Well Python uses C under the hood

jolly karma
jolly karma
maiden fable
#

I told u

maiden fable
#

Also there is a discord wrapper in C too, in case u want to check it out

maiden fable
#

Nvm there isn't one

slate swan
#

lmao

maiden fable
maiden fable
#

Well 🤷

#

pip install discord.py[voice]

#

Type this and press Enter in command prompt

jolly karma
#

@maiden fable sir its working but i wanted so that it joins when the code is turned on so that i dont have to type a command

maiden fable
#

use on_ready

jolly karma
#

how?

#

i put the code there

#

but its not making it join

maiden fable
#

Well

jolly karma
maiden fable
#
import discord
from discord.ext import commands

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

@bot.event
async def on_ready():
  print("online uwu")
  channel = bot.get_channel(channel_id)
  if not channel:
    return
  try:
    channel.connect()
  except discord.Forbidden:
    print("Gimme perms")
bot.run(token)
slate swan
boreal ravine
maiden fable
maiden fable
jolly karma
slate swan
#

Mac?

#

Linux?

maiden fable
#

same

jolly karma
boreal ravine
slate swan
# jolly karma why?

because that event is triggered multiple times and has a higher chance of your bot disconnecting

maiden fable
jolly karma
slate swan
slate swan
jolly karma
boreal ravine
#

help bug: ```py
IMPORT FISOCRD

CLITNETE = FISOCORD.FICOCORDO(CLIENT=NONE, CPREFIX="UWU*)

CLIEGNENE.RUN("UWU.GOKEN")

maiden fable
slate swan
#

...

jolly karma
slate swan
boreal ravine
#

its real

#

pls click

slate swan
#

DNS error

supple thorn
maiden fable
boreal ravine
#

FREE NITRO

maiden fable
#

Hmmm

supple thorn
boreal ravine
#

TRUST.

boreal ravine
jolly karma
jolly karma
#

breh

maiden fable
slate swan
jolly karma
maiden fable
jolly karma
#

btw @maiden fable so with that code if i will run the code for 24/7, so the bot will be in the vc forever??

boreal ravine
maiden fable
#

Meh, even if u get my IP and get my laptop name, idgaf its named as HP anyways and brave has blocked all the website trackers

jolly karma
#

ic

maiden fable
#

U cannot get my location anyways 🤷

jolly karma
#

me on dark web ;-;

maiden fable
#

Stop, its against ToS

jolly karma
#

uwu

jolly karma
#

i just use vpn

latent ember
#

Its just possible

buoyant zodiac
#

spam bot??

formal basin
#

When i say hi it spams hi back

formal basin
#

Btw it is under an a message event

supple thorn
formal basin
#

I send a screenshot

supple thorn
formal basin
supple thorn
formal basin
#

Ok

supple thorn
#

Hello Ash

slate swan
#

and is it good to define a variable every message....?

slate swan
supple thorn
formal basin
boreal ravine
#

@slate swan this you

slate swan
#

I'm not 18 yet s.m.h.

formal basin
pure sparrow
#

hi guys are you interested to host your bot for free ? I have a youtube video that is really helpful and I get it, my bot is hosted without paying anything, of course you can pay to upgrade some characteristics but that's not important

pure sparrow
supple thorn
#

That's what someone who is advertising would say

pure sparrow
#

imagine if a guy here looking for hosting his bot

pure sparrow
formal basin
supple thorn
#

You are promoting your video

pure sparrow
#

that's not my bruh

supple thorn
#

🗿

slate swan
pure sparrow
#

bruuh

supple thorn
pure sparrow
#

ok so we can't help here

supple thorn
#

It doesn't matter if it isn't yours

pure sparrow
#

🤦‍♂️

supple thorn
#

You literally just posted that out of the blue

pure sparrow
#

and is it forbidden ? I can't see anything that forbid it

unkempt canyonBOT
#

6. Do not post unapproved advertising.

supple thorn
pure sparrow
#

maybe advertising is forbidden but help each other...

#

did I posted the link of the video ? man your cringe

#

"unapproved"

supple thorn
formal basin
supple thorn
#

And why are using member.bot

#

It's in a on_message event

#

You don't have member

formal basin
supple thorn
#

It's message.author.bot iirc

supple thorn
formal basin
#

Ok

supple thorn
supple thorn
#

It should just be

if message.author.bot:
    return
maiden fable
spring flax
#

is this correct usage?

async def on_message(self, message):
    if message.channel.id != CHANNEL_ID or \
    not message.author.bot or \
    not message.attachments:
        return
spring flax
#

then what can I put?

maiden fable
#

U can instead do:

if (
condition1 or
condition2
or condition3
):
#

I just showed u 2 ways to put or

#

Either at the first or last

spring flax
#

ah yeah that looks more net thank you

#

neat*

latent ember
#
@discord.ext.commands.has_role(959430769086959646)
async def mute(ctx, member: discord.Member, *, reason=None):
  guild = ctx.guil
  mutedRole = discord.utils.get(guild.roles, name="Muted")

  if not mutedRole:
    mutedRole = await guild.create.role(name = "Muted")

    for channel in guild.channels:
      await channel.set_permissions(mutedRole, speak=False, send_messages=False, read_message_history=True, read_messages=False)

await member.add_roles(mutedRole, reason=reason)
await ctx.send(f"Muted {member.mention} for reason {reason}")
await member.send(f"You were muted in the server {guild.name} for reason {reason}")```
#

File "main.py", line 75
await member.add_roles(mutedRole, reason=reason)
^
IndentationError: unindent does not match any outer indentation level

#

how to fix?

spring flax
#

oh my

spring flax
#

!resources

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.

latent ember
spring flax
#

Have you fixed them?

latent ember
#

Yes

#

now it works

spring flax
#

ah okay cool

spring flax
#

Because the way you're making the muted role if there is no role named Muted isn't very efficient.

latent ember
#

im making a bot for my own server.

latent ember
#

and i cant find the problem in that

#
@discord.ext.commands.has_role(959430769086959646)
async def unmute(ctx, member: discord.Member):
      mutedRole = discord.utils.get(ctx.guild_roles, name= "Muted")

    await member.remove_roles(mutedRole)
    await ctx.send(f"Unmuted {mention.member}", delete_after = 20)
    await member.send(f"You were unmuted in the server {guild.name}")```
#

File "main.py", line 84
await member.remove_roles(mutedRole)

IndentationError: unindent does not match any outer indentation level

spring flax
#

indents

#

!indents

unkempt canyonBOT
#

Indentation

Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.

Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.

Example

def foo():
    bar = 'baz'  # indented one level
    if bar == 'baz':
        print('ham')  # indented two levels
    return bar  # indented one level

The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.

Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines

More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation

latent ember
#

.

spring flax
#

sure you can

#

IndentationError: unindent does not match any outer indentation level

latent ember
#

how to fix it

spring flax
#

do you know what indents are?

spring flax
latent ember
#

not really

#

can you help

spring flax
#

which editor or IDE are you using?

latent ember
#

replit

spring flax
#

!paste

unkempt canyonBOT
#

Pasting large amounts of code

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

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

spring flax
#

Just copy-paste

latent ember
#

do you know how to fix the unmute thing?

spring flax
#
@client.command(description = "Unmutes the specified person")
@discord.ext.commands.has_role(959430769086959646)
async def unmute(ctx, member: discord.Member):
      mutedRole = discord.utils.get(ctx.guild.roles, name="Muted")

  
  await member.remove_roles(mutedRole)
  await ctx.send(f"Unmuted {mention.member}", delete_after = 10)
  await member.send(f"You were unmuted in the server {guild.name}")

#

this is a function, so all the code for the command should be indented a tab after the async def unmute(ctx, member : disnake.Member):

#

and your decorators are wrong

#

!d discord.ext.commands.has_role

unkempt canyonBOT
#

@discord.ext.commands.has_role(item)```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member invoking the command has the role specified via the name or ID specified.

If a string is specified, you must give the exact name of the role, including caps and spelling.

If an integer is specified, you must give the exact snowflake ID of the role.

If the message is invoked in a private message context then the check will return `False`.

This check raises one of two special exceptions, [`MissingRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingRole "discord.ext.commands.MissingRole") if the user is missing a role, or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") if it is used in a private message. Both inherit from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").

Changed in version 1.1: Raise [`MissingRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingRole "discord.ext.commands.MissingRole") or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") instead of generic [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure")...
spring flax
#

and I must mention your unban command is a very bad practice

hoary cargo
spring flax
#

tis not my code

hoary cargo
#

Is not muted*

#

Ik

spring flax
#

yeah it's probably from a YT video

latent ember
#

and learn at same time

spring flax
spring flax
latent ember
#

But i need an working unmute command now

spring flax
hoary cargo
#

Tbh you should use the timeout feature

#

More efficient

hoary cargo
#

In Python without indentation you can't do nothing

slate swan
#

😔

#

!e

print("uwu")
unkempt canyonBOT
#

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

uwu
hoary cargo
#

blobsad yeah that's what I wanted to say rn
You can print uwu world

slate swan
#

good enough

spring flax
#

how do you get the number of reactions the message has in a raw_reaction_add?

maiden fable
lament mesa
#

there was some undocumented bot._connection.get_message or something

sturdy raven
#
import discord 

from discord.ext import commands

from datetime import datetime

class Yawncommands(commands.Cog):

    def __init__(self, bot: commands.Bot):
        self.bot = bot

    @commands.Cog.listener()
    async def on_member_join(self, member: discord.Member):
        channel = self.bot.get_channel(915295833845530656)
        if not channel:
            return
        
        wel_msg = discord.Embed(title=f"Welcome {member}!", description=f"Greetings {ctx.member.metion}. Thank you for joining us, please follow the rules and check out our patch notes and announcements for updates on the server. ", colour=0x9b59b6, timestamp=datetime.utcnow())
        wel_msg.set_footer(text="supposedIy_sam", icon_url="https://i.imgur.com/8re0BwN.png")
        wel_msg.set_thumbnail(url="https://i.imgur.com/8re0BwN.png")
        await channel.send(embed=wel_msg)

def setup(bot: commands.Bot):
    bot.add_cog(Yawncommands(bot)

NameError: name 'ctx' is not defined

supple thorn
#

Why would you use ctx?

#

It's in a on_member_join

sturdy raven
#

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

#

oh wait nvm

#

ty btw

formal basin
#

Why does this not work?

spring flax
slate swan
#

hi

cold sonnet
formal basin
cold sonnet
#

are you copying a video

formal basin
warm sable
#

What is the error

formal basin
#

When I type ?bal @jaunty folio it says my bal

#

Instead of @jaunty folio bal

warm sable
cold sonnet
#

you always use ctx.author

formal basin
warm sable
#

You hard coded the user to be the author

feral jacinth
maiden fable
formal basin
cold sonnet
#

and you opened the account of yourself, not the user

spring flax
formal basin
#

So what do I do

cold sonnet
#

this is why you don't just copy a video without understanding

maiden fable
warm sable
spring flax
warm sable
#

If you need the author somewhere else, use ctx.author or add author = ctx.auhtor somewhere instead of using user again

#

Since that will override the variable you used in the command before

cold sonnet
#

pretty sure you have to replace ctx.author in the open_account() aswell

spring flax
#

also where are the docs for bot.get_message?

feral jacinth
#

@formal basin do open_account(user)

warm sable
cold sonnet
#

does it

#

!d discord.RawReactionActionEvent

unkempt canyonBOT
#

class discord.RawReactionActionEvent```
Represents the payload for a [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") or [`on_raw_reaction_remove()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_remove "discord.on_raw_reaction_remove") event.
formal basin
feral jacinth
cold sonnet
formal basin
warm sable
cold sonnet
warm sable
#

I assume if you check the numbers it will be their bal :)

formal basin
#

Oh

feral jacinth
warm sable
feral jacinth
#

user variable that you made use it

warm sable
feral jacinth
#

use it

formal basin
cold sonnet
#

god

warm sable
#

No need to use ctx

formal basin
#

Do I use that

feral jacinth
formal basin
warm sable
#

user is already the person

feral jacinth
#

or display_name

formal basin
#

It works

warm sable
#

You should only use ctx if you need some info from the command you used (the msg, the author, ...)

formal basin
#

Thanks

feral jacinth
#

ctx is command context

#

learn python

latent ember
#

why is my bot doing this?

#

when muting someone

feral jacinth
latent ember
#
@discord.ext.commands.has_role(959430769086959646)
async def mute(ctx, member: discord.Member, *, reason=None):
  guild = ctx.guild
  mutedRole = discord.utils.get(guild_roles, name="Muted")

  if not mutedRole:
    mutedRole = await guild.create_role(name ="Muted")

    for channel in guild.channels:
      await channel.set_permissions(mutedRole, speak=False, send_messages=False, read_message_history=True, read_messages=True)

  await member.add_roles(mutedRole,reason=reason)
  await ctx.send(f"Muted {member.mention} for reason {reason}", delete_after = 10)
  await member.send(f"You were muted in the server {guild.name} for reason {reason}")
latent ember
latent ember
warm sable
#

It doesn't say Successfully muted anywhere?

latent ember
#

it sucessfully mutes

#

but it dosent tag the muted person

gaunt ice
#

tag?

warm sable
#

You can always just use <@id> to tag

latent ember
#

i know

warm sable
#

What I meant was, the msg in your screenshot is no where in the code you send

maiden fable
lament mesa
#

though increasing the cache size will make your program use more ram

#

but if a have a lot of ram then go for it

latent ember
lyric apex
#

I need To get all channels of bot is in not for one guild for whole how do i get it anyone pls go through and help

latent ember
#

Now my mute command dosent work

#

Traceback (most recent call last):
File "/home/runner/Bot/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/home/runner/Bot/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/home/runner/Bot/venv/lib/python3.8/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: NameError: name 'guild_roles' is not defined

honest shoal
unkempt canyonBOT
#

for ... in get_all_channels()```
A generator that retrieves every [`abc.GuildChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.GuildChannel "discord.abc.GuildChannel") the client can ‘access’.

This is equivalent to:

```py
for guild in client.guilds:
    for channel in guild.channels:
        yield channel
```   Note

Just because you receive a [`abc.GuildChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.GuildChannel "discord.abc.GuildChannel") does not mean that you can communicate in said channel. [`abc.GuildChannel.permissions_for()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.GuildChannel.permissions_for "discord.abc.GuildChannel.permissions_for") should be used for that.
latent ember
# latent ember Traceback (most recent call last): File "/home/runner/Bot/venv/lib/python3.8/s...
@discord.ext.commands.has_role(959430769086959646)
async def mute(ctx, member: discord.Member, *, reason=None):
  guild = ctx.guild
  mutedRole = discord.utils.get(guild_roles, name="Muted")

  if not mutedRole:
    mutedRole = await guild.create_role(name ="Muted")

    for channel in guild.channels:
      await channel.set_permissions(mutedRole, speak=False, send_messages=False, read_message_history=True, read_messages=False)

  await member.add_roles(mutedRole,reason=reason)
  await ctx.send(f"Muted {member.mention} for reason {reason}", delete_after = 10)
  await member.send(f"You were muted in the server {guild.name} for reason {reason}")```
lyric apex
#

So would i use , client.get_all_text_channels()? @honest shoal

honest shoal
lyric apex
#

ok I try If any error i will get back to you

acoustic sleet
#

how can i make a command to snipe an edited message with discord.py

#

like, how to get the original msg

lyric apex
#

it isn't working @honest shoal

honest shoal
honest shoal
lyric apex
#

@client.command() async def testt(ctx): r, g, b = tuple(int(x * 255) for x in colorsys.hsv_to_rgb(random.random(), 1, 1)) embed=discord.Embed(color = discord.Color((r << 16) + (g << 8) + b), timestamp=ctx.message.created_at) all = len(set(client.get.all_text_channels())) embed.add_field(name="Bot Channels: ", value=all) await ctx.send(embed=embed)

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.

lyric apex
#

I use?

honest shoal
#

yes

lyric apex
#

!code @client.command()
async def testt(ctx):
r, g, b = tuple(int(x * 255) for x in colorsys.hsv_to_rgb(random.random(), 1, 1))
embed=discord.Embed(color = discord.Color((r << 16) + (g << 8) + b), timestamp=ctx.message.created_at)
all = len(set(client.get.all_text_channels()))
embed.add_field(name="Bot Channels: ", value=all)
await ctx.send(embed=embed)

honest shoal
#

ahh

lyric apex
#

?

honest shoal
#
@client.command()
async def testt(ctx):
     r, g, b = tuple(int(x * 255) for x in colorsys.hsv_to_rgb(random.random(), 1, 1))
     embed=discord.Embed(color = discord.Color((r << 16) + (g << 8) + b), timestamp=ctx.message.created_at) 
     all = len(set(client.get.all_text_channels()))
     embed.add_field(name="Bot Channels: ", value=all)
     await ctx.send(embed=embed)```
#

just posting from your side to make it readable

lyric apex
#

Oh

#

Is there any mistake?

#

@honest shoal ?

honest shoal
#

use a for loop

lyric apex
#

I didn't understand

honest shoal
spring flax
#

Where are the docs for max_messages kwarg for bot

maiden fable
lyric apex
# honest shoal did you get any error

``raise CommandInvokeError(exc) from exc

2022-04-02T10:53:27.972087+00:00 app[worker.1]: discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Bot' object has no attribute 'get'``

spring flax
visual island
cloud dawn
#

Why?

lyric apex
#

Pls help

slate swan
#

whats the issue?

cloud dawn
lyric apex
lyric apex
supple thorn
cloud dawn
slate swan
honest shoal
lyric apex
#

Ok i try both

supple thorn
cloud dawn
supple thorn
#

🗿

honest shoal
#

ohh, I didn't read properly

slate swan
visual island
#

!d discord.Client.get_all_channels

unkempt canyonBOT
#

for ... in get_all_channels()```
A generator that retrieves every [`abc.GuildChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.GuildChannel "discord.abc.GuildChannel") the client can ‘access’.

This is equivalent to:

```py
for guild in client.guilds:
    for channel in guild.channels:
        yield channel
```   Note

Just because you receive a [`abc.GuildChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.GuildChannel "discord.abc.GuildChannel") does not mean that you can communicate in said channel. [`abc.GuildChannel.permissions_for()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.GuildChannel.permissions_for "discord.abc.GuildChannel.permissions_for") should be used for that.
honest shoal
#

my bad

visual island
#

easier

acoustic sleet
honest shoal
cloud dawn
acoustic sleet
#

yeah i was asking for how to get the original message from an edited one

slate swan
#
c = ([channel in guild.text_channels for guild in bot.guilds])

what would this do?
@cloud dawn

visual island
#

channel is undefined

acoustic sleet
#

i think it would create a list of every text channel of every server the bot is in

cloud dawn
slate swan
#

ic

slate swan
cloud dawn
acoustic sleet
cloud dawn
#

And in bot.guilds will give a syntax error.

acoustic sleet
#

oh

maiden fable
cloud dawn
visual island
#

isinstance exists

cloud dawn
# visual island isinstance exists

Would be more code and not faster since this is the get_all_channels function ```py
for guild in client.guilds:
for channel in guild.channels:
yield channel

lyric apex
#

Not working

cloud dawn
lyric apex
#
@client.command()
async def testt(ctx):
     r, g, b = tuple(int(x * 255) for x in colorsys.hsv_to_rgb(random.random(), 1, 1))
     embed=discord.Embed(color = discord.Color((r << 16) + (g << 8) + b), timestamp=ctx.message.created_at) 
     all_channels = len([channel for guild in bot.guilds for channel in guild.text_channels])
     embed.add_field(name="Bot Channels: ", value=f"{all_channels}")
     await ctx.send(embed=embed)```
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Command' object has no attribute 'guilds'

#

@cloud dawn this is the error

visual island
#

You have a command named "bot"

maiden fable
lyric apex
cloud dawn
maiden fable
#

Wait nvm, yea it is. Just use list(get_all_channels) then, ig?

visual island
#

for?

#

len also works for iterator/generator

maiden fable
#

Ouh

#

Then channels = len(cnl for cnl in bot.get_all_channels() if isinstance(cnl, TextChannel)) should work

cloud dawn
# maiden fable Huh, get_all_channels is a generator?

Still a generator ```py
def get_all_channels(self) -> Generator[GuildChannel, None, None]:
"""A generator that retrieves every :class:.abc.GuildChannel the client can 'access'.
This is equivalent to: ::
for guild in client.guilds:
for channel in guild.channels:
yield channel
.. note::
Just because you receive a :class:.abc.GuildChannel does not mean that
you can communicate in said channel. :meth:.abc.GuildChannel.permissions_for should
be used for that.
Yields
------
:class:.abc.GuildChannel
A channel the client can 'access'.
"""
for guild in self.guilds:
yield from guild.channels

tidal hawk
#

Does Mee6 bot allow other bots to use their commands?

maiden fable
#

No

lyric apex
cloud dawn
maiden fable
#

It is?

cloud dawn
# maiden fable It is?

I mean you are getting more results then filtering them using isinstance so I'd say it is.

lyric apex
#

What i do now?

cloud dawn
lyric apex
cloud dawn
# lyric apex Yeah

try this ```py
@client.command()
async def testt(ctx):
r, g, b = tuple(int(x * 255) for x in colorsys.hsv_to_rgb(random.random(), 1, 1))
embed=discord.Embed(color = discord.Color((r << 16) + (g << 8) + b), timestamp=ctx.message.created_at)
all_channels = len([channel for guild in client.guilds for channel in guild.text_channels])
embed.add_field(name="Bot Channels: ", value=all_channels)
await ctx.send(embed=embed)

lyric apex
#

Does that was because of f string?

cloud dawn
#

the main issue that since I thought we were making a command I used bot but since you named bot client and not bot, I used bot instead of client but generally with commands we use bot for better naming.

slate swan
#

this is annoying me

visual island
cloud dawn
slate swan
#

yes

supple thorn
slate swan
#

whats wrong with it being uppercase

supple thorn
slate swan
#

wdym by why then

misty sluice
#
Traceback (most recent call last):
  File "C:\Users\Micro\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 113, in wrapped
    ret = await coro(arg)
  File "C:\Users\Micro\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 783, in _invoke    
    await self.callback(ctx, **kwargs)
  File "c:\Users\Micro\Downloads\Canomi\main.py", line 51, in serverinfo
    await ctx.send(embed = embed)
  File "C:\Users\Micro\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\abc.py", line 1438, in send
    data = await state.http.send_message(
  File "C:\Users\Micro\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 357, in request
    raise HTTPException(response, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In embeds.0.fields.4.value: Must be 1024 or fewer in length.

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

Traceback (most recent call last):
  File "C:\Users\Micro\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 994, in invoke_application_command
    await ctx.command.invoke(ctx)
  File "C:\Users\Micro\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 314, in invoke     
    await injected(ctx)
  File "C:\Users\Micro\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 119, in wrapped    
    raise ApplicationCommandInvokeError(exc) from exc
discord.commands.errors.ApplicationCommandInvokeError: Application Command raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In embeds.0.fields.4.value: Must be 1024 or fewer in length.
``` whats this error mean
#

for the code of

@client.slash_command(guild_ids = servers, name="serverinfo")
async def serverinfo(ctx):
  all_roles = ""
  for role in ctx.guild.roles:
    all_roles += f"{role.mention} "

  guild = ctx.guild
  embed = discord.Embed(title = ctx.guild.name, description = f"Information on {ctx.guild}", color = client.ecolor)
  embed.add_field(name = "Members", value = guild.member_count, inline = False)
  embed.add_field(name = "Channels", value = f"All channels: {len(guild.channels)} \n Text Chanels: {len(guild.text_channels)} \n Voice Channels: {len(guild.voice_channels)}", inline = False)
  embed.add_field(name = "ID", value = guild.id, inline = False)
  embed.add_field(name = "Owner", value = guild.owner, inline = False)
  embed.add_field(name = f"Roles ({len(guild.roles)})", value = all_roles, inline = False)
  embed.set_thumbnail(url = ctx.guild.icon.url)
  await ctx.send(embed = embed)
cloud dawn
misty sluice
#

o

cloud dawn
#

You can check for char length and cut items.

misty sluice
#

is guild.bot_count a thing? i wanna fetch the amount of bots in a server with d.py

neat salmon
#

I don't think bot_count is a thing, you might have to iterate through every member instead and see if they're a bot, to then add them to a list.

#

Also, ideally don't ghost ping; it's just not cool for some people.

misty sluice
#

there has to be some way!

neat salmon
#

Add to a list

boreal ravine
#

iterate through guild.members check if the member is a bot

neat salmon
#

int += 1

modern fiber
#

What's a function for bot to list (mention) all users that have a specific role?

#

Trying to create a staff list bot.

cloud dawn
#

Why not mention the role instead of mentioning all users?

modern fiber
#

so...

neat salmon
#

for every member
if your role in their roles
add to list

cloud dawn
#
user_mentions = [member.mention for member in role.members]
modern fiber
#

I think I found it, this one good?

cloud dawn
neat salmon
#

It's been a while since I've done bot development.

modern fiber
# modern fiber

Is there a way I can make a command so you can choose your staff roles, and then it uses those for this command / event that will auto-edit itself whenever someone new is being added to one of those roles

#

@cloud dawn

cloud dawn
#

!d discord.on_member_update Yes that is possible

unkempt canyonBOT
#

discord.on_member_update(before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") updates their profile.

This is called when one or more of the following things change:

• nickname

• roles

• pending...
cloud dawn
#

half a decade lmao

modern fiber
#

Ah,

#

I mean - it still works uh?

cloud dawn
rocky hornet
#

where should i store bot db cursor?

#

i have bot.db which is the connection

#

bot.cursor = bot.db.cursor()?

cloud dawn
modern fiber
# unkempt canyon

Is there an example of how to use it, on this code for example?

@bot.command(pass_context=True)  
async def getuser(ctx, role: discord.Role):
    role = discord.utils.get(ctx.message.server.roles, name="mod")
    if role is None:
        await bot.say('There is no "mod" role on this server!')
        return
    empty = True
    for member in ctx.message.server.members:
        if role in member.roles:
            await bot.say("{0.name}: {0.id}".format(member))
            empty = False
    if empty:
        await bot.say("Nobody has the role {}".format(role.mention))```
rocky hornet
#

ty

sick birch
neat salmon
cloud dawn
sick birch
#

And yeah the code is very old

slim ibex
#
@bot.event
async def on_member_update(before, after):
  ...
modern fiber
#

Okay, let me try.

slim ibex
#

bot.say 🗿

cloud dawn
slim ibex
#

^

modern fiber
#

role = discord.utils.get(ctx.message.server.roles, name="mod")
if role is None:

sick birch
#

But what if you don’t want context

cloud dawn
supple thorn
sick birch
#

Hm I guess you can just use a placeholder variable _

modern fiber
modern fiber
#

but trying to test if it works as private bot first.

sick birch
#

Gotcha, probably best to have a command that sets the mod role

cloud dawn
sick birch
#

So your users aren’t forced into a certain name for their mod roles

#

(Hint: database time!)

modern fiber
cloud dawn
cloud dawn
modern fiber
modern fiber
#

That's why am I trying to find an other way.

#

And all the sources seems old as fuck.

green bluff
#

im trying to learn aiosqlite but im getting no where

cloud dawn
#

Robin always has time, he once made a whole system for someone. You're in good hands.
Even on phone.

green bluff
sick birch
sick birch
#

But glad you think that 😊

slim ibex
# green bluff

in the first parenthesis, you specify the column to insert to

modern fiber
#

If you don't mind- 😐

cloud dawn
cloud dawn
#

dw ptsd will kick in after a year or so

sick birch
#

Help channels are generally better since people can pop in and provide some feedback

cloud dawn
#

I want to help.. but I'm going soon so don't want to ty myself to a big thing rn. My grandpa is having his birthday :)

modern fiber
#

The thing is I don't know where to start from, including the set mod roles command.

sick birch
supple thorn
cloud dawn
sick birch
#

By typehinting to discord.Role

cloud dawn
supple thorn
modern fiber
modern fiber
sick birch
#

Ping CokeCane (go ahead, laugh) if you open up a help channel later

sick birch
cloud dawn
#

@modern fiber okay correct me if I'm wrong.
He want to create a static channel dedicated to a staff list.
That when someone gets added or deleted to update itself.

So looking at dynamic input of role and channel and saving the msg id.

sick birch
#

Oh, that’s not hard in theory

#

Coding it up might prove slightly more challenging

cloud dawn
frozen patio
#

Hello, I need to add the pfp of the user for my userinfo command, not the authors pfp

sick birch
#

Not being sarcastic, it shouldn’t be very difficult to code if you know what you’re doing, that is

cloud dawn
#

This requires combining like 10+ methods and a database.

sick birch
#

When you put it like that maybe

slim ibex
#

it would be user.avatar.url in your case

slate swan
modern fiber
sick birch
#

More so about time than difficulty

slate swan
cloud dawn
modern fiber
supple thorn
sick birch
#

Is there an event dispatched for on role update?

supple thorn
#

We already answered

cloud dawn
slim ibex
slate swan
#
@client.command(aliases=["whois"])
async def userinfo(ctx, member: discord.Member = None):
    if not member: 
        member = ctx.message.author
    roles = [role for role in member.roles]
    embed = discord.Embed(colour=discord.Colour.purple(), timestamp=ctx.message.created_at,
                          title=f"User Info - {member}")
    embed.set_thumbnail(url=member.avatar_url)
    embed.set_footer(text=f"Requested by {ctx.author}")

    embed.add_field(name="ID:", value=member.id)
    embed.add_field(name="Display Name:", value=member.display_name)

    embed.add_field(name="Created Account On:", value=member.created_at.strftime("%a, %#d %B %Y, %I:%M %p UTC"))
    embed.add_field(name="Joined Server On:", value=member.joined_at.strftime("%a, %#d %B %Y, %I:%M %p UTC"))

    embed.add_field(name="Roles:", value="".join([role.mention for role in roles]))
    embed.add_field(name="Highest Role:", value=member.top_role.mention)
    print(member.top_role.mention)
    await ctx.send(embed=embed)
cloud dawn
sick birch
#

Or is that part of on guild update

modern fiber
sick birch
#

Hm. Okay you can use that to update the staff list

frozen patio
sick birch
#

Or is that what you’re already doing? I saw some mention about on member update a while ago

cloud dawn
sick birch
#

Yeah let’s get an MVP out first then worth about that haha

modern fiber
cloud dawn
#

Public bots are a pain to debug.

sick birch
modern fiber
supple thorn
cloud dawn
modern fiber
modern fiber
sick birch
supple thorn
sick birch
#

Best place to start is a basic bot structure

cloud dawn
supple thorn
#

Never made a PR before

sick birch
#

The GitHub has a basic_bot.py example that might be useful to you

supple thorn
#

Would also want to try

modern fiber
sick birch
#

Takes a bit to get the hang of but you’ll get there

cloud dawn
modern fiber
#

What an actual f-

#

Would replit work instead? LOL

sick birch
#

I have never seen that before

#

Is that GitHub desktop?

modern fiber
cloud dawn
modern fiber
#

Oh not an app-

#

It seems impossible for me to install app since I get like 50 errors.

cloud dawn
sick birch
#

Just make a new repository and drop your code in

#

All online btw

cloud dawn
green bluff
#

help please it counts each letter of a string

modern fiber
sick birch
#

I find the desktop to be intimidating

modern fiber
#

Lol.

green bluff
sick birch
green bluff
#

can someone help it counts each letter of the string and tries putting it in db

sick birch
#

“Create a new repo from the command line”

#

Since you already have your code

modern fiber
cloud dawn
# modern fiber Where?

I recommend github desktop unless you like no-gui command line harcore windows user like robin

sick birch
#

I don’t even use windows man

modern fiber
#

😳

modern fiber
cloud dawn
sick birch
#

It’s good. You’re not the first one

modern fiber
#

Okay listen me- Im being ultra noob at this point

#

mind explaining me? LOL

cloud dawn
modern fiber
slim ibex
modern fiber
sick birch
#

Should be an easy fix

modern fiber
#

or should I use pip install git

slim ibex
modern fiber
#

LMFAO

cloud dawn
#

We're not linux where we download programs trough cl

sick birch
#

You’ll need git a lot so Better to have it than not

modern fiber
sick birch
modern fiber
#

Ignore my rondo all turca mp4

cloud dawn
slim ibex
#

imagine using MacOS

sick birch
#

Or you know, coming pre installed like a normal person 🙃

modern fiber
#

I just spammed next

sick birch
#

There you are

sick birch
modern fiber
#

Should I just continue with Finish'

cloud dawn
#

Switch them.

sick birch
#

Yep

modern fiber
cloud dawn
#

who reads release notes lol

sick birch
#

True

modern fiber
#

So I should uncheck it and check git bash?

sick birch
#

Check it off if you want doesn’t matter

cloud dawn
#

Yes

modern fiber
#

Ok

#

Ok uhhh

#

am I about to hack a NASA now or what

sick birch
#

Yeah close that off

modern fiber
cloud dawn
#

There is your GUI-less command line interface.

sick birch
#

Now you can follow those commands git told you about

modern fiber
#

Mk.

sick birch
#

Just the first section

modern fiber
cloud dawn
#

I recommend logging in first.

sick birch
#

Oh come on

modern fiber
#

Huh?

sick birch
#

Does git auto add to path on windows?

cloud dawn
modern fiber
#

.

sick birch
#

Damnnit

modern fiber
#

.....

#

So what do I do now LMFAO

sick birch
#

Fine we’ll do this manually

cloud dawn
#

gitdesktop

modern fiber
sick birch
#

Go on your GitHub repo and it should be a button to upload files

cloud dawn
sick birch
#

Gits being a pain

modern fiber
#

"…or import code from another repository
You can initialize this repository with code from a Subversion, Mercurial, or TFS project."

#

This one?

sick birch
#

Nah click the code button at the top

#

That takes you to your empty repo

modern fiber
tough lance
#

Hllo

sick birch
undone tartan
cloud dawn
modern fiber
sick birch
#

Hmm

#

Hate git sometimes

undone tartan
modern fiber
sick birch
#

Right

modern fiber
#

Pressed it..

cloud dawn
undone tartan
#

huh

sick birch
#

You know what it’s fine we’ll do this later lmao

#

Let’s get the code working first

undone tartan
#

i just want the hour number non-zero padded

modern fiber
cloud dawn
sick birch
#

Git is a pain to install

modern fiber
undone tartan
#

theres an installer, and then you restart

#

as long as its added to path then ur good

sick birch
#

Sorry couldn’t do more. Usually gits pre installed for me

sick birch
cloud dawn
#

I mean git desktop is pretty easy

undone tartan
#

theres an option when setting it up

#

i use github desktop personally and it installs it while you install desktop so

sick birch
#

@modern fiber or you can run the installed this time and instead of spamming next look for a “add to path button” and check it

modern fiber
#

Would basically need a command like this to start off with, @sick birch

undone tartan
#

and its nice to have a gui

modern fiber
sick birch
modern fiber
#

Not yet.

sick birch
#

That’s a good place to start

cloud dawn
sick birch
#

Damnit

modern fiber
#

Got the desktop app in meantime.

undone tartan
#

this might be what i need

sick birch
#

Pandabweer this one’s for you

cloud dawn
modern fiber
sick birch
#

GitHub desktop… my bane

cloud dawn
undone tartan
#

wait i dont want month i want hour

modern fiber
cloud dawn
modern fiber
#

lol

cloud dawn
#

Make sure to not include your token

modern fiber
#

So how do I move my pycharm code in it?

#

Should I put it into a document or?

cloud dawn
modern fiber
#

.

cloud dawn
#

I recommend pushing it trough pycharm then otherwise issues and pycharm will get a heart attack.

modern fiber
#

.

#

My brain is breaking a part please 😢

#

what do I do now lmfao

cloud dawn
#

Okay just move the project files there pycharm doesn't need to know

#

Our secret

modern fiber
#

I heard too much unknown things today

#

my brain is stopping to function

cloud dawn
# modern fiber .

Then head over to the git desk again then you should see the local changes.

#

You'll get the hang of it, i did it solo. It did took 2 hours to setup git and modify some things.

modern fiber
#

can I screenshare you?

#

I beg you

cloud dawn
#

Okay

modern fiber
#

Panda helped me a lot with making the git.

cloud dawn
modern fiber
#

Yeahh lol

#

will work on that

modern fiber
#

Appreciate it.

undone tartan
#

how do i turn a big float into a small float kinda thing

#

like turn 52.538520052078596 into 52.5

granite parcel
#
@client.command()
async def add(ctx, a:int, b:int):
    embed=discord.Embed()
    embed.add_field(name="Solution", value=(a+b))
    await ctx.reply(embed=embed)```
cloud dawn
unkempt canyonBOT
#

@cloud dawn :white_check_mark: Your eval job has completed with return code 0.

52.5
undone tartan
#

ah ty

cloud dawn
#

!d round

unkempt canyonBOT
#

round(number[, ndigits])```
Return *number* rounded to *ndigits* precision after the decimal point. If *ndigits* is omitted or is `None`, it returns the nearest integer to its input.

For the built-in types supporting [`round()`](https://docs.python.org/3/library/functions.html#round "round"), values are rounded to the closest multiple of 10 to the power minus *ndigits*; if two multiples are equally close, rounding is done toward the even choice (so, for example, both `round(0.5)` and `round(-0.5)` are `0`, and `round(1.5)` is `2`). Any integer value is valid for *ndigits* (positive, zero, or negative). The return value is an integer if *ndigits* is omitted or `None`. Otherwise, the return value has the same type as *number*.

For a general Python object `number`, `round` delegates to `number.__round__`.
undone tartan
granite parcel
#

like when i use add i give command -add 1 2 i want that it should be 1+2

#

@cloud dawn?

cloud dawn
#

Or as result you want 1+2=3 back?

granite parcel
slate swan
#

thats more of not a very helpful command imo

#

no offence

granite parcel
#

its considered as int so what do you think?

cloud dawn
#

I know how but it's very hard coded, command will get pretty big to account for all peoples mistakes.

#

I don't like greedy

#

greedy also dies with 1+1+1+1

slate swan
#

rip

#

you gotta make a kwarg and do that list stuff?

cloud dawn
#

For calc it's best to just eval it and return the result.

granite parcel
#

bro but asking for help is not so called greedy

slate swan
cloud dawn
slate swan
#

ignore

maiden fable
slate swan
#

I'll just go lmao

maiden fable
unkempt canyonBOT
#

class discord.ext.commands.Greedy```
A special converter that greedily consumes arguments until it can’t. As a consequence of this behaviour, most input errors are silently discarded, since it is used as an indicator of when to stop parsing.

When a parser error is met the greedy converter stops converting, undoes the internal string parsing routine, and continues parsing regularly.

For example, in the following code:

```py
@commands.command()
async def test(ctx, numbers: Greedy[int], reason: str):
    await ctx.send("numbers: {}, reason: {}".format(numbers, reason))
```  An invocation of `[p]test 1 2 3 4 5 6 hello` would pass `numbers` with `[1, 2, 3, 4, 5, 6]` and `reason` with `hello`...
cloud dawn
oblique laurel
#

Using eval directly hooked up to a bot?

slate swan
maiden fable
oblique laurel
#

Cant people run anything there

cloud dawn
#

I think it's marvelous.

maiden fable
oblique laurel
#

Like if someone put in exit(), i think the bot would shut down

maiden fable
#

What are the odds haha

cloud dawn
slate swan
#

lmao

#

not me

cloud dawn
#

I wasn't talking about a bare eval

#

just use snekbox

#

yum

oblique laurel
#

Also i think it might be possible for them to do print(token) and guess the environ you stored token as and get ur token

#

take a shot every time i said token

lament mesa
#

If its is a calc command just make a parser which parses the string which contains the mathematical expression

#

won't be too hard lemon_sweat

undone tartan
#

now that is a scary emoji

lament mesa
#

yeah

slate swan
#

no comments

lament mesa
#

what

#

Ok understood 👌

slate swan
slate swan
lament mesa
#

the understood was sarcastic...

slate swan
#

lmao

modern fiber
#

Is there any way I can open a GIT project straight in the pycharm?

#

or like replit?

slate swan
maiden fable
#

U hosting the bot on yr pc?

#

Install pypresence and use discord yo change/update ur custom presence

#

Idk, just a better way to update presence 🤷‍♂️

#

Nah, for yr profile

slate swan
maiden fable
#

Nvm, u don't understand what I mean lol

slate swan
maiden fable
slate swan
maiden fable
#

I have worked with its source code and uhhhh, I don't have words to explain how beautiful it was

slate swan
#

wont ask

maiden fable
slate swan
maiden fable
#

Blame discord, not pypresence

quaint epoch
#

(lurks)

#

what kinda bot u wanna make i guess

muted quarry
#
@client.command()
async def test(ctx):
    discord_embed = discord.Embed(
        title="Testing Select Menu",
        components=[Select(
            placeholder='Select something',
            options=[
                SelectOption(label="Option 1", value='1'),
                SelectOption(label="Option 2", value='2'),
                SelectOption(label="Option 3", value='3'),
                SelectOption(label="Option 4", value='4'),
                ],
            custom_id='SelectTesting')])

    await ctx.send(embed=discord_embed)
    interaction = await client.wait_for(
        'select_option',
        check=lambda inter: inter.custom_id == 'SelectTesting' and inter.user == inter.author)
    res=interaction.values[0]```

Guys I am working on making a dropdown/select menu in discord 
The code I wrote is not sending the drop down menu and is only sending an embed with the title in (Line 4 ). Can someone please help me fix this
#

Only a title is being sent

slate swan
#

How do i define date here:
now = date.today()

muted quarry
paper sluice
#
Traceback (most recent call last):
  File "C:\Users\ryuga\AppData\Roaming\Python\Python310\site-packages\discord\ui\view.py", line 373, in _scheduled_task
    await item.callback(interaction)
  File "E:\Computer Science\Python\Game\Discord\Oxygen\cogs\wiki.py", line 290, in go_to_sections
    await interaction.response.edit_message(embed=self.cls.wiki['about'], view=self.cls)
  File "C:\Users\ryuga\AppData\Roaming\Python\Python310\site-packages\discord\interactions.py", line 658, in edit_message
    await adapter.create_interaction_response(
  File "C:\Users\ryuga\AppData\Roaming\Python\Python310\site-packages\discord\webhook\async_.py", line 194, in request
    raise HTTPException(response, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In embeds.0.url: Not a well formed URL.

this is an example url self.wiki[val] generates
https://upload.wikimedia.org/wikipedia/commons/thumb/a/a8/Bill_Gates_2017_%28cropped%29.jpg/220px-Bill_Gates_2017_%28cropped%29.jpg

it was working file, few mins ago lemon_angrysad

paper sluice
#

👋🏻

muted quarry
#

Could you have a look at the problem I am having please
Its working fine but Its only sending the embed with the title and not the dropdown menu

paper sluice
muted quarry
paper sluice
muted quarry
#

I think I have above 2.0

#

Pretty sure

#

@paper sluice Could you tell me where I shd put it in the code

maiden fable
paper sluice
maiden fable
#

Try printing the url everytime

muted quarry
hoary cargo
paper sluice
#

`message`

hoary cargo
#

and 2.0 it's not even stable so meh

paper sluice
#

ya sure. mb

paper sluice
#

or just use discord.ui.Select

muted quarry
paper sluice
#

This is the Ultimate Python Guide on Select Menus with Discord.py or Pycord. In this video, I talk about how to create select menus in discord.py or pycord and how to respond to dropdown menu interactions. After watching this you'll know everything about Select Menus in discord.py or pycord.

Ultimate Guide on Buttons: https://youtu.be/kNUuYEWG...

▶ Play video
slate swan
#

gmt_time_zone = pytz.timezone('GMT')
is this incorrect?

muted quarry
quaint epoch
#

for interactions, do y'all prefer bot.wait_for or a callback func?

sullen pewter
#

Why cant I import intents?

from discord import Intents
ImportError: cannot import name 'InvalidArgument' from 'discord' (C:\Users\PC\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\__init__.py)
#

Oh

#

Ok