#discord-bots

1 messages · Page 569 of 1

tough wagon
#

the onlys way that is possible is messages are empty, or you dont have message intents enabled

#

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

slate swan
tough wagon
#

or your bot is broken

#

nothing can help you

slate swan
#
intents = Intents.all()
bot = commands.Bot(command_prefix="!", intents=intents)
#

maybe it's the d.py versions? i'm using master

slate swan
tough wagon
#

and me2 using history

#

(if you mean master is 2.0)

maiden fable
#

@slate swan what happened?

spiral frigate
#
Ignoring exception in command очистить:
Traceback (most recent call last):
  File "C:\Users\Baraban4ik\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\ext\commands\converter.py", line 1085, in _actual_conversion
    return converter(argument)
ValueError: invalid literal for int() with base 10: 'fgjgh'

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

Traceback (most recent call last):
  File "C:\Users\Baraban4ik\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\ext\commands\bot.py", line 995, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\Baraban4ik\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 887, in invoke
    await self.prepare(ctx)
  File "C:\Users\Baraban4ik\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 821, in prepare
    await self._parse_arguments(ctx)
  File "C:\Users\Baraban4ik\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 727, in _parse_arguments
    transformed = await self.transform(ctx, param)
  File "C:\Users\Baraban4ik\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 579, in transform
    return await run_converters(ctx, converter, argument, param)  # type: ignore
  File "C:\Users\Baraban4ik\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\ext\commands\converter.py", line 1182, in run_converters
    return await _actual_conversion(ctx, converter, argument, param)
  File "C:\Users\Baraban4ik\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\ext\commands\converter.py", line 1094, in _actual_conversion
    raise BadArgument(f'Converting to "{name}" failed for parameter "{param.name}".') from exc
nextcord.ext.commands.errors.BadArgument: Converting to "int" failed for parameter "amount".
#

How to check if a person wrote some text to him or wrote something

#

Code

import nextcord as discord
from nextcord.ext import commands


class Utilities(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
    
#----------очистить----------#

    @commands.command(name= "очистить")
    async def clear(self, ctx, amount:int = 0):
        if amount == 0 or amount >= 100:
            embed = discord.Embed (
                title = 'Команда `s~очистить`',
                description = 'Команда `s~очистить` очистить какое-то количество сообщений \n в данном канале. Не забудь что я могу очистить 100 сообщений за раз, а также \n очень древние сообщения я не смогу удалить.',
                colour = 0x694c5f
            )
            embed.add_field(name= "Использование:", value= "> `s~очистить` `(Количество)`", inline= False)
            embed.add_field(name= "Параметры:", value= ">>> <> - Необязательный параметр \n () - Обязательный параметр", inline= False)
            embed.add_field(name= "Пример:", value= ">>> `s~очистить` `100` \n ⮩ Очистит 100 сообщений", inline= False)

            await ctx.reply(embed = embed)
        else:
            await ctx.channel.purge(limit= amount)
            embed = discord.Embed (
                description = f':white_check_mark: Удаленно `{amount}` сообщений',
                colour = 0x694c5f
            )
            
            await ctx.send(embed = embed,)

#---------------------------#

def setup(bot):
    bot.add_cog(Utilities(bot))
    print("Ког Utilities роботает")
```]
#

yes

maiden fable
#

!rule 4

unkempt canyonBOT
#

4. Use English to the best of your ability. Be polite if someone speaks English imperfectly.

spiral frigate
tough wagon
#

@clear.error

maiden fable
#

Thanks

spiral frigate
spiral frigate
#

Let's go to the bos

tough wagon
#

bos?

spiral frigate
#

ls

tough wagon
#

i dont understand you sry..

slate swan
maiden fable
slate swan
#
            if utils.get(ctx.guild.text_channels, name="mod-logs"):
                print("before")
                channel = utils.get(ctx.guild.text_channels, name="mod-logs")
                print(type(channel))
                for message in channel.history:
                    print(type(message.content))
                    print(message.content)
            else:
                print("not working")
maiden fable
#

Ah

#

!d discord.TextChannel.history

unkempt canyonBOT
#

async for ... in history(*, limit=100, before=None, after=None, around=None, oldest_first=None)```
Returns an [`AsyncIterator`](https://discordpy.readthedocs.io/en/master/api.html#discord.AsyncIterator "discord.AsyncIterator") that enables receiving the destination’s message history.

You must have [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permissions to use this.

Examples

Usage...
maiden fable
#

It's AsyncIterator

#

See the example? Lol

slate swan
#

ahh I see lemme try that

maiden fable
#

async for msg in channel.history()....

slate swan
#

message.content returns a type of str

maiden fable
#

Yea

slate swan
#

but it doesn't print anything when i print it

maiden fable
#

Code

slate swan
#
            if utils.get(ctx.guild.text_channels, name="mod-logs"):
                print("before")
                channel = utils.get(ctx.guild.text_channels, name="mod-logs")
                print(type(channel))
                async for message in channel.history(limit=None):
                    print(type(message.content))
                    print(message.content)
            else:
                print("not working")
        else
maiden fable
#

Weird...

#

What does type(message.content) prints

slate swan
#

<class 'str'>

#

and it prints that multiple times

maiden fable
#

Hmm

slate swan
#

assuming the amount of every message in the channel

maiden fable
#

That means it's getting the messages

#

Yes

slate swan
#

but why wont it print the content?

maiden fable
#

I don't really know tbh...

#

Can I see the output

river kindle
#

I mean guys I'm creating a translation command for my bot, here the code:

async def translate (ctx, lang_to, * args):
  lang_to = lang_to.lower ()
  if lang_to not in googletrans.LANGUAGES and lang_to not in googletrans.LANGCODES:
    raise commands.BadArgument ("This language does not exist.")

  text = '' .join (args)
  translator = googletrans.Translator ()
  text_translated = translator.translate (text, dest = lang_to) .text
  await ctx.send (text_translated)``

My problem:
    raise TypeError ("Aliases of a command must be a list or a tuple of strings.")
TypeError: Aliases of a command must be a list or a tuple of strings.

(I tried to do what it said, but it gives the same error.)
slate swan
#
876189455592062978
before
<class 'discord.channel.TextChannel'>
<class 'str'>

<class 'str'>

<class 'str'>

<class 'str'>

<class 'str'>

<class 'str'>

maiden fable
#

Wait, enable the Message intent from discord dev portal

slate swan
#

It is enabled

#

oh wtf

#

it isn't

#

my bad

maiden fable
#

Haha

tough wagon
#

...........................................

#

i said it to him
he: it is enabled!

#

hate my life

slate swan
#

still wont work

#






output ^^ empty lines

maiden fable
#

U gotta enable it from Discord Dev portal

maiden fable
slate swan
#

wdym

#
            if utils.get(ctx.guild.text_channels, name="mod-logs"):
                channel = utils.get(ctx.guild.text_channels, name="mod-logs")
                async for message in channel.history(limit=None):
                    print(message.content)
            else:
                print("not working")
#

this is the code, this should work right

maiden fable
#

Yups it should

slate swan
#

it prints empty lines even after i enabled this thing

maiden fable
#

try using another library since discord.py doesn't work anymore, ig....?

slate swan
#

wdym

maiden fable
#

It's stopped being maintained lol

slate swan
#

lol what

maiden fable
#

Yea

slate swan
#

but why does the code work for u and not me

maiden fable
#

Danny doesn't update it anymore

maiden fable
slate swan
#

danny not the daddy anymore.

maiden fable
#

Lmao

tough wagon
tough wagon
#

im using dpy and all is working

#

and not goind to switch cus it is easier to update it by myself

maiden fable
slate swan
#
@bot.command()
async def info(ctx, member:discord.Member=None):
    if member == None:
        member = ctx.author

    embed=discord.Embed(title="Cursex", description="**Identifitcation Card**", color = 0x5865f2)
    embed.add_field(name="User's name:", value=f"{member.name}", inline=False)
    embed.add_field(name="User's tag:", value=f"{member.discriminator}", inline=False)
    embed.add_field(name="User's ID:", value=f"{member.id}", inline=False) 
    embed.add_field(name="Guild creation date:", value=f"{ctx.guild.created_at.strftime('%A, %B %d %Y @ %H:%M:%S %p')}", inline=False)
    embed.add_field(name="Account creation date:", value=f"{member.created_at_strftime('%A, %B %d %Y @ %H:%M:%S %p')}", inline=False)
    await ctx.send(embed=embed)
``` how do i make an "account creation date" thing
maiden fable
unkempt canyonBOT
#

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

ok

magic stump
#

oke

#

channel = guild.get_channel(828011225292079124)
NameError: name 'guild' is not defined

tough wagon
#

member.guild

icy mango
#
@client.command()
@commands.has_role("Report Managers")
async def report_taken(ctx, message_id : discord.Message.id) :

how do i check if message_id author is the bot

tough wagon
#

fetch message, then check (message.author.bot)

icy mango
tough wagon
#

no

icy mango
#

den?

#

um

tough wagon
#

!d discord.TextChannel.fetch_message

unkempt canyonBOT
#

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

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

so how to do it

#

wait

#
@client.command()
@commands.has_role("Report Managers")
async def report_taken(ctx, message_id : discord.Message.id) :
  the_message = await fetch_message(id)
#

like dat?

tough wagon
#

no

#

channel.fetch_message

#

idk from where to get channel

#

you can walk through all channels on the server

icy mango
# tough wagon `channel.`fetch_message

so

@client.command()
@commands.has_role("Report Managers")
async def report_taken(ctx, message_id : discord.Message.id) :
  channel = client.get_channel(help_log)
  the_message = await channel.fetch_message(id)
#

like dat?

tough wagon
#

yes

icy mango
#

thank you

kind radish
icy mango
#
@client.command()
@commands.has_role("Report Managers")
async def report_taken(ctx, message_id : discord.Message.id) :
    if message_id is None :
        await ctx.send("Syntax : er!report_taken <message_id>")
    
    else :
        help_log = client.get_channel(help_log_channel)
        report_message = await help_log.fetch_message(id)

        if report_message.author is      
#

i want to do if report_message.author is the bot how do i do it

kind radish
tough wagon
icy mango
#

will it continue or stop

tough wagon
tardy lagoon
#

yo what lib u guys use?

inner pumice
#

how do I store every time the bot is ready in a json/txt file?

tough wagon
icy mango
tardy lagoon
#

dis.py isn't maintained anymore

inner pumice
icy mango
#

i want it is only the bot which is the mine bot

tough wagon
inner pumice
#

you can still use it

icy mango
tough wagon
tardy lagoon
icy mango
tardy lagoon
#

whats a good lib for menus and buttons

inner pumice
#

literally

#

thats what its called

tardy lagoon
#

wdym

icy mango
#

it has buttons

#

not sure about menus

tardy lagoon
#

not dis py

#

not using dis py

tough wagon
tardy lagoon
#

but it isn't maintained is it

tough wagon
icy mango
tardy lagoon
#

ye

icy mango
#

py or next

tardy lagoon
#

next

slate swan
icy mango
#

i dont know about next

spiral frigate
#

who knows how to find out how many messages the bot has deleted

slate swan
#

new lib?

tardy lagoon
#

if snake is better then I'll switch to it

icy mango
#

but discord_components work on pycord

tardy lagoon
#

how about snake?

icy mango
#

i guess nextcord has its own command for buttons

icy mango
#

new fork?

tardy lagoon
#

disnake?

icy mango
#

not heard its name

slate swan
#

yo is there a new lib coming? what about discord.py? im not caught up with the stuff

tardy lagoon
#

discordpy is discontinued

slate swan
#

aw man

icy mango
#

means no update

slate swan
#

f

tardy lagoon
#

gotta migrate

icy mango
#

like pycord and nextcord

slate swan
#

what lib will replace dpy

tardy lagoon
#

nextcord is easy to switch to

slate swan
#

oh i see

icy mango
tough wagon
#

discord.py is NO LONGER UPDATED
You can still use discord.py, but with the next updates to the discord application, you will have to update this library yourself.

discord.py is working like this:
Request to Discord API (https://discord.com/developers/docs/interactions/application-commands)
Parse json output (https://docs.python.org/3/library/json.html)
(Requests: https://docs.python-requests.org/en/latest/)

Or you can use it's forks/unofficial parties
Such as pycord, nextcord and other...

Discord Developer Portal

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

icy mango
slate swan
#

damn

icy mango
#

you don thave to change discord to nextcord

slate swan
icy mango
#

just uninstall discord then install py-cord no need to change the discord to nextcord

tardy lagoon
#

oh

#

pycord support dislash?

icy mango
tardy lagoon
#

hmmm nice

slate swan
#

imma go google and search up stuff ;-;. This is getting confusng

icy mango
#

but i dont know how to use em thats why i am using discord_components

tardy lagoon
#

ill change nextcord to discord again

#

ugh

tardy lagoon
#

niceee

icy mango
tardy lagoon
#

it

icy mango
#

yup

#

discord_components is working on pycord

slate swan
#

so what forks you guys prefer

icy mango
tardy lagoon
#

i will switch to pycord rn

icy mango
tardy lagoon
#

?

icy mango
#

wait

slate swan
#

i see, ill try all the forks. and choose whats better

icy mango
#

dming

slate swan
#

What makes pycord good?

tough wagon
icy mango
#

just uninstall dpy and install pycord

undone wyvern
tough wagon
#

yes?

#

uh ye

slate swan
#

oh you mean progress of the bot?

river kindle
#

hi guys, I'm creating a translation command, here the code:

async def translate (ctx, lang_to, * args):
  lang_to = lang_to.lower ()
  if lang_to not in googletrans.LANGUAGES and lang_to not in googletrans.LANGCODES:
    raise commands.BadArgument ("This language does not exist.")

  text = '' .join (args)
  translator = googletrans.Translator ()
  text_translated = translator.translate (text, dest = lang_to) .text
  await ctx.send (text_translated)

My mistake:
Command raised an exception: AttributeError: 'NoneType' object has no attribute 'group'

icy mango
#

and now as discord.py is dead you are migrating to pycord

#

now when you migrate to pycord you dont need to change the code

slate swan
#

i see

spiral frigate
#
Traceback (most recent call last):
  File "C:\Users\Baraban4ik\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 606, in _load_from_module_spec
    spec.loader.exec_module(lib)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "O:\Suzuki\cogs\info.py", line 6, in <module>
    class Info(commands.Cog):
  File "O:\Suzuki\cogs\info.py", line 11, in Info
    @bot.slash_command(name= "тян", guild_ids=[894452684072046652])
NameError: name 'bot' is not defined

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

Traceback (most recent call last):
  File "O:\Suzuki\bot.py", line 51, in <module>
    bot.load_extension(f"cogs.{filename[:-3]}")
  File "C:\Users\Baraban4ik\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 678, in load_extension
    self._load_from_module_spec(spec, name)
  File "C:\Users\Baraban4ik\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 609, in _load_from_module_spec
    raise errors.ExtensionFailed(key, e) from e
discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.info' raised an error: NameError: name 'bot' is not defined
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x000001AFBA4DD780>
slate swan
#

no problem for me tho

icy mango
#

just pip uninstall discord and piiip install pycord and thats it

spiral frigate
#

code

import random
import discord
from discord.ext import commands
import datetime as DT
from discord.ext.commands.errors import MemberNotFound
class Info(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

#-----------тян-----------#
    @bot.slash_command(name= "тян", guild_ids=[894452684072046652])
    @commands.command(name= "тян")
    async def than(self, ctx):

        ping = round(self.bot.latency * 1000)

        embed = discord.Embed(
            title = 'Кто я?',
            description = 'Я не большой бот, зовут меня **Сузуки**, надеюсь запомните.\nКак и все боты в моём стиле я `Тянка`. Ладно что-то я отвлеклась.\n\nЧто я могу? Ну в принципе как все боты я имею команды, для:\n`Модерации`, `Веселья`, `Получения информации`.\n\nНу на этом пока всё. Мой `Семпай` трудится и делает меня \n`Лучше`, `Красивее` и `Продвинутой`.',
            colour = 0x694c5f
        )    
        embed.add_field(name= 'Имя:', value= '>>> `Сузуки`')
        embed.add_field(name= 'Создатель:', value= '>>> `Барабан4ик#3148`')
        embed.add_field(name= 'Пинг:', value= f'>>> `{ping} мс`')

        

        embed.set_footer(text= 'Барабан4ик © 2021 Все права у тянок', icon_url= 'https://cdn.discordapp.com/avatars/637685929611493422/32b105aa2097b6a3a84b2cda2f7b8e00.png?size=128')

        await ctx.reply(embed = embed)
slate swan
#

i dont have a discord bot being continued

icy mango
#

while if you use nextcord you have to change all discord keywords to nextcord

icy mango
tough wagon
slate swan
#

also you dont use the same function for normal and slash cmds

spiral frigate
#

and how

slate swan
#

what library are you using?

spiral frigate
#

I forgot to remove

spiral frigate
slate swan
#

ah idk why you imported discord

tough wagon
slate swan
#

sorry for being dumb but this used to be normal and now i just came back to discord bots and this is getting confusing.

#

i better leave

slate swan
#

is the pycord docs not updated or something?

#

i miss dpy, even though i just got to know that it is discontinued

#

mhm same , i shifted to a non-fork library now

#

oo, what is that library

#

hikari

#

!pypi hikari

unkempt canyonBOT
slate swan
#

brb gonna try that

#

sure

slate swan
#

oo

#

interesting

kind radish
#

I am trying to see if mentioned member has afk role
and send a msg then
but bot sends msg only if the author mentions himself
am i doing something wrong?
sorry i am new

    async def on_message(self, message):
        role = message.guild.get_role(self.afk)
        if message.author != self.bot.user:
            for member in message.guild.members:
                if role in member.roles:
                    if member.mention in message.content.lower():
                        await message.channel.send(f"user is afk")
                    if member.id == message.author.id:
                        await member.remove_roles(role)
                        await message.channel.send(f"you are not afk anymore")

Thank you

tawdry perch
#

hikari has a same syntax?

boreal ravine
#

it doesnt

slate swan
#

So like hikari has all the new features right?

tawdry perch
#

well then I can't switch to it (or want to)

boreal ravine
#

hikari is shit

slate swan
#

ah i just want a good library

tough wagon
#

lemao what's going on

boreal ravine
#

last commit 4 days ago

#

its getting dead

tawdry perch
boreal ravine
#

¯_(ツ)_/¯

slate swan
#

A

tough wagon
#

brrr never will use it

tawdry perch
slate swan
# boreal ravine pain

bro thats raw hikari , there are extnesions like lightbulb ( similar to ext.commands for dpy)

boreal ravine
#

edpy, hikari is cringe

tough wagon
#

dies from cringe

slate swan
#

@boreal ravine do u use a non-fork lib?

boreal ravine
slate swan
#

what is that fork

slate swan
boreal ravine
slate swan
#

disnake is dope

boreal ravine
#

latest version got autocomplete

slate swan
#

sheesh

boreal ravine
#

I think the owner of edpy hates py-cord for some reason

slate swan
#

lmao

boreal ravine
#

¯_(ツ)_/¯

slate swan
#

thanks guys, ill try all the libraries and choose whats good

boreal ravine
#

👍

slate swan
#

if you guys can suggest me more id be happy

slate swan
boreal ravine
#

pog

slate swan
#

alr

tawdry perch
#

The image above it seems different

slate swan
#

some guy was suggesting pycord ill try both

slate swan
tough wagon
#

where/how to install?

slate swan
#

hello does anyone knows how to make a discord modmail

boreal ravine
boreal ravine
slate swan
tough wagon
boreal ravine
#

^ depends

tawdry perch
boreal ravine
#

same

slate swan
tawdry perch
#

Can I help no

tough wagon
slate swan
dusk dust
#

can i create a channel in specific category?

#

if yes, how?

tough wagon
#

noice, thanks

shy schooner
#
class Bot(commands.Bot):
    def __init__(self):
        super().__init__(
            command_prefix=commands.when_mentioned_or('l.'), 
            intents=discord.Intents.all()
        )

    async def on_ready(self):
        print(f'{self.user} is ready!')
        for file_name in os.listdir("./cogs"):
            if file_name.endswith(".py"):
                self.load_extension(f"cogs.{file_name[:-3]}")

client = Bot()

I think I have a problem with my help cog

discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.help' raised an error: AttributeError: 'Bot' object has no attribute 'get_listeners'
tawdry perch
#

Trying to DM me to get help... big no

river kindle
#

hi guys, I'm creating a translation command, and I wish that when the bot translates the language it does it inside an embed, I just don't know how to do it.

here my code

async def translate (ctx, lang_to, * args):
  lang_to = lang_to.lower ()
  if lang_to not in googletrans.LANGUAGES and lang_to not in googletrans.LANGCODES:
    raise commands.BadArgument ("This language does not exist.")

  text = '' .join (args)
  translator = googletrans.Translator ()
  text_translated = translator.translate (text, dest = lang_to) .text
  await ctx.send (text_translated)```
final iron
#

Whats with the spaces

river kindle
slate swan
#
@bot.event
async def on_reaction_add(reaction):
  schannel = bot.get_channel(int(901834168357515284))
  def count_reacts(msg):
    count = 0
    rlist = msg.reactions
    for react in rlist:
      count = count + 1
    return int(count)

on reaction add takes 1 positional argument but 2 were given?

#

when did I give it two arguments 🗿

sinful jewel
#

hi i made a bot that could fetch an image url from a show stats website which should update when the user changes their profile picture but when the link sends in discord the image is always the old image and not the updated one and idk how to fix

slate swan
#

send code

sinful jewel
# slate swan send code
if message_content.startswith('>pfp'):
      preview = link_preview("https://anilist.co/user/LumpiaAce")
      print("image:", preview.image)
      await message.channel.send(preview.image)
river kindle
#

hi guys, I'm creating a translation command, and I wish that when the bot translates the language it does it inside an embed, I just don't know how to do it.

here my code

async def translate (ctx, lang_to, * args):
  lang_to = lang_to.lower ()
  if lang_to not in googletrans.LANGUAGES and lang_to not in googletrans.LANGCODES:
    raise commands.BadArgument ("This language does not exist.")

  text = '' .join (args)
  translator = googletrans.Translator ()
  text_translated = translator.translate (text, dest = lang_to) .text
  await ctx.send (text_translated)```
leaden jasper
#

do u put functions inside cog class or outside it

river kindle
#

for now there are only functions, I have not created any embed

leaden jasper
river kindle
#

yes

leaden jasper
#

then u just need to create a discord embed

river kindle
#

and

leaden jasper
#

replace ur last line

  await ctx.send (text_translated)

with this

  embed = discord.Embed(description=text_translated)
  await ctx.send(embed=embed)
river kindle
#

ok

wintry kernel
#

why doesnt this work

leaden jasper
#

oh np

wintry kernel
#

any help?

river kindle
# leaden jasper oh np

if, on the other hand, I also want to put the language that the user requested?
eg:

[THE LANGUAGE REQUIRED HERE]
text here
[THE LANGUAGE OF THE TEXT]

leaden jasper
#

i dont understand

river kindle
#

oh ok

sick kettle
#

how do i set webhook avatar
i tried giving it a https link tho it showed startswith first arg must be str or a tuple of str, not bytes
i also gave it the Asset cls ie the ctx.author.avatar_url
tho same error

maiden fable
#

ctx.author.avatar.url if u r on 2.0

candid ore
#
UnboundLocalError: local variable 'island_level' referenced before assignment```
Anyone?
valid perch
#

Define the variable?

wintry kernel
#

how do i constantly check the prefix

valid perch
#

wdym\

slate swan
candid ore
#
        profile = await self.bot.profiles.find_one({"_id":ctx.author.id})
        inv = await self.bot.invs.find_one({"_id":ctx.author.id})
        money, materials_name, materials_value = self.bot.req[building_name]
        money = (island[building_name]+1)**2**island_level
        if profile["money"] < money:
            await ctx.channel.send(f"{ctx.author.mention} You don't have enough coins ({money:,}{self.bot.item_emoji['coin']}).")
            return False
valid perch
candid ore
valid perch
#

Yea but wheres that

candid ore
#

in db

valid perch
#

Well you need to define it as a variable in your code. THe code you gave doesnt define it

wintry kernel
# valid perch wdym\

so i have this function,

but it checks only for the first time. when i change it and try doing another command it wont read the new prefix

final shard
#

How to type a username without a mention or discriminator?

#

I used to know. Now I forgor.

candid ore
#

Ya mean this one?

final shard
final shard
unkempt canyonBOT
#

bot.py line 16

def get_prefix(bot, message):```
magic stump
#
@client.event
async def on_member_join(member):

    global hasloo


    haslo = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'

    haslo2 = 5

    hasloo = "".join(random.sample(haslo,haslo2))



    channel = guild.get_channel(828011225292079124)
    await channel.send(f"**{member.name}, użyj komendy** `!verify (kod)`\n**Twój kod weryfikacyjny to** \n`{hasloo}`")```     channel = guild.get_channel(828011225292079124)
NameError: name 'guild' is not defined
wintry kernel
#

anyways, ill use json

valid perch
#

Im sure you can figure it out

magic stump
slate swan
final shard
#

from discord

magic stump
#

XD

tawdry perch
final shard
#

from discord import guild

slate swan
#

How can I make slash commands?

final shard
#

sorry i made a mistake

tawdry perch
magic stump
#

o thanks

tawdry perch
candid ore
#

chat so fast, damn

tawdry perch
#

Sometimes

final shard
magic stump
#

a no work

#

ch = await self.create_dm() File "C:\Users\Uzytkownik\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\member.py", line 142, in general return await getattr(self._user, x)(*args, **kwargs) AttributeError: 'ClientUser' object has no attribute 'create_dm'

final shard
final shard
#

then check the documentation, that'll work

magic stump
tawdry perch
#

could you share the code as well?

#

what is even create_dm?

candid ore
#

money = (island[building_name]+1)**2**island_level
UnboundLocalError: local variable 'island_level' referenced before assignment

slate swan
#
  def count_reacts(msg):
    count = 0
    rlist = msg.reactions
    for react in rlist:
      count = count + 1
    return int(count)

this doesn't count reactions properly and instead returns 1 everytime it's called?

tawdry perch
wintry kernel
#
    return prefixes[str(message.guild.id)]
KeyError: '903281738686562314'```

getting this error
tawdry perch
#

@candid ore , I recommend writing your own code from scratch instead of copy pasting random code

silent ermine
tawdry perch
candid ore
#

screw it, ill figure it out eventually.

silent ermine
slate swan
slate swan
tawdry perch
#

oh wait, did I misunderstood that?

slate swan
tawdry perch
#

try to print len of rlist = msg.reactions

tawdry perch
wintry kernel
#

i did this like an year ago

#

the changeprefix

boreal ravine
wintry kernel
boreal ravine
#

a keyerror

#

ur looking for something that doesnt exist

#

!e

a = {"1": "one"}
print(a["a_key_error"])
unkempt canyonBOT
#

@boreal ravine :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 2, in <module>
003 | KeyError: 'a_key_error'
boreal ravine
#

^

tough wagon
#

Did I install too old 2.0 version of dpy?

boreal ravine
outer violet
tough wagon
boreal ravine
slate swan
#

even though there are 2 reactions

tough wagon
#

p.embed.set_author(name=member.display_name, icon_url=member.display_avatar.url)

boreal ravine
#

wait

#

@tough wagon

#

if ur displaying the avatar

#

you dont need .url

boreal ravine
#

!d discord.Member.display_avatar @tough wagon xD

unkempt canyonBOT
#

property display_avatar: discord.asset.Asset```
Returns the member’s display avatar.

For regular members this is just their avatar, but if they have a guild specific avatar then that is returned instead.

New in version 2.0.
tawdry perch
tough wagon
#

It was just too old version of 2.0

#

I fixed alrdy

boreal ravine
#

wdym

tough wagon
#

I mean that I installed git repo when there wasnt display_avatar in it

boreal ravine
#

when oh

tawdry perch
#

There is no old version of 2.0, is there?

boreal ravine
#

display_avatar new in 2.0

boreal ravine
#

he did .url

#

i dont think that works

#

nvm xd

tawdry perch
#

I cant remember

wintry kernel
#

@tawdry perch what do ya want?

#
@client.command()
async def profile(ctx, member:discord.Member=None):
    if member == None:
        member = ctx.author

    image = member.avatar_url
    created_at = member.created_at.strftime("%A, %B %d | %Y | %H:%M:%S %p")
    joined_at = member.joined_at.strftime("%A, %B %d | %Y | %H:%M:%S %p")
    userid = member.id
    roles = member.roles
    roles = ', '.join([role.mention for role in member.roles])

    embed = discord.Embed(
        title = "User Profile",
        description = f"{member}",
        colour = discord.Colour.purple()
    )
    
    embed.set_footer(text=f"ID: {userid}")
    embed.set_thumbnail(url = image)
    embed.set_author(name= member, icon_url=image)
    embed.add_field(name="Roles", value=roles)
    embed.add_field(name= "Created account at:", value=created_at, inline=False)
    embed.add_field(name= "Joined Server at:", value=joined_at, inline=False)

    await ctx.send(embed=embed)```

u may find something usefull in here ig. this my profile code
tawdry perch
slate swan
#

goat

tawdry perch
#

?

slate swan
tawdry perch
#

Ok?

slate swan
#

there are two

#

yet it returns 1

tawdry perch
#

Mind to send ss?

#

Of reactions*

slate swan
#

may I send you the server link where I'm testing the bot?

tawdry perch
#

No you can't

slate swan
#

ok lemme get a ss

velvet crest
#

how can i set back the channel perm to default ? like make it back to neutral

slate swan
#

ok nvm, it just started working @tawdry perch

#

even though I didn't change anything

#

🗿

tawdry perch
#

Good that it works!

spiral frigate
#

how to make the messages that the bot deleted and not the user entered write to a variable and output it

tawdry perch
#

Do what..?

spiral frigate
#

well, the messages in the channel 2 + 1 are command and when I enter commands into the parameter I write 5 and so that 3 and not 5 are output

#

Sorry for English I'm Russian

slate swan
#
@bot.command()
async def infoo(ctx, member:discord.Member=None):
    if member == None:
        member = ctx.author

 created_at = member.created_at.strftime("%A, %B %d | %Y |%H:%M:%S %p")
 joined_at = member.joined_at.strftime("%A, %B %d | %Y | %H:%M:%S %p")

    embed=discord.Embed(title="Cursex", description="**Identifitcation Card**", color = 0x5865f2)
    embed.add_field(name="User's name:", value=f"{member.name}", inline=False)
    embed.add_field(name="User's tag:", value=f"{member.discriminator}", inline=False)
    embed.add_field(name="User's ID:", value=f"{member.id}", inline=False) 
    embed.add_field(name="Guild creation date:", value=f"{ctx.guild.created_at.strftime('%A, %B %d %Y @ %H:%M:%S %p')}", inline=False)
 embed.add_field(name= "Created account at:", value=created_at, inline=False)
 embed.add_field(name= "Joined Server at:", value=joined_at, inline=False)

File "main.py", line 197, created_at = member.created_at.strftime("%A, %B %d | %Y |%H:%M:%S %p") IndentationError: unindent does not match any outer indentation level

gaunt mortar
#

Hi guys, I'm not using discord.py a lot, but how can I manage to get a display like this ? I'm only using classic await for now and want to get a result like this. Thanks for any answer

icy mango
#

you have not indented the test

#
@client.command()
@commands.has_role("Report Managers")
async def report_taken(ctx, message_id : discord.Message.id) :
    if message_id is None :
        await ctx.send("Syntax : er!report_taken <message_id>")
    
    else :
        help_log = client.get_channel(help_log_channel)
        report_message = await help_log.fetch_message(id)

        if report_message.author is client.user :
            await report_message.reply(f"Report case taken by {ctx.message.author}")
        
        else :
            await ctx.message.reply("That is not my message. Maybe you got the wrong message id?")
``` throwing error
slate swan
icy mango
#

converting to id failed for parameter message_id

icy mango
#

and add it again

#

it will now throw error

#

but of joined_at

icy mango
#

then do the same with joined_at remove all spaces and add tab space

icy mango
#

wdym?

#

is it your question?

icy mango
#

send ur code again

slate swan
#
@bot.command()
async def infoo(ctx, member:discord.Member=None):
    if member == None:
        member = ctx.author

 created_at = member.created_at.strftime("%A, %B %d | %Y |%H:%M:%S %p")
 joined_at = member.joined_at.strftime("%A, %B %d | %Y | %H:%M:%S %p")

    embed=discord.Embed(title="Cursex", description="**Identifitcation Card**", color = 0x5865f2)
    embed.add_field(name="User's name:", value=f"{member.name}", inline=False)
    embed.add_field(name="User's tag:", value=f"{member.discriminator}", inline=False)
    embed.add_field(name="User's ID:", value=f"{member.id}", inline=False) 
    embed.add_field(name="Guild creation date:", value=f"{ctx.guild.created_at.strftime('%A, %B %d %Y @ %H:%M:%S %p')}", inline=False)
 embed.add_field(name= "Created account at:", value=created_at, inline=False)
 embed.add_field(name= "Joined Server at:", value=joined_at, inline=False)
icy mango
#

the space in created_at and joined_at is not equal to all other keywords

slate swan
#

help

disnake.ext.commands.errors.NoEntryPointError: Extension 'cogs.game' has no 'setup' function.  ```
i have setup function in the cog.
#

am using disnake ;-;

icy mango
#

u using disnake?

slate swan
#

yes

#

i told you i will try all the forks

icy mango
#

as i told you before

#

ohk

slate swan
icy mango
#

i dont know how to fix it then

slate swan
#

oh ok

icy mango
#

u dont have to learn different syntax or change your code

slate swan
#

nah people say cogs is in disnake is just as in discord.py. The point is i forgot cogs

#

this is what my dict looks like

#

oh wait i forgot to import in the cogs

dusk dust
#

Is it possible to do this?:

create a text channel (i already did)
send a message on this channel (i need know)

slate swan
#

why wouldn't it be possible

dusk dust
#

i know that's possible, but i don't know how do i can do

slate swan
#
channel = ... #create text channel
await channel.send("Hey")
slate swan
#

yes

#

you just need to use a variable, simple as that

dusk dust
slate swan
#

channel = await guild.create_text_channel(name=f'Ticket of {ctx.author.name}')

#

bro even when i use normal dpy this error discord.ext.commands.errors.NoEntryPointError: Extension 'cogs.game' has no 'setup' function.

#

read it

#

no setup function

#
    bot.add_cog(Cog_Name(bot))```
#

forgot this

slate swan
#

.-.

#

i can read .-.

#

why is it indented

#

its not

#

it's supposed to be out of the cog

#

thats just vsco-

#

btw that "game" is actually "Game"

gaunt mortar
#

Hi guys, I'm not using discord.py a lot, but how can I manage to get a display like this ? I'm only using classic await for now and want to get a result like this. Thanks for any answer

valid perch
#

Is that in discord?

#

Or on a web browser

slate swan
#

It's discord

#

you named it game and added Game

#

that's kinda nice

#

it still didnt work

#

lowercase bro

slate swan
valid perch
#

It's likely just an image you need to generate somehow

slate swan
#

game != Game

#

with "g" uppercase it didnt work bro

#

i know, i already know python smh

#

gave up

gaunt mortar
slate swan
# slate swan

Name your class with G, classes should start with uppercase letters, and in your setup you alps have it with G not g, also make sure you save and restart

slate swan
#

OH WAIT I DONT HAVE AUTOSAVE ON

#

Lmao

#

LOL

#

🤦‍♂️

icy mango
#

hi

#

anyone want help

gaunt mortar
slate swan
#

Also you can add a graph from numpy as long as you manage to make it into an image file, using PIL and pasting whatever numpy gives should work (probably)

gaunt mortar
#

uh, seems like a pain

slate swan
#
@bot.command()
async def bal(ctx):
   await open_account(ctx.author)

   users = get_FD_data()
   user = ctx.author

   pocket_amt = users[str(user.id)]["pocket"]
   FD_amt = users[str(user.id)]["FD"]

   embed = discord.Embed(title=f"{ctx.author.name}", color=0xcf24ff)
   embed.add_field(name="pocket", value=f"{pocket_amt}")
   embed.add_field(name="FD", value=f"{FD_amt}")
   await ctx.send(embed=embed)

async def open_acocunt(user):

    users = get_FD_data()

    if str(user.id) in users:
        return False
    else:
        users[str(user.id)]["pocket"] = 0
        users[str(user.id)]["FD"] = 0

    with open("bank.json", "w") as f:
        json.dump(users,f)
    return True

async def get_FD_data():
    with open("bank.json", "r") as f:
        users = json.load(f)
    return users

error:
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

#

help please

valid perch
#

get_FD_data() needs to be awaited since you defined it as async

slate swan
valid perch
#

await get_FD_data()...

slate swan
#

error

#

can i get source code of python bot

hard trail
#

So I have coded an AI Chat Bot and there is one thing wrong

#

hold on let me get the screenshot and code

valid perch
valid perch
kindred epoch
unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

kindred epoch
#

wait thast resource

slate swan
#

do we need to get memeber object from ctx.author for adding roles and stuff ?

kindred epoch
#

!source

unkempt canyonBOT
valid perch
#

No, it will already be member if its in a guild

slate swan
#

oki

hard trail
#

So the bot says the message and then the response time which I don't want. I only want it to say the message like "You are very wise" not that

valid perch
#

data[0]['message']

hard trail
#
from discord.ext import commands
from prsaw import RandomStuff
from keep_alive import keep_alive

bot = commands.Bot(command_prefix = ">")
api_key = "My API"
rs = RandomStuff(async_mode = True, api_key = api_key)

@bot.event
async def on_ready():
    activity = discord.Game(name="Chatting with Y'all!", type=3)
    await bot.change_presence(status=discord.Status.online, activity=activity)
    print("Bot is ready!")

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

  if message.channel.id == Channel ID:
    response = await rs.get_ai_response(message.content)
    await message.reply(response)
  
  
  await bot.process.commands(message)```
valid perch
#

Its a list of dict, so index the list to get what you want, then use the correct key for the dict

hard trail
valid perch
#

Yea

hard trail
#

Alright hold on

#

@valid perch not working it keeps saying 'invalid syntax' when I place it. Where do you think I should put that code?

valid perch
#

Think

#

Maybe after you get the response?

hard trail
kindred epoch
hard trail
#
from discord.ext import commands
from prsaw import RandomStuff
from keep_alive import keep_alive

bot = commands.Bot(command_prefix = ">")
api_key = "My API"
rs = RandomStuff(async_mode = True, api_key = api_key)

@bot.event
async def on_ready():
    activity = discord.Game(name="Chatting with Y'all!", type=3)
    await bot.change_presence(status=discord.Status.online, activity=activity)
    print("Bot is ready!")

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

  if message.channel.id == Channel ID:
    response = await rs.get_ai_response(message.content)
    await message.reply(response)
  
  
  await bot.process.commands(message)```
#

Changed everything back

#

to the way it was

hard trail
valid perch
hard trail
#

hold on

kindred epoch
#

rs.get_api_responce returns a dict inside a list, so you need to index it

valid perch
#

I provided the code as well haha, oop. They just had to change a variable name and put it in the right place which aint hard

kindred epoch
#

yea lmao

#

ig they dont know what indexing is

valid perch
#

Yea, but will wait for more code to help

zenith zinc
valid perch
#

.guild

zenith zinc
#

ok i tryy....

gaunt mortar
#
client = discord.Client()
await client.get_channel(898274639913058349).send("Test")
#

Someone knows why I can't get the channel ? I got a NoneType instead of it

#

Already checked if my bot have access to the channel

valid perch
#

You can't run async code unless its in an async function

slate swan
#

it returned nonetype

valid perch
#

And the cache (which get_ uses) isn't populated until the bots logged in and ready

slate swan
#

so we already know that that's not the case

gaunt mortar
#

It is in but I'm not sending the whole function

valid perch
#

try fetch_channel

gaunt mortar
#

I'm trying it, thanks

valid perch
#

Then if it errors itll provide more info

zenith zinc
#

TFFFFF

valid perch
#

An AttributeError

#

It means your bot object doesnt have that attribute

zenith zinc
#

my gramm

valid perch
#

Because your looking at the wrong thing, and I can't help without code

zenith zinc
#

i send

#
@client.command(pass_context=True)
async def play(ctx, url):
    server = ctx.message.guild
    voice_client = client.voice_client_in(server)
    player = await voice_client.create_ytdl_player(url, after=lambda: check_queue(server.id))
    players[server.id] = player
    player.start()```
valid perch
zenith zinc
#

@valid perch

zenith zinc
#

no

valid perch
#

Doesn't exist there mateo

#

So use the link to get the guilds voice client

#

Could also just use ctx.guild.voice_client

gaunt mortar
# valid perch Make it two lines
client = discord.Client()
channel = client.fetch_channel(898274639913058349)
await channel.send("Test")

Something like that ? Tried and I still got the same error :/

valid perch
#

await fetch_channel

hard trail
valid perch
#

!resources

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

gaunt mortar
#
    client = discord.Client()
    await client.fetch_channel(898274639913058349).send("Test")

Something like that ?

hard trail
brazen raft
valid perch
#
client = discord.Client()
channel = await client.fetch_channel(898274639913058349)
await channel.send("Test")
gaunt mortar
#

Yup, I'm used to use Python but I'm not using a lot of async/await things

lunar helm
#

how do i send a message when the bot runs into the error of not having permissions

sick birch
kindred epoch
lunar helm
kindred epoch
#

what

brazen raft
slate swan
#

I wish I want banned for dpy

#

Server

lunar helm
# kindred epoch what
@client.event
async def on_command_error(ctx, error):
    if isinstance(error, CommandNotFound):
        embed=discord.Embed(title="**Error** :important:", color=0xff0000)
        embed.clear_fields()
        embed.add_field(name="Command Error", value="The provided command does not exist. Please take a look at the existing commands via the help menu.", inline=False)
        embed.set_footer(text="Made with love and care by Need_Not and Mrgoldy")
        await ctx.send(embed=embed)
    if isinstance(error, BotMissingPermissions):
        ctx.send("i dont have the permission to do that")```
#

2nd one doesn't work

rare saddle
#

Why is the button with id 4 not working?

lunar helm
#

where do i look

kindred epoch
dusk dust
#

how can I create a channel within a category?

leaden jasper
#

do u put functions outside of cog class or inside

leaden jasper
unkempt canyonBOT
#

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

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

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

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

Note

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

    global hasloo


    haslo = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'

    haslo2 = 5

    hasloo = "".join(random.sample(haslo,haslo2))

    gildia =  client.get_guild(656203782144917525)

    channel = gildia.guild.get_channel(828011225292079124)
    await channel.send(f"**{member.name}, użyj komendy** `!verify (kod)`\n**Twój kod weryfikacyjny to** \n`{hasloo}`")```
#

File "C:\Users\Uzytkownik\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\client.py", line 343, in _run_event await coro(*args, **kwargs) File "c:/Users/Uzytkownik/Desktop/Dawid Orginalny/Python/avexy veryfi/main.py", line 73, in on_member_join channel = gildia.guild.get_channel(828011225292079124) AttributeError: 'Guild' object has no attribute 'guild'

kindred epoch
#

do you know how get_channel works?

magic stump
kindred epoch
#

its as simple as just doing member.channel.send, why are you doing all that

magic stump
#

Because that's what they recommended to me

leaden jasper
#

do u put functions in cogs class or outside

leaden jasper
magic stump
#

no dm

waxen granite
#

Command raised an exception: PermissionError: [Errno 1] Operation not permitted what is this?

kindred epoch
magic stump
#

mhm

magic stump
kindred epoch
#

wait

magic stump
kindred epoch
magic stump
#

a

valid perch
#

Orrrr hear me out

await member.send

magic stump
#
    gildia =  client.get_guild(656203782144917525)

    channel = gildia.guild.get_channel(828011225292079124)
    await member.guild.channel.send(f"**{member.name}, użyj komendy** `!verify (kod)`\n**Twój kod weryfikacyjny to** \n`{hasloo}`")
valid perch
#

await channel.send

#

gildia.guild.get_channel(828011225292079124) -> gildia.get_channel(828011225292079124)

waxen granite
# kindred epoch send the whole error
Ignoring exception in on_command_error
Traceback (most recent call last):
  File "/home/Mechanic/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/Mechanic/cogs/samp.py", line 91, in addserver
    serverName = getServerName(client)
  File "/home/Mechanic/scwrapper.py", line 4, in getServerName
    info = client.get_server_info()
  File "/home/Mechanic/sampclient/client.py", line 62, in get_server_info
    response = self.send_request(OPCODE_INFO)
  File "/home/Mechanic/sampclient/client.py", line 46, in send_request
    self.socket.sendto(body, (self.address, self.port))
PermissionError: [Errno 1] Operation not permitted```
magic stump
#

oke

kindred epoch
valid perch
#

True

slate swan
#

you want a command that sends something to the person that joins a server?

#

@valid perch

kindred epoch
slate swan
#

who is it

slate swan
#

i can't help??

kindred epoch
slate swan
#

i thought it was him that needed help

#

why are you getting so mad?

#

is there a message:discord.Message?

magic stump
# kindred epoch ye

channel = gildia.guild.get_channel(828011225292079124)
AttributeError: 'Guild' object has no attribute 'guild'

kindred epoch
kindred epoch
magic stump
#

oke oke

slate swan
kindred epoch
slate swan
magic stump
kindred epoch
slate swan
slate swan
magic stump
kindred epoch
slate swan
magic stump
slate swan
magic stump
#

yes

slate swan
slate swan
#

i had to remove those 2

magic stump
#

What should I arrange

kindred epoch
# slate swan

ofc from replit import db wont work cuz its not replit

slate swan
#

HIDE YOUR TOKEN

#

BRO

slate swan
#

but it is what is is

#

@magic stump remove pic

magic stump
#

o fck

slate swan
#

reset token

magic stump
#

okey

#

dałna z tym dostaje

#

File "c:/Users/Uzytkownik/Desktop/Dawid Orginalny/Python/avexy veryfi/main.py", line 73, in on_member_join await member.guild.channel.send(f"**{member.name}, użyj komendy**!verify (kod)\n**Twój kod weryfikacyjny to** \n{hasloo}") AttributeError: 'Guild' object has no attribute 'channel' ```py

hasloo = "".join(random.sample(haslo,haslo2))


channel = member.guild.get_channel(828011225292079124)
await member.guild.channel.send(f"**{member.name}, użyj komendy** `!verify (kod)`\n**Twój kod weryfikacyjny to** \n`{hasloo}`")```
magic stump
#

but

crystal rapids
#

member.guild returns Guild object
But seems like you've already fetched the channel on the line above

So you can just use that to send the message right

echo wasp
crystal rapids
crystal rapids
echo wasp
magic stump
#

a oke

crystal rapids
echo wasp
magic stump
# crystal rapids Exactly

Ignoring exception in on_message Traceback (most recent call last): File "C:\Users\Uzytkownik\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\client.py", line 343, in _run_event await coro(*args, **kwargs) File "c:/Users/Uzytkownik/Desktop/Dawid Orginalny/Python/avexy veryfi/main.py", line 39, in on_message await message.author.send(embed=embed1) File "C:\Users\Uzytkownik\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\abc.py", line 1013, in send channel = await self._get_channel() File "C:\Users\Uzytkownik\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\member.py", line 299, in _get_channel ch = await self.create_dm() File "C:\Users\Uzytkownik\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\member.py", line 142, in general return await getattr(self._user, x)(*args, **kwargs) AttributeError: 'ClientUser' object has no attribute 'create_dm'

echo wasp
#

i just relooked at it

crystal rapids
magic stump
#
@client.event
async def on_member_join(member):

    global hasloo


    haslo = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'

    haslo2 = 5

    hasloo = "".join(random.sample(haslo,haslo2))


    channel = member.guild.get_channel(828011225292079124)
    await channel.send(f"**{member.name}, użyj komendy** `!verify (kod)`\n**Twój kod weryfikacyjny to** \n`{hasloo}`")```
crystal rapids
#

Oh

echo wasp
magic stump
crystal rapids
#

It's in the on message event, check for the error sir

#

Brb, battery

magic stump
#

mhm okey

#

error sir?

stiff nexus
#

how do i get the bots prefixs?

echo wasp
magic stump
#

aaaaaaaaaaaaaaaa

magic stump
#
@client.event
async def on_message(message):
    channel = (828011225292079124)
    if message.channel.id == channel and message.content != "!verify":
        await message.delete()
        embed1=discord.Embed(title="Błąd", color=0xff0000,timestamp=datetime.utcnow())
        embed1.add_field(name="\u200b", value="**Użyj komendy !verify aby się zweryfikować! **", inline=False)
        embed1.set_thumbnail(url = "https://emoji.gg/assets/emoji/1326_cross.png")
        await message.author.send(embed=embed1)

    await client.process_commands(message)``` How to do here not to delete bot messages?
shrewd pasture
#

?

shrewd pasture
#

the message it sent?

#

if so

#
@client.event
async def on_message(message):
    channel = (828011225292079124)
    if message.channel.id == channel and message.content != "!verify":
        await message.delete()
        embed1=discord.Embed(title="Błąd", color=0xff0000,timestamp=datetime.utcnow())
        embed1.add_field(name="\u200b", value="**Użyj komendy !verify aby się zweryfikować! **", inline=False)
        embed1.set_thumbnail(url = "https://emoji.gg/assets/emoji/1326_cross.png")
        await message.author.send(embed=embed1, delete_after=time) # Time must be an int and its in seconds

    await client.process_commands(message)
magic stump
shrewd pasture
#

no its not

echo wasp
shrewd pasture
#

delete_after=True is stupid imo

#

delete_after=time_in_int is better

#

please dont tell people false info mate

#

using that is not efficient

echo wasp
sinful jewel
#

uh this may be a stupid question so apologies, but im trying to make a bot that can get data from AniList and after some research i found an API for it. However I do not know what to do with it :/ does anyone have like a guide ig i can read or smthn to learn how to use an API

heres the API: https://github.com/AniList/ApiV2-GraphQL-Docs/tree/master/book

magic stump
shrewd pasture
#

@magic stump you dont want !verify to delete?

magic stump
#

Everything works, it only shows the error when the bot sends a message that it can't

shrewd pasture
#

@magic stump bc the users dms are likely closed

magic stump
shrewd pasture
#

you are dming homie

#

its sending a message to the users dms

sinful jewel
#

^^
you might want

await message.channel.send ()
magic stump
#

the user comes to the server and the bot sends to the veryfication channel the verification code that the user must enter now he wants to do if I enter something other than the command! verify

magic stump
waxen granite
#

how can i send msg if there are 2 words in the msg?

slate swan
#

??

magic stump
#
@client.event
async def on_message(message):
    global s
    channel = (828011225292079124)
    if message.channel.id == channel and message.content != "!verify" or :
        await message.delete()
        embed1=discord.Embed(title="Błąd", color=0xff0000,timestamp=datetime.utcnow())
        embed1.add_field(name="\u200b", value="**Użyj komendy !verify aby się zweryfikować! **", inline=False)
        embed1.set_thumbnail(url = "https://emoji.gg/assets/emoji/1326_cross.png")
        await message.author.send(embed=embed1, delete_after=time) # Time must be an int and its in seconds

    await client.process_commands(message)
``` i wish abty bot wouldn't delete its messages
slate swan
#

what is that or doing in your if statement

magic stump
slate swan
#

oh

#

and message.author != bot.user?

#

client.user actually

magic stump
#

a

#

wokrs

shrewd pasture
#

i dont understand what youre trying to do exactly

brave ravine
#

replace a character

slate swan
#

EZ

shrewd pasture
brave ravine
#

its for a bot

slate swan
#

you're welcome

brave ravine
#

thanks for the help

slate swan
#

❤️

left wind
#

Can a message have multiple images?

slate swan
#

yes

#

abc.Messageable.send() has a files keyword-argument

#

!d discord.TextChannel.send

unkempt canyonBOT
#

await send(content=None, *, tts=None, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, mention_author=None, view=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Sends a message to the destination with the content given.

The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.

To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") objects. **Specifying both parameters will lead to an exception**.

To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
left wind
#

oh nice ty

#

so i just make a list with discord files

slate swan
#

exactly

#

To upload a single file, the file parameter should be used with a single File object. To upload multiple files, the files parameter should be used with a list of File objects. Specifying both parameters will lead to an exception.

left wind
#

Yeah ive been doing single images but recently learnt multiple is possible 🤭

hollow palm
#
msg = await ctx.channel.send(f"`Now playing: {var3}` \n{url}")
await msg.add_reaction(u"\u23F8")
await msg.add_reaction(u"\u25B6")
try:
    reaction, user = await client.wait_for("reaction_add", check=lambda reaction, user: reaction.emoji in [u"\u23F8", u"\u25B6"], timeout=90.0)

except asyncio.TimeoutError:
    return await msg.clear_reactions()

else:
    if reaction.emoji == u"\u23F8":
        await msg.remove_reaction(reaction.emoji, ctx.author)
        await ctx.voice_client.pause()
    elif reaction.emoji == u"\u25B6":
        await msg.remove_reaction(reaction.emoji, ctx.author)
        await ctx.voice_client.resume()

This code is supposed send a message showing what is playing, and bring up pause and play reactions which will pause and play the audio when reacted to by a user. Right now it only responds to a reaction once, for example if someone hits the pause emoji then the audio will be paused, however if the play emoji is hit after that then nothing will happen.

slate swan
#

how do i add badges into the summary of who someone is?

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

    created_at = member.created_at.strftime("%A, %B %d | %Y | %H:%M:%S %p")
    joined_at = member.joined_at.strftime("%A, %B %d | %Y | %H:%M:%S %p")
    badges = {
    UserFlag.hypesquad_bravery: ":Braverylogo:899689315083366430",
    UserFlag.hypesquad_brilliance: ":Brilliancelogo:",
    UserFlag.hypesquad_balance: ":Balancelogo:",
    UserFlag.verified_bot_developer: ":verifitedbotdeveloperlogo:",
    UserFlag.bug_hunter: ":Bughunterlogo:",
    UserFlag.bug_hunter_level_2: ":Bughunterlevel2logo:",
    UserFlag.early_supporter: ":earlysupporterlogo:",
    UserFlag.staff: ":stafflogo:",
    UserFlag.discord_certified_moderator: ":certifiedmoderatorlogo:"}
  allbadges = [badges[flag] for flag in member.public_flags.all()]

    embed=discord.Embed(title="Cursex", description="**Identifitcation Card**", color = 0x5865f2)
    embed.add_field(name="User's name:", value=f"{member.name}", inline=False)
    embed.add_field(name="User's tag:", value=f"{member.discriminator}", inline=False)
    embed.add_field(name="User's ID:", value=f"{member.id}", inline=False) 
    embed.add_field(name"=Badges:", value=f"{member.badges}", inline=False)
    embed.add_field(name="Guild creation date:", value=f"{ctx.guild.created_at.strftime('%A, %B %d %Y | %H:%M:%S %p')}", inline=False)
    embed.add_field(name= "Created account at:", value=created_at, inline=False)
    embed.add_field(name= "Joined Server at:", value=joined_at, inline=False)
    embed.set_footer(text=f"Requested by {ctx.author}")
    embed.timestamp = datetime.utcnow()
    await ctx.send(embed=embed)
#

would that work?

silent ermine
#

Hey i need some help. I want to create a roblox verify command and it links a user to their roblox account.

waxen granite
#

why this error

#

?

silent ermine
#

not sure if roblox has one

echo wasp
kindred epoch
#

!pypi roblox

unkempt canyonBOT
silent ermine
silent ermine
#

do you want me to explain it?

kindred epoch
#

you might want to google some things for that

#

that was just some random guess

silent ermine
#

dont worry

silent ermine
#

Try out that code

#

Title and Description should be in embed=discord.Embed(title="e", description='e')

echo wasp
echo wasp
#

and it didn't like it

silent ermine
#

Ohhh

silent ermine
echo wasp
#

so i just need help gettign a new line made

#

that is what i had before

#

i asked i wanted to add another invite link but the line wouldn't create for the new one

silent ermine
#

So is it work ing or

echo wasp
#

and i did \n in another part just fine

silent ermine
#

the new code i sent

echo wasp
#

it is working half

echo wasp
#

ok

silent ermine
#

OHHH

#

So when you are using /n you dont need to create new ""

echo wasp
silent ermine
buoyant plover
#

Hey, does anyone know the steps we need to take to track when a user is and isn't speaking in a VC?
I know the bot needs to be in the VC but not sure if there are events for this or if we have to parse some ws stream

silent ermine
echo wasp
kindred epoch
buoyant plover
#

d.py has no builtin methods to recieve voice data?

silent ermine
buoyant plover
#

no vc ws conn?

echo wasp
kindred epoch
#

good

silent ermine
#

Did you use the new code i just sent?

#

ig but nicee

echo wasp
silent ermine
#

Just a quick explanation

kindred epoch
slate swan
#

why won't my code replace user.mention?


user = ctx.author

if "{user.mention}" in message:
            message = message.replace("{user.mention}", user.mention)
buoyant plover
silent ermine
#

when using discord embeds, it should be like this: embed=discord.Embed(title="Title Here", description="Description here"). And when using \n it should be like await ctx.send("hey \n hi")

slate swan
#

ohhh shit

#

thank you

silent ermine
# slate swan ohhh shit
user = ctx.author

if "{user.mention}" in message:
            message = message.replace(f"{user.mention}", user.mention)```
silent ermine
silent ermine
echo wasp
#

taken note of

waxen granite
#
    return await message.edit("You have not added any servers.")
TypeError: edit() takes 1 positional argument but 2 were given```
what did i do wrong?
silent ermine
silent ermine
waxen granite
#

ah

silent ermine
#

np

magic stump
#

If I want to put the bot on herok hosting, do I have to delete the last line?

brave vessel
silent ermine
brave vessel
#

Ah, what issue are you getting?

magic stump
#

on console

#

and change this

brave vessel
#

No that’s fine. Do you have a Procfile in your repo?

magic stump
#

repo?

#

aaaaaaa

#

yes\

brave vessel
magic stump
#

yes i have

#

this

magic stump
brave vessel
# magic stump :)\

Could you post an image of your repositories files? not the file content, just the files

magic stump
#

yes

brave vessel
#

heroku requires a Procfile to run I believe

magic stump
#

profil

magic stump
brave vessel
#

so you would add a file just called Procfile and in there you would write worker: python main.py

brave vessel
magic stump
#

okey

magic stump
brave vessel
magic stump
#

a

#

a wait

#

and no work bot ofline @brave vessel

brave vessel
magic stump
#

yes

brave vessel
#

Like could you take a larger photo to the right?

magic stump
#

I don't know if there is a bug, but it is offline

brave vessel
#

It cuts off at "state changed from starting.."

magic stump
#

what

brave vessel
#

I can't see the error descriptions

echo wasp
#

umm so i have multiple servers my bot is in but it only shows the members of one of the servers not both how do i fix that? and it it only shows one server with id that it is connected to **Code:**https://paste.pythondiscord.com/sohorudemi.py Ping me if you got a fix for that

magic stump
#

all konsole

brave vessel
#

Those are called slash commands!

brave vessel
placid skiff
#

There is a way to check whenever a role is added to a member?

slate swan
#

maybe on_member_update or smth

#

!d discord.on_member_update

unkempt canyonBOT
#

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

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

• nickname

• roles

• pending...
slate swan
#

yes

placid skiff
#

Thanks

#

This is an event right?

slate swan
#

yes

brave vessel
echo wasp
brave vessel
magic stump
#

o error

echo wasp