#discord-bots

1 messages Β· Page 1134 of 1

indigo dagger
#

i dont even know the 'w' of wait for

slate swan
#

just learn english

#

no offence

indigo dagger
main path
#

just copy it and try it

indigo dagger
#

ok

main path
#

oops sorry for ping ashley

slate swan
indigo dagger
#

uh grmr mistakes

slate swan
#

more of a proverb

#

but okay Β―_(ツ)_/Β―

indigo dagger
#

i just wanted to learn wait for to add games in my bot

slate swan
#

I didn't I just jumped in the convo and wrote what I saw

#

lmao

indigo dagger
#

not working

slate swan
#

bruh, the check πŸ—Ώ

indigo dagger
#

oh hi sarth we meet again

slate swan
#

I don't remember you but hey UCwave

#

you need to use the any statment here

indigo dagger
#

yesterday we met

slate swan
#

!e ```py
if any( word in "ash is always high" for word in ("hi", "hello")): print("yes")

unkempt canyonBOT
#

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

yes
slate swan
#

oh my bad, but still any isnt a statement god

#

a perfect reason to use str.split() ^

#

that was kinda rude tbh

#

πŸ˜” just stop

slate swan
#

calling me high

#

high, like a god

#

whatever said I'm still a sick maniac lmao

indigo dagger
#

bye guys

paper sluice
#

πŸ‘‹

paper sluice
slate swan
#

i missed a bracket so don't mind me

pliant gulch
paper sluice
#

oh yes, forgot about intersection

#
re.search(f"[{'|'.join(filtered_words)}]", sentence)
pliant gulch
#

Regex is way slower

spring flax
#

How would I get a list of timeout members in a guild?

slate swan
#

πŸ‘€

#

do a list comprehension, loop on all guild members and check their timeouts if any

spring flax
slate swan
#

im not sure but it should be same, unless you're using map

shrewd apex
paper sluice
torn sail
#

*7k

slate swan
#

Hi, so I'm having this error when coding a discord bot in python "could not import 'interactions' from 'nextcord' " does anyone know how to fix this?

#

Hey I programmed a Slash Commands for my Bot and it seems that I didn’t work. Now like I said should I delete it and put some Events & Intents on it?

paper sluice
slate swan
paper sluice
#

sure\

paper sluice
slate swan
slate swan
#

@paper sluice

#

And now it’s offline

paper sluice
slate swan
#

Yes

paper sluice
#

this is a python server

slate swan
#

But in python it’s the same

#

And then I made it in python

#

But yeah I will look

slate swan
#

I'll never get this damn bot online):

paper sluice
#

!d nextcord.Interaction

unkempt canyonBOT
#

class nextcord.Interaction```
Represents a Discord interaction.

An interaction happens when a user does an action that needs to be notified. Current examples are slash commands and components.

New in version 2.0.
paper sluice
#

New in version 2.0.
do you have 2.0 installed?

slate swan
#

Yes

#

I have 2.0

paper sluice
#

u did from nextcord import Interaction right?

fallow girder
#

I have a question can we put two buttons containing a link in an embed?

paper sluice
slate swan
paper sluice
#

what do you type to run your bot, like python filname.py?

slate swan
#

That's the command I used

paper sluice
#

try to install nextcord using python3 -m pip ...

#

and then run ur script

#

make sure you install nextcord 2.0

slate swan
#

How do I turn text into a code font like you just did?

pliant gulch
# paper sluice ya :/

You could probably optimise the regular expression but that would probably still be slower than using set notation

restive rapids
fallow girder
#

Ok thanks bro

slate swan
slate swan
restive rapids
slate swan
#

Alright

#

Code block

paper sluice
restive rapids
#

lol

slate swan
#

In my opinion

paper sluice
slate swan
paper sluice
#

hmm, then i have no clue, sry

slate swan
#

Man I'm starting to hate Linux. There's no way in hell I'm going back to windows tho.

paper sluice
#

windows is always bad lol

slate swan
slate swan
#

πŸ’€ eh, just use vsc or something they allow you to choose what interpreter you want to run with

#

can you do python -m pip freeze

slate swan
#

bruh ik what linux is.

#

im using vsc rn in linux.

#

just install the deb or whatever distro ur using from their site

slate swan
#

its kali/debian

#

are you on fedora?

slate swan
slate swan
slate swan
slate swan
#

They did ask for telemetry permission which obviously I refused

#

atom is not even continued , and the telementry can be declined for any ide

slate swan
#

download this, go to ur terminal ```bash
$sudo dpkg -i thisfile

#

I'm already happy with atom tho.

slate swan
#

Alright

#

@slate swan I tried the command. It didn't help the error

#

its not a command to fix your error, it lists all the installed libraries
do you see nextcord in it?

#

Lemme look

#

@slate swan yes it's there

#

and how do you run the bot?

#

i mean the terminal command

slate swan
#

openDB is a folder and openDB.py is a file inside it?

slate swan
#

cool, now try using python openDB

#

Alright

#

Do I use python3 or just python?

#

python

#

Alright

#

It keeps on saying command not found

#

I think I have to use python3

#

what did you use last time when i asked to use the freeze command then?

#

python3?

slate swan
#

That's literally all I typed because for some reason when I put in -m it just says command not found

#

Same when I try to use python3

modern fiber
#

How do I kicked user's ID?

slate swan
#

🀨

slate swan
slate swan
#

I forgot the exact command I used to install pip but it was definitely not apt

#

install pip binded with python, else that would be problematic.

slate swan
#

if you did that, python3 -m pip would work.

#

what's the issuwue πŸ˜”

slate swan
#

Lemme try this and see if I got a bootleg

slate swan
#

download it, and run it with your python3 command

slate swan
#

nah just ignore that

#

Alright

slate swan
#

anyways, i'll suggest using a venv

slate swan
slate swan
slate swan
unkempt canyonBOT
#

Virtual Environments

Virtual environments are isolated Python environments, which make it easier to keep your system clean and manage dependencies. By default, when activated, only libraries and scripts installed in the virtual environment are accessible, preventing cross-project dependency conflicts, and allowing easy isolation of requirements.

To create a new virtual environment, you can use the standard library venv module: python3 -m venv .venv (replace python3 with python or py on Windows)

Then, to activate the new virtual environment:

Windows (PowerShell): .venv\Scripts\Activate.ps1
or (Command Prompt): .venv\Scripts\activate.bat
MacOS / Linux (Bash): source .venv/bin/activate

Packages can then be installed to the virtual environment using pip, as normal.

For more information, take a read of the documentation. If you run code through your editor, check its documentation on how to make it use your virtual environment. For example, see the VSCode or PyCharm docs.

Tools such as poetry and pipenv can manage the creation of virtual environments as well as project dependencies, making packaging and installing your project easier.

Note: When using Windows PowerShell, you may need to change the execution policy first. This is only required once:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

slate swan
#

try python -m pip instead πŸ˜”

#

they dont have python

#

py ?

#

python3

#

looli why do i have 3 python installations aaaaa

slate swan
#

dude

slate swan
#

!e print("my opinions")

#

see?

slate swan
#

nice joke, very funny indeed

modern fiber
slate swan
modern fiber
slate swan
#

i wouldn't be surprised if you were not, these things are too common in this channel.

slate swan
#

DaniGlasses you wont face this if you used hikari lightbulb

#

I'll never get my damn bot online 😭

#

try using a venv is the best thing i can suggest

slate swan
#

what does it say?

slate swan
#

cause it doesnt exist

#

its Interaction

#

!d nextcord.Interaction

unkempt canyonBOT
#

class nextcord.Interaction```
Represents a Discord interaction.

