#discord-bots

1 messages · Page 735 of 1

maiden fable
#

Why will u need to send the link

jovial dock
slate swan
#

github lol

vague grove
#

hey guys, I have a on_member_join event, how can I make it so it triggers for a specific guild? or carries on the command with a specified guild id or something

@client.event
async def on_member_join(member):
    print(member)

thanks

#

tried adding a guild parameter w/ no lucl

spring flax
spring flax
#

so if member.guild.id == your_guild_id

vague grove
#

mhm exactly what i wanted

#

thanks

sturdy prairie
#

I have b een working on a discord bot (ELO SYSTEM)

I want to change the nick of the player where there wins are update

for eg:
this is the users first game

his nick say be Night

after adding the win +addwin @sturdy prairie
it must become [wins] nightcentaur

and I was able to solve this but when i want to update the win next time

the nick becomes [2][1]NightCentaur (which is not the expected output)

rather it must be
[2] nightcentaur

#

can anyone help me also if the person has a server nick i dont want to change that rather keep it the same with updating the wins

final iron
#

Probably not the best solution but you could split on the space, remove the first index in the list and then use " ".join to turn it back in to a string

#

@sturdy prairie

#

Also, just realized I was going to have my bots nicknames messed up if people used a prefix larger than 1 character

#

Thanks to you I caught that and deployed a patch

sturdy prairie
#

Wc

crimson idol
#

I'm not sure if you're like an expert on this, but I'm doing something similar to the code written above and I'm wondering what you mean by "randomly". As in spam? Is it OK to dm them if they're muted, etc?

quick gust
#

u can just ask here

crimson idol
#

mb

final iron
quick gust
#

Yes as gazes said, you can dm but it honestly depends on whom u are dming and if THEY are fine with it

crimson idol
#

Thanks for the input

slate swan
#

making a command that can dm random members seems off

#

like why would you tbh?

final iron
#

Giveaway maybe?

#

No clue

slate swan
final iron
#

How would I check what messaged someone replied to?

slate swan
quick gust
unkempt canyonBOT
#

The message that this message references. This is only applicable to messages of type MessageType.pins_add, crossposted messages created by a followed channel integration, or message replies.

New in version 1.5.

final iron
#

Thanks

slate swan
#

Does the bot respond slower if multiple people are running different commands simultaneously?

final iron
#

If you have a really under powered machine, you probably will get latency spikes

slate swan
maiden fable
#

Should be good

slate swan
maiden fable
#

I have a bot in over 100 servers and it hardly uses up 250 MB of RAM (I have both members and messages intent)

final iron
maiden fable
#

Nahhh

#

And about 92k bot.users

slate swan
#

1gb is overkill ngl

final iron
#

Damn I bought a 4 GB raspberry pi and thought that it was too little

maiden fable
#

Hahaha BTW my bot hardly uses up 0.1% of CPU Core

final iron
#

4 cores (but arm architecture)

slate swan
#

do you guys run your bot locally?

maiden fable
#

It just needs CPU for startup, since asyncio and discord.py, mainly, is ram intensive

maiden fable
final iron
maiden fable
#

Yea

final iron
#

Server processors are a lot more powerful than arm cpus

#

I can run discord with about 60% usage on the pi

maiden fable
#

Well my bot takes like 0.1% of CPU Core or smth

final iron
#

I'll probably be fine

spring flax
#

does channel.permissions_for not return view channel?

maiden fable
#

@final iron

spring flax
#

weird..I'm not seeing it let me check again

final iron
#

If it's epyc you got real lucky

maiden fable
#

!d discord.Permissions.view_channel

unkempt canyonBOT
maiden fable
#

@spring flax

#

Read Messages

maiden fable
spring flax
maiden fable
#

Idk

final iron
#

I meant amd's lineup of server processors

#

Epyc

maiden fable
#

Yea it's an AMD for mine

final iron
#

Nice

#

It's most likely epyc then

maiden fable
#

?

final iron
#

Epyc is AMD's server lineup of processors. They're incredibly powerful

maiden fable
#

Ah that. Idk bout that. Thought u were talking about Epic Host lol

final iron
#

Yeah, nah

static lintel
#

is there any way i can make my discord bot set people on timeout?

untold token
untold token
#

You don't get that for free

maiden fable
untold token
#

If you bot hits over a 1000 servers then you will see a significant difference

slate swan
#

Any help?

flint rapids
#

@slate swan

#

remove member:discord.Member

slate swan
#

Hm?

#

Oh

#

I forgot that was useless

flint rapids
#

does it work now

untold token
flint rapids
#

@slate swan

untold token
#

and you creating an argument member that takes a member object

slate swan
flint rapids
#

wait @untold token did i get it correct

untold token
#

and because the errorhandler deco doesn't pass that value, you get than error

slate swan
#

Yes it works

untold token
#

Yeah its correct

flint rapids
#

omg first time helping

#

im pretty new to bot coding as well started a day ago

untold token
#

It only takes commands.Context object and Exception

flint rapids
#

anyhelp

#

#giveaway system
@client.command
async def gstart(ctx, mins : int, , reason:str):
embed = discord.Embed(title="Giveaway!", description=f"{reason}", colour=discord.colour.gold())
end = datetime.datetime.utcow() + datetime.timedelta(seconds = mins
60)
embed.add_field(name="Ends at:", value = f"{end} UTC")
embed.set_footer(text=f"Ends in {mins} miniutes!")
my_msg = await ctx.send(embed=embed)
await my_msg.add_reaction("🎉")
await my_msg
await asyncio.sleep(mins)
new_msg = await ctx.channel.fetch_message(my_msg.id)
users = await new_msg.reactions[0].users().flatten()
users.pop(users.index(client.user))
winner = random.choice(users)
await ctx.send(f'Congratulations {winner.mention} won {reason}!')

#

bot doesnt respond

slate swan
#

that'd be my guess

#

And it's discord.Colour

#

but what are you even awaiting in that line

slate swan
#

Is text-to-speech possible?

worn tiger
#

Hey, what is the new system how discord bots using animated emojis

untold token
#

google Text To Speech

slate swan
#

oo

untold token
#

!pypi gTTS

unkempt canyonBOT
#

gTTS (Google Text-to-Speech), a Python library and CLI tool to interface with Google Translate text-to-speech API

slate swan
green bluff
#

lemme give it a rty

slate swan
worn tiger
#

nvm it

slate swan
#

Simply add a \ before sending the emote here in chat, then copy paste it.

worn tiger
#

I wrote it wrong

green bluff
#

@slate swan

#

doesnt work

worn tiger
#

it's stupid that normally you need nitro to get the id except you are cheating

slate swan
#

You don't need to.

green bluff
#

929283672950079508

#

this is me

#

by the way

slate swan
#

You can use inspect element or copy the emoji ID from the link.

green bluff
#

@slate swan

flint rapids
#

ok ill message from this it doesnt work

green bluff
#

my code

#

#giveaway system
@client.command
async def gstart(ctx, mins : int, , reason:str):
embed = discord.Embed(title="Giveaway!", description=f"{reason}", colour=discord.Colour.gold())
end = datetime.datetime.utcow() + datetime.timedelta(seconds = mins
60)
embed.add_field(name="Ends at:", value = f"{end} UTC")
embed.set_footer(text=f"Ends in {mins} miniutes!")
my_msg = await ctx.send(embed=embed)
await my_msg.add_reaction("🎉")
await asyncio.sleep(mins)
new_msg = await ctx.channel.fetch_message(my_msg.id)
users = await new_msg.reactions[0].users().flatten()
users.pop(users.index(client.user))
winner = random.choice(users)
await ctx.send(f'Congratulations {winner.mention} won {reason}!')

#

@slate swan what did i do wrong

slate swan
#

!code

unkempt canyonBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

green bluff
#
async def gstart(ctx, mins : int, , reason:str):
    embed = discord.Embed(title="Giveaway!", description=f"{reason}", colour=discord.Colour.gold())
    end = datetime.datetime.utcow() + datetime.timedelta(seconds = mins60)
    embed.add_field(name="Ends at:", value = f"{end} UTC")
    embed.set_footer(text=f"Ends in {mins} miniutes!")
    my_msg = await ctx.send(embed=embed)
    await my_msg.add_reaction("🎉")
    await asyncio.sleep(mins)
    new_msg = await ctx.channel.fetch_message(my_msg.id)
    users = await new_msg.reactions[0].users().flatten()
    users.pop(users.index(client.user))
    winner = random.choice(users)
    await ctx.send(f'Congratulations {winner.mention} won {reason}!')```
slate swan
#

Why are there 2 , after the mins arg

green bluff
#

@slate swan

#

theres an aterisk

#

it just doesnt show up

spring flax
#

if I wanted to make a rule command where you'd do ?rule [rule number], what's the most efficient way to define each rule number with the given rule?

slow fog
slate swan
slate swan
spring flax
slate swan
spring flax
slate swan
#

yea my bad

spring flax
#

Well i guess doing command groups for this would be bad because there are many rules

exotic kite
#

Hi guys
When i code in replit
And make 2 files on top of each other only one file works, the other one doesnt respond. When i try them single they work fine, why doesnt this happen to other people also? I see some repls with 100 files

tawdry perch
#

If I have commands. group smth like this py @commands.group() async def foo(self, ctx) ... @foo.command() async def bar(self, ctx) ... can I make a subcommand for bar even it is alrd a subcommand?

#

So it would be like !foo bar <another command>

slate swan
slate swan
tawdry perch
#

So foo command would look like this? ```py
@foo.command()
@commands.group()
async def foo(...

slate swan
#

you want it to be same as the main command name?

tawdry perch
#

Oh no, I mean bar

#

I mean do I need the @commands.group() to make a new subcommand for bar?

exotic kite
slate swan
#

@exotic kite hi

#

we both r from same clans

exotic kite
#

Ohh spy?

slate swan
#

lol

tawdry perch
slate swan
exotic kite
slate swan
#

RAID ZONE

exotic kite
#

Can you dm me it real quick

tawdry perch
solar anchor
#
import discord
import os
import math
import random

from discord import user
from discord import client
from discord.ext import commands

prefix = '.'

client = discord.Client()

@client.event
async def on_ready():
    print('We have logged in as {0.user}'.format(client))

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

    if client.user.mentioned_in(message):
        embedVar = discord.Embed(title="**Settings for this server**", description="", color=0x004AEB)
        embedVar.add_field(name="Info:", value='The prefix is set to: ' + '``' + prefix + '`` \n \n Type ``.commands`` for the list of commands', inline=False)
        #embedVar.add_field(name="Field2", value="hi2", inline=False)
        await message.channel.send(embed=embedVar)

    if message.content.startswith(prefix + 'commands'):
        await message.channel.send('__Comming Soon!__') #commands```
#

is it dumb that i use client

tawdry perch
#

If you want to make commands you might not want to use client

solar anchor
#

i see

#

what should i change?

stable berry
#

Hello

solar anchor
#

hi

tawdry perch
#

use commands.Bot instead of client, and maybe rename client to bot

stable berry
#

Me new to python coding

tawdry perch
tawdry perch
#

!d discord.ext.commands.Bot

unkempt canyonBOT
#

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

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

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

thanks

tawdry perch
#

And this might help

stable berry
#

Just wanted to know why my ban command is not working

urban forge
#

Hi, I have seen some people create websites where once a user authorizes a discord app connection to their account, the user can click a button to join the server without any extra effort. How exactly can I do this with discordpy?

tawdry perch
stable berry
tawdry perch
solar anchor
tawdry perch
solar anchor
#

oooo i see im dumb thanks

urban forge
stable berry
# tawdry perch In the place you had discord.Client
import discord 
from discord.ext import commands 
client = commands.Bot(command_prefix="T!")

@client.event
async def on_ready():
  print("Bot is ready")

@client.command(aliases=['k'])  
async def kick(ctx,member : discord.Member,*,reason= "no reason provided"):
  await member.send("You have been kicked from the server , because:"+reason)
  await member.kick(reason=reason)

This is the command and the traceback tells that I don't have the permission even when I and my bot both have admin perms

solar anchor
#
import discord
import os
import math
import random

from discord import user
from discord import client
from discord.ext import commands

prefix = '.'

Bot = commands.Bot()

@Bot.event
async def on_ready():
    print('We have logged in as {0.user}'.format(client))

@Bot.event
async def on_member_join(member):
    print(member)

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

    if client.user.mentioned_in(message):
        embedVar = discord.Embed(title="**Settings for this server**", description="", color=0x004AEB)
        embedVar.add_field(name="Info:", value='The prefix is set to: ' + '``' + prefix + '`` \n \n Type ``.commands`` for the list of commands', inline=False)
        #embedVar.add_field(name="Field2", value="hi2", inline=False)
        await message.channel.send(embed=embedVar)

    if message.content.startswith(prefix + 'commands'):
        await message.channel.send('__Comming Soon!__') #commands```
#

so like this?

tawdry perch
#

client.user is invalid now

solar anchor
#

yeah i see

#

gotta change that too

tawdry perch
#

You need to use bot instead

#

Ye otherwise it looks good

solar anchor
#

appricate the help!

tacit token
#

Hi guys. anybody help me? my problem: (I try to create " Wait for responses" command, but not work)

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.

stable berry
stable berry
#

Or u wanted me to paste it here

tacit token
#

?

honest shoal
tawdry perch
stable berry
tacit token
stable berry
honest shoal
stable berry
solar anchor
#
import discord
import os
import math
import random

from discord import user
from discord import client
from discord.ext import commands


Bot = commands.Bot(command_prefix=".")

@Bot.event
async def on_ready():
    print('We have logged in as {0.user}'.format(Bot))

@Bot.event
async def on_member_join(member):
    print(member)

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

    if Bot.user.mentioned_in(message):
        embedVar = discord.Embed(title="**Settings for this server**", description="", color=0x004AEB)
        embedVar.add_field(name="Info:", value='The prefix is set to: ' + '``' + prefix + '`` \n \n Type ``.commands`` for the list of commands', inline=False)
        #embedVar.add_field(name="Field2", value="hi2", inline=False)
        await message.channel.send(embed=embedVar)

    if message.content.startswith(prefix + 'commands'):
        await message.channel.send('__Comming Soon!__') #commands```
tacit token
solar anchor
#

how do i make the prefix work now?

tawdry perch
#

The are no commands yet

frail notch
#

How can I put the code from the right hand side as a command in the code on the left hand side? (though like make it so that the right hand side code just runs the program on the left when the command >save is sent

solar anchor
#

oh

stable berry
#

Guys using replit is better or should I use download the software

stable berry
frail notch
solar anchor
#

id say vscode

honest shoal
#

I don't find anything better than vs code + github

frail notch
#

Basically how can I make a command file which runs the code on the right when I send the command >save

green bluff
stable berry
#

Ok

slow fog
#

thanks

honest shoal
tacit token
#

fun command.

stable berry
tacit token
#

vsc

stable berry
#

Ok

tacit token
honest shoal
stable berry
#

As I am new so i can ask silly questions so pls don't mind😅

stable berry
#

👍

tacit token
honest shoal
#

can't understand the usage

stable berry
#

Ig it's a chat bot ( maybe )

tacit token
#

You know him the dank memer stick? a hack like that commands make, only totally some other way

tacit token
solar anchor
#

@Bot.command(aliases=[])

stable berry
#

Oo

solar anchor
#

can someone explain me this?

#

how does it work

honest shoal
solar anchor
#

owh

stable berry
#

Just put the aliase in it

#

Like k for kick

solar anchor
#

how do i make it do something if

#

wait what?

tacit token
solar anchor
#

and if i then do .hello what happens?

#

(prefix is .)

tacit token
#

dm me

tacit token
stable berry
#

It's lick a nick name ( a secondary name for your command )

honest shoal
#

in try:

tacit token
#

not work

honest shoal
plain shadow
# tacit token

Seems like you are in a cog. You shouldn't use client.wait_for but self.client.wait_for()

#

check it out

stable berry
magic stump
#

I?

#

raise CommandInvokeError(exc) from exc discord.ext.commands.errors.CommandInvokeError: Command raised an exception: InvalidArgument: No overwrite provided. ```py
@bot.command()
async def v(ctx):
overwrite={
ctx.guild.default_role:discord.PermissionOverwrite(read_messages=False),
ctx.me:discord.PermissionOverwrite(read_messages=True),
ctx.author:discord.PermissionOverwrite(read_messages=True),
}

await ctx.channel.set_permissions(ctx.author)
await ctx.message.guild.create_text_channel(f"Verify {ctx.author}", overwrites=overwrite)```
slate swan
#

Does anybody know any free hosting service beside replit?

#

I know replit isn’t exactly hosting service but is works like this a little

tawdry perch
#

Epikhost I guess

slate swan
#

Ok

#

I need to move my bot from replit because it keeps crashing

#

.send takes a file/files kwarg

#

!d discord.File

unkempt canyonBOT
#

class discord.File(fp, filename=None, *, spoiler=False)```
A parameter object used for [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send") for sending file objects.

Note

File objects are single use and are not meant to be reused in multiple [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send")s.
solar anchor
#
@Bot.event
async def on_message(message):
    if message.author == Bot.user:
        return
    if Bot.user.mentioned_in(message):
        embedVar = discord.Embed(title="**Settings for this server**", description="", color=0x004AEB)
        embedVar.add_field(name="Info:", value='The prefix is set to: ' + '``' + Bot.command_prefix + '`` \n \n Type ``.commands`` for the list of commands', inline=False)
        #embedVar.add_field(name="Field2", value="hi2", inline=False)
        await message.channel.send(embed=embedVar)


@Bot.command(aliases=["commands"])
async def help_command(ctx):
        await ctx.channel.send("__Coming Soon!__")```

Why cant i have these **both** at the same time? they work but only if i remove the other
stable berry
magic stump
kindred drum
#
 if str(payload.emoji) == "✅":
            msg = await channel.fetch_message(payload.message_id)
            msg_user = discord.Embed.to_dict(msg.embeds[0])
            pre_user_id = msg_user["fields"][0]["value"]
           
            
            user = await bot.fetch_user(pre_user_id)
            guild = bot.get_guild(payload.guild_id)
            role = discord.utils.get(guild.roles, name="Verified")
            
            await user.add_roles(role)            
            print("[INFO]: Verified" )
            ```
I get this error ``AttributeError: 'User' object has no attribute 'add_roles'`` Anyone got any idea why
stable berry
#

hello can some one help me

#

if yes then pls dm me

slate swan
kindred drum
honest vessel
#

member object

kindred drum
#

okay I changed it, but I this error now: AttributeError: 'NoneType' object has no attribute 'get_member'

 @commands.Cog.listener()
    async def on_raw_reaction_add(self, payload: discord.RawReactionActionEvent):
        if payload.member.bot:
            return
        channel = bot.get_channel(payload.channel_id) or await bot.fetch_channel(payload.channel_id)

        if str(payload.emoji) == "✅":
            msg = await channel.fetch_message(payload.message_id)
            msg_user = discord.Embed.to_dict(msg.embeds[0])
            pre_user_id = msg_user["fields"][0]["value"]
           
            guild = discord.utils.get(bot.guilds, name='Cosmic Overground')
            user = await guild.get_member(pre_user_id)
            guild = bot.get_guild(payload.guild_id)
            role = discord.utils.get(guild.roles, name="Verified")
            
            await user.add_roles(role)            
            print("[INFO]: Verified" )
            
                    ```
slate swan
#

Instead of using a url in a embed thumbnail, is it possible to specify an image file?

exotic patrol
kindred drum
#

😭

#

SomeCommands is the class btw

exotic patrol
#

just a min

kindred drum
#

can I not just like

#

make self.guild a attribute

exotic patrol
#

sure

kindred drum
#

how would that work

#

self.guild = guild?

#

wait nvm I have no idea how I would do that

#

lets ignore

exotic patrol
kindred drum
#

i cba cause then I need to change like all of the code

exotic patrol
kindred drum
#
            user = await guild.get_member(pre_user_id)```
swap them?
kindred drum
#

ah

#

I found the problem

exotic patrol
#
guild = discord.utils.get(self.bot.guilds, name='Cosmic Overground')
            user = await guild.get_member(pre_user_id)```
kindred drum
#

this was actually so simple, thank god I know now - one of my variables was assigned poorly so it was none "guild = discord.utils.get(self.bot.guilds, name='Cosmic Overground')" like the name was wrong

#

hence the none type error

#

gotta remember that

exotic patrol
#

cool then, I'm not so good at discord.py module, did not used it in past 9 months so forgot all... need to revise everything...

kindred drum
#

haha Im just learning

maiden fable
#

@kindred drum @exotic patrol don't await get_xxx calls

kindred drum
exotic patrol
#
@bot.command()
@commands.is_owner()
async def start(ctx):
  y = ctx.guild.members()
  v = ctx.guild.fetch_role(123)
  await ctx.send("Yes!")
  while True:
    for a in y:
      try:
        if a.Game("VALORANT"):
          a.add_roles(v)
        else:
          try:
            a.remove_roles(v)
          except:
            pass
      except:
        pass```
I made this command and it says that list object is not callable, what is it?
#
y = ctx.guild.members()```
kindred kindle
#

why does this happen?

maiden fable
exotic patrol
maiden fable
#

it's already a list

exotic patrol
kindred drum
#
user = guild.get_member(pre_user_id)
            print(user)``` user doesn't get assigned, not sure why. pre_user_id is the string if a certain user. It gets assigned for sure
slate swan
#

!d discord.File

unkempt canyonBOT
#

class discord.File(fp, filename=None, *, spoiler=False)```
A parameter object used for [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send") for sending file objects.

Note

File objects are single use and are not meant to be reused in multiple [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send")s.
slate swan
#

and , read the the link in above embed's description

frail notch
#

how can I make it so that the code on the right will execute the code on the left if I do >restore?

potent spear
frail notch
potent spear
frail notch
#

yea.. true

potent spear
#

apart from that, you can perfectly run functions from another file by importing them

velvet tinsel
#

Isn’t message.author already a str?

frail notch
#

So I just do like py import main?

velvet tinsel
#

Or am I dreaming

potent spear
#

also, you seem to be using API requests instead of just using the discord py library for all that? it's basically a wrapper for all that you're trying to do xd

frail notch
#

so like? ```py
import main
if user_message.lower(py main.py) == ">restore":
embedVar = discord.Embed(title="Restoring in progress.", color=0x00ff00)
await message.channel.send(embed=embedVar)
return

tacit token
#

Hi guys, anybody help me? they would take a liking to it to nominate people_nation

potent spear
slate swan
#

i am trying to make a dropdown menu command but I am getting this error
raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: Object of type Embed is not JSON serializable

codes:

        options = [
             disnake.SelectOption(
                label=" Parody Commands", description="All Parody Doujinshi Commands", value=embed
            ),
            disnake.SelectOption(
                label=" Commands", description="All Video Commands", value='hmmm'
            )
        ]

        super().__init__(
            placeholder="Help",
            min_values=1,
            max_values=1,
            options=options,
        )

    async def callback(self, interaction: disnake.MessageInteraction):
        await interaction.response.send_message(f"{self.values[0]}")


class DropdownView(disnake.ui.View):
    def __init__(self):
        super().__init__()

        # Adds the dropdown to our view object.
        self.add_item(Dropdown())```
potent spear
tacit token
potent spear
#

pingeles @tacit token

#

just like that

frail notch
tacit token
#

I would like it so, that if somebody writes it in, that pingeles and writes a name there, marks it then

potent spear
slim ibex
#

@tacit token what are you trying to do?

potent spear
potent spear
tacit token
potent spear
#

works perfectly

#

do that and it'll work...

#

just basically add this one line

#

await ctx.send(user.mention)

slim ibex
frail notch
potent spear
slim ibex
slate swan
potent spear
solar anchor
#

how can i make it a space

potent spear
solar anchor
#

so i can use the command .help moderation

frail notch
potent spear
frail notch
#

its a test bot

slate swan
solar anchor
#

i already have that

#

.help works

slim ibex
slim ibex
#

or command, etc

solar anchor
#

huh

slim ibex
#

the best way is the HelpCommand subclass

solar anchor
#

i already removed help

#

i have my own

potent spear
#

just check out the link, you'll be busy for a while

solar anchor
#
@Bot.command()
async def help(ctx):

    em=discord.Embed(title="Help", description = '**' + Bot.command_prefix + 'help <command>**',color=0x004AEB)
    em.add_field(name="moderation", value=":white_check_mark:", inline=True)
    em.add_field(name="reactionroles", value=":white_check_mark:", inline=True)
    em.add_field(name="currency", value=":white_check_mark:", inline=True)
    em.add_field(name="levels", value=":white_check_mark:", inline=True)
    em.add_field(name="music", value=":white_check_mark:", inline=True)
    em.add_field(name="other", value=":white_check_mark:", inline=True)
    em.set_footer(text='Use these commands to get further information about them' + '\nInformation requested by:')

    await ctx.send(embed=em)

@Bot.command()
async def help_moderation(ctx):
    em=discord.Embed(title="**Coming soon...**", description ="",color=0xFF0000)        #Coming soon

    #em=discord.Embed(title="**Moderation**", description ="**Info about moderation:**",color=0xFF0000)
    #em.add_field(name='.', value='.', inline=True)
    await ctx.channel.send(embed=em)```
potent spear
#

totally wrong

solar anchor
#

i just want another one thats .help moderation

potent spear
#

stop whatever you're doing and start reading that link

solar anchor
#

bro why does everyone tell diffrent shi, ive been restarting withmy code for 5 times already cuz ppl tell me to

#

ugh

quick gust
#
  1. use subclassing it's better
  2. if ure doing it that way atleast use command group
potent spear
solar anchor
#

idk who the right ppl are..

#

if someone helps me and it works i think theyre

#

thnx tho guys

slim ibex
#

what you have to do is:

potent spear
#

If you REALLY want confirmation, go to the dpy server and ask active helpers, they basically helped writing the library and know what's best.
we just learn based on what they tell us

slim ibex
#

create the base help command
find a way to handle if someone does .help cog or .help command
display it

solar anchor
#

ah okay

slim ibex
#

dont use dpy

solar anchor
#

im creating my own help

potent spear
#

idk, whatever fork you like I guess

solar anchor
#

I have this if i do .help

potent spear
#

terrible

solar anchor
#

i just want to be able to do .help moderation

quick gust
potent spear
#

start reading the link, you'll have to start over again

solar anchor
#

oof

solar anchor
#

im sick of this lol

potent spear
#

nah, you'll thank yourself in the end

solar anchor
#

yeah i have it infront of me thnx

slim ibex
#

i made a whole help command with views, dropdowns, etc with HelpCommand

solar anchor
slim ibex
#

and it handles everything

solar anchor
#

okay thanks ill just read it and start over

slim ibex
#

i told you everything you need to do

#

so get on with it (: gl

solar anchor
#

thanks guys!

potent spear
solar anchor
#

i need to create a class right?

potent spear
#

the link tells you..

slim ibex
#

i dont use dpy. its dead

potent spear
#

I'm currently still using it, my bot is private anyways, I only use it for these purposes:

#

.

slim ibex
#

my bot is public and hosted

solar anchor
#

can i use my embed tho?

slim ibex
#

but i archived it and stopped development for a bit since my old disc with it got hacked

potent spear
solar anchor
#

okayy

slim ibex
#

no, it was an executable that hacked my discord somehiow

#

and i had 2fa

#

weird right

quick gust
#

so that's 100% normal if u got token logged

slim ibex
#

ah

potent spear
#

an extra ) at the end mate

#

you need await message.channel.send(file=...)

#

that's how it'll work out for you

#

you haven't tried it, try it first

#

if it still doesn't show me the code

slate swan
#

wait something is wrong

#

oh nvm its replit

potent spear
#

true, don't ever use that shity

slate swan
#

<@&831776746206265384>

potent spear
#
f = discord.File("some_file_path", filename="image.png")
e = discord.Embed()
e.set_image(url="attachment://image.png")
await messagable.send(file=f, embed=e)

Note that the filename in the File constructor and the filename in the URL must match, and must be alphanumeric.

try this and come back and tell me it worked ofc

tall dust
#

!ban 927658763278745610 joined to spam a crypto ad

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied ban to @tawny kelp permanently.

slate swan
#

is nice

manic wing
#

probably nowhere

solar anchor
#

how can i fix this?

potent spear
tall dust
#

if people express interest of their own volition, we're not stopping you, but please don't advertise such that it disrupts the community

solar anchor
#

it cannot import ui

potent spear
tall dust
#

open a modmail thread by DMing @novel apex

solar anchor
potent spear
solar anchor
#

huh

velvet tinsel
#

?

#

have you added python to PATH?

solar anchor
#

i dont think so

velvet tinsel
#

then do it

slate swan
#

How do I make a two player game using discord. py

velvet tinsel
solar anchor
#

i think that

velvet tinsel
solar anchor
#

i had problems with this before

dire folio
#

How is urs 24/7 mine goes offline like every 1hr or so

slim ibex
velvet tinsel
#

yeah, add python to PATH

slim ibex
#

I host 24/7 with a VPS

solar anchor
velvet tinsel
slim ibex
#

oh

velvet tinsel
slate swan
#

That dank memer has

velvet tinsel
velvet tinsel
#

buttons then pithink

#

right ima head off to lunch

solar anchor
velvet tinsel
slate swan
velvet tinsel
slate swan
velvet tinsel
#

can I eat my lunch?

velvet tinsel
slate swan
velvet tinsel
#

questions keep sticking to my head

#

it's stopping me from eating

#

so I go back to answer them

slate swan
#

It's a you problem, sir

velvet tinsel
#

ig it is

slate swan
#

Now have a good lunch

solar anchor
#

imma reinsytall python

#

how again do i fix this?

slate swan
#

U dont have the library

#

pip install discord.py

#

In the cmd

solar anchor
slate swan
#

Search up on yt

solar anchor
#

ive been doing that

#

google

slate swan
# solar anchor google

Install python from scratch:- https://youtu.be/oa9BYgEzb_I

Hi Guys, In this video, we will see, solution of python/pip/pip3 is not recognized as an internal or external command. You might get python is not recognized as an internal or external command operable program or batch file error. So here is the solution to this pip is not recognized as...

▶ Play video
#

Watch the whole video

random kelp
#

can i use json and python ?

slate swan
random kelp
dire folio
#

Same but it still goes offline

slate swan
random kelp
#
    "name": "Fessor",
    "age": 10
}```
#

i made this json file

#

now how i print name in pyhton

slim ibex
#

prolly gotta specify guild ids in the @slash.slash()

potent spear
#

clearly not

#

is the url basically the same link to the duck you have saved locally?

solar anchor
#

@potent spear i got this

potent spear
solar anchor
#

wheres cmd?

potent spear
solar anchor
#

i error

potent spear
#

then what's the URL ? another image?

solar anchor
#

smth with this

potent spear
#

which isn't the same as the one you stored locally?

#

bruh, just do discord.Embed()
embed.set_image(url=...)
you don't need to do all that local stuff I sent you earlier

#

pip install the previous shit I sent you ofc wow

solar anchor
potent spear
#

you forgot python...

haughty sedge
#

do i have to use a seperate web socket for voice connections?

slim ibex
#

don t use discordpy bro

#

use like

#

!pypi nextcord

unkempt canyonBOT
slim ibex
#

!pypi disnake

unkempt canyonBOT
haughty sedge
#

which is more fun

slate swan
#

or use hikari

solar anchor
grim oar
#

Voice connection uses datagram right

slate swan
slim ibex
#

!pypi pincer

unkempt canyonBOT
solar anchor
haughty sedge
grim oar
#

What

solar anchor
#

i have now!

#

thanks

slate swan
#

gr8

potent spear
#

aight

solar anchor
#

still couldnt do

#

same error

slate swan
#

but ill still recommend using a fork instead of the master branch , since you'll need to update to slash commands and new discord features anyways

potent spear
solar anchor
#

i did

#

selected path but it didnt work

#

then i manually did the path

spring flax
#

for create_thread, what's a public thread?

solar anchor
#

ill just reinstal again

slate swan
haughty sedge
#

is it necessary to encrypt for sending voice data

solar anchor
slate swan
#

it means u dont have git installed

solar anchor
#

its dutch but

slate swan
#

eh?

grim oar
#

so why not do that

slate swan
#

if i run this people just get kick for always and can't even join back
anyway to break it?

solar anchor
#

"lol banned" lmao

slate swan
#

bruh I didnt had better phrase

#

!custom-cooldown

unkempt canyonBOT
#

Cooldowns in discord.py

Cooldowns can be used in discord.py to rate-limit. In this example, we're using it in an on_message.

from discord.ext import commands

message_cooldown = commands.CooldownMapping.from_cooldown(1.0, 60.0, commands.BucketType.user)

@bot.event
async def on_message(message):
    bucket = message_cooldown.get_bucket(message)
    retry_after = bucket.update_rate_limit()
    if retry_after:
        await message.channel.send(f"Slow down! Try again in {retry_after} seconds.")
    else:
        await message.channel.send("Not ratelimited!")

from_cooldown takes the amount of update_rate_limit()s needed to trigger the cooldown, the time in which the cooldown is triggered, and a BucketType.

solar anchor
slate swan
#

this may be helpful

solar anchor
#

i just press install now right

slate swan
# unkempt canyon

@slate swan u can use something like that , and kick/ban or any action instead of sending a message

unkempt canyonBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

slate swan
#

please use codeblocks

#

bad indentation

#

at discord.Embed

#

@solar anchor u need to install git first ...

solar anchor
#

my bad

potent spear
flat solstice
#

Hi, I have this task which cycles through a few different status msgs however it broke a while ago and I'm not sure why as It's not giving me any errors as far as I can see. (by broke I mean it's not been showing a status msg on the bot for some time)```py
class Events(commands.Cog):
def init(self, bot):
self.bot = bot
self.statuses = []
self.status.start()

@tasks.loop(minutes = 5) # seconds = 10
async def status(self):
    await self.bot.change_presence(activity = discord.Game(next(self.statuses)))

@status.before_loop
async def before_status(self):
    await self.bot.wait_until_ready()
    data = await self.bot.get_data(448405740797952010)
    users = sum(await self.bot.comm.handler("user_count", self.bot.cluster_count))
    self.statuses = cycle([f'/help | {self.bot.config.default_prefix}help', f'{self.bot.config.activity}', f'{data[13]} is the current count', f'RaidMode is {"Enabled" if data[14] is True else "Disabled"}', f'{data[15]} is the required age for new accounts when raidmode is enabled.', f'Latency: {round(self.bot.latency * 1000, 2)}ms.', f'CPU Usage: {psutil.cpu_percent(interval=None)}%', f'RAM Usage: {psutil.virtual_memory().percent}%', f'I can see {str(users)} users', f'Python Version: {platform.python_version()}', f'Discord.py Version: {discord.__version__}', 'I support slash commands', ])```
frosty axle
#

hello

true moon
#

I have a query will embed.description = 'text' will work if i want to set the description of the embed

haughty sedge
#

where can i get an example of this

velvet tinsel
#

google what’s this?

#

Bad PEP8

#

💀

slate swan
velvet tinsel
#

Looks fine to me

flat solstice
# slate swan

doesn't discord.Embed need to be indented to be part of the async block?

velvet tinsel
honest shoal
#

hey

#

why I'm getting this

velvet tinsel
grim oar
flat solstice
grim oar
#

No no

#

It's Embed.set_image(url=...)

honest shoal
grim oar
#

First create the instance then use set_image with it

flat solstice
#

but do you need to do that if your inside of the embed object? thought you only had to do that if you'd escaped the object, which i don't think they have

grim oar
#

!d discord.Embed

unkempt canyonBOT
#

class discord.Embed(*, colour=Embed.Empty, color=Embed.Empty, title=Embed.Empty, type='rich', url=Embed.Empty, description=Embed.Empty, timestamp=None)```
Represents a Discord embed.

len(x) Returns the total size of the embed. Useful for checking if it’s within the 6000 character limit.

bool(b) Returns whether the embed has any data set.

New in version 2.0.

Certain properties return an `EmbedProxy`, a type that acts similar to a regular [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") except using dotted access, e.g. `embed.author.icon_url`. If the attribute is invalid or empty, then a special sentinel value is returned, [`Embed.Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty").

For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") for you.
grim oar
#

See There's no parameter for setting image

unkempt canyonBOT
#

You are not allowed to use that command here. Please use the #bot-commands channel instead.

grim oar
#

I don't understand what you asking

honest vessel
#

this is so weird in on_message_delete msg = await channel.send(embed=em) AttributeError: 'NoneType' object has no attribute 'send'

@commands.Cog.listener("on_message_delete")
    async def on_message_delete(self, message):
        guild = self.bot.get_guild(self.log_guild_id)
        channel = self.bot.get_channel(self.log_guild_id)
grim oar
#

are you getting the channel from cache

#

Oh

little ether
velvet tinsel
#

Nova are you normal now?

grim oar
honest vessel
#

aaah

grim oar
visual island
velvet tinsel
#

Oh…I’d better leave soon 😳

honest vessel
#

@visual islandno checked that

grim oar
velvet tinsel
#

You printed it?

grim oar
velvet tinsel
velvet tinsel
honest vessel
#

yeah indentation is fine, now i get this with try fetching

#

disnake.errors.NotFound: 404 Not Found (error code: 10003): Unknown Channel

grim oar
#

Ohh I didn't see that smh

velvet tinsel
#

You seem to be using the same ID

honest vessel
#

channel = self.bot.get_channel(self.log_guild_id) or await self.bot.fetch_channel(self.log_guild_id)

grim oar
#

Yeah lol

honest vessel
#

its not same id

grim oar
#

No no my bad they are right

velvet tinsel
#

Did you print them?

grim oar
#

Is it getting the guild obj or no

velvet tinsel
#

U there 😦

honest shoal
#

and gets crashed

velvet tinsel
honest shoal
#

ahh wait

#

was just updating to disnake forgot to set a requirement for it

#

sorry my bad

velvet tinsel
#

pithink ok

honest vessel
#

oh i found error

#

yall missed it

grim oar
#

That's because you are using same Id as ice and dek said

velvet tinsel
#

Which channel is it? Try getting the channel ID and c- what

honest vessel
#

i am asking self.bot not guild.fetch_channel()

#

😄

velvet tinsel
#

O

velvet tinsel
#

💀

honest vessel
#

eeeh still same what the F

#
    raise NotFound(response, data)
disnake.errors.NotFound: 404 Not Found (error code: 10003): Unknown Channel
velvet tinsel
honest vessel
#

oh and you guys was correcct

#

i am checking same id forgot chance variable

grim oar
#

Finally

honest vessel
#

guild.fetch_channel(self.log_guild_id) kek

grim oar
#

🤨 exactly

visual island
grim oar
#

only if you didn't ignore this person ^

honest vessel
#

yeah i checked ID it self but my eyes didnt catch the variable was same

grim oar
#

Same lmao

honest vessel
#

channel = guild.get_channel(self.log_channel_id) or await guild.fetch_channel(self.log_channel_id) here we go thanks tho

#

i am lil dissy today maybe covid on its way :/

#

or i havnt woken up fully yet

fluid spindle
#

Quick question: What's the function to change a user's Game Activity again?

grim oar
#

!d discord.Client.change_presence

unkempt canyonBOT
#

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

Changes the client’s presence.

Example

```py
game = discord.Game("with the API")
await client.change_presence(status=discord.Status.idle, activity=game)
```   Changed in version 2.0: Removed the `afk` keyword-only parameter.
fluid spindle
#

Cool, thanks

dusk pumice
#

Hmm...

#

How can I use slash command without discord.py 2.0?

#

But I'd like to use slash command

#

If you know any librarys, Please DM me.

honest vessel
#

guys is there a website or why dont this discord have a channel like where you can post functions or commands that are completed for others to use / get inspiration ?

#

and maybe peoples can react to it, if too many negative reaction it removes the codepost

#

so community itself can keep relevant code and remove shitty functions

#

(can u make a public github where other users can post in without accept them?)

heavy folio
#

and iirc you can use this even on 1.7.3

dusk pumice
#

Kk thanks

slate swan
#

hello

#

i need a smol help

#

if message.content.startswith('~wikipedia'):
x = wikipedia.search(message.content[11:len(message.content)])
await message.channel.send(wikipedia.page(x[0]).url)

#

so i tried running ~wikipedia india

#

to search for india and for it to send the url

#

but

#

it does not reply, and instead, i get this error on the terminal on which the bot is running:

#

/usr/lib/python3.10/site-packages/wikipedia/wikipedia.py:389: GuessedAtParserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("lxml"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.

The code that caused this warning is on line 389 of the file /usr/lib/python3.10/site-packages/wikipedia/wikipedia.py. To get rid of this warning, pass the additional argument 'features="lxml"' to the BeautifulSoup constructor.

lis = BeautifulSoup(html).find_all('li')
Ignoring exception in on_message
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/discord/client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "/home/govind/Desktop/bot.py", line 20, in on_message
await message.channel.send(wikipedia.page(x[0]).url)
File "/usr/lib/python3.10/site-packages/wikipedia/wikipedia.py", line 276, in page
return WikipediaPage(title, redirect=redirect, preload=preload)
File "/usr/lib/python3.10/site-packages/wikipedia/wikipedia.py", line 299, in init
self.__load(redirect=redirect, preload=preload)
File "/usr/lib/python3.10/site-packages/wikipedia/wikipedia.py", line 393, in __load
raise DisambiguationError(getattr(self, 'title', page['title']), may_refer_to)
wikipedia.exceptions.DisambiguationError: "indian" may refer to:

slate swan
honest shoal
slate swan
#

i have imported the wikipedia module

slate swan
honest shoal
slate swan
#

yes that is the complete code for the wikipedia command

haughty sedge
#

how do i encode audio using opus

#

PLS HELP

honest shoal
slate swan
#

i checked it is installed on my system as well

honest shoal
#

em looks like a different one

slate swan
#

the code searches on wikipedia

#

puts the results in a list

#

takes the first one

honest vessel
#

@slate swanit tells u to add features="lxml", so lis = BeautifulSoap(html, features="lxml").find_all('li')

#

on the first notice

slate swan
#

so do i put it in the code?

#

lis = BeautifulSoap(html, features="lxml").find_all('li')

#

this command

honest shoal
#

can anyone explain this error please. disnake.ext.commands.errors.BadArgument: Converting to "float" failed for parameter "time". I just switched to disnake rn. This is the command py @bot.command() async def timeout(member: disnake.Member, time: float = None, *, reason=None) -> None: await member.timeout(duration=time, reason=reason)

honest vessel
#

why float tho?

#

dosnt int work fine?

honest shoal
honest vessel
#

oh duration (Optional[Union[float, datetime.timedelta]]

honest shoal
honest vessel
#

so i guess time: Optional[Union[float]]

#

nvr used this typehint before so let me know how it works

honest shoal
#

what is Optional and Union

honest vessel
#

this is what it sais in documents duration (Optional[Union[float, datetime.timedelta]]

honest shoal
#

yes optional duration

honest vessel
#

i cant help explain it cause i dont know myself (waiting for someone to do )

honest shoal
honest vessel
#

i want to display multi images in an embed how?

honest shoal
#

however we can also add in author, footer, and thumbnail too

honest vessel
#

thing is i am doing a msg delete event that is going to log and i want to display images from attachments from that deleted message

#

i guess i will display only first attachment and rest just being urls

honest shoal
#

well such logging is against TOS

#

and I have experienced that only the first one is logged

slate swan
#

Note that uploaded images to Discord will be removed from the CDN once the message is deleted. So even if you log images, after a few hours you won't even be able to see it anymore in your logging channel.

kind wind
#

is the library keep_alive made for python bots?

slate swan
#

logging images are totally fine.

tawdry perch
slate swan
kind wind
#

I saw someone using it on stackoverflow because I wanted to search a question and I wanted to see it

tawdry perch
#

it's a file afaik

#

it's just a file with some code

kind wind
#

so its not a library

tawdry perch
#

correct

kind wind
#

alright

slate swan
#

check the library ig ?

tawdry perch
#

at least the one I guess you are talking about

#

!pypi keep_alive

unkempt canyonBOT
tawdry perch
#

ye, this exists but might not be the one you are looking for

kind wind
#

to make a command answer differently for each different person can I use the username if it is a valid thing

#
  if username == "VDP":
    await ctx.reply("Hi VDP")
#

like this

#

and use the else if it isnt a valid username

slate swan
#

hey

vale wing
honest vessel
#

@kind wind i would reccommend use discordID cause usernames can always be changed

vale wing
#

Like you can't code if statement for every person

#

In this case it would be

await ctx.reply(f'Hi {username}')```
honest vessel
#

you can make a list of discord IDs

honest vessel
#
greeting_list = [1234567, 988587817]
if ctx.author.id in greeting_list:
    await ctx.send(f"Hi! {ctx.author.mention}")
#

and u prob want to do display_name instead of username?

#

and if u want custom lines then do like a dict.

dict_msg = {"1234567": "Hi mate! {} how are you", "8756781625": "Oh not you again! {}"}
ctx.send(dict_msg[str(ctx.author.id)].format(ctx.author.display_name))

something like this improvised

slate swan
#

idk anymore how to use it... but i want to make these
main_command command arguments
like this
settings prefix
settings volume

#

😪

peak loom
#
List_convo = ['good', 'Good']

@bot.event
async def on_message(msg):
    if msg.content.lower() == 'hi':
        await ctx.send('hi')
        await bot.wait_for('how are you')
        await ctx.send('good how are you')
        await bot.wait_for(List_convo)
        await ctx.send('Bye, I gotta go. Until the chat dies!')

@bot.event
async def on_message(msg):
    if msg.content.lower() == 'Hi':
        await ctx.send('Hi!')
        await bot.wait_for('How are you?')
        await ctx.send('Good how are you?')
        await bot.wait_for(List_convo)
        await ctx.send('Bye, I gotta go.')
```No errors but the bot don't work.
stable berry
#

How to make buttons

honest vessel
#

@slate swandosnt python have eval()?

potent spear
#

you don't, use the one jishaku has

novel apexBOT
#

This is not a Modmail thread.

stable berry
#

Can nyone tell me how to add buttons in bot

honest vessel
#

check the documents first ?

stable berry
#

Like a button which can take me to the voting site

stable berry
honest vessel
#

you can also tell chat what library u using

peak loom
honest vessel
peak loom
honest vessel
#

ok tips, do like message = msg.content.lower() and now u can ignore uppercase

peak loom
#

I do have discord imported.

potent spear
peak loom
potent spear
#

exactly

#

it won't ever be Hi, since that has an uppercase in it

honest vessel
#
List_convo = ['good', 'Good']

@bot.event
async def on_message(msg):
    message = msg.content.lower()
    if message == 'hi':
        await ctx.send('hi')
        await bot.wait_for('how are you')
        await ctx.send('good how are you')
        await bot.wait_for(List_convo)
        await ctx.send('Bye, I gotta go. Until the chat dies!')
potent spear
#

your wait_for is wrong

#

check out some examples in the documentation

#

you have to wait_for an event

peak loom
#

Oh.

honest vessel
#

wait_for(event, *, check=None, timeout=None)

#
@client.event
async def on_message(message):
    if message.content.startswith('$greet'):
        channel = message.channel
        await channel.send('Say hello!')

        def check(m):
            return m.content == 'hello' and m.channel == channel

        msg = await client.wait_for('message', check=check)
        await channel.send(f'Hello {msg.author}!')``` example
#
def check(m):
    return m.content.lower() == "good"
``` kinda like this
honest shoal
honest vessel
#

lol thats kinda dumb, if u logg all images, then what does deleted image do ?

#

maybe u log an image that is later on deleted

#

error ?

#

but yes one is int one is string and u have +

#

read TypeRrror msg

#

basic python

honest vessel
slate swan
honest vessel
#

@peak loomread the other messages its ur wait_for that is wrong

peak loom
final iron
peak loom
# final iron Can we see your new code?
@bot.event
async def on_message(msg):
    message = msg.content.lower()
    if message == 'hi':
        await ctx.send('hi')

@bot.event
async def on_message(msg):
  await bot.wait_for()
    message = msg.content.lower()
    if message == 'how are you':
        await ctx.send('good how are you')
        
@bot.event
async def on_message(msg):
    message = msg.content.lower()
    if message == 'good':
        await ctx.send(' Thats good! I gotta go now! Until the chat dies!')

@bot.event
async def on_message(msg):
    message = msg.content.lower()
    if message == 'bad':
        await ctx.send('I hope your day gets better!')
        time.sleep(1)
        await ctx.send('I gotta go now!')
honest vessel
#

spoon feed


@bot.event
async def on_message(msg):
    message = msg.content.lower()

    def check(m):
        return m.content.lower() == "good"

    if message == 'hi':
        await msg.channel.send('hi')
        await bot.wait_for('message', check=check)
        await msg.channel.send('good to hear!')
slate swan
final iron
honest vessel
#

sry

peak loom
final iron
#

Also ctx is undefined

slate swan
#

It looked like

@somthing.command()
async def example(ctx):

@example.command()
async def add(ctx):

@example.command()
async def remove(ctx):
``` @reef shell
slate swan
final iron
#

Or use a dict

unkempt canyonBOT
#

@discord.ext.commands.group(name=..., cls=..., **attrs)```
A decorator that transforms a function into a [`Group`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Group "discord.ext.commands.Group").

This is similar to the [`command()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.command "discord.ext.commands.command") decorator but the `cls` parameter is set to [`Group`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Group "discord.ext.commands.Group") by default.

Changed in version 1.1: The `cls` parameter can now be passed.
peak loom
honest vessel
#

@final ironedited it good eyes

slate swan
peak loom
#

I tried makig it a if statement it no work either.

honest vessel
#

iv given him plenty of exmaples now and with dict list etc

slate swan
peak loom
#

I'm gonna go make a game with c#. Bye.

honest vessel
#

is that a way of try sound smarter using c# but cant do basic python?

peak loom
#

No, I'm making a VR game.

honest vessel
#

i hope u get more help in future when u get given information u say bye screw this....

slate swan
#

!e

class message:
    ...
    #dummy class just to able to use message.author
message.author = "lucid"
def send(): print("sent that message")
def listener(message : str) -> str:
  dct = {"hi":f"hey {message.author}","feeling bad":"whats wrong"}
  send()
  return dct[message]
listener("hi")```
unkempt canyonBOT
#

@slate swan :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 10, in <module>
003 |   File "<string>", line 7, in listener
004 | AttributeError: 'str' object has no attribute 'author'
slate swan
#

mb

#

but u get the idea

#

!e


class message:
    ...
    #dummy class just to able to use message.author
message.author = "lucid"
def send(s): print(f"sent {s} that message")
def listener(message1 : str) -> str:
  dct = {"hi":f"hey {message.author}","feeling bad":"whats wrong"}
  send(dct[message1])
  return dct[message1]
listener("hi")```
unkempt canyonBOT
#

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

sent hey lucid that message
slate swan
honest shoal
#

how do we add command permissions in disnake?

glass dock
#

How can I add Embed to the database?

fluid spindle
#

What does self.bot.cogs.myCog.__doc__ do?

glass dock
final iron
#

!d disnake.ext.commands.has_permissions

unkempt canyonBOT
#

@disnake.ext.commands.has_permissions(**perms)```
A [`check()`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.ext.commands.check "disnake.ext.commands.check") that is added that checks if the member has all of the permissions necessary.

Note that this check operates on the current channel permissions, not the guild wide permissions.

The permissions passed in must be exactly like the properties shown under [`disnake.Permissions`](https://docs.disnake.dev/en/latest/api.html#disnake.Permissions "disnake.Permissions").

This check raises a special exception, [`MissingPermissions`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.ext.commands.MissingPermissions "disnake.ext.commands.MissingPermissions") that is inherited from [`CheckFailure`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.ext.commands.CheckFailure "disnake.ext.commands.CheckFailure").
honest shoal
final iron
honest shoal
glass dock
#

The syntax is the same

final iron
#

They're incredibly similar

glass dock
glass dock
final iron
glass dock
#

I want to configure Embed and add its parameters to the database

#

for later use

#

Can you help me?

honest shoal
#

wait

#

sorry for the ping nvm

glass dock
#

try:

from disnake.ext.commands import has_permissions
slate swan
glass dock
#

Show the code

fluid spindle
tawdry perch
#

What are the ratelimits for sending messages?

slate swan
peak loom
lament mesa
spring flax
#

Anyone mind suggesting some unique moderation commands?

slate swan
slate swan
spring flax
#

disnake has application commands, right?

slate swan
#

or all channel lockdown and hide all the channels but one for announcements or a lecture

slate swan
fluid spindle
spring flax
slate swan
spring flax
#

the disnake's context menu commands

slate swan
#

select menus?

#

im not sure what you mean

spring flax
#

like user commands

#

application commands

slate swan
#

slash commands lol

#

well yes i have done them

spring flax
#

do you know how they work?

slate swan
#

yeah

spring flax
#

can i have something like when I right click a user and press apps, and I select one of them it changes the user's name to [something] only

slate swan
#

good way to start

keen talon
slate swan
#

same thing

#

slash commands or application commands

keen talon
slate swan
keen talon
slate swan
#

like a group of stuff im not sure but slash commands does fall in it

keen talon
#

Application commands is for getting member's details , ban them etc

slate swan
spring flax
#

I have this


@bot.user_command()
async def avatar(inter, user):
    user_discriminator = user.discriminator
    await user.edit(nick=f"User {user_discriminator}")

when i use it, it changes the user's name but also shows in ephemeral that the interaction failed. how do i prevent that message? If possible

keen talon
honest shoal
#

how to use datetime.timedelta as a duration parameter in timeout command for disnake

slate swan
keen talon
spring flax
slate swan
#

arent slash commands msgs always ephemeral?

keen talon
spring flax
#

well, i guess that'd work too.

keen talon
slate swan
keen talon
slate swan
#

read it again

#

seems like you dont understood what i ment

quartz badger
#

I was trying to make a command that restarts the bot and the command is working but I wanted only me to be allowed to use it. So I put in my id but still it is saying I don't have permission. What is wrong?

@bot.command(name = 'restart')
async def restart(ctx):
    if ctx.author.id == '543955269315723279':
        await ctx.send("**`Reiniciando o bot...`**")
        restart_bot()
    else:
        await ctx.send("Você não tem permissão para usar este comando!")```
slate swan
#

like on interaction arent those msgs always ephemeral

keen talon
#

No

slate swan
slate swan
#

isnt that like buttons?

#

you have to respond to that interaction or it will say it failed but continues it

spring flax
#

is anything wrong with this?

@bot.user_command()
async def nickname(inter, user):
    user_discriminator = user.discriminator
    await user.edit(nick=f"User {user_discriminator}")
    embed=disnake.Embed(description=f"{bot.success_emoji} Changed {user.mention}'s nickname")
    await inter.response.send_message(embed=embed)
slate swan
#

like buttons since theyre both interactions i think maybe thats the issue

quartz badger
slate swan
slate swan
spring flax
slate swan
#
await inter.send(embed=embed, ephemeral=True)
spring flax
#

oh so that means I jsut mispelled it, no surprise