#discord-bots

1 messages ยท Page 431 of 1

slate swan
#

oh alright

#

good point

jade jolt
#

or {n}

slate swan
#

lemme see what i can do to that

#

works

jade jolt
#

good to know

slate swan
#

thanks SwagHappy

jade jolt
#

np

#

could make it smaller

#

2 lines (or 1 line if u want to)

slate swan
#

oh alright it doesnt matter

#

pepe_shrug if u want to do it , give it a shot

vocal plover
#

import urllib
urllib.urlencode("text with spaces")

slate swan
#

either ways do you know how to take user input

#

like user prefix/hello

bot
  whats your name

user
lucid

```bot again
welcome lucid ```
vocal plover
#

I have something for that :P https://dpy.tips/cogs

final iron
#

I'm trying to create a custom help command and im getting a TypeError: help_command must be a subclass of HelpCommand error

#

The code is

class CustomHelpCommand(commands.HelpCommand):

    def __init__(self):
        super().__init__()

    async def send_bot_help(self, mapping):
        return await super().send_bot_help(mapping)

    async def send_cog_help(self, cog):
        return await super().send_cog_help(cog)

    async def send_group_help(self, group):
        return await super().send_group_help(group)

    async def send_command_help(self, command):
        return await super().send_command_help(command)

client = commands.Bot(command_prefix = get_prefix, help_command = CustomHelpCommand)
#

The error im getting is in line 18

vocal plover
#

it needs to be an instance of the help command, not the type, so help_command=CustomHelpCommand()

final iron
#

Its always stupid little mistakes like that

vocal plover
#

np, that one has caught me out a bunch of times too

#

i can never remember if it takes an instance or the type

somber musk
#

I need help, what's the code making a bot delete a message when the user for example says the f word... Obviously when the bot had administrator perms

burnt ether
#

noice

#

i need halp

#

any idea how to make dis work?

#

so i can do collection(x, y).fetch.all()

final iron
burnt ether
#

yea

#

its like a lib

#

sry am a beginner wit classes

#

like self?

#

a class inside a class

#

now self.db doesnot exist

#

me 2, lol, am tryin to figure this out

#

never tried da builtin classmethod

#

func

#

and decorator

vocal plover
burnt ether
#

i just need to do:

  1. can call collection(x, y).fetch.all()
  2. can call collection(x, y).fetch.one_by_id(id_var)
vocal plover
#

no yumyum

burnt ether
#

ah

#

sry

#

yea

#

my mongodb helper

hardy yoke
burnt ether
#

yep

#

dis my bot

final iron
#

Quick question on cogs

#

Idk how to describe it

#

Like you have a class where everything functions

#

Do all the commands have to be in that class?

hardy yoke
final iron
#

Alright

#

Cogs are a bit confusing

frosty bronze
#
def check(reaction, user):
            return user == c.author and str(reaction.emoji) in reaction_list
        
        while True:
            try:
                reaction, user = await bot.wait_for("reaction_add", timeout=60, check=check)
                
                if str(reaction.emoji) == reaction_list[0]:
                    await help_page.edit(embed=help_embed)
                    await help_page.remove_reaction(reaction, user)
                    print('AAA')

                elif str(reaction.emoji) == reaction_list[1]:
                    print('BBB')
                    await help_page.edit(embed=help2_embed)
                    await help_page.remove_reaction(reaction, user)
                    
                
                elif str(reaction.emoji) == reaction_list[2]:
                    print('CCC')
                    await help_page.edit(embed=help3_embed)
                    await help_page.remove_reaction(reaction, user)
                    
                else:
                    await help_page.remove_reaction(reaction, user)

            except asyncio.TimeoutError:
                await help_page.delete()
                break

My 2nd and 3rd reaction are not returning True

tender frigate
#

hello?

still tiger
hardy yoke
#

pins

slate swan
#

Not exactly, Danny just stopped working on this project. I wish someone equal to Danny to take on this project with the appetite he had when he started it. We love you Danny!

vocal plover
#

This is good for competition, everyone is making libs now so we will have some variety

subtle glen
#

hi

#

can I have the mute/warn/ban code?

slate swan
#

Write It

subtle glen
#

idk ยฏ_(ใƒ„)_/ยฏ

slate swan
#

I can help

bitter perch
slate swan
#

Or you can take some examples from channel history

subtle glen
slate swan
#

Im going to sleep sry.

subtle glen
slate swan
#

If I do not forget it for sure

#

hey guys

#

my friend sayed that discord.py shutdown is fake any proofs?

#

like iknow it is real but tell it to him

vocal plover
#

the official repo is archived.

vocal plover
slate swan
vocal plover
#

Well you can only convince people of things if they're willing to be convinced

worn wigeon
#

say goodbye to discord.py

final iron
#

Honestly I hope somebody makes a fork of discord.py that's extremely similar so that people don't have to switch existing code that much

vale narwhal
stiff nexus
#

from await guild.bans() can we know when the user was banned (time)

vale narwhal
#

Anyone have an example version of it

vagrant brook
#

check this out

paper bane
#

you will have to log it on your own

vagrant brook
#

I think bans are logged in audit log

lament ridge
#

This is the place for me now ๐Ÿ˜Ž

paper bane
#

Oh yeah completely went over my head for some reason

lament ridge
#

Amped to be re-writing dpy ๐Ÿ˜Ž ๐Ÿฅฒ

paper bane
#

you can fetch the audit entry of the ban and get its creation time

slate swan
stiff nexus
paper bane
#

the /bans endpoint doesn't provide ban timestamps

stiff nexus
#

ok

stiff nexus
paper bane
#

!d discord.Guild.audit_logs

unkempt canyonBOT
#

async for ... in audit_logs(*, limit=100, before=None, after=None, oldest_first=None, user=None, action=None)```
Returns an [`AsyncIterator`](https://discordpy.readthedocs.io/en/stable/api.html#discord.AsyncIterator "discord.AsyncIterator") that enables receiving the guildโ€™s audit logs.

You must have the [`view_audit_log`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions.view_audit_log "discord.Permissions.view_audit_log") permission to use this.

Examples

Getting the first 100 entries:

```py
async for entry in guild.audit_logs(limit=100):
    print('{0.user} did {0.action} to {0.target}'.format(entry))
```...
paper bane
#

you can specify the action and the user. In this case, the action will be discord.AuditLogAction.ban

stoic whale
#

hello, I have a problem, the function of the button works well and the menu also, but I want to know is how I do so that the button can be executed again, so that several people can press it and it works, I am new, I hope you help me Pbs_pepefeliz

slate swan
#

@stoic whale what library are you using?

#

For the buttons and menus

stoic whale
nimble kayak
#

because some of my freinds told it is going to close

#

so please ping and reply me

foggy merlin
#

has closed*

#

some people are working on forks though. Don't know how reliable they will be. But if you really want to stick with d.py, those are your best bet

round yarrow
#

can anyone tell me whats wrong in this code...it shows no errors but doesnt work either...when commands r typedhttps://paste.pythondiscord.com/duqiluyubu.py

nimble kayak
brisk pine
#

should i use discord-py-interactions or dislash for slash commands and others

slate swan
#

i dunno you can lmk

little ether
dense swallow
#

yes

#

many people is continuing it

nimble kayak
dense swallow
#

not by danny

little ether
dense swallow
#

unless a miracle happens

brisk pine
#

hoping for a miracle

#

praying

dense swallow
#

yeah

slate swan
foggy merlin
#

however, if you are under that threshold, it should work fine (assuming discord doesn't decide to mess that up as well)

brisk pine
slate swan
#

enhanced-discord.py is a fork of the original code being lead by dutchy i believe, they're striving to keep it up-to-date

brisk pine
#

thanks!

jade jolt
royal dock
#

They seem to be working getting 2.0 out and later work on slash commands

slate swan
#

yeah well, enhanced-dpy hasn't had any action for a few months

#

we'll see what unfolds

glass latch
nimble kayak
#

what

jade jolt
#

whats the issue

glass latch
#

Suggest me some alternative

nimble kayak
#

bro

jade jolt
#

use a vps lol

nimble kayak
#

tell the issues

glass latch
#

@nimble kayak the bot gets turned off

nimble kayak
#

ping the server

glass latch
#

After 10 mins

nimble kayak
#

with uptime robot

jade jolt
#

run a webserver to keep it online

glass latch
#

It was working nice until yesterday

jade jolt
nimble kayak
glass latch
jade jolt
#

didnt work very well lol

nimble kayak
glass latch
upbeat otter
#

Guys, i want to make a function for my bot that fetches the meaning of the word, anyone can suggest any source or something?

maiden fable
#

urban

glass latch
upbeat otter
maiden fable
#

What

upbeat otter
#

its an API?

maiden fable
#

!pypi urbandict

unkempt canyonBOT
brisk pine
#

how to make slash commands and buttons with enhanced-dpy?

foggy merlin
#

are you sure urban dictionary is the best place to find definitions

maiden fable
#

Or use the API

upbeat otter
#

api is only for js

#

or can i use for python?

foggy merlin
#

it would be better to use a proper website for definitions

lament mesa
foggy merlin
#

definitions on urban dictionary arent usually what you think they are going to be

lament mesa
#

you can use any programming language to interact with an api

foggy merlin
#

just google "dictionary API" or something

#

you'll find tons

upbeat otter
foggy merlin
#

you may be confusing yourself with an API wrapper which are designed for specific languages

brisk pine
#

how can i make slash commands and buttons with enhanced-dpy?

distant pagoda
#

can someone help me with some code

jade jolt
#

show the code

distant pagoda
#

i took the token out cus yk

#

but everytime i run it it runs fine

#

if i say .ping itll respond with pong

#

until i say .say and want it to repeat me

jade jolt
#

just do message.content.replace(".say", "")

#

that should work

#

you dont need all the split and list adding bruh

distant pagoda
#

replace with message.content.startswith(".say"): ?

jade jolt
#

no?

distant pagoda
#

im new

jade jolt
#

under that

distant pagoda
#

ah ok thanks

jade jolt
#

np

distant pagoda
#

i dont think python liked that

jade jolt
#

show error

distant pagoda
#

how do i make it like this so its easier

jade jolt
#

```py
code
```

tight obsidian
#

I'm getting this while trying to attach my interactions endpoint URL. I get this error, but Discord doesn't send any requests to me. What's wrong?

distant pagoda
#

jeez

#

sorry about that

jade jolt
#

ur token is invalid

distant pagoda
#

oh crap i forgot to put it back

#

sorry lmao

maiden fable
tight obsidian
maiden fable
#

Ah, well u will need application.commands scope for slash commands

distant pagoda
#
Ignoring exception in on_message
Traceback (most recent call last):
  File "C:\Users\josue\PycharmProjects\pythonProject1\venv\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\josue\PycharmProjects\pythonProject1\main.py", line 21, in on_message
    for word in mes[1:]:
NameError: name 'mes' is not defined
maiden fable
#

message*

lime palm
#

an error came saying "discord.ext import commands" unknown locaion

desert heart
tight obsidian
distant pagoda
#
Ignoring exception in on_message
Traceback (most recent call last):
  File "C:\Users\josue\PycharmProjects\pythonProject1\venv\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\josue\PycharmProjects\pythonProject1\main.py", line 21, in on_message
    for word in message[1:]:
TypeError: 'Message' object is not subscriptable
tight obsidian
#

Maybe Discord blacklists domains on the .su TLD?

distant pagoda
#

wait

#

i think its cus i had a + instead of a =

#

nvm

#
Ignoring exception in on_message
Traceback (most recent call last):
  File "C:\Users\josue\PycharmProjects\pythonProject1\venv\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\josue\PycharmProjects\pythonProject1\main.py", line 21, in on_message
    for word in message[1:]:
TypeError: 'Message' object is not subscriptable
maiden fable
#

Bro

#

message.content blobpain

distant pagoda
#

where

maiden fable
#

in message[1:]

#

message.content[1:]

jade jolt
#

does it show you that im typing?

#

ive had a few say that they cant

#

oh wrong channel nvm

distant pagoda
#
Ignoring exception in on_message
Traceback (most recent call last):
  File "C:\Users\josue\PycharmProjects\pythonProject1\venv\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\josue\PycharmProjects\pythonProject1\main.py", line 24, in on_message
    await message.channel.send(output)
  File "C:\Users\josue\PycharmProjects\pythonProject1\venv\lib\site-packages\discord\abc.py", line 1065, in send
    data = await state.http.send_message(channel.id, content, tts=tts, embed=embed,
  File "C:\Users\josue\PycharmProjects\pythonProject1\venv\lib\site-packages\discord\http.py", line 254, in request
    raise HTTPException(r, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50006): Cannot send an empty message
slate swan
distant pagoda
#

i had to put in before message.content because there was an error saying 'in' expected

slate swan
#

Hmm

distant pagoda
slate swan
upbeat otter
#

Guys, i want to maintain the most active users on my server, how can i do that?

cinder horizon
#
@bot.command(pass_context=True)
async def test(ctx, user: discord.Member):
    # Remove unnecessary characters
    hypesquad_class = str(user.public_flags.all()).replace('[<UserFlags.', '').replace('>]', '').replace('_',
                                                                                                         ' ').replace(
        ':', '').title()

    # Remove digits from string
    hypesquad_class = ''.join([i for i in hypesquad_class if not i.isdigit()])
    
    # Output
    test = discord.Embed(title=f"{user.mention}'s Badges", description="test", color=0xff0000)
    if "Hypesquad Bravery" in hypesquad_class.lower():
      embed.add_field(name="1", value=" ")
    elif "Hypesquad Balance" in hypesquad_class.lower():
      embed.add_field(name="2", value=" ")
    elif "Hypesquad Brilliance" in hypesquad_class.lower():
      embed.add_field(name="3", value=" ")
    await ctx.channel.send(embed=test)
stiff nexus
#
Traceback (most recent call last):
  File "main.py", line 12, in <module>
    from discord.ext import tasks
ImportError: cannot import name 'tasks' from 'discord.ext' (unknown location)
```help????
brisk pine
#

is there a discord server for enhanced-dpy?

serene lynx
#
import discord
from discord.ext import commands
import aiohttp
from io import *
from discord.ext.commands.converter import Greedy
from discord_slash import cog_ext, SlashContext