An interaction happens when a user does an action that needs to be notified. Current examples are slash commands and components.

New in version 2.0.
slate swan
#

I keep on making a damn typo

#

I did actually type interaction

modern fiber
#

In that logging channel

slate swan
modern fiber
slate swan
modern fiber
#

No, plus I am hosting it by pushing to heroku automatically.

#

So it doesn't display in terminal

slate swan
#

If I do pass the code for openDB to one of you, you can finish the bot on one condition. KEEP IT OPEN SOURCE

slate swan
#

more like you should

modern fiber
#

how do I unpush it now

#

XD

slate swan
#

unpush aint a thing, you can obv reset your commits and push the new state

#

Does anyone want to help the bot's development?

#

no

tough lance
#

no

#

We can help here

slate swan
#

I'm not getting this damn error solved.

#

No matter who I try to ask

#

what error

slate swan
tough lance
#

Bro Interaction not interaction

slate swan
#

^

tough lance
#

I uppercase

#

ironic

modern fiber
#

I don't see it saying any errors for channel.send?

slate swan
#

the user's dms are disabled

#

use try: except while sending message to that user

tough lance
#

Yea DMs are closed and your code isn't running past that step

slate swan
#
try:
    # sending messages
except discord.HTTPException:
    ...
slate swan
#

I finally fixed the import error. But now there's another πŸ™„

#

Man I suck at python

modern fiber
slate swan
#

So do I have to make intents have a uppercase I too?

modern fiber
#

where should I place it

tough lance
#

You're making a discord bot in python and you don't even know try except statement πŸ™ƒ

slate swan
#

its called PascalCase

slate swan
#

!d discord.Intents you can always refer to docs

unkempt canyonBOT
#

class discord.Intents(value=0, **kwargs)```
Wraps up a Discord gateway intent flag.

Similar to [`Permissions`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions "discord.Permissions"), the properties provided are two way. You can set and retrieve individual bits using the properties as if they were regular bools.

To construct an object you can pass keyword arguments denoting the flags to enable or disable.

This is used to disable certain gateway features that are unnecessary to run your bot. To make use of this, it is passed to the `intents` keyword argument of [`Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client").

New in version 1.5.
slate swan
slate swan
#

I'm still getting an error even though I corrected my lower case I in "Intents = true"

#

It says it's a name error

modern fiber
#

@tough lance

@client.command(description="Kicks a member")
@commands.has_permissions(kick_members=True)
async def kick(ctx: commands.Context, member: disnake.Member = None, *, reason=None):
    guildId = ctx.message.guild.id
    guild = client.get_guild(guildId)
    embed = disnake.Embed(
        color=disnake.Color.blue(), title="**Notification**",
        description=f"You have been **kicked** from **``{guild.name}``** (ID:{guildId}) for {reason}")
    embed.timestamp = datetime.datetime.utcnow()
    embed1 = disnake.Embed(
        color=disnake.Color.blue(), title="",
        description=f"***{member} ({member.id}) was kicked*** | {reason}")
    embed2 = disnake.Embed(
        color=disnake.Color.blue(), title="Action Log",
        description=f"{member} ({member.id}) has been kicked by by {ctx.author} for {reason}")

    if member == None:
        await ctx.send("You have to specify an user!")
        print('no user')
        return
    if member == ctx.message.author or member == None:
        await ctx.send("You cannot kick yourself!")
        print('yourself')
        return
    if reason == None:
        await ctx.send("You have to specify a reason!")
        print('no reason')
        return

    await ctx.guild.kick(member, reason=reason)
    await ctx.send(embed=embed1)
    await member.send(embed=embed)
    logs = disnake.utils.get(ctx.guild.channels, name="punishment-logs")
    await logs.send(embed=embed2)```
tough lance
#

Params are usually lowercase

modern fiber
#

That's my command

#

"await member.send(embed=embed)
logs = disnake.utils.get(ctx.guild.channels, name="punishment-logs")"

#

Doesn't seem to work? Since it's not sending anything

#

in that channel

tough lance
#

So the code stops at that point and doesn't move to next statement

modern fiber
#

Oh

#

So what I do now..

slate swan
modern fiber
#

Should I put that last?

#

I mean- is there a way it can DM people actually?

tough lance
modern fiber
#

Okay, also man,

slate swan
#

):

modern fiber
#

How do I put custom emojis in embed?

#

Tried it 100 times, never works.

tough lance
#

Also you're kicking then sending the message

modern fiber
#

:ID:name:

#

Doesn't seem to work

modern fiber
slate swan
tough lance
slate swan
paper sluice
tacit token
#

how can i log member timeout with dc.py 1.7.3?

paper sluice
#

I don't think timeout was there in dpy1.7

tough lance
modern fiber
#

bc of error - it will send message anyways?

tough lance
modern fiber
slate swan
#

The error is "name error: name 'intents' is not defined

slate swan
paper sluice
slate swan
modern fiber
#

Hm

slate swan
#

Do you want the .py?

paper sluice
slate swan
spring flax
#

i have ```py
@bot.command()
@commands.has_role(620417313455210507)
async def timeouts(ctx):
timeouts = [member for member in ctx.guild.members if member.current_timeout]
if not timeouts:
members = 'No members are currently on timeout'
else:
members = "\n".join([f'{member.mention} {str(member)}' for member in timeouts])
embed = disnake.Embed(title=f'Members on timeout ({len(timeouts)})', description=members)
await ctx.send(embed=embed)

but it takes a very long time to execute
spring flax
#

is it worth noting that it's iterating through 380,000 members

paper sluice
spring flax
#

Don't think it's much better

paper sluice
slate swan
spring flax
#

Let me see

slate swan
#

The code itself?

carmine crater
#

Can anyone fix my code? import discord

client = discord.Client()

@client.event
async def on_ready():
print(f"We have logged in as {client.user}")

@client.event
async def on_message(message):
if message.author == client.author:
return

if message.content.startswith("Ping"):
    await message.channel.send("Pong")

client.run("example-token")

paper sluice
slate swan
#

Alright

slate swan
# paper sluice ya show the code pls

import nextcord
from nextcord import Interaction
from nextcord.ext import commands

Intents = nextcord.Intents.default()
Intnets.Members = True

client = commands.bot(command_prefix = '!', intents=intnets)

@client.event
async def on_ready():
print("openDB is now online")

testingserverID = no
@client.slash_command(name = "hello", description="replies with hello", guild_ids=[testingserverID])
async def hellocommand(interaction: interaction):
 await interaction.response.send.message("hello")

client.run('my bot token')
spring flax
#

There isnt a specific action of timeout member in the audit logs i think

modern fiber
#

How do I send custom emoji in bot's embed? Tried 100 times, didn't worked. Let's say this dynoSuccess

#

Should be that huh?

paper sluice
spring flax
#

Yeah

modern fiber
#

Okay let me try

heady sluice
slate swan
#

Fuck, another error.

slate swan
modern fiber
#

What's this called tho

#

this color for embed

heady sluice
#

that's the color of the embed

modern fiber
#

disnake.Color.green?

heady sluice
#

()

modern fiber
#

Yeah but I wanted to ask the color

#

Green?

heady sluice
#

well probably, I'm not able to read the hex of that color

#

but I know you have to call green()

slate swan
#

i bet that its an embed sent by dyno

#

Traceback (most recent call last):
File "openDB.py", line 8, in <module>
client = commands.bot(command_prefix = '!', Intents=intents)
NameError: name 'intents' is not defined
superuser@devastation:~/openDB$ still getting an error

#

what am i doing wrong?

#

@heady sluice

torn sail
#

or just rename Intents with a lowercase i

slate swan
#

Ok

#

If this works, thanks

#

@torn sail it worked. Now it says "module object is not callable"

#

did you from discord import intents ?

slate swan
#

No

#

What line do I put it in?

#

Line 4

#

?

#

!intents it should be something like this.

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 Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, and to get members' statuses.

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

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

from discord import Intents
from discord.ext import commands

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

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

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

slate swan
#

This is what I did in my ide

#

What did I do wrong now?

#

Lemme copy and paste the error

#

$udo, what's your experience with python?

slate swan
#

Traceback (most recent call last):
File "openDB.py", line 8, in <module>
client = commands.bot(command_prefix = '!', intents=Intents)
TypeError: 'module' object is not callable
superuser@devastation:~/openDB$

paper sluice
slate swan
#

That's how I learned python

#

I fixed the error. Now it says message content intent is not enabled. How do I enable it?

#

developer portal

slate swan
#

@slate swan it's already enabled

#

now enable it in your code by settings Intents.message_content to True

slate swan
#

@slate swan its still not working: Traceback (most recent call last):
File "openDB.py", line 4, in <module>
Intents.message_content = True
NameError: name 'Intents' is not defined
superuser@devastation:~/openDB$

#

use whatever variable you used to define the Intents class

slate swan
#

Oh, damnit I forgot how to define it

slate swan
slate swan
#

@slate swan that didn't work either. I'm still getting the same error

slate swan
# slate swan show your code

Traceback (most recent call last):
File "openDB.py", line 4, in <module>
intents.message_content = True
NameError: name 'intents' is not defined
superuser@devastation:~/openDB$

(this error has the line thats not working so you could see whats wrong)

slate swan
# slate swan code not error smh

import nextcord
from nextcord import Interaction
from nextcord.ext import commands
intents.message_content = True

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

client = commands.Bot(command_prefix = '!', intents=Intents)

@client.event
async def on_ready():
print("openDB is now online")

testingserverID = (my testing server id)
@client.slash_command(name = "hello", description="replies with hello", guild_ids=[testingserverID])
async def hellocommand(interaction: interaction):
 await interaction.response.send.message("hello")

client.run('my bot token')
#

Sob indentation AAAAAAA

slate swan
slim spoke
#

does anyone know a good working library that still works for buttons? I found discord_components (but didn't manage to install it) and discord.ext with discord.ui but didn't work either

slate swan
#

Now the bot just won't start at all

#

):

#

Do I need to send the code again?

#

bad indentation.

slate swan
#

It didn't do anything

#

there's no error, cause you're doing nothing

#

look at your code and analyse what it does

#

I looked

#

My code is fucking broken 😭

#

Everything looks normal

#

lemme do it for you

#
import nextcord
from nextcord import Interaction
from nextcord.ext import commands
# correct

Intents = nextcord.Intents.default()
Intents.members = True
# correct
client = commands.Bot(command_prefix = '!', intents=Intents)
# correct

@client.event
async def on_ready():
    # when my bot is ready (online)
    print("openDB is now online")


    testingserverID = (my testing server id)
    # add a slash command to it
    @client.slash_command(name = "hello", description="replies with hello", guild_ids=[testingserverID])
    async def hellocommand(interaction: interaction):
     await interaction.response.send.message("hello")
    # and run the bot
    client.run('my bot token')```

so basically you're trying to run the bot when it starts running without running the bot ![whatBlink](https://cdn.discordapp.com/emojis/893296403634331729.webp?size=128 "whatBlink")
modern fiber
#
@client.command(description="Admin permissions required. Purges a specified amount of messages.")
@commands.has_role("Administrative Staff")
async def purge(ctx, amount):
    await ctx.channel.purge(limit=25)```
#

Can someone help with my purge command? Doesn't seem to work

slate swan
#

elaborate "doesnt work"

slate swan
#

No errors

slate swan
slate swan
#

I'm sorry

modern fiber
slate swan
#

oh god

slate swan
modern fiber
#

lol

slate swan
#

thats just pycharm warnings.

modern fiber
#

so it works huh?

slate swan
#

run it and see.

#

I'm still unable to get this damn bot online 😭😭😭😭😭😭😭

slate swan
# slate swan Like. It tries to run then it stops running.
    testingserverID = (my testing server id)
    # add a slash command to it
    @client.slash_command(name = "hello", description="replies with hello", guild_ids=[testingserverID])
    async def hellocommand(interaction: interaction):
     await interaction.response.send.message("hello")
    # and run the bot
    client.run('my bot token')``` unindent this part of your code, and please learn basic python properly before making a discord bot
modern fiber
#

@slate swan is this how I make it purge the amount and 1 more message?

#

(so it deletes the trigger message)

slate swan
#

indeed

slate swan
modern fiber
#

great

slate swan
#

!d discord.TextChannel.purge it only has kwargs iirc

unkempt canyonBOT
#

await purge(*, limit=100, check=..., before=None, after=None, around=None, oldest_first=None, bulk=True, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Purges a list of messages that meet the criteria given by the predicate `check`. If a `check` is not provided then all messages are deleted without discrimination.

You must have the [`manage_messages`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission to delete messages even if they are your own. The [`read_message_history`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission is also needed to retrieve message history.

Changed in version 2.0: The `reason` keyword-only parameter was added.

Examples

Deleting bot’s messages...
slate swan
#

yeah kwargs only

#

yeah πŸ˜” so you gotta do limit = amount+1 ^

#

ash saves the day

slate swan
modern fiber
slate swan
#

idk why i used !e but ok

modern fiber
#

like this?

#

XD

slate swan
#

absolutely not

modern fiber
#

Can I just keep it say amount

slate swan
slate swan
slate swan
#

limit=amount+1 in the purge, amount: int in the function

slate swan
#

i'll also suggest to check the amount variable, if its too much it can get ur bot ratelimited

pliant gulch
#

It’s pretty lenient, somewhat at least for purging

#

1 API call is equivalent to 100 deleted messages or less

#

I don’t know what the ratelimit headers are actually though so

slate swan
slate swan
slate swan
#

await bot.get_channel(channel_id).send(embed=log_embed)

Any ideas?

slate swan
kindred oracle
#

Hello guys

#

is this possible to make slash commands with discord.py?

pure crypt
#

yes

kindred oracle
#

And how could I do that? I saw someone do it by importing app_commands but pylance doesnt seem to find it even after reinstalling discord.py with pip

pure crypt
#

First you need to install discord-py-slash-command via pip. Then from discord_slash import slash_command(ig)

#

Wait a second like this it not works

kindred oracle
#

okay

#

then how does it do?

pure crypt
#

seconds

kindred oracle
#

xd

pure crypt
#

first i found a mistake you need from discord_slash import SlashCommand and second after your bot=commands.Bot() you need slash=SlashCommand(bot, sync_commands=True)

#

If you want to add a command you need @gloomy cloak.slash ig (sry 4 ping)

kindred oracle
#

isn't it earsier if I just switch to pycord?

pure crypt
#

ig xD

torn sail
#

You would have to install straight from GitHub

kindred oracle
#

the one from ralpzt? or sth like that

torn sail
#

Yeah

kindred oracle
#

just clone?

#

and it should work?

torn sail
#

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

kindred oracle
gloomy cloak
#

how convenient that i am named after the character /

fresh ice
#

'NoneType' object has no attribute 'guild'

sick birch
#

@kindred oracle please don’t use discord-py-slash-commands that was suggested

sick birch
#

I don’t think that’s by rapptz

kindred oracle
#

I saw it mulitple times and now master suggested it too

sick birch
#

Either way dpy has native slash commands without anything else

kindred oracle
sick birch
#

Well discord-py-slash-commands is seperate, and you shouldn’t install it

pure crypt
sick birch
kindred oracle
#

okay

#

i did it dont worry I wont use the other one

#

thanks in advance

sick birch
#

Yep, just want to make sure people don’t use mediocre libraries

austere vale
#
  @commands.Cog.listener()
  async def on_member_join(self,member:nextcord.Member):
    embed=nextcord.Embed(color=0xfd9fa1, description= f'{member.mention}{member.name}{member.discriminator}\n**Account Age** \n {member.created_at}', title='Member Joined')
    if member.avatar is None:
        embed.set_thumbnail(url=f'{member.default_avatar}')
        embed.set_footer(text=f'{member.guild}', url=f'{member.guild.icon.url}')
    else:
        embed.set_thumbnail(url=member.avatar.url)
        embed.set_author(name=f'{member.name}', icon_url=f'{member.avatar.url}')
        embed.set_footer(text=f'{member.guild}', icon_url=f'{member.guild.icon.url}')
    embed.timestamp=datetime.datetime.utcnow()
    await self.bot.get_channel(933978399280599080).send(embed=embed)

how do i fix this?

torn sail
#

!d discord.Embed.set_footer

unkempt canyonBOT
#

set_footer(*, text=None, icon_url=None)```
Sets the footer for the embed content.

This function returns the class instance to allow for fluent-style chaining.
torn sail
#

It’s icon_url= not url= @austere vale

#

Also why are you setting the footer and thumbnail multiple times

pure crypt
austere vale
#

thank you

flint heart
unkempt canyonBOT
#

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

001 |   File "<string>", line 1
002 |     https://paste.pythondiscord.com/ozilagacut
003 |           ^^
004 | SyntaxError: invalid syntax
upper belfry
#

hello, ive got a question. Im currently working on a discord bot and I wanted someone to give me a suggestion whether I should make the the different functions of the bot in different files or just keep it all in the same file?

flint heart
#

Much easier

sick birch
upper belfry
#

thanks

sick birch
#

This is also where cogs and extensions come in, which lets you do nifty things like hot reloading on command

kindred oracle
#

Hey I have a problem wiht the new discord.py, i get this error on the client.Clietn() line

sick birch
#

Well what’s the error say?

kindred oracle
#

this

sick birch
#

So.. what do you think you should do?

#

It’s telling you you’re missing intents

kindred oracle
#

and what are they?

sick birch
#

!intents

kindred oracle
#

In the past it never needed anything

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 Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, 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
#

A quick look at the docs would tell you that

kindred oracle
#

ah

#

thanks

torn sail
upper belfry
kindred oracle
#

Yeah

limber pagoda
# unkempt canyon

a little recommendation: usepy intents = discord.Intents.all()instead ofpy discord.Intents.default()

dry pike
#

can someone tell me how I can only release bot ranks in discord.py commands? So that the bot has ranks that you have to buy or have to be able to execute or use certain commands? I've been looking for quite a while and can't find anything about it on the internet, and I hope you can help me

you can answer me here or via dm

kindred oracle
#

My bot suddenly doesnt wanna the messages

#

I think it uses on_message still

pure crypt
#

code?

sick birch
sick birch
#

Only for development, for production I would restrict my intents to only what I need

limber pagoda
#

but for convenience, discord.Intents.all() is best

limber pagoda
sick birch
#

Right, but just make sure you do, or use the proper intents from the start so you don’t forget

kindred oracle
#

So I tried making slash commands by a turorial but it doesn't seem to work

#

It just doesn't show up

#

I think I just remake it by the givan example in app_commands and we will see

slate swan
#

yo robin have u ever made a discord bot dashboard with Quart ?

#

if yes can u tell me how to host it im using Hypercorn but i really dont know how to host it on a specific domain PB_peepo_cry it says the app is listening on "0.0.0.0:8000" :P

kindred oracle
#

Hey

#

So I get this error:

#

which I don't really get because my bot has Admin perms

#

(token is invalid tho)

flat solstice
#

So I've had a look at https://github.com/Rapptz/discord.py/blob/master/examples/views/persistent.py and I'm a bit confused on where I set a custom_id. I'm calling my view herepy view = View(timeout=None) view.add_item(AlphaDropdown())and creating my dropdowns here https://github.com/SnowyJaguar1034/ModMail-FAQ/blob/master/classes/dropdown.py and I'd like both the Alpha and Beta dropdowns to be persistent. Do I set the custom_id as part of the view inilsiation in the command or in the Select's themselves?

wicked atlas
#

You need it in addition to the bot scope in order to update commands

kindred oracle
#

So I have to regenerate the invite too?

#

I cant use the old one?

sick birch
#

I have made dashboards for my bot, but I believe quart is not the best way to do that

slate swan
wicked atlas
kindred oracle
#

Oh my...

#

thanks tho

kindred oracle
wicked atlas
#

πŸ‘

fallen mica
#

Hi, is there any way I can detect a ban & kick using an event?

limber pagoda
#

you also have to enable a few intents in the discord developer portal

#

πŸ‘

#

website dashboard

slate swan
limber pagoda
fallen mica
slate swan
#

ik that the .tk domain is free so im asking if "80.80.80.80" is the dns for dis domain

#

think right?

limber pagoda
slate swan
limber pagoda
slate swan
limber pagoda
limber pagoda
slate swan
#

i didnt know that anyways tnx

slate swan
limber pagoda
slate swan
#

railway(for hosting)

slate swan
limber pagoda
slate swan
#

Import "discord" could not be resolved how do i fix that

#

yes

#

lemme check

#

alright it worked

#

lol

#

lol

slate swan
unkempt canyonBOT
#

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

If the guild or member could not be found in the internal cache this event will not be called, you may use [`on_raw_member_remove()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.on_raw_member_remove "discord.on_raw_member_remove") instead.

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

!d discord.on_member_ban

unkempt canyonBOT
#

discord.on_member_ban(guild, user)```
Called when user gets banned from a [`Guild`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild "discord.Guild").

This requires [`Intents.bans`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Intents.bans "discord.Intents.bans") to be enabled.
fallen mica
#

yeah, i already found it but thanks

slate swan
#

lol

tough slate
#

This might be a strange question but is there any way to use buttons paginate the options in a select menu. Or any way around the 25 option limit

sick birch
#

Sure, edit the select with new options

frigid dome
#

if message.content == "apples": await message.channel.send("i love apples")

my discord bot responds "i love apples" when a message is "apples"
how to make the bot always respond " i love apples " when the word "apples" is inside a sentence for example
"apples are delicious" , the bot won't respond to it unless the message is only "apples"

#

a help would be appreciated

torn sail
frigid dome
rain olive
#

make sure the string is lowercase

mint cargo
#

hi someone can help me to make my bot ban and kick people?

rain olive
#

use the ban and kick methods

#

member.kick()
member.ban()
pretty simple

#

you can add further logic if you want

dusky pine
frigid dome
mint cargo
slate swan
#
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'str' object has no attribute 'client'```???
#

code:

@client.command(aliases=['unbanuser'])
@commands.has_permissions(ban_members=True)
async def unban(ctx, self):
    ban_list = await self.client.get_bans(ctx.message.server)

    # Show banned users
    await client.say("Ban list:\n{}".format("\n".join([user.name for user in ban_list])))

    # Unban last banned user
    if not ban_list:
        await client.say("Ban list is empty.")
        return
    try:
        await client.unban(ctx.message.server, ban_list[-1])
        await client.say("Unbanned user: `{}`".format(ban_list[-1].name))
    except discord.Forbidden:
        await client.say("I do not have permission to unban.")
        return
    except discord.HTTPException:
        await client.say("Unban failed.")
        return```
#
"""
BAN COMMAND
""" @client.command(aliases=['banuser'])
@commands.has_permissions(ban_members=True)
async def ban(ctx, member : discord.Member, *, reason= "No reason was provided"):
    await ctx.send(":white_check_mark: Banned them from the server")
    await member.ban(reason=reason)```

```py
"""
Kick Command
"""
@client.command(aliases=['tempban'])
@commands.has_permissions(kick_members=True)
async def kick(ctx, member : discord.Member, *, reason= "No reason was provided"):
    await ctx.send(":white_check_mark: Kicked them from the server")
    await member.kick(reason=reason)```@mint cargo
mint cargo
#

Ty

#

like these is okΒΏ @slate swan

slate swan
#

!d discord.ext.commands.Bot

unkempt canyonBOT
#

class discord.ext.commands.Bot(command_prefix, *, help_command=<default-help-command>, tree_cls=<class 'discord.app_commands.tree.CommandTree'>, description=None, intents, **options)```
Represents a Discord bot.

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

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

Unlike [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client"), this class does not require manually setting a [`CommandTree`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CommandTree "discord.app_commands.CommandTree") and is automatically set upon instantiating the class.

async with x Asynchronously initialises the bot and automatically cleans up.

New in version 2.0.
livid hedge
#

hello

#

I would like to receive some help in a simple thing

#

My code is receiving an error because of intents.

#

The code I wrote

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

Intents enabled through Discord Developer Portal

#

The error I get:

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.

Discord Developer Portal

Integrate your service with Discord β€” whether it's a bot or a game or whatever your wildest imagination can come up with.

slate swan
#

message intents

livid hedge
#

?

#

I put .all() because I need them all

slate swan
#

stop ?ing, and you also need to turn them on to use them all.

#

scroll down you will find another intent named "Message Content Intent"

ionic turtle
slate swan
#

!d help

#

πŸ’€ im sure we have many client, bot and commands too looli

#
Traceback (most recent call last):
  File "C:\Users\Clicks\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\Users\Clicks\Desktop\Timmy (smile)\bot.py", line 67, in unban
    member_name, member_disc = member.split('#')
ValueError: not enough values to unpack (expected 2, got 1)

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

Traceback (most recent call last):
  File "C:\Users\Clicks\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\Clicks\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\Clicks\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ValueError: not enough values to unpack (expected 2, got 1)``` what
#

code:

UnBan Command
unbans members from the discord server
"""


@client.command(aliases=['unbanuser'])
@commands.has_permissions(ban_members=True)
async def unban(ctx, *, member):
    banned_users = await ctx.guild.bans()
    member_name, member_disc = member.split('#')

    for banned_entry in banned_users:
        user = banned_entry.user
        
        if(user.name, user.discriminator)==(member_name,member_disc):

            await ctx.guild.unban(user)
            await ctx.send(member_name + " has been unbanned!")
            return

    await ctx.send(member+" was not found")



"""
Purge Command
Purges amount of messages requested
"""

@client.command(aliases=['clear', 'prune'])
@commands.has_permissions(manage_messages=True)
async def purge(ctx, amount=11):
    amount = amount + 1
    if amount > 101:
        await ctx.send('Can not delete more than 100 messages at once!')
    else:
        await ctx.channel.purge(limit=amount)
        await ctx.send('Cleared the messages requested by {}'.format(ctx.author.mention))
        await ctx.message.delete()```
fading marlin
#

not another lucas ban command blobpain

patent lark
#

stop - copying - code - from - youtube

fading marlin
#

read the error and traceback too, it kinda tells you what went wrong

slate swan
# slate swan code: ```""" UnBan Command unbans members from the discord server """ @clien...

Is your unban command looking like this?

      for ban_entry in banned_users:
          user = ban_entry.banned_users

          if (user.name, user.discriminator) == (member_name, member_discriminator):
              ...

Lucas' unban only works for banning people via their name#discrim, now, this way is not wrong, but there are easier ways of unbanning people, e.g.:

# Unbanning by ID only (converting the ID to a object using discord.Object):
await ctx.guild.unban(discord.Object(id = id))

# converting the given user to a User object by type hinting:
async def unbean(ctx, user : discord.User, reason = None): 
fading marlin
#

unbean ducky_dave

patent lark
#

lmao

fading marlin
#

I believe discord.User type hints only work for IDs if the user and the bot don't share a server, right?

slate swan
#

!d discord.ext.commands.UserConverter if checks with these steps

unkempt canyonBOT
#

class discord.ext.commands.UserConverter(*args, **kwargs)```
Converts to a [`User`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User "discord.User").

All lookups are via the global user cache.

The lookup strategy is as follows (in order)...
patent lark
#

you dont need to change anything, but you are using the command incorrectly as it is written.

slate swan
patent lark
#

but, there could be much easier and efficient code.

slate swan
#

^ you need to provide a user#tag, a mention or ID won't work

patent lark
#

like @slate swan's example.

slate swan
#

if you want that to work with IDs, get some idea from the 2nd codeblock

slate swan
patent lark
#

wherever you want.

slate swan
# slate swan ?

stop ?ing, asking about what did you not understand can get you better help than a ? πŸ™‚

#

alright

dusky pine
#

"stop _HUHH_ing"

patent lark
#

it seems like you have little to no knowledge about coding. i recommend you learn python basics before jumping into discord.py.

dusky pine
#

page.title += "something"

left idol
#

is there a way to role an undetermined amount of people in a slash command?

brave ravine
slate swan
#

why do i have to type the extra arguments to get the embed to work?

#

code:

@client.command(aliases=['helpunban'])
async def unbanhelp(ctx, embed, param):
    embed=discord.Embed(title="Unban", description="Need some help with the unban command? We got you covered. read the instructions below and you should be good to go.", color=0x00ff11)
    embed.set_author(name="Command Help:")
    embed.add_field(name="Requirements", value="Ban Members Permission", inline=True)
    embed.add_field(name="γ…€", value="User must actually be banned.", inline=True)
    embed.add_field(name="Usage", value="t!unban (user)+(user#). Ex t!unban Clicks#8882", inline=True)
    await ctx.send(embed=embed)```
#

nvm fixed the issue

#

I had to remove

embed, pram```
unreal spire
#

got a question:
downloading an image file takes 0.3s using aiohttp alone, but if i download the same image using aiohttp as part of a discord bot it takes 0.8s - 1s
why?

async def download(url):
    t = time.perf_counter()
    filename = "image" + str(random.randint(0, 5000)) + ".png"
    try:
        async with aiohttp.ClientSession() as session:
            async with session.get(url) as response:
                if response.status == 200:
                    content = await response.read()
                    async with aiofiles.open(filename, mode='wb') as f:
                        await f.write(content)
                    print(f"Time take to download: {time.perf_counter() - t}")
                    return filename
    except Exception as e:
        print(e)
paper sluice
#

what else if your bot doing with the image?

#

if its sending that image then it will depend on ur bot's ping. If ur bot's ping is 200ms then it will take .3s + .2+s to send it to discord

pine knot
#
@client.command(aliases=[help, commands])
async def cmds(ctx):
    helpCMD = discord.Embed(title="Commands", color=0xff3500)
    helpCMD.add_field(name="vc/kick", value="Kicks a member of the server.", inline=False)
    helpCMD.add_field(name="vc/ban", value="Bans a member of the server.", inline=False)
    helpCMD.add_field(name="vc/mute", value="Mutes a member of the server.", inline=False)
    helpCMD.add_field(name="vc/warn", value="Warns a member of the server.", inline=False)
    helpCMD.add_field(name="vc/clear", value="Deletes an amount of messages in a specified channel.", inline=False)
    helpCMD.add_field(name="vc/monkey", value="Generates a random picture of monke.",
    helpCMD.add_field(name="vc/rank", value="Learn about our ranking system.")
    await ctx.send(embed=helpCMD)
#

this works on literally all my other bots, why doesnt it work now?

#

and yes i didnt forget

# Client
client = commands.Bot(command_prefix='vc/')

client.remove_command('help')
paper sluice
#

(aliases=[help, commands]) , help and commands are supposed to be strs

dusky pine
pine knot
#

oh yeah ""

#
@client.command(aliases=["help", "commands"])
async def cmds(ctx):
    helpCMD = discord.Embed(title="Commands", color=0xff3500)
    helpCMD.add_field(name="vc/kick", value="Kicks a member of the server.", inline=False)
    helpCMD.add_field(name="vc/ban", value="Bans a member of the server.", inline=False)
    helpCMD.add_field(name="vc/mute", value="Mutes a member of the server.", inline=False)
    helpCMD.add_field(name="vc/warn", value="Warns a member of the server.", inline=False)
    helpCMD.add_field(name="vc/clear", value="Deletes an amount of messages in a specified channel.", inline=False)
    helpCMD.add_field(name="vc/monkey", value="Generates a random picture of monke.",
    helpCMD.add_field(name="vc/rank", value="Learn about our ranking system.")
    await ctx.send(embed=helpCMD)```
#

saying the last line is the problem

left idol
#
@bot.command()
@commands.has_role("Council")
async def addrole(ctx, role: discord.Role, *members: discord.Member):
    rnames = [role.name for role in player.roles]
    for member in members:
        if str(role) in rnames:
            await ctx.respond(f"<@{member.id}> already in {role}")
        else:
            await member.add_roles(discord.utils.get(ctx.guild.roles, name=role))
            await ctx.respond(f":white_check_mark: {role} added to <@{member.id}>")
@addrole.error
async def addrole_error(ctx, error):
    if isinstance(error, commands.MissingRole):
        await ctx.send("You dont have the Council role.", ephemeral = True)

im not sure what i did wrong but when im doing a command to add role to multiple people, it isn't doing anything?

#

no errors

pine knot
#

ohh

#

K im just tired then

unreal spire
paper sluice
#

hmm then its weird, it should take the same amount of time

slate swan
#
@client.command()
@commands.has_permissions(timeout_members=True)
async def timeout(ctx: commands.Context, member: discord.Member, until: int):
    handshake = await timeout_user(user_id=member.id, guild_id=ctx.guild.id, until=until)
    if handshake:
         return await ctx.send(f"Successfully timed out user for {until} minutes.")```
#

I get this error:

#
Traceback (most recent call last):
  File "c:\Users\Clicks\Desktop\Timmy (smile)\bot.py", line 125, in <module>
    @commands.has_permissions(timeout_members=True)
  File "C:\Users\Clicks\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 1779, in has_permissions
    raise TypeError('Invalid permission(s): %s' % (', '.join(invalid)))
TypeError: Invalid permission(s): timeout_members
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x0000026323E53C10>```
dusky pine
#

timeout_members is not a permission, or not named that in dpy

slate swan
slate swan
dusky pine
left idol
#
@bot.command()
@commands.has_role("Council")
async def addrole(ctx, role: discord.Role, *members: discord.Member):
    rnames = [role.name for role in player.roles]
    for member in members:
        if str(role) in rnames:
            print(f"<@{member.id}> already in {role}")
        else:
            await member.add_roles(discord.utils.get(ctx.guild.roles, name=role))
            print(f":white_check_mark: {role} added to <@{member.id}>")

why does my command to role multiple people not return anything?

slate swan
#

eww

dusky pine
left idol
#

i mean it doesn't do any role updates either

#

or give any errors

slate swan
#

also, wont *members convert everything to a string

left idol
#

oh does it

dusky pine
#

why not just await member.add_roles(role) since role is already a discord.Role after converting

#

you should typehint *members to list[discord.Member] too i think

#

!d discord.ext.commands.Greedy

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

yeah that

#
File "c:\Users\Clicks\Desktop\Timmy (smile)\bot.py", line 125, in <module>
    @commands.has_permissions(moderate_members = True)
  File "C:\Users\Clicks\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 1779, in has_permissions
    raise TypeError('Invalid permission(s): %s' % (', '.join(invalid)))
TypeError: Invalid permission(s): moderate_members
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x0000022885C87B50>```
slate swan
#

PS C:\Users\Clicks\Desktop\Timmy (smile)> py -3 -m pip install -U discord.py
Requirement already satisfied: discord.py in c:\users\clicks\appdata\local\programs\python\python310\lib\site-packages (1.7.3)
Requirement already satisfied: aiohttp<3.8.0,>=3.6.0 in c:\users\clicks\appdata\local\programs\python\python310\lib\site-packages (from discord.py) (3.7.4.post0)
Requirement already satisfied: typing-extensions>=3.6.5 in c:\users\clicks\appdata\local\programs\python\python310\lib\site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py) (4.3.0)
Requirement already satisfied: yarl<2.0,>=1.0 in c:\users\clicks\appdata\local\programs\python\python310\lib\site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py) (1.7.2)
Requirement already satisfied: attrs>=17.3.0 in c:\users\clicks\appdata\local\programs\python\python310\lib\site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py) (21.4.0)
Requirement already satisfied: chardet<5.0,>=2.0 in c:\users\clicks\appdata\local\programs\python\python310\lib\site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py) (4.0.0)
Requirement already satisfied: multidict<7.0,>=4.5 in c:\users\clicks\appdata\local\programs\python\python310\lib\site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py) (6.0.2)
Requirement already satisfied: async-timeout<4.0,>=3.0 in c:\users\clicks\appdata\local\programs\python\python310\lib\site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py) (3.0.1)
Requirement already satisfied: idna>=2.0 in c:\users\clicks\appdata\local\programs\python\python310\lib\site-packages (from yarl<2.0,>=1.0->aiohttp<3.8.0,>=3.6.0->discord.py) (3.3)

#

oh god

#

?

#

it's 1.7.3 smh

#

timeout is a 2.0^ thing

#

;-;

#

lemme update it

dusky pine
#

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

#

2.0 is not on PyPI yet

slate swan
#

and I just asked for the version not the whole terminal satisfied requirments crap

#

πŸ˜”

slate swan
#

also, where tf does it say the version

dusky pine
#

Requirement already satisfied: discord.py in c:\users\clicks\appdata\local\programs\python\python310\lib\site-packages (1.7.3)

slate swan
left idol
slate swan
#

no

left idol
#

or use the greedy thing

slate swan
#

greedy

#

def ...(uwu, members: commands.Greedy[discord.Member]

#

def(uwu)?

#

;-;

slate swan
left idol
slate swan
#

yeah ig, but the command is kinda overdone

#

and overcomplicated

left idol
#

i'm new to this but wym

slate swan
#

like half the stuff is redundant

#

like you can simply compare roles instead of names
and getting the role again while assigning it could return None and hence errors

left idol
#

oh do you mean
rnames = [role.name for role in player.roles]

slate swan
left idol
#
@bot.command()
@commands.has_role("Council")
async def addrole(ctx, role: discord.Role, members: commands.Greedy[discord.Member]):
    for member in members:
        if role in player.roles:
            print(f"<@{member.id}> already in {role}")
        else:
            await member.add_roles(role)
            print(f"{role} added to <@{member.id}>")
left idol
#

alright, thanks! let me try this out

slate swan
#
async def addrole(...):
     [await member.add_roles(role) for member in members if role not in player.roles else print(f"{member} already has the {role.name} role")]```
πŸ˜” while me
#

I want to add a new line to the embed without having to add another Field. how do I do so?

embed=discord.Embed(title="Help", description="List of all the commands")
embed.add_field(name="a1", value="a1", inline=False)
await ctx.send(embed=embed)```
slate swan
#

unless it's a slash help

slate swan
#

i want them both to look the same

#

helppppppppppp

#

also

#

when I attempt to use the command it shows this error

#

Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "help" is not found

#

\n in a string can be used to change lines

#
@client.command
async def help(ctx):
    embed=discord.Embed(title="Help", description="List of all the commands")
    embed.add_field(name="Moderation", value="a1" "a1", inline=False)
    embed.add_field(name="Fun", value=f"test\ntest", inline=False)
    await ctx.send(embed=embed)```
#
Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "help" is not found```
paper sluice
#

you didnt call command, its supposed to be @client.command()

slate swan
#

lmao

#

interesting, discord edits your own message if its a random executable

slate swan
#

12:59 AM*

dusky pine
#

round up bro

slate swan
#

okimii you seriously should go to school

slate swan
#

now its 1amπŸ˜”

dusky pine
slate swan
slate swan
dusky pine
slate swan
#

youve sent that mp3 file 3 times already and havent pressed it once😀

slate swan
dusky pine
slate swan
#

okay let's get back on topic.
New topic: why is the codejam participants role colour so ugly πŸ˜”

slate swan
slate swan
slate swan
#

emerald is a bit lighter

#

afaik

dusky pine
#

here's a UI I sketched the other day, doesn't emerald mmmmmhhhhh

slate swan
#

see its not emerald

#

its Eucalyptus

dusky pine
#

it's close πŸ˜”

#

ok im gonna get tailwind color palette and replace it

#

ok there i'm sure that's emerald

#

put it in your bio

#

and your status

slate swan
#

and add it to top.gg or something

dusky pine
#

pesky requirements

slate swan
#

like?

#

the only thing i don't like while adding bots to bot list it making a description πŸ˜”

slate swan
paper sluice
#

red is the best color

dusky pine
slate swan
#

ok

dusky pine
#

Complete the qualifier

paper sluice
slate swan
robust fulcrum
#

Hi

dusky pine
#

hi

robust fulcrum
#

Very boring day today

slate swan
#

yup

#

to qualify for cj9 and get the role!

robust fulcrum
#

Should I participate in code jam?

slate swan
robust fulcrum
#

Hoe much time i have?

slate swan
#

until july 13

robust fulcrum
#

Oh

slate swan
robust fulcrum
#

It's a lot

#

I can try doing

inner epoch
#

I invited a bot to my guild and set his permission not to view the channel but still am able to use his slash commands is there a way to restrict that?

slate swan
#

for the qualifier

#

the jam will start july 21

robust fulcrum
slate swan
inner epoch
#

Umm how can I restrict his commands in particular channel?

inner epoch
slate swan
#

Hi πŸ‘‹

slate swan
inner epoch
slate swan
slate swan
slate swan
slate swan
inner epoch
# slate swan .

Umm but I want the bot to be allowed to run commands in some channels

slate swan
inner epoch
slate swan
#

can you share a screenshot of what you have on ur screen rn

inner epoch
#

Something like this

slate swan
#

slide up.

#

you will see all bot commands listed there

#

you can choose what channels and roles can use those commands there

#

note: it doesn't change it for admins and owners

inner epoch
#

What all I see is this

slate swan
#

slide up bruh

slate swan
#

2KSF_annaFacePalm up up

dusky pine
#

Scroll up

inner epoch
#

WAIT GOT IT!!1

#

Oops I was sliding up my finger as in sliding down got it

#

Thanks

slate swan
#

yw st92_drinkwater

#

tf is sliding

#

what type of question is that

#

😭

patent lark
#

what kind of conversation is this

slate swan
#

snowπŸ‘οΈπŸ‘οΈ

patent lark
#

okimii

#

i know, been a while.

slate swan
#

yup

#

how have you been?

patent lark
#

ive been alright, lets not get off topic here though. :D

slate swan
#

nice

dusky pine
#

when a conversation gets moved to OT, 90% of the time the convo dies

#

I call it "the OT curse"

brittle garden
#

hi

dusky pine
#

hi

#

scorpion, your name is barely visible

patent lark
brave ravine
#

not really a code question but im wondering if anyone else uses the pandas library for their discord bot as well

#

im working on a project that requires a lot of pandas/discord py integration and im not really sure if a lot has been done between the two

static topaz
#

hey all, I was hoping someone may be able to assist me, I started a python project a while ago that I think would be really beneficial, but having not looked at it recently and not being exceptionally good with python, I was hoping someone may be able to take a look and either help me complete it or would be willing to complete it for me? happy to negotiate a price if requested. I am basically up to the creation of the bot now and struggling with completing it

bright pebble
#

Hey

#

Need help with changing quote color

#

Blockquote color

slate swan
#

blockquote?

unkempt canyonBOT
#

9. Do not offer or ask for paid work of any kind.

static topaz
#

oh sorry, my bad!

#

should have read that. If someone is willing to help for free that's even more appreciative

static topaz
#

So basically the bot would allow a user to "subscribe" to a show in a database I have, so whenever a new episode is available for their subscribed show, they would receive a message/notification on discord letting them know. They would also be able to see and edit their current "subscriptions".

slate swan
#

uhh nice

static topaz
#

the project at this point has:

a working first run script, a working database (SQLite3), and I am able to get it to interact with discord and get next episode air information, but got stuck there

slender mesa
#

how do i fix this?

#

i followed a tutorial but i still get an error

slate swan
slate swan
static topaz
#

was attempting to use a dropdown box with multiple choices to choose from and it got complicated, plus I started a new job that took all of my time away so I haven't been able to go back to it

slate swan
#

nice

static topaz
#

It's been that long since I've looked at it, I'm trying to run it now to see where it is up to

shrewd apex
slender mesa
#

i press ctrl s to do that right

solemn flame
#

im looking at examples for interactions in discord.py 2.0 and im wondering how to add a button to a message
like how to attatch an instance of button to a message

shrewd apex
shrewd apex
solemn flame
#

whats the name of the example for buttons

#

nvm found it

static topaz
shrewd apex
#

πŸͺ¦

static topaz
#

error: command errored out with exit code 1 for most of the requirements it seems

slender mesa
slender mesa
#

OOOOH

shrewd apex
#

πŸ’€

slender mesa
#

fml

#

this shit is hard

#

WAIT IT WORKS OMG

shrewd apex
#

ur probs till now we're typos = and not saving are u paying attention to what you are doing

slender mesa
#

the bot is online im so exited

shrewd apex
#

πŸŽ‰

slate swan
#

exited

shrewd apex
#

rip typos again

slate swan
#

typoes happen

static topaz
#

ok so now if I run the initial "first run" script, it allows me to enter all the data, but then once it's connected to discord and sonarr, it shows me an error relating to the main scrip that will run, and I'm not sure why it errors

#

feel free to dm me if you like Asher, heading out to dinner but will be home in an hour and a bit

shrewd apex
shrewd apex
#

πŸ‘‹ morning oki

slate swan
# static topaz So basically the bot would allow a user to "subscribe" to a show in a database I...

Well you can use a db and make an initial subscribe command that takes the users snowflake id and the show, ofc you would need a check so a user doesnt make multiple accounts but can have multiple shows. then idk maybe an api can help with requesting a new episode for the show the user has subscribed to and have a background task running maybe making a request every day, and then have a command with a dropdown menu for the manipulation of the show column in your db

slate swan
shrewd apex
#

πŸͺ¦

slate swan
#

but good morning❀️

slate swan
#

πŸ˜”

slate swan
#

sleeping problems am i right

dusky pine
#

i can sleep with you if that makes you feel any better 😳

slate swan
slate swan
robust fulcrum
#

Hi

slate swan
#

πŸ‘‹

robust fulcrum
#

Code jam qualifier very difficult

slate swan
#

fail

robust fulcrum
#

Same

dusky pine
#

Why tf does embed not load

robust fulcrum
#

I just gave up doing qualifier project

slate swan
slate swan
robust fulcrum
slate swan
slate swan
robust fulcrum
#

Ok

#

Come

slate swan
#

😏

dusky pine
#

Come

slate swan
#

hehee

slate swan
loud junco
#

i still somehow got this error after creating a new repl

#

and copy pasta all the code one by one

robust fulcrum
loud junco
dusky pine
loud junco
#

maybe she accidentally pressed the shutdown button 🀣

loud junco
loud junco
#

there is no traceback

robust fulcrum
#

πŸ˜‚

loud junco
#

:/

robust fulcrum
#

He mean to show start code

dusky pine
#

it literally shows (e.is)

#

like your whole file, show it

loud junco
#

this is only partial of them

robust fulcrum
#

Hmm

dusky pine
loud junco
#

ok

#

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

loud junco
slate swan
#

there isn't anything called e.is in that file hmm

#

oh wait

#

what do you expected e to be?

slate swan
dusky pine
#

line 99

robust fulcrum
#

Ryuga the Shepard πŸ˜‚

slate swan
#

tf

dusky pine
#

@loud junco is is a reserved keyword, try doing e["is"] instead of e.is

robust fulcrum
loud junco
#

btw

#

can someone give me the link to download the latest discord.py