class createemoji(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @commands.command()
    @commands.has_permissions(manage_emojis=True)
    async def createemoji(self, ctx, url: Greedy[str], name: Greedy[str]):
        self.bot.ses = aiohttp.ClientSession()
        async with self.bot.ses.get(url) as r:
            try:
                if r.status in range(200, 299):
                    img = BytesIO(await r.read())
                    bytes = img.getvalue()
                    emoji = await ctx.guild.create_custom_emoji(image=bytes, name=name)
                    await ctx.send(f'success create emoji: <:{emoji.name}:{emoji.id}> by {ctx.author}')
                    await ctx.message.delete()

                else:
                    await ctx.message.delete()
                    await ctx.send(f'error when making request | response : {r.status}')

            except Exception as e:
                print(e)
                await ctx.send(e)


def setup(bot):
    bot.add_cog(createemoji(bot))
#
discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.avatar' raised an error: ExtensionFailed: Extension 'cogs.createemoji' raised an error: TypeError: Greedy[str] is invalid.```
#

how to use greedy in discord py?

compact harbor
#

Is there any official documentation for slash commands??

slate swan
maiden fable
brisk pine
#

can u gimme the link to it plz?

maiden fable
brisk pine
#

sure

sleek ore
stiff nexus
#

when will the message response time be 0.44328s???

upbeat otter
#
with open("users.json", "r") as j:
    users = json.load(j)

  await update_data(users, member)

  with open("users.json", 'w') as j:
    json.dump(users, j)

Why is the update_data giving errors?

maiden fable
stiff nexus
#

how to do like when u edited your cmd the bot also edited the response right?

slate swan
sleek ore
compact harbor
#

It means you are simply importing every classes, functions and attributes from config module

floral jacinth
#

why server = commands.Bot.get_guild('123123123123123123') say TypeError: get_guild() missing 1 required positional argument: 'id'

floral jacinth
floral jacinth
#
    async def test(self, ctx):
        server = commands.bot.get_guild('123123123123123123')
        channel_id = server.get_channel(123123123123123123)
        print(server)
        print(channel_id)```
slate swan
#

wow

#

remove commands in commands.bot.get_guild('123123123123123123') and remove the ' '

floral jacinth
#

bot is not defined

slate swan
floral jacinth
#

no

slate swan
#

show all code. but not the token

compact harbor
#

That's not good things, and it's so confusing

floral jacinth
# slate swan show all code. but not the token

this is the start

import asyncio
import discord
from discord.embeds import Embed
from discord.ext import commands
from var import *

class user(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @commands.command(pass_context=True)
    async def test(self, ctx):
        server = self.bot.get_guild(123123123123123123)
        channel_id = server.get_channel(866257647657549845)
        print(server)
        print(channel_id)```
slate swan
slate swan
compact harbor
floral jacinth
#

i tried add self. but do not work

compact harbor
#

Because the context will always pass

slate swan
floral jacinth
#

so how to solve?

lament mesa
fast quest
#

Can someone help me

floral jacinth
#

but error still there

compact harbor
river kindle
#

Guys I'm creating a bot discord only that for the connection between the token and the API it gives me this error:

Traceback (most recent call last):
File "/Users/francescomascolo/Desktop/BOT py/BOT.py", line 20, in <module>
client.run('my token')
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/client.py", line 723, in run
return future.result()

floral jacinth
# compact harbor What error

why server = commands.Bot.get_guild('123123123123123123') say TypeError: get_guild() missing 1 required positional argument: 'id'

slate swan
river kindle
#

it is too long to send, it gives me a connection error

slate swan
#

must be invalid token

#

!paste you can paste it here

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

compact harbor
river kindle
slate swan
river kindle
#

It gives me an error with the token and API

fast quest
#
async def _8ball(ctx, *,question):
  responses = [ 'It is Certain.',
  '> It is decidedly so.',
  '> Without a doubt.',
  '> Yes definitely.',
  '> You may rely on it.',
  '> As I see it, yes.',
  '> Most likely.',
  '> Outlook good.',
  '> Yes.',
  '> Signs point to yes.',
  '> Reply hazy, try again.',
  '> Ask again later.',
  '> Better not tell you now.',
  '> Cannot predict now.',
  '> Concentrate and ask again.',
  "> Don't count on it.",
  '> My reply is no.',
  '> My sources say no.',
  '> Outlook not so good.',
  '> Very doubtful.']
  await ctx.send(random.choice(responses)) ``` 
i'm typing !8ball are you good, but it aint showing anything
slate swan
lament mesa
#

instance vs class

river kindle
#

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

river kindle
#

is safe?

#

sussy

compact harbor
fast quest
#

but doesnt it still work

#

?

lone flume
#

How to do i add a Database to my bot using Replit?

compact harbor
#

For dpy, you don't need any web hooks to interact with your bots

floral jacinth
spring flax
compact harbor
fast quest
#

@client.event
async def on_ready():
  print("Decide your Destiny")

@client.command(aliases = ['8ball','8-ball',"decideDestiny", "8 ball"])
async def _8ball(ctx, *,question):
  responses = [ 'It is Certain.',
  '> It is decidedly so.',
  '> Without a doubt.',
  '> Yes definitely.',
  '> You may rely on it.',
  '> As I see it, yes.',
  '> Most likely.',
  '> Outlook good.',
  '> Yes.',
  '> Signs point to yes.',
  '> Reply hazy, try again.',
  '> Ask again later.',
  '> Better not tell you now.',
  '> Cannot predict now.',
  '> Concentrate and ask again.',
  "> Don't count on it.",
  '> My reply is no.',
  '> My sources say no.',
  '> Outlook not so good.',
  '> Very doubtful.']
  await ctx.send(random.choice(responses))

lament mesa
fast quest
#

here what i am doinng wrong?

floral jacinth
compact harbor
#

Not string

floral jacinth
river kindle
river kindle
floral jacinth
compact harbor
#

Try using util function then

river kindle
compact harbor
compact harbor
#

Just use ctx.guild

floral jacinth
slate swan
# lament mesa i dont get it though, websockets is ideal for event based communication, using w...

Exactly, but discord also gives option to operate it through webhooks. Dpy uses the gateway one btw.
Iirc it was something like you don't need to have a bot to have slash commands. You can just register your commands to discord and receive interactions. If responding back does not require any physical existence of any bot application in the guild, then also they can be responded.
But that's the case like 1 out of 1000's will use. rooThink

lament mesa
#

also the message intents

slate swan
compact harbor
lament mesa
#

i mean, why use http for event based communication when ws is meant to be event based

slate swan
#

Yeah so that you don't require a bot application to be in the server

#

They also provide a different scope for app commands

lament mesa
#

ws is faster and more efficient iirc

slate swan
#

Looks like they're planning to end bots lol

#

Yes

lament mesa
#

i quitted few weeks ago

slate swan
#

Since everyone is trying to implement it, I also made a small implementation (though I don't think it'll work) blobpain But yeah it's fun

lament mesa
fast quest
#

Can anyone help me.

slate swan
#

Also slash commands are too complicated notlikeduck They have command, options, sub-command, sub-command options, option types, like what blobpain

lament mesa
compact harbor
slate swan
compact harbor
lament mesa
fast quest
# lament mesa ask your question
from discord.ext import commands
import random
import os
from asd import keep_alive

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

@client.event
async def on_ready():
  print("Decide your Destiny")

@client.command(aliases = ['8ball','8-ball',"decideDestiny", "8 ball"])
async def _8ball(ctx,*,question):
  responses = [ '> It is Certain.',
  '> It is decidedly so.',
  '> Without a doubt.',
  '> Yes definitely.',
  '> You may rely on it.',
  '> As I see it, yes.',
  '> Most likely.',
  '> Outlook good.',
  '> Yes.',
  '> Signs point to yes.',
  '> Reply hazy, try again.',
  '> Ask again later.',
  '> Better not tell you now.',
  '> Cannot predict now.',
  '> Concentrate and ask again.',
  "> Don't count on it.",
  '> My reply is no.',
  '> My sources say no.',
  '> Outlook not so good.',
  '> Very doubtful.']
  await ctx.reply(random.choice(responses))

  
@client.command(aliases = ['help8ball','h',"8ballhelp"])
async def embed(ctx):
    embed=discord.Embed(title="8Ball:8ball:", url= "", description="$ is the default prefix. $8 ball is the only runnable command for this bot now", color=discord.Color.red())
    await ctx.send(embed=embed)
@client.event
async def on_message(message):
  if message.content.startswith("!roll"):
        msg = message.content
        value = msg.split('!roll ', 1)[1]
        roll_value = int(value.split("d")[0])
        face_value = int(value.split("d")[1])
        slimit = 0
        roll_result = []
        while slimit < face_value:
            roll = random.randint(1, roll_value)
            slimit += 1
            roll_result.append(roll)
        embed = discord.Embed(title="Roll Results", description=f":game_die:{roll_result}:game_die:",color = discord.Color.red())
        await message.reply(embed=embed)
       
  
       
keep_alive()
my_secret = os.environ['secret']
client.run(my_secret) ```
hmm why is the 8ball one not working? ๐Ÿ˜ฆ
maiden fable
#

bro

#

WHAT THE FUCK

slate swan
maiden fable
#

wait nvm

slate swan
#

Thanks lemon_happy

maiden fable
#

Lucky Akshu

fast quest
maiden fable
#

I still got another year in this hell hole

compact harbor
slate swan
fast quest
#

bcoz of this

lament mesa
fast quest
#

yeah

maiden fable
#

I just need these intents hehe

slate swan
#

What is the function I should make http calls on startup to register app commands? In discord.Client class

#

Any idea rooThink

compact harbor
maiden fable
slate swan
#

Lol

lament mesa
compact harbor
lament mesa
slate swan
lament mesa
#

run_command

slate swan
#

Good Idea rooThink

#

run_command does not exist too blobpain

lament mesa
#

dpy has _run_event

#

_schedule_event

slate swan
#

That handles websocket and I don't feel like I should interfere with those for http requests... Maybe I'll just delay ready and add before that

lone flume
#

How do this?
Bot reply with the message

slate swan
#

!d discord.Message.reply

unkempt canyonBOT
#

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

A shortcut method to [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/stable/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send") to reply to the [`Message`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Message "discord.Message").

New in version 1.6.
lone flume
#

No no

maiden fable
#

GJ

lone flume
#

How dat?

maiden fable
#

ah

#

args of the command

lament mesa
lone flume
#

Example

compact harbor
maiden fable
# lone flume Code?
@bot.command()
async def shop(ctx, *, item):
    await ctx.send(ctx.author.mention, item)
lofty heron
#

hi, how can i make something catch an error for the error message

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

so far ii've tried

@client.event
async def on_command_error(ctx,error):
    if isinstance(error, commands.AttributeError, NoneType):
        await ctx.send("kekw you must be in a vc for this to work")

but it doesn't work

slate swan
lament mesa
#

๐Ÿ‘

shrewd barn
#

When I type bot.latency, It gives ping in Seconds, how can I translate to MS?

maiden fable
#

Multiply*

#

Haha all cool

shrewd barn
#

Ty

visual island
#

umm... did i do something?

lament mesa
#

remove intents=intesnts in super().__init__

#

intents is being passed in kwargs

visual island
#

still

lament mesa
river kindle
#

Guys I have a problem, my discord bot won't connect to the token with the API giving me this error:

ClientConnectorCertificateError: Unable to connect to host discord.com:443 ssl: True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] Certificate verification failed: Failed to get local issuer certificate (_ssl.c: 1129)') ]

fast quest
compact harbor
fast quest
#

can you share the link?

river kindle
#

who

compact harbor
visual island
#

class BotBase(commands.Bot):

lament mesa
fast quest
compact harbor
river kindle
#

why nobody help me

#

come on

compact harbor
#

What's the command here, lol

subtle glen
#

Guy!!!

#

how to wake the bot when we call them?

compact harbor
#

Bot will be offline in other time?

subtle glen
#

yeah like that

compact harbor
#

Not sure about that

subtle glen
#

idkยฏ_(ใƒ„)_/ยฏ

river kindle
#

Guys I have a problem, my discord bot won't connect to the token with the API giving me this error:

ClientConnectorCertificateError: Unable to connect to host discord.com:443 ssl: True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] Certificate verification failed: Failed to get local issuer certificate (_ssl.c: 1129)') ]

river kindle
#

how

compact harbor
#

Go to discord developer portal

river kindle
#

ok

#

and

compact harbor
#

Then go to applications

river kindle
#

ok

compact harbor
#

Then choose your bot, then go to oauth token section

river kindle
#

okok

slate swan
subtle glen
compact harbor
river kindle
#

the same*

compact harbor
#

Send your code

river kindle
#

the problem is the certificate

#

but i have downloaded the certificate

#

and not work

compact harbor
#

No ssl certs are required for making discord bots

#

Lol

river kindle
#

i know

river kindle
#

I've been exploding for 1 hour I've been researching research but nothing

compact harbor
#

Bots are meant to be secure always, those are handled by API client as it is

lofty heron
#

hi can somebody check why running this

@client.command()
async def youtube(ctx):
    link = await togetherControl.create_link(ctx.author.voice.channel.id, 'youtube', max_age=60)
    await ctx.send(f"click the link not the play button\n{link}")
    if ctx.author.voice == None:
        return await ctx.send('Join a VC')
Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "/opt/homebrew/lib/python3.9/site-packages/discord/ext/commands/core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/opt/homebrew/lib/python3.9/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: AttributeError: 'NoneType' object has no attribute 'channel'

if the author isn't in a voice channel?
is my homebrew lib just broken lol

#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'channel' this hmm thonk

compact harbor
#

Follow official docs

lofty heron
#

hmm ok tenks

eager harness
#
        embed.set_author(name = ctx.author.name, icon_url= ctx.author.avatar_url)
``` doesn't work, why is it?
eager harness
#

it doesn't send anything

spring flax
#

can you send the whole embed/command code

eager harness
#
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Member' object has no attribute 'avatar_url'
``` sorry this is the error
dusky robin
#

Why discord don't register my slash commands?

spring flax
eager harness
#

oh alr

#

thanks it worked

spring flax
compact harbor
#

And archieved

hasty iron
#

so what

#

itโ€™s still usable

upbeat otter
#

Guys, why is the error coming as, u have been temporarily disconnected because of exceeding rate-limit of discord API

noble nimbus
#

You probably ยซย spamย ยป the api with requests

upbeat otter
noble nimbus
#

Have you a loop or something in your bot ?

upbeat otter
#

not even a single one

noble nimbus
#

Hm and a command that edit a role/channel/other ?

#

That users could spam ?

upbeat otter
#

users use the bot in a limited way

upbeat otter
visual island
#

umm, how do i implement built-in dunder function to class (not instances) so like classmethod dunder function maybe?

#

should've ask in general...

nimble kayak
#
my message is not been recognised as a message object
@client.event
async def on_message(message):
  msg = message
  os.system("clear")
  os.system(f"echo {client.user}")
  print(msg.guild.id)
Error

Ignoring exception in on_message
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "main.py", line 55, in on_message
    print(msg.guild.id)
AttributeError: 'NoneType' object has no attribute 'id'

hasty iron
#

guild is None, which means the message was sent in dms

nimble kayak
#

let me check

nimble kayak
#

any possible way

hasty iron
#

if guild is None, it has been sent in dms

calm vortex
#

guild will be None

nimble kayak
#

like any conditions using if

slate swan
hasty iron
#

no, the dev app's id

#

select an application, General Information

#

and you should see Application ID

slate swan
#

Oh

#

But that's same as bot id?

#

Means I can just use the bot's ID for registering commands? rooThink

hasty iron
#

i dont think its the same as the bot's id

slate swan
#

Ah nvm bot has an application_id attr

hasty iron
#

i mean if it was the same anybody could add slash commands to your bot

slate swan
hasty iron
#

i dont think the bot's id is the same as client id

#

not sure though

slate swan
#

859446480687333436 and it's the ID I copied from context menu.. They'll are same rooThink

hasty iron
#

well whatever

slate swan
#

Thanks

hasty iron
slate swan
#

Lol Np blobpain

upbeat otter
#

Guys, when i assign a muted role to somebody, they can still type so what do i do?

hasty iron
#

change the role's permissions

upbeat otter
#

everything is toggled off

#

@hasty iron

spring flax
#

if you did it and they can still talk, it wasn't done correctly

upbeat otter
#

can i send a screenshot of the perms?

spring flax
#

send the code where you set the permissions

#

or did you do it manually through role settings?

upbeat otter
nimble kayak
#
code
@client.event
async def on_message(message):
  if message.guild == None:
    ctx = message.channel
    em = discord.Embed(title = f"Info", description = f"yaml\nI dont accept Dms\n", color = 0xffffff)
    em.add_field(name = "Invite Me", value = f"[Here]({invite_link})")
    em.timestamp = datetime.datetime.utcnow()
    em.set_footer(text = "Chatty - Stopping Bad Words", icon_url = client.user.avatar_url)
    await ctx.send(embed = em) 
error
It Just Dms Continiously How Can I make It Dm Just Once
upbeat otter
#
@client.command()
async def mute(ctx, member: discord.Member, reason=None):
  role = get(ctx.guild.roles, name="muted")
  guild = ctx.guild
  if role not in guild.roles:
    perms = discord.Permissions(send_messages=False, speak=False)
    await guild.create_role(name="muted", permissions=perms)
    await member.add_roles(role)
    await ctx.send(f"{member} has been muted!")
  else:
    await member.add_roles(role)
    await ctx.send(f"{member.display_name} has been muted!")

@client.command()
async def unmute(ctx, member: discord.Member, reason=None):
  role = get(ctx.guild.roles, name="muted")
  await member.remove_roles(role)
  await ctx.send(f"{member.display_name} has been unmuted!")

@spring flax

hasty iron
nimble kayak
# hasty iron add a check to see if the author is a bot using `message.author.bot` which retur...
@client.event
async def on_message(message):
  if message.guild == None:
    ctx = message.channel
    em = discord.Embed(title = f"Info", description = f"yaml\nI dont accept Dms\n", color = 0xffffff)
    em.add_field(name = "Invite Me", value = f"[Here]({invite_link})")
    em.timestamp = datetime.datetime.utcnow()
    em.set_footer(text = "Chatty - Stopping Bad Words", icon_url = client.user.avatar_url)
    await ctx.send(embed = em) 
  if message.author == client.user:
    return
  if message.author.bot:
    return
Still Same Error
upbeat otter
#

Anybody bothering to help me out?

chrome edge
#

they literally told you the answer

eager harness
#

for a discord button to work, it should always be in a class?

deep spade
#

Can I make a music bot that plays saved mp3 files?

#

In voice rooms

upbeat otter
chrome edge
#

what is

upbeat otter
upbeat otter
chrome edge
#

lol

echo crystal
#

Hey hello, which plan i need to select when i create an aws account

deep spade
upbeat otter
deep spade
#

Ok thamks guys

waxen granite
#

Are the shutting down d.py or no updates anymore?

spring flax
reef dock
#

just about to ask that cause i need to move over commands that require an arg to slash KEK

slate swan
#

how to check how much lines i have in a .txt file?

#

ok

#

ill try

#

works

#

thx

maiden fable
#

7408_shrekstare seems like I have become a bit too rusty

slate swan
#

๐Ÿงข

maiden fable
#

msg = await inter.send()
await msg.edit()

#

Yea

#

So is there a problem?

slate swan
#

content=

#

gotta give it the content kwarg

maiden fable
#

Ah yea

slate swan
#

otherwise it no work

maiden fable
#

Yes

gentle sedge
#

Impossible without using third party libs.

#

Discord.py will no longer update so there will be no slash commands.

#

Use third party libs

lofty heron
#
@client.command()
async def youtube(ctx):
    if ctx.author.voice == None:
        embed = discord.Embed(
            title="error",
            description="join a vc first",
            color=0xE02B2B
        )

hi this returns an error in the terminal, i'm not sure how to fix it and i'm kinda new to discord bots i don't really know what im doing with embeds

gentle sedge
#

Try to read the docs. I was not using this lib before so idk how it works.

lofty heron
#

sorry internet bit laggy

fast zenith
lofty heron
#

um no

#

that's it

#

oh i didn't paste in the last bit

#
@client.command()
async def youtube(ctx):
    if ctx.author.voice == None:
        embed = discord.Embed(
            title="oi what happened",
            description="you can't do this",
            color=0xE02B2B
        )
        await context.send(embed=embed)
fast zenith
#

there is your error...

#

await ctx.send(embed=embed) not await context.send(embed=embed)

lofty heron
#

hmmHD oof.

fast zenith
#

You have no variable called context

lofty heron
#

oh well thanks

dapper cobalt
#

It's now for support to any thing related to bot development in Python. (I think)

maiden fable
#

Yes

#

u r correct. This channel is more generalised now

dapper cobalt
#

Anyways, finally my damn paypal works. I'm getting my cyan name back.

#

Even better.

past ermine
#

What's the permission named to manage servers?

@commands.has_permissions(manage_server=True)
``` doesnt work for me


```py
Traceback (most recent call last):
  File "/home/pi/Downloads/bot/GelbieLevel/main2.py", line 98, in <module>
    @commands.has_permissions(manage_server=True)
  File "/usr/local/lib/python3.9/site-packages/discord/ext/commands/core.py", line 1779, in has_permissions
    raise TypeError('Invalid permission(s): %s' % (', '.join(invalid)))
TypeError: Invalid permission(s): manage_server
slate swan
#

manage_guild

ionic wadi
#

embed.add_field(name="Moderatie", value="!help moderatie", inline=False)
IndentationError: unexpected indent

#

@bot.group(invoke_without_command=True)
async def help(ctx):
embed = discord.Embed(title="Hoe kan ik je helpen!", description="Zie hieronder de modules!")
embed.add_field(name="Moderatie", value="!help moderatie", inline=False)
embed.add_field(name="Public", value="!help public", inline=False)
embed.add_field(name="Informatie", value="!help informatie", inline=False)
await ctx.send(embed=embed)

@help.command()
async def moderatie(ctx):
embed = discord.Embed(title="Moderatie commands", description="Zie hieronder de moderatie commands!")
embed.add_field(name="!warn <Gebruiker> <reden>", value="Persoon een waarschuwing geven.", inline=False)
await ctx.send(embed=embed)

maiden fable
#

u cannot. u can run a command or something

#

or use asyncio.run() or something

visual island
maiden fable
#

huh

#

is it?

visual island
#

it is

#

use loop.run_until_complete or create_task instead

visual island
#

!d discord.Client.get_user

unkempt canyonBOT
visual island
#

this requires intents.members btw

maiden fable
#

!intents

unkempt canyonBOT
#

Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default, discord.py has all intents enabled, except for the Members and Presences intents, which are needed for events such as on_member and to get members' statuses.

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

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

from discord import Intents
from discord.ext import commands

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

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

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

hoary gust
#

guys how to prevent users from using vpn

#

any way to prevent this

hardy yoke
lament mesa
#

you cant prevent it lol

hoary gust
#

but i want to know how to prevent users from using vpn

lament mesa
#

you cant

lone flume
#

Y does my bot send two messages when type a command?

zinc lion
#

Can someone please send an example where a bot detects a reaction, nothing is working for me

zinc lion
hoary gust
lament mesa
hardy yoke
# hoary gust how to prevent users from using vpn

You can't completely. You could theoretically check their IP against known VPN ranges but a) won't catch every vpn B) they could just disable it while they verify.
more effort than worth and a bit complex for this channel

lament mesa
#

there are a lot of vpn ips

hardy yoke
hardy yoke
#

lol

#

IRC is like discord but 20 years olde

hoary gust
#

how can i prevent them from using vpn any idea or any module

hardy yoke
hoary gust
#

@lament mesa is there any module that can make a simple website

#

just a simple one

lament mesa
hoary gust
lament mesa
#

or fastapi

lament mesa
hoary gust
#

@lament mesa any module for captcha

#

?

lament mesa
hoary gust
lament mesa
unkempt canyonBOT
#

A captcha library that generates audio and image CAPTCHAs.

hoary gust
gritty flame
#

ImportError: cannot import name '_UnionGenericAlias' from

#

bruh

willow vine
gritty flame
#

!d discord.Role.members

unkempt canyonBOT
willow vine
#

thats for 1 role

gritty flame
#

yep

willow vine
#

how do i get any number of roles passed as an argument

gritty flame
#

and what do you want

#

for roles in list:
return roles.members

willow vine
#

the user can enter any number of roles, it should fetch users having all those roles

#

^

gritty flame
#

[role.members for role in list]

#

returns a list of

coarse compass
#

you can create sets and then intersect them, it's a weird way to solve it but it should do the work

willow vine
gritty flame
#

im almost done with slash commands

slate swan
coarse compass
willow vine
#

:/

coarse compass
#

i am not very good at this command but i'm trying ๐Ÿ˜ฆ

#

!d set

unkempt canyonBOT
#
set

class set([iterable])``````py

class frozenset([iterable])```
Return a new set or frozenset object whose elements are taken from *iterable*. The elements of a set must be [hashable](https://docs.python.org/3.10/glossary.html#term-hashable). To represent sets of sets, the inner sets must be [`frozenset`](https://docs.python.org/3.10/library/stdtypes.html#frozenset "frozenset") objects. If *iterable* is not specified, a new empty set is returned.

Sets can be created by several means:

โ€ข Use a comma-separated list of elements within braces: `{'jack', 'sjoerd'}`

โ€ข Use a set comprehension: `{c for c in 'abracadabra' if c not in 'abc'}`

โ€ข Use the type constructor: `set()`, `set('foobar')`, `set(['a', 'b', 'foo'])`...
coarse compass
#

there you go

willow vine
#

Ohh

#

thanks I'll check it out

coarse compass
#

yep

willow vine
#

but can you also go through my code and find out where i went wrong

coarse compass
#

where is your code?

willow vine
#

because it really seems fine to me but doesn't work the way i want it to

#

i posted it on stack overflow

dapper cobalt
willow vine
gritty flame
#

what in the

dapper cobalt
gritty flame
#

anyone now my error?

willow vine
gritty flame
#

i mean the problem with my code

dapper cobalt
gritty flame
#

*roles

willow vine
gritty flame
#

!e

import asyncio

async def x(*idk):
print(idk)

loop = asyncio.get_event_looop()
loop.run_until_complete(x)

#

dam

willow vine
dapper cobalt
coarse compass
#

what does role.members return? List?

willow vine
willow vine
coarse compass
#

no, I mean datatype

willow vine
#

class

coarse compass
#

List or a custom class?

willow vine
coarse compass
#
@bot.command()
@commands.has_role('Admins')
async def find(ctx,*, name):
  guild=ctx.guild
  roles=name.split(",")
  role=get(guild.roles, name=roles[0])
  members=set(role.members)
  for role in roles[1:]:
    role = get(guild.roles, name=role.strip(" "))
    lm=set(role.members)
    members = members.intersection(lm)

        
  l=[f"{role.mention}" for role in members]   
  print(l)
willow vine
#

ohhh

#

i think it might work

#

let me try

coarse compass
#

okay

#

ping me

gritty flame
#

@coarse compass can u help!

#

sorry for the ping

coarse compass
#

it's okay

#

what is the problem

gritty flame
coarse compass
#

okay gimme a min

celest saddle
#

I want to make an event happening every 1th day of month. What is the best way to do it?

coarse compass
#

!d typing.Any

gritty flame
#

!d typing

unkempt canyonBOT
#

New in version 3.5.

Source code: Lib/typing.py

Note

The Python runtime does not enforce function and variable type annotations. They can be used by third party tools such as type checkers, IDEs, linters, etc.

This module provides runtime support for type hints as specified by PEP 484, PEP 526, PEP 544, PEP 586, PEP 589, PEP 591, PEP 612 and PEP 613. The most fundamental support consists of the types Any, Union, Tuple, Callable, TypeVar, and Generic. For full specification please see PEP 484. For a simplified introduction to type hints see PEP 483.

The function below takes and returns a string and is annotated as follows...

coarse compass
gritty flame
#

ok

hoary gust
#

guys how to update something in mongo

coarse compass
#

@hoary gust

willow vine
#

works like a charmmm thanks a lot!! @coarse compass ๐Ÿ˜„ ๐Ÿ˜„

gritty flame
#

bruhhh then how

coarse compass
coarse compass
willow vine
#

Using the datetime module

#

im not very sure though

coarse compass
#

yeah

coarse compass
celest saddle
gritty flame
#

@coarse compass

vagrant brook
#

I mean you can set up a task which checks for the time every minute

celest saddle
#

I don't think it's good to do sth like
while not datetime.now().day() == 1:
#do nothing
else:
#do my thing

hasty iron
#

you aren't supposed to

gritty flame
#

something

hasty iron
#

what is that something

vagrant brook
#

Just add some delay so it doesn't lag

gritty flame
#

slash

#

commands

hasty iron
#

slash?

#

what

gritty flame
#

slash commands

hasty iron
#

ok what does that have to with that class

coarse compass
gritty flame
hasty iron
#

what

#

just check Union?

coarse compass
#

@gritty flame sorry then my bad ๐Ÿ˜…

lone flume
#

Wht is the hex for white?

slate swan
#

Yo anynody know how to make a bot active all the time?

gritty flame
hasty iron
slate swan
celest saddle
slate swan
#

I know that i have to host it in a server

hasty iron
gritty flame
slate swan
#

But idk how

slate swan
hasty iron
upper egret
#

does anyone have any examples of a basic ping/pong bot implemented just with discord api (no wrapper)?

#

using websockets/http requests

slate swan
hasty iron
slate swan
gritty flame
#

alr

slate swan
#

Mann??

#

Anybody

#

How to make a bot inline 24 7

hasty iron
#

get a vps

lone flume
#

Color=0xFFF002
this is for gold
how do i find for uh white?

gritty flame
#

go search it up of google

hasty iron
#

uh

#

just look it up

gritty flame
hasty iron
#

oh wait no

lone flume
hasty iron
#

you have to do getattr(annotation, '__origin__') first

#

and then if whatever is Union:

serene lynx
#

why is this when deployed to heroku, it gets an error, even though when it's run locally it's okay

serene lynx
#
2021-08-29T13:01:13.573348+00:00 app[worker.1]: The above exception was the direct cause of the following exception:
2021-08-29T13:01:13.573349+00:00 app[worker.1]: 
2021-08-29T13:01:13.573356+00:00 app[worker.1]: Traceback (most recent call last):
2021-08-29T13:01:13.573363+00:00 app[worker.1]:   File "/app/adit.py", line 270, in <module>
2021-08-29T13:01:13.573453+00:00 app[worker.1]:     bot.load_extension(f'cogs.{filename[:-3]}')
2021-08-29T13:01:13.573460+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 678, in load_extension
2021-08-29T13:01:13.573619+00:00 app[worker.1]:     self._load_from_module_spec(spec, name)
2021-08-29T13:01:13.573626+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 609, in _load_from_module_spec
2021-08-29T13:01:13.573774+00:00 app[worker.1]:     raise errors.ExtensionFailed(key, e) from e
2021-08-29T13:01:13.573802+00:00 app[worker.1]: discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.remove' raised an error: ExtensionFailed: Extension 'cogs.love' raised an error: OSError: cannot open resource
2021-08-29T13:01:13.763731+00:00 heroku[worker.1]: Process exited with status 1
2021-08-29T13:01:13.950720+00:00 heroku[worker.1]: State changed from up to crashed```
hasty iron
lone flume
unkempt canyonBOT
#

Hey @serene lynx!

Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:

โ€ข If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)

โ€ข If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:

https://paste.pythondiscord.com

serene lynx
#
@commands.command()
    async def love(self, ctx, user1: discord.Member, user2: discord.Member):
        if user1 == user2:
            await ctx.send('user1 and user2 must be different')

        else:
            love_image = Image.open('imglove.jpg')
            asset = user1.avatar_url_as(size=128)
            asset2 = user2.avatar_url_as(size=128)
            data = BytesIO(await asset.read())
            data2 = BytesIO(await asset2.read())
            pfp = Image.open(data)
            pfp2 = Image.open(data2)
            pfp = pfp.resize((177, 177))
            pfp2 = pfp2.resize((177, 177))
            love_image.paste(pfp, (282, 264))
            love_image.paste(pfp2, (794, 264))
            draw = ImageDraw.Draw(love_image)
            text1 = f'{user1}'
            text2 = f'{user2}'
            acak = random.randint(1, 100)
            hasil1 = ''
            hasil2 = ''
            hasil3 = ''
            hasil4 = ''
            if acak == 100:
                hasil1 = f'{acak}%'
                hasil2 = 'Sempurna'

            elif acak <= 33:
                hasil1 = f'{acak}%'
                hasil2 = 'Maaf kamu kurang beruntung'

            elif acak > 33 and acak <= 50:
                hasil1 = f'{acak}%'
                hasil2 = 'lumayan cocok'

            elif acak > 50:
                hasil1 = f'{acak}%'
                hasil2 = 'cocok banget'
            draw.text((281, 468), text1, (0, 0, 0), font=self.font)
            draw.text((794, 466), text2, (0, 0, 0), font=self.font)
            draw.text((606, 329), hasil1, (0, 0, 0), font=self.font)
            draw.text((515, 358), hasil2, (0, 0, 0), font=self.font)

            love_image.save('profile.jpg')
            try:
                await ctx.send(file=discord.File('profile.jpg'))

            except Exception as e:
                e = sys.exc_info()
                print(e)```
strong niche
#

Hey

strong niche
#

what am i doing wrong i cant figure it out

celest saddle
#

async def love(self I like this part

slate swan
#

when i place the order its tell me an error message on my bot

@bot.command('wanted')
async def wanted(ctx, member: discord.Member = None):
    if member == None:
        member = ctx.author

    wanted = Image.open("wanted.jpg")

    asset = member.avatar_url_as(size = 128)
    data = BytesIO(await asset.read())
    profilepic = Image.open(data)

    profilepic= profilepic.resize((597, 720))

    wanted.paste(profilepic, (339, 570))

    wanted.save("wanted1.jpg")
hasty iron
gritty flame
#

my slash commands finally work!!

#

been 2 days

slate swan
#

help

#

pls

gritty flame
#

show the error

#

how do you expect us to help you

slate swan
#

"The command is unknown."

#

rip

gritty flame
#

did u make sure to save after editing

slate swan
#

yes

#

and i reload the bot

#

idk what's going on

soft trout
#

dislash i think

unkempt canyonBOT
crystal kestrel
soft trout
#

but it is good

crystal kestrel
#

ppl who built their bots on discord.Client (not using a "template" like commands.Bot) can't even use it lol

soft trout
#

ok ok

slate swan
#
@client.command()
async def bt(ctx):
    print("bt command send")
    await ctx.send(
        "This is a Button!",
        componets=[
            Button(label='Click Me!')
        ]
    )
    interaction = await client.wait_for("button_click", check=lambda i: i.component.label.startswith("Click"))
    await interaction.respond(content="Button Clicked!")
#

why dont work me?

ionic wadi
#

File "/home/container/bot.py", line 153
async def help(ctx):
^
SyntaxError: invalid syntax

#
async def help(ctx):
    embed = discord.Embed(title="Hoe kan ik je helpen!", description="Zie hieronder de modules!")  
    embed.add_field(name="Moderatie", value="!moderatie", inline=False)
    embed.add_field(name="Public", value="!public", inline=False)
    embed.add_field(name="Informatie", value="!informatie", inline=False)
    await ctx.send(embed=embed)```
slate swan
#

!codeblock

ionic wadi
#

Nvm, It was because there was a ) missing at the command above.

slate swan
#
@client.command()
async def bt(ctx):
    print("bt command send")
    await ctx.send(
        "This is a Button!",
        componets=[
            Button(label='Click Me!')
        ]
    )
    interaction = await client.wait_for("button_click", check=lambda i: i.component.label.startswith("Click"))
    await interaction.respond(content="Button Clicked!")

why this no work for me?

dapper cobalt
#

You missed a n.

wintry hare
#

You are rate limited

dapper cobalt
#

All I can tell you is it's not preferable to code Discord bots on repl.it. There's always a high chance it gets blocked and rate limited from the API since you have multiple other people hosting their bots on the same IP as you are hosting your bot.

slate swan
dapper cobalt
slate swan
fresh kestrel
#

realistically, is someone going to take over dpy? or is it dead?

dapper cobalt
dapper cobalt
hardy yoke
#

type kill 1 in the repl shell, it'll sometimes throw you on a new IP
this will happen every now and then on repl

fresh kestrel
hardy yoke
dapper cobalt
fresh kestrel
slate swan
slate swan
lament mesa
#

they prob wont do that

fresh kestrel
slate swan
#

Just wait or use another, there are loads of libs still in existence. Or change the programming language

fresh kestrel
#

the first part i donโ€™t understand

slate swan
#

Use hikari, it'll be developed soon completely

dapper cobalt
#

!d discord.AuditLogAction.member_disconnect

unkempt canyonBOT
#

A memberโ€™s voice state has changed. This triggers when a member is force disconnected from voice.

When this is the action, the type of extra is set to an unspecified proxy object with one attribute:

โ€ข count: An integer specifying how many members were disconnected.

New in version 1.3.

slate swan
signal spire
#

what's the difference between this:

@client.event
async def on_message(message):
	if (message.content.startswith('!ping')):
		message = await message.channel.send('pong!')
``` and this:
```py
@client.command()
async def ping(ctx):
    await ctx.send("pong!")
lament mesa
dapper cobalt
#

I'm not very sure then.

lament mesa
#

the output is the same

dapper cobalt
lament mesa
#

oh, the output is the same

slate swan
#

It'll look messy

#

Use command

dapper cobalt
signal spire
dapper cobalt
#

I believe you missed the type attribute.

stark bobcat
#

Hoi

slate swan
#

you can use command they are simple and not messy

#

What are you gonna do if a command requires a argument??

dapper cobalt
slate swan
#

what if he want to mention a member?

dapper cobalt
#

!d discord.Message.mentions

unkempt canyonBOT
#

A list of Member that were mentioned. If the message is in a private message then the list will be of User instead. For messages that are not of type MessageType.default, this array can be used to aid in system messages. For more information, see system_content.

Warning

The order of the mentions list is not in any particular order so you should not rely on it. This is a Discord limitation, not one with the library.

signal spire
slate swan
#

if you think on_message events are good for making a command go ahead good luck

#

why dont work if i click again

slate swan
dapper cobalt
dapper cobalt
dapper cobalt
slate swan
signal spire
slate swan
#
    interaction = await client.wait_for("button_click", check=lambda i: i.component.label.startswith("Click"))
dapper cobalt
# slate swan Can it be changed?

I believe that package allows you to have an on_button_click event. So you can have

@client.event
async def on_button_click(interaction)
signal spire
#

it's how I mention

slate swan
#

go ahead if you want to use on_message go ahead

dapper cobalt
unkempt canyonBOT
#
Noooooo!!

No documentation found for the requested symbol.

vagrant brook
#

!d discord.Member.mention

unkempt canyonBOT
zinc lion
#

please can someone give me an example of on raw reaction add

slate swan
dapper cobalt
unkempt canyonBOT
#

discord.on_raw_reaction_add(payload)```
Called when a message has a reaction added. Unlike [`on_reaction_add()`](https://discordpy.readthedocs.io/en/stable/api.html#discord.on_reaction_add "discord.on_reaction_add"), this is called regardless of the state of the internal message cache.

This requires [`Intents.reactions`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Intents.reactions "discord.Intents.reactions") to be enabled.
zinc lion
#

!d discord.on_reaction_add

unkempt canyonBOT
#

discord.on_reaction_add(reaction, user)```
Called when a message has a reaction added to it. Similar to [`on_message_edit()`](https://discordpy.readthedocs.io/en/stable/api.html#discord.on_message_edit "discord.on_message_edit"), if the message is not found in the internal message cache, then this event will not be called. Consider using [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/stable/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") instead.

Note

To get the [`Message`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Message "discord.Message") being reacted, access it via [`Reaction.message`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Reaction.message "discord.Reaction.message").

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

Note

This doesnโ€™t require [`Intents.members`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Intents.members "discord.Intents.members") within a guild context, but due to Discord not providing updated user information in a direct message itโ€™s required for direct messages to receive this event. Consider using [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/stable/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") if you need this and do not otherwise want to enable the members intent.
zinc lion
#

which should i use i dont understand

muted vessel
#

anyone care with AI

fickle turret
zinc lion
#

can i have a stackoverflow or smth pls

#

for explanation @fickle turret

gritty flame
#

!d discord.on_command

unkempt canyonBOT
#

discord.on_command(ctx)```
An event that is called when a command is found and is about to be invoked.

This event is called regardless of whether the command itself succeeds via error or completes.
hybrid fjord
#
@client.command()
async def call(ctx, user:discord.Member):
  if ctx.author.voice == None:
    await ctx.author.send(embed=discord.Embed(description=f"Hold on! You cannot call someone if you aren't in a voice channel!", color=0x004cff,timestamp=ctx.message.created_at))

  if ctx.author.voice != None:
    embed=discord.Embed(description=f"![telephone](https://cdn.discordapp.com/emojis/857699114861985812.webp?size=128 "telephone") **{ctx.author.display_name}** is calling **{user.display_name}** in frequency:\n`{ctx.author.voice.channel}`", color=0x004cff,timestamp=ctx.message.created_at)
    embed.set_author(name=f"@{ctx.author.display_name}", icon_url=ctx.author.avatar_url)
    await buttons.send(
    content=f"{user.mention}",
    embed=embed,
    channel=ctx.channel.id,
    components=[
      ActionRow([
        Button(
          label="Join Call",
          style=ButtonType().Success,
          custom_id="callCommand"
        )
      ])
    ]
  )
@buttons.click
async def callCommand(ctx):
  print(f"called {ctx.message}")```
I'm trying to make it so when someone "calls" you, a button pops up that says "Join Call" and when you press it, it moves you to the VC of the command executor's voice channel. How would I go about doing that?
Right now the button works but I don't know how to get the voice channel of the person who ran the command.
craggy cloak
#

How to fix this?

hybrid fjord
#

We need the code.

maiden fable
#

Yes

craggy cloak
zinc reef
kindred epoch
hybrid fjord
#

lol

#

int(value)
float(value)

hybrid fjord
zinc reef
stiff nexus
#
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/jishaku/features/python.py", line 145, in jsk_python
    async for send, result in AsyncSender(executor):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/jishaku/functools.py", line 109, in _internal
    value = await base.asend(self.send_value)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/jishaku/repl/compilation.py", line 140, in traverse
    async for send, result in AsyncSender(func(*self.args)):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/jishaku/functools.py", line 109, in _internal
    value = await base.asend(self.send_value)
  File "<repl>", line 5, in _repl_coroutine
    if last_boost.premium_since is not None:
UnboundLocalError: local variable 'last_boost' referenced before assignment
if ctx.guild.premium_tier != 0:
  boosts = f'Level {ctx.guild.premium_tier}\n{ctx.guild.premium_subscription_count} boosts'
  last_boost = max(ctx.guild.members, key=lambda m: m.premium_since or ctx.guild.created_at)
if last_boost.premium_since is not None:
  boosts = f'{boosts}\nLast Boost: {last_boost} ({discord.utils.format_dt(last_boost.premium_since, style = "F")})'
await ctx.send(boosts)

help??? this came when the guild had 0 boost how do i not get the error?

kindred epoch
kindred epoch
#

wdym how

#

try sending it if it fails send something else

gritty flame
#

i'm finally finished with slash implementation

kindred epoch
#

nice

gritty flame
#

so now just intents which wont be coming kinda soon

high flame
#

interesting

gritty flame
high flame
#

css without html sus

gritty flame
high flame
#

can you show me in browser?

gritty flame
#

ok brb

high flame
#

waiting

gritty flame
#

@high flame

high flame
#

nice

boreal ravine
#

@hybrid fjord No spoonfeeding

gritty flame
#

i didnt work on it for a week andi dont plan on working on it for a while

high flame
#

im shit in frontend

gritty flame
#

ah

hybrid fjord
boreal ravine
cloud dawn
#

Makes site that looks decent, Looks good :D
Opens it in mobile view :(

hybrid fjord
#

thats not spoonfeeding..

gritty flame
#

im gonna make a whole new website this is just to learn some css

#

and html

cloud dawn
#

how to center a div

high flame
#

lel

cloud dawn
#

I needed to code websites for a year, it was a pain but i did learn from it :)

high flame
#

open source?

#

i want to see