#discord-bots

1 messages · Page 501 of 1

hoary gust
#

to communicate between process

odd pendant
#

yes? the library i said is for ipc

hoary gust
# odd pendant yes? the library i said is for ipc

yes good but the thing is like discord-ext-ipc is good buy it cannot be used for the thing i am trying to do thats why i was asking for ipc and i dont really get what multiprocess.communication is

#

is it a lib or a module of mutipocess

maiden fable
#

flask discord

#

!pypi flask-discord

unkempt canyonBOT
hoary gust
maiden fable
#

Ah

hoary gust
#

!pypi multiprocess

unkempt canyonBOT
maiden fable
#

Well, sorry bro... I haven't made a dashboard till now so I don't have any experience with the same

#

:c

hoary gust
#

anyone?

#

someone help me

quiet coral
#
import disnake
import os
import time
from life_saver import get_crypto_price
from disnake.ext import commands
from crypto_listing import get_crypto_rank
CMC_API_KEY=os.environ.get('CMC')
token=os.environ.get('Discord_crypto_bot_token')


client=commands.Bot(command_prefix='!')
@client.event
async def on_ready():
    #await client.change_presence(status=disnake.Status.idle)
    print("Hey you I am ready ")

@client.event
async def on_message(message):
    if message.content.startswith('!'):
        crypto_to_check=message.content.split("!",1)[1].lower()
        await message.channel.send(get_crypto_price(crypto_to_check))
    
    if message.content.lower()=='/commands':
        await message.channel.send("type / + crypto's name  to get the crypto price")
        await message.channel.send("for example:\n /bitcoin to get bitcoin's price")
@client.command()
async def rank(ctx,crypto):
    await message.channel.send(get_crypto_rank(crypto))
                           
         
client.run(token)

Hello,I am getting this error:AttributeError: 'Client' object has no attribute 'command'

manic wing
#

!d discord.ext.commands.Bot.commands

unkempt canyonBOT
#

property commands: Set[discord.ext.commands.core.Command[discord.ext.commands.core.CogT, Any, Any]]```
A unique set of commands without aliases that are registered.
hoary gust
#

@odd pendant plz help

manic wing
hoary gust
odd pendant
hoary gust
quiet coral
dapper cobalt
#

This is not the appropriate channel for this. You may ask in #web-development . This is for Discord bots development and not general discord-related questions.

slate swan
slate swan
#

alright.

slate swan
maiden fable
#

print(discord.__version__)

#

add this to yr code please

#

this should print the version

slate swan
#

alright

#

dosent send the version only errors.

slate swan
slate swan
boreal osprey
ripe jackal
boreal osprey
ripe jackal
#

remove the ``

boreal osprey
#

i now get this

rigid island
#

heyyy

#

i need help

ripe jackal
boreal osprey
#

yes

#

in the token env file

outer ridge
#

it is not able to read the environment variable then.

#

so it gives you None

rigid island
#
from azlyrics.azlyrics import lyrics

song = input('song:')
artist = input('artist:')
ly = lyrics(artist,song)
for line in ly:
    print(line)
i get the input here but then i do that in replit then it show error ```
boreal osprey
#

but i have the required things\

rigid island
#

import discord
import os
from azlyrics.azlyrics import artists, songs, artists
from azlyrics.azlyrics import lyrics

client = discord.Client()

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


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

    if message.content.startswith("$k"):
        x=''
        args = str(message.content).split(" ")
        args.pop(0)
        args = " ".join(map(str, args))
        args = args.split(",")
        wd = lyrics(args[0],args[1])
        for line in wd:
          x=x+line
        await message.channel.send(x)
        print(wd)
client.run(os.getenv("TOKEN"))
boreal osprey
slate swan
outer ridge
#

and check if you have your token there

boreal osprey
#

yes it's in there

outer ridge
ripe jackal
#

try this:

import discord
from discord.ext import commands

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

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

client.run("TOKEN HERE")```
outer ridge
#

without the token

boreal osprey
#

DISCORD_TOKEN="token"

outer ridge
#

no that's not how you save an environment path

rigid island
#

HELP :((

slate swan
rigid island
slate swan
rigid island
hasty iron
slate swan
hasty iron
#

guess

slate swan
#

pip uninstall discord.py 😭

slate swan
#

i mean it dont work should i run it in vsc or command prompt?

outer ridge
rigid island
boreal osprey
rigid island
#

error that it not exist

hasty iron
slate swan
outer ridge
#

so i doubt anyone has a solution for it

slate swan
#

works, tysm 👐

outer ridge
#

just don't use REPL xD as it's a Linux / Unix environment

hasty iron
#

whats wrong with unix environments

outer ridge
#

search "env variables" on Start

#

and then this will pop up

boreal osprey
#

i'm using ubuntu though

hasty iron
outer ridge
rigid island
outer ridge
#

Just use pyopen('token.env').read() then

hasty iron
#

no that’s bad

#

you need to close the file

rigid island
#

mostly people use genius py but i cant understand it tbh

hasty iron
#

or a way to do it

outer ridge
#

use a "with" enclosure then

#
with open('token.env') as token_file:
    token = token_file.read()
hasty iron
#

you still haven’t answered my question on what’s wrong with unix environments

outer ridge
#

Well, the library probably doesn't work correctly on that platform that REPL uses

#

I assume so since it works on your computer

#

also check that REPL is installing the same version of that library

hasty iron
#

hm so we just guess that it’s the lib’s fault

hasty iron
gleaming torrent
#

How do I prevent messages being duplicated?

outer ridge
gleaming torrent
hasty iron
#

client.command wont work in their case right now

gleaming torrent
#

so people cant spam like that

hasty iron
#

theyre using Client not Bot

outer ridge
#

I'd probably check the consecutive letters

gleaming torrent
#

I dont know how tho xd

hasty iron
#

use a collections.Counter

gleaming torrent
#

is there any api I need to check

hasty iron
#

actually no

#

that might not work in your case

gleaming torrent
#

ok ok

#

so collection counter?

hasty iron
#

well there is no definite way to classify spam

#

you’ll just have to guess based on character count and occurrence

gleaming torrent
#

Wait

hasty iron
#

since somebody can write a whole paragraph

gleaming torrent
#

I have an idea

hasty iron
#

and it can detect it as spam

gleaming torrent
#

so on the message event channel

#

I can make an variable that says
spam = ["eeeeeeeeeee"]

#

and more

hasty iron
#

that’s too inefficient

gleaming torrent
#

and check if the message contants it

#

Well thats what Im trying to prevent

hasty iron
#

you won’t have a list of tens of hardcoded items

gleaming torrent
#

well cmon, its just the alpabet

hasty iron
#

but you could

gleaming torrent
#

alphabet*

#

I could probably try and check if message.content is times 2

#

which also should work

#

idk

hasty iron
#

you can have per-server character limits

gleaming torrent
#

i have a "character" limit

#

for messages

#

I'll be back if it doesn't work

outer ridge
#

@gleaming torrent

def is_spam(string):
    consecutive = 0
    last_char = ''
    for char in string:
        if char == last_char:
            consecutive += 1
        if consecutive >= 6:
            return True
        last_char = char
    return False
gleaming torrent
#

dude thank you

#

lol

outer ridge
#

I just wrote this, should work

hasty iron
#

again that’s not efficient

outer ridge
#

it's the only way xD

hasty iron
#

i can have multiple characters in the same sentence

outer ridge
#

and it is efficient

gleaming torrent
hasty iron
outer ridge
#

no, you didn't understand what my code is doing

hasty iron
#

it has 6 e

odd pendant
hasty iron
#

what

odd pendant
#

he re re re re re re is fine, heeeeeeeee would be spam

hasty iron
#

no

#

thats not how iterating through a string works

outer ridge
#

lol

hasty iron
#

it gives you all the characters

outer ridge
#

You didn't even read my code.

hasty iron
#

i did

#

oh wait

#

nvm me stupid

outer ridge
#
def is_spam(string, tollerance=3):
    consecutive = 0
    last_letter = ''
    for letter in string:
        if letter == last_letter:
            consecutive += 1
        if consecutive >= tollerance:
            return True
        last_letter = letter
    return False
``` A better version here
slate swan
hasty iron
#

you dont

#

you’ll have to monkeypatch stuff and end up breaking other stuff

dapper cobalt
#
e_count = 0
for "e" in message.content:
  e_list += 1

spam = False

if e_count >= 10:
  spam = True
#

I think this should work.

#

If you're counting how many e's are in the message.

outer ridge
#

This is not a great idea.

slate swan
hasty iron
#

it is

#

but you shouldn’t do it

dapper cobalt
odd pendant
slate swan
outer ridge
#

You should keep track of how many equal consecutive characters there are

hasty iron
slate swan
hasty iron
dapper cobalt
#

!d collections.Counter

unkempt canyonBOT
#

class collections.Counter([iterable-or-mapping])```
A [`Counter`](https://docs.python.org/3.10/library/collections.html#collections.Counter "collections.Counter") is a [`dict`](https://docs.python.org/3.10/library/stdtypes.html#dict "dict") subclass for counting hashable objects. It is a collection where elements are stored as dictionary keys and their counts are stored as dictionary values. Counts are allowed to be any integer value including zero or negative counts. The [`Counter`](https://docs.python.org/3.10/library/collections.html#collections.Counter "collections.Counter") class is similar to bags or multisets in other languages.

Elements are counted from an *iterable* or initialized from another *mapping* (or counter):

```py
>>> c = Counter()                           # a new, empty counter
>>> c = Counter('gallahad')                 # a new counter from an iterable
>>> c = Counter({'red': 4, 'blue': 2})      # a new counter from a mapping
>>> c = Counter(cats=4, dogs=8)             # a new counter from keyword args
dapper cobalt
#

!e

import collections
text = "Hello world"
frequencies = collections.Counter(text)
repeated = {}
for key, value in frequencies.items():
  if value > 1:
    repeated[key] = value

print(repeated)
unkempt canyonBOT
#

@dapper cobalt :white_check_mark: Your eval job has completed with return code 0.

{'l': 3, 'o': 2}
hasty iron
#

you can pass in the string directly

#

a string is an iterable

dapper cobalt
#

Yeah, I know.

#

I was copying an example.

hasty iron
#

oh kite

dapper cobalt
hasty iron
#

i did suggest that idea at first

#

but it wouldn’t be best for detecting spam

dapper cobalt
#

Does he want to detect how many times a character is repeated next to itself?

#

So like "eeeeeeee" = spam
"hey ey eyo" != spam

hasty iron
dapper cobalt
#

One moment.

fallow mauve
#

ok

#

big question

#

whats a decorator? i feel like this is an important term that i need to know

#

but nobody's explain that to me yet

dapper cobalt
#
import collections
@client.event
async def on_message(message):
  messages = []
  async for message in ctx.channel.history(limit=3)
    messages.append(message.content)

  frequencies = collections.Counter(messages)
  for key, value in frequencies.items():
    if value >= 3:
      spam = True

I believe this works. This checks if the last 3 messages sent are the same.

pliant gulch
#

Imo a good way to detect duplicated messages is via difflib.get_close_matches, the cutoff can be set to what you want and harder to bypass if you only add a few extra characters

#

Just check if that returns None else count it as spam

fallow mauve
#

?

slate swan
#
async def on_ready():
    await client.change_presence(activity=discord.Streaming(name="coolin with slums", url="https://twitch.tv/fraudpays"))
    print("daddy is online.")``` should i keep my status cmd in `@client.event`?
#

or is it not appropiate to

fallow mauve
dapper cobalt
fallow mauve
#

k

dapper cobalt
#

@fallow mauve

fallow mauve
#

ok

dapper cobalt
#

!d discord.ext.commands.Bot.wait_until_ready

unkempt canyonBOT
#

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

Waits until the client’s internal cache is all ready.
slate swan
#

yu

slate swan
pliant gulch
#

What

#

Why would you put that there just pass activity when constructing the bot

#

What would wait_until_ready even do here to help??

slate swan
#

i see the point of it but idk

pliant gulch
#

on_ready is litteraly fired when the cache is ready

#

WHICH is the exact same thing wait_until_ready does

slate swan
pliant gulch
#

infact wait_until_ready waits for on_ready in a sense

#

Anyhow this wouldn't fix the problem of it firing multiple times

#

which is why you pass the activity kwarg when constructing the bot

slate swan
#

how will i fix the problem of it firing multiple times

pliant gulch
#

by removing it from on_ready and passing activity kwarg to the bots constructor

plain birch
#

hello

#
@client.command()
@commands.has_permissions(ban_members=True)
async def ban(ctx, member: discord.Member, *, reason=None):
     await member.ban(reason=reason)
     await ctx.send(f'User {member} has been kick')
``` gives me an error: member was not found
broken dirge
#

@ client.command(pass_context=True) @ commands.has_permissions(administrator=True) async def ban(ctx, member: discord.Member, *, reason=None): await ctx.send(f'Nuked { member.mention}')

#

Should work just fine

fallow mauve
#

whats wrong with this? my alt acc does not have kick members perm yet can use the command

plain birch
#

nice edit lol

dapper cobalt
#

I'm sure @hasty iron got an answer. 🙂

fallow mauve
#

ok

#

i probably made a stupid mistake

dapper cobalt
#

Sorry blanket, not sorry blanket.

paper bane
#

has_guild_permissions is a decorator for commands

broken dirge
#

just use what you need

slate swan
hasty iron
broken dirge
#

or just @ commands.has_permissions(administrator=True)

hasty iron
#

you’ll have to check if on your own inside the function

hasty iron
dapper cobalt
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.

dapper cobalt
#

Also why administrator permissions to ban?

fallow mauve
#

im not getting this at all

#

idk how to fix this stupid command

hasty iron
#

that’s not even a command

#

its an event

fallow mauve
#

ok

#

what is a "command" then?

#

i obviously dont know

hasty iron
#

anything decorated by Bot.command or commands.command

lyric moat
#

How do i make it add makes you add your own colour?

@client.command()
async def make_embed(ctx):
    def check(message):
        return message.author == ctx.author and message.channel == ctx.channel

    await ctx.send('Waiting for a title')
    title = await client.wait_for('message', check=check)
  
    await ctx.send('Waiting for a description')
    desc = await client.wait_for('message', check=check)

    await ctx.send('Waiting for a colour')
    desc = await client.wait_for('colour', check=check)

    embed = discord.Embed(title=title.content, description=desc.content, color=colour.content)
    await ctx.send(embed=embed)```
hasty iron
unkempt canyonBOT
#

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

Changed in version 1.5: Add an alias named ColorConverter

The following formats are accepted...
cyan sundial
#

how do i add a specific role to a channel? i have default user and role, but idk how to set a specific one. ```py
await ticket_channel.set_permissions(ctx.guild.default_role, send_messages=False, read_messages=False)
await ticket_channel.set_permissions(ctx.author, send_messages=True, read_messages=True, read_message_history=True, embed_links=True, attach_files=True, add_reactions=True)

plain birch
#

how to make music command?

slate swan
#

lol

dapper cobalt
lyric moat
lyric moat
slate swan
#

No module named 'discord_buttons_plugin' someone know why?

#

from discord_buttons_plugin import *

dapper cobalt
dapper cobalt
slate swan
dapper cobalt
slate swan
#

?

pliant gulch
lyric moat
dapper cobalt
crystal wind
#

Is it possible to add an additional dialogue after a second message of the user when the first message sent has been triggered?
For instance :
I say the keyword "hello"
If it's "hello" it will respond with "what do you need"
However, if I say "I need popsicle", the bot will respond with something too
if not, it will return
If "hello" is not here it will return as well

#

Basically a dialogue. More or less.

dapper cobalt
unkempt canyonBOT
#

wait_for(event, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Waits for a WebSocket event to be dispatched.

This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.

The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.

In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.

This function returns the **first event that meets the requirements**...
crystal wind
#

thank you

kindred epoch
#

can i put days in tasks.loop?

jade bay
#

A random question, would it be smart to store your bot's data into a json file, and have the bot upload it into some discord channel?
Basically using a channel to store data instead of a database or anything else. Even though a database would be way better for storing data, but a json file for storing the bots config, such as prefix and whatever else, should be good enough, right?

kindred epoch
#

nvm you cant

final iron
kindred epoch
final iron
#

Alr

kindred epoch
#

also, can someone explain me what the reconnect parameter does in tasks.loop?

#

if the bot disconnects will it start from the time it left or will it start a whole new loop?

pliant gulch
kindred epoch
pliant gulch
#

Yep if reconnect is set to true it basically suppresses the error and continues running

kindred epoch
#

ah ok thanks

distant pagoda
#
@client.event
async def on_command(command):
    @client.has_permissions(manage_roles=True) 
    async def create_role(ctx, *, name):
        guild = ctx.guild
        await guild.create_role(name=name)
        await ctx.send(f'Role `{name}` has been created')
#

whats the command for this

#

like what do i type in my server to actually use it

patent lark
#

this is not a command

slate swan
#

wait a minute ,its a event

distant pagoda
#

wait

#

oh sorry give me a sec

patent lark
#

it’s not a command; like i said

#

also is on_command even a decorator in discord.ext.commands?

distant pagoda
#

i just get this ```line 43, in <module>
@client.command
AttributeError: 'Client' object has no attribute 'command'

patent lark
#

you aren’t using discord.ext.commands.Bot

#

you’re using discord.Client()

distant pagoda
#

ohhh

patent lark
#

!d discord.ext.commands.Bot

unkempt canyonBOT
#

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

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

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

hey, im trying to do change prefix between servers but i got an error everytime. someone knows?

#

u talk to me?

distant pagoda
#

no

#

sorry hold on

slate swan
distant pagoda
hallow palm
patent lark
#

remove that

distant pagoda
#

im gonna do this on a different bot

slate swan
#

how do i start a for loop inside a if statement

slate swan
distant pagoda
kindred epoch
#

@pliant gulch sorry for ping, but what do you think this does?

from discord.ext import tasks
from datetime import datetime
import asyncio

@tasks.loop(seconds=30)
async def test():
    channel = bot.get_channel(856373686809788430)
    await channel.send("test")

startdate = datetime(2021,9,27,22,28,00)

await discord.utils.sleep_until(startdate,test.start())

pliant gulch
#

Then afterwards it runs in 30 second intervals

kindred epoch
#

idk why

pliant gulch
#

Is the time you set past the current time?

kindred epoch
#

no, that time was when i tested it

#

it was 22:27

#

and i set it as 22:28

pliant gulch
#

Probably some weird time zone stuff then

kindred epoch
#

ooooo

pliant gulch
#

As it always run if the set time is past current time

kindred epoch
#

lemme try adding utc timezone

#

!d datetime

rustic onyx
#

So

I've 2 bots, copied the command from one bot, pasted the code in the other-

The command in the first bot is working, not in the new one. What the fuck? The command only works when its used with the bot

Its a userinfo command, it displays userinfo lmao

So when I do !userinfo <bot_id> it works, when I use the command with another user it doesnt

kindred epoch
#

set tzinfo as timezone.utc

pliant gulch
#

Not sure then all I know is that it doesn't sleep if the time set is already passed

kindred epoch
#

hm ok thanks

crystal wind
# unkempt canyon

Concerning about wait_for(event, *, check=None, timeout=None)
I was wondering if there's a way to break this waiting if someone sends a message that doesn't include the keyword required.

#

Like an If/Else

rustic onyx
#

so weird, and in this other bot it works with every user

proven elm
#

Anyone know how to add a small image like this at the bottom of an embedded message?

rustic onyx
#

yeah

paper bane
#

!d discord.Embed.set_footer

unkempt canyonBOT
#

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

This function returns the class instance to allow for fluent-style chaining.
rustic onyx
#

icon_url

paper bane
#

icon_url kwarg

stark hearth
proven elm
#

why does it say set_footer isnt defined

paper bane
#

code

proven elm
#
@client.command()
async def help(ctx):
    embedVar = discord.Embed(description='''**Commands Help!**\n\n**➀Prefix(.)**\n**➀
    All the commands within this bot include**\n\n➀.help\n➀.Ping\n➀.locklist\n
    ➀.staffapp\n➀.clear\n➀.8ball\n➀.addrole\n➀.kick\n➀.ban ''', color=0x2AD7B6)
    msg1 = await ctx.send(embed=embedVar)
    set_footer(text=current_time, icon_url='UDMLogo.png')
near glade
proven elm
#

ill move ctx.send embed to after I set footer

paper bane
#

set_footer isn't defined by itself, its a method of Embed objects

proven elm
#

hmm

paper bane
#

you need to call it on embedVar

paper bane
final iron
#

embedVar.set_footer

proven elm
#

ahh okay thank you

final iron
#

Also

crystal wind
final iron
#

I don't think the image would work

#

Yeah it wouldn't work

paper bane
#

It wouldn't no

#

!local-file

unkempt canyonBOT
#

Thanks to discord.py, sending local files as embed images is simple. You have to create an instance of discord.File class:

# When you know the file exact path, you can pass it.
file = discord.File("/this/is/path/to/my/file.png", filename="file.png")

# When you have the file-like object, then you can pass this instead path.
with open("/this/is/path/to/my/file.png", "rb") as f:
    file = discord.File(f)

When using the file-like object, you have to open it in rb mode. Also, in this case, passing filename to it is not necessary.
Please note that filename can't contain underscores. This is a Discord limitation.

discord.Embed instances have a set_image method which can be used to set an attachment as an image:

embed = discord.Embed()
# Set other fields
embed.set_image(url="attachment://file.png")  # Filename here must be exactly same as attachment filename.

After this, you can send an embed with an attachment to Discord:

await channel.send(file=file, embed=embed)

This example uses discord.TextChannel for sending, but any instance of discord.abc.Messageable can be used for sending.

pliant gulch
#

Brandon what's with the camelCase

#

đŸ˜©

paper bane
#

its his var name 😖

final iron
#

@proven elm send the image through discord in a random server. Click on open original then copy the url. Then paste the URL into the footer

pliant gulch
final iron
#

camelCase with python

#

đŸ˜©

#

I think it's proper practice with js or smth

kindred epoch
jovial cypress
#

hi i need help i'm trying to make a discord bot and this syntax keeps popping up and i dont know why

proven elm
#
@client.command()
async def help(ctx):
    embedVar = discord.Embed(description='''**Commands Help!**\n\n**➀Prefix(.)**\n**
    ➀All the commands within this bot include**\n\n➀.help\n➀.Ping\n➀.locklist\n
    ➀.staffapp\n➀.clear\n➀.8ball\n➀.addrole\n➀.kick\n➀.ban ''', color=0x2AD7B6)
    embedVar.set_footer
    file = discord.File("./UDMLogo.png", filename="UDMLogo.png")
    f = discord.File("./UDMLogo.png", filename="UDMLogo.png")  
    embedVar.set_image(url="attachment://image.png") 
    await ctx.send(file=f, embed=embedVar) 
#

Why is it not sending the image in the embed

#

oh

#

any idea why it wont send the image inside the embed?

jovial cypress
#

thank you

stark hearth
#

np

jovial cypress
#

ok but wdym

#

im a noob

#

help

stark hearth
#

hmm

proven elm
#
@client.command()
async def help(ctx):
    embedVar = discord.Embed(description='''**Commands Help!**\n\n**➀Prefix(.)**\n**
    ➀All the commands within this bot include**\n\n➀.help\n➀.Ping\n➀.locklist\n
    ➀.staffapp\n➀.clear\n➀.8ball\n➀.addrole\n➀.kick\n➀.ban ''', color=0x2AD7B6)
    embedVar.setfooter('UDM Staff Bot ‱', current_time)
    embedVar.set_image(url='UDMLogo.png')
    await ctx.send(embed=embedVar)

#

Why is it not sending it to discord

#

I presume I need to use something other then ctx.send but idk what

jovial cypress
proven elm
#

print('''we have logged in as {0.user}
'''.format (client))

#

or what

stark hearth
proven elm
stark hearth
proven elm
#

thats what I used?

#

@stark hearth

#

oh

jovial cypress
#

thank you but there is a syntax there now

proven elm
#

double equal sign

stark hearth
#

in the set_image it has to be path/to/image/image.png

proven elm
#

ohhh ok

flat solstice
#

How do I get the embed info like the title or description from a message, is it py for embed in message.embeds: embed = discord.Embed(color = embed[0].colour, description = embed[0].description)

proven elm
#

@stark hearth

jovial cypress
#

now there's anoteher syntax

proven elm
dusk pumice
#

I will send a code

#

paste it on yours!

proven elm
#

alright thank you

proven elm
jovial cypress
stark hearth
#

oh it has to be like attachment://image.png

stark hearth
proven elm
#

like this?
embedVar.set_image(url='attachment://UDMLogo.png')

quiet coral
#

hey how can I make a command usable in a specific channel ???

proven elm
stark hearth
#

hmm

#

error?

proven elm
proven elm
#

doesnt send anything when I do .help

slate swan
#

hello guys, i am a new . can anyone help me. the question is ( how i need learn python for cyber security and pentesting? any books? web ?

dusk pumice
#

bot.remove_command("help")

#

cahnge it to clint

quiet coral
left dove
jovial cypress
#

i think i did something rightish now there is yet another syntax

slate swan
#

@dusk pumice hello

proven elm
dusk pumice
#

opps wrong typing

jovial cypress
#

lol

left dove
dusk pumice
#

client.remove_command("help")

#

c or C

#

try it!

left dove
#

mate can u copy paste the code here

#

its full of mistakes

proven elm
dusk pumice
#

ok~~

jovial cypress
#

import discord
import os

client = discord.Client()

@client.event
async def on_ready():
print ('''we have logged in as {0.user} '''.format (client))
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith ('$fallout'):
await message.channel.send('beginning fallout procedures adios amigos')

  client.run(os.environ('MATTHEW PASSWORD'))\
jovial cypress
proven elm
stark hearth
#

try this import the image to discord and copy the link to url @proven elm

#

or any image link service

proven elm
#

ight

left dove
#
import discord
import os

client = discord.Client()

@client.event
async def on_ready():
  print ('''we have logged in as {0.user} '''.format (client))
@client.event
async def on_message(message):
   if message.author == client.user:
     return
    if message.content.startswith ('$fallout'):
      await message.channel.send('beginning fallout procedures adios amigos')

client.run(os.environ('MATTHEW PASSWORD'))```
stark hearth
left dove
#

and also u defined the client.event decorator inside another client.event decorator thats not right @jovial cypress

stark hearth
#

@proven elm sorry for delay because im doing my essay at the same time

proven elm
#

no worries bro

dusk pumice
#

Got to go

#

Cya

#

👍

proven elm
#
    embedVar.set_footer('UDM Staff Bot ‱', current_time)
    embedVar.set_image(url='https://ibb.co/JFvtMWN')
    await ctx.send(embed=embedVar)

still not working

proven elm
# left dove whats ur error?

none, no error at all but when I add the embedVar.setfooter and set_image it just doesnt send anything, if I remove those two lines then it will send the text

left dove
#

did u defined embedVar object?

proven elm
#
@client.command()
async def help(ctx):
    embedVar = discord.Embed(description='''**Commands Help!**\n\n**➀Prefix(.)**\n**
    ➀All the commands within this bot include**\n\n➀.help\n➀.Ping\n➀.locklist
    ➀.staffapp\n➀.clear\n➀.8ball\n➀.addrole\n➀.kick\n➀.ban ''', color=0x2AD7B6)
    embedVar.set_footer('UDM Staff Bot ‱', current_time)
    embedVar.set_image(url='https://ibb.co/JFvtMWN')
    await ctx.send(embed=embedVar)
#

full code

left dove
#

hmm`

#

any error msg came in console?

proven elm
#

Nope

left dove
#

but bot send embed send but img not coming?

proven elm
#

nah nothing sends

#

at all, nothing whatsoever

left dove
#

wait whta

proven elm
#

but if I remove those 2 lines then it sends

left dove
#

whats ur bot prefix?

left dove
proven elm
slate swan
#

Guys I need some help. Anyone have any alternate suggestions for the on_reaction_add event, the issue with this reaction event is it only activates the function to messages sent AFTER the bot was turned on not before.

left dove
#

u have anything decorator like

@help.error
#

?

proven elm
#

nah don't have that

left dove
#

mate the url ur providing is not raw img

proven elm
proven elm
stark hearth
left dove
#

try anyother google img

stark hearth
proven elm
#

oh thank you

left dove
stark hearth
stark hearth
proven elm
#

I use it to loop through activity statuses

stark hearth
proven elm
#

also still doesnt send image

stark hearth
#

code again?

left dove
#

maybe send code again

proven elm
#
@client.command()
async def help(ctx):
    embedVar = discord.Embed(description='''**Commands Help!**\n\n**➀Prefix(.)**\n**
    ➀All the commands within this bot include**\n\n➀.help\n➀.Ping\n➀.locklist
    ➀.staffapp\n➀.clear\n➀.8ball\n➀.addrole\n➀.kick\n➀.ban ''', color=0x2AD7B6)
    embedVar.set_footer('UDM Staff Bot ‱', current_time)
    embedVar.set_image(url='https://i.ibb.co/gFS9BbG/UDMLogo.png')
    await channel.send(embed=embedVar)
    await ctx.send(embed=embedVar)
stark hearth
#

did you save?

outer violet
#

i finished my calculator buttons command and i just tried it but whenver i put a symbol or another number it gives me this, idk whats happening

stark hearth
proven elm
#

the file? yes

stark hearth
stark hearth
#

just do await ctx.send(embed=embedVar)

proven elm
slate swan
#

..

#

@stark hearth channel is not defined

proven elm
slate swan
#

that's gonna give him an error

left dove
slate swan
#

are u good?

stark hearth
slate swan
left dove
proven elm
left dove
#

ctx.send is enough

proven elm
#

still doesnt send an embed image

stark hearth
left dove
#

his problem is in embed image not coming

slate swan
stark hearth
#

also i am sleep deprived over this essay

final iron
final iron
#

So you would add timestamp=ctx.message.created_at

stark hearth
slate swan
#

the reply pings me u dont have to do it twice.

proven elm
stark hearth
slate swan
#

but anyways

hasty iron
#

whats the issue here

proven elm
#

still doesnt send embed image

slate swan
#

!discord.Embed.set_image

#

!d discord.Embed.set_image

unkempt canyonBOT
#

set_image(*, url)```
Sets the image for the embed content.

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

Changed in version 1.4: Passing [`Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty") removes the image.
hasty iron
proven elm
#
@client.command()
async def help(ctx):
    embedVar = discord.Embed(description='''**Commands Help!**\n\n**➀Prefix(.)**\n**
    ➀All the commands within this bot include**\n\n➀.help\n➀.Ping\n➀.locklist
    ➀.staffapp\n➀.clear\n➀.8ball\n➀.addrole\n➀.kick\n➀.ban ''', color=0x2AD7B6)
    embedVar.set_footer('UDM Staff Bot ‱')
    embedVar.set_image(url='https://i.ibb.co/gFS9BbG/UDMLogo.png')
    await ctx.send(embed=embedVar)

this code isnt sending embed image

hasty iron
#

does it send the embed without the image or the whole embed isnt getting sent

hasty iron
#

no errors?

#

oh right

#

!d discord.Embed.set_footer

unkempt canyonBOT
#

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

This function returns the class instance to allow for fluent-style chaining.
hasty iron
#

takes only kwargs

slate swan
#

thats for icon url bruh

hasty iron
#

yeah and text is useless

proven elm
#

so how do I solve my issue?

slate swan
#

But set_image takes https: images???

hasty iron
#

set_footer takes only kwargs and their passing in it as positional

slate swan
hasty iron
#

set_footer(text=
)

proven elm
#

text= ?

hasty iron
#

whatever you want

left dove
hasty iron
#

do you know what a kwarg is

#

keyword argument

proven elm
hasty iron
#

then you should know how it works

proven elm
#

still sends nothing

#

text='adihawidhaw'

slate swan
proven elm
#

sends nothing, nothing happens

hasty iron
#

Embed.set_footer takes only kwargs

hasty iron
#

kwargs is an abbreviation for keyword arguments

slate swan
#

ik... i just said that?

terse slate
#

Hello guys I want to learn python to code some discord bots, how much knowledge of python would you guys say is needed in order to start with discord library? Maybe the basic level of python? Or go in depth with python and then move on?

hasty iron
hasty iron
# terse slate Hello guys I want to learn python to code some discord bots, how much knowledge ...

How much Python do I need to know?

discord.py is ultimately a complicated Python library for beginners. There are many concepts in there that can trip a beginner up and could be confusing. The design of the library is to be easy to use -- however the target audience for the library is not complete beginners of Python.

With that being said, beginners tend to use this library quite liberally anyway and while I appreciate the endeavour and tenacity it should be noted that asking for help here does take up the valuable time of volunteers. As a result certain knowledge is required before you can actively participate in the help channels:

  • The difference between instances and class attributes.
    • e.g. guild.name vs discord.Guild.name or any variation of these.
  • How to use data structures in the language.
    • dict/tuple/list/str/...
  • How to solve NameError or SyntaxError exceptions.
  • How to read and understand tracebacks.

This list is not exhaustive

If these concepts are confusing -- please feel free to complete a smaller and simpler project first before diving into the complexities that is asynchronous programming in Python. The Python help channel (#738572311107469354) or the Python server (https://discord.gg/python) could also be a place to go for basic Python help.

proven elm
#
@client.command()
async def help(ctx):
    embedVar = discord.Embed(description='''**Commands Help!**\n\n**➀Prefix(.)**\n**
    ➀All the commands within this bot include**\n\n➀.help\n➀.Ping\n➀.locklist
    ➀.staffapp\n➀.clear\n➀.8ball\n➀.addrole\n➀.kick\n➀.ban ''', color=0x2AD7B6)
    embedVar.set_footer(text='UDM Staff Bot ‱')
 embedVar.set_image(text='awdawd',url='https://i.ibb.co/gFS9BbG/UDMLogo.png')
    await ctx.send(embed=embedVar)
left dove
hasty iron
#

you dont need to know apis

terse slate
#

i want to use the bot to interact with google sheets, isnt that an api?

left dove
hasty iron
#

?

slate swan
hasty iron
hasty iron
left dove
hasty iron
left dove
hasty iron
#

i think you mean, "how to read docs"

slate swan
stark hearth
#

!d discord.Embed.set_image

unkempt canyonBOT
#

set_image(*, url)```
Sets the image for the embed content.

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

Changed in version 1.4: Passing [`Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty") removes the image.
slate swan
#

its like connections between a program and the code

#

for example.. modules

proven elm
slate swan
#

they have an api, that's how its able to work within python to begin with

hasty iron
unkempt canyonBOT
#

Pasting large amounts of code

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

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

hasty iron
#

like everything

slate swan
left dove
hasty iron
#

that should be obvious

slate swan
#

BRO READ THE WHOEL THING BEFORE U SAY SUM

left dove
#

ok

stark hearth
hasty iron
proven elm
hasty iron
#

it can be anything

slate swan
#

a connection between the program and the computer

#

tell me im wrong rn .-.

terse slate
#

what is the optimal way to learn python? i was looking for online courses in datacamp, udemy, etc. I dont know if theres a better option to learn

slate swan
#

thats the most splified i can give u

hasty iron
slate swan
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.

slate swan
#

Once I learned everything I should be learning, like statements, variables, classes, other instances, error handling, traceback

proven elm
#

@hasty iron

slate swan
#

I just kinda came into discord.py and see what's good using the API reference

visual island
proven elm
#

ill remove it

left dove
stark hearth
left dove
#

remove it

hasty iron
left dove
proven elm
#

FINALLY IT WORKS!!

slate swan
#

what are u passing set_image...

left dove
proven elm
#

now how do I place the image in the footer instead

slate swan
#

!d discord.Embed.set_image

unkempt canyonBOT
#

set_image(*, url)```
Sets the image for the embed content.

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

Changed in version 1.4: Passing [`Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty") removes the image.
stark hearth
slate swan
#

url is the only kwargs

hasty iron
unkempt canyonBOT
#

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

This function returns the class instance to allow for fluent-style chaining.
terse slate
hasty iron
left dove
hasty iron
#

again, its a kwarg

slate swan
left dove
stark hearth
#

read docs for kwargs @proven elm

terse slate
stark hearth
hasty iron
#

they are talking about python not dpy

stark hearth
#

use free interactive services like freecodecamp

hasty iron
#

videos for python are mostly fine, but you should do your own research, like reading python docs

stark hearth
#

they have videos and interactive practices for you

proven elm
#

image looks kinda cut off?

left dove
stark hearth
left dove
hasty iron
#

blame discord

proven elm
#

ight nw thank you guys

terse slate
#

ok thank you guys

left dove
stark hearth
left dove
#

lol then why blaming

slate swan
#

u cant do nun about that

stark hearth
hasty iron
#

it was meant as a joke but ok

left dove
#

hmm

slate swan
#

u cant edit image sizes in set_footer

left dove
#

no

slate swan
#

no kwags support it

left dove
#

maybe edit a pic to that pixel and use it

slate swan
#

there are no kwargs in it that lets u do this*

stark hearth
#

the Travel right?

mental tartan
#

yeah

stark hearth
#

countries = random.choice(Travel)

jaunty sparrow
#

wrap the expression in {} like in other places in the string

#

The {} in an f-string makes it evaluate it

#

rather than show it literally

left dove
mental tartan
stark hearth
#

zig came in clutch

#

i am too stupid and tired to think of that

#

gtg byee

left dove
#

bye

flat solstice
#

Is this the correct way to get my bot to copy and send each embed in a msg starting from the second one (sending the first one in a different msg)py await ctx.reply(content = plain, embed = embed[0].copy(), components = [action_row]) if len(message.embeds) > 0: for embed in message.embeds[1:]: await ctx.reply(embed = embed.copy())

wicked atlas
#

Either way, you shouldn't need to use copy

boreal ravine
quiet coral
#

Hello is it better to use events or commands?

little ether
patent lark
quiet coral
#

if I wanted my commands to run in one channel can I make just one if statement or I have to write the if statement for every command?

patent lark
#

you could write a function, or make your own decorator for it

quiet coral
visual island
#

um, how do you hide a cog? Is hidden a thing in Cog?

fallow mauve
#

this command isnt working, any idea why?

patent lark
#

looks fine to me, do you have an on_message event?

fallow mauve
#

no

#

wait

patent lark
#

any errors when you run the command?

fallow mauve
#

no errors

#

should i send the full code?

patent lark
#

yeah

fallow mauve
lament mesa
fallow mauve
patent lark
fallow mauve
#

mhm

visual island
fallow mauve
patent lark
#

you need to process commands probably

visual island
#

and hidden = True raises TypeError: __init_subclass__() takes no keyword arguments

lament mesa
patent lark
#

await bot.process_commands(message)

lament mesa
maiden fable
#

!d discord.ext.commands.CogMeta

unkempt canyonBOT
#

class discord.ext.commands.CogMeta(*args, **kwargs)```
A metaclass for defining a cog.

Note that you should probably not use this directly. It is exposed purely for documentation purposes along with making custom metaclasses to intermix with other metaclasses such as the [`abc.ABCMeta`](https://docs.python.org/3/library/abc.html#abc.ABCMeta "(in Python v3.9)") metaclass.

For example, to create an abstract cog mixin class, the following would be done...
fallow mauve
maiden fable
#

Try seeing that. It has the args

little ether
patent lark
lament mesa
#

It only takes command_attrs, name and description

surreal creek
patent lark
#

make sure its not under any if conditions either

maiden fable
patent lark
maiden fable
#

@bot.listen() instead of @bot.event

lament mesa
#

You can set your own hidden attribute though @visual island

maiden fable
visual island
#

Ill probably make my own metaclass potatothink

lament mesa
#

yeah

fallow mauve
#

is this right?

maiden fable
#

No

#

Just remove that line and change the deco

fallow mauve
#

deco?

maiden fable
#

From @bot.event to @bot.listen()

#

Ezzzzz

little ether
maiden fable
#

Yea that ^^^
My bad

fallow mauve
surreal creek
fallow mauve
#

nobody had done that yet

maiden fable
#

Ah

#

Well dpy is all about decos

fallow mauve
#

command "say" still not found

maiden fable
#

Show code

#

Did u do @bot.command()?

surreal creek
maiden fable
fallow mauve
maiden fable
#

I know why

fallow mauve
fallow mauve
maiden fable
#

The command name is <say (ctx

#

Cz that's what u specified in the deco

#

Try running with this name

fallow mauve
#

?

#

im lost

little ether
muted cosmos
fallow mauve
#

this pops up now

#

how fix?

muted cosmos
#

oh lol

fallow mauve
#

nvm

little ether
little ether
# fallow mauve this?

remove the <, just put say in there, or just leave it empty cuz the func name is already say , d.py will do the command processing, you don't need to add the prefix in the command name

patent lark
muted cosmos
#

whats the difference between .listen() and .event?

fallow mauve
#

y'all are really helping me a lot, ive learned so much about python in the last few days

patent lark
# muted cosmos whats the difference between .listen() and .event?

when you listen for an event, you can specify the event you listen to, @bot.listen("function_name") and then you could define the function as anything you want, i dont know too much about the benefits, but i know that with on_message it removes your requirement to process commands, and its good when you want mutliple on_message events.

muted cosmos
#

oh i see

#

thx, im gonna implement that on my dpy

patent lark
#

no problem

fallow mauve
#

im making this bot to help in the discord server for my friend's mc SMP and im trying to learn python as i make it, so thx for helping me with this, i rly appreciate it

patent lark
#

👍

slate swan
#

I wanna get a list of the guild names that my bot is connected to..

Here is my code: py @bot.event async def on_ready(): for guilds in bot.guilds: print(guilds.name)

But the code gives error: 'Guilds' is not iterable

Please help

fallow mauve
#

never used guilds, sry

slate swan
#

:(

fallow mauve
#

*in code

maiden fable
red forge
#

just watch a tutorial on youtube like how to add options to slash commands in discordpy examle /add num1 num2

patent lark
maiden fable
#

Yea

crystal wind
#

I actually write my discord bot code in replit, although I was wondering if you could play an mp3 file from the bot in VC, by playing the mp3 file that was locally given on replit.

soft radish
#

this wat i meant

boreal ravine
#

I know.

tiny ibex
boreal ravine
#

thats what I just said

tiny ibex
crystal wind
#

I know you can do something like this, although I'm not sure how am I supposed to implement it on a command. Most of the tutorials are referring to youtube_dl, but we can't do that anymore.

ocean leaf
#

can we mention someone in discord embed title?

boreal ravine
#

The title is fully MD'd

ocean leaf
lyric moat
#

i tried making a make embed command but how do i added image?

@client.command()
async def make_embed(ctx):
    def check(message):
        return message.author == ctx.author and message.channel == ctx.channel

    await ctx.send('Waiting for a title')
    title = await client.wait_for('message', check=check)
  
    await ctx.send('Waiting for a description')
    desc = await client.wait_for('message', check=check)
    
    await ctx.send('Waiting for a Image')
    image = await client.wait_for('link', check=check)

    embed = discord.Embed(title=title.content, description=desc.content,image=image.content,color=0x2f3136)
    await ctx.send(embed=embed)```
ocean leaf
#

any mistake?

supple thorn
#

Color

ocean leaf
slate swan
supple thorn
ocean leaf
slate swan
#

!d discord.Colour

unkempt canyonBOT
#

class discord.Colour(value)```
Represents a Discord role colour. This class is similar to a (red, green, blue) [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)").

There is an alias for this called Color...
slate swan
#

title="whatever", colour=..

ocean leaf
unkempt canyonBOT
#

set_image(*, url)```
Sets the image for the embed content.

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

Changed in version 1.4: Passing [`Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty") removes the image.
ocean leaf
slate swan
#

you can use either

lyric moat
slate swan
slate swan
lyric moat
slate swan
lyric moat
#

Ik that but its a custom embed it makes the embed for you in chat

slate swan
#

also , if the user enters a wrong url , whole embed fails so make sure to use try and except

lyric moat
slate swan
#

read the docs of set_image

#

set_image is a function

#

its not a parameter

#

is a function

#

^

#
embed = discord.Embed(title = title.content, description = desc.content, color = 0x2f3136)
embed.set_image(url = image.content)
wintry ledge
#

if this isnt the proper place to message this, i am sorry

unkempt canyonBOT
#

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

wintry ledge
#

Sorry

boreal ravine
boreal ravine
# lyric moat error

You could do ```py
embed=discord.Embed(title=title.content, description=description.content, color=0x2f3136).set_image(url=image.content)

lyric moat
#

does not work

ocean leaf
#

isn't this how we import cogs?

stark hearth
#

also it has to be commands. in load extension

slate swan
stark hearth
ocean leaf
slate swan
#

It should commands.{filename.


stark hearth
mental cairn
#

is it possible for discord bots to ignore mentions from replies?

ocean leaf
#

what is this? it can't recognize

slate swan
mental cairn
#

oh alright thanks

ocean leaf
slate swan
ocean leaf
#

it is in commands folder

slate swan
#

It's replit?

ocean leaf
#

yes

slate swan
#

Aah idk

ocean leaf
#

i think it works in the same way as in vscode or any other ide

slate swan
slate swan
#

it a error in the cog

ocean leaf
slate swan
#

something is wrong with the code in the cog

#

literally the error

slate swan
ocean leaf
#

yes

slate swan
#

Send cog code here

ocean leaf
#

ok

slate swan
#

"Extension 'commands.warn raised an error:"

ocean leaf
#
import discord
from discord.ext import commands
import pymongo
from pymongo import MongoClient

cluster = MongoClient('mongodb url')
database = cluster['discord']
collection = database['warn-database']

class Warn(commands.Cog):
  def __init__(self, client):
    self.client = client

  # command
  @commands.command()
  @commands.has_permissions(manage_channels = True)
  async def warn(self, ctx, user: discord.Member = None, *, reason=None):
    id = user.id
    if collection.count_documents({"memberid": id}) == 0:
      collection.insert_one({"memberid":id, "warns": 0})

    if reason == None:
      return await ctx.send('Please mention a valid reason!')
    elif user == None:
      return await ctx.send('Please mention a member to warn!')

    warn_count = collection.find_one({'memberid':id})

    count = warn_count['warns']

    new_count = count + 1

    collection.update_one({'memberid':id}, {'$set':{'warns':new_count}})

    warn_embed = discord.Embed(
      title = f'Successfully warned {user.name}',
      colour = discord.Colour.red()
    )
    
    warn_embed.add_field(name = 'Reason', value = reason, inline = False)
    warn_embed.add_field(name = 'Warned by', value = ctx.author.name, inline = False)
    warn_embed.add_field(name = 'Total warnings', value = new_count, inline = False)

    await ctx.send(embed = warn_embed)

def setup(client):
  client.add_cog(Warn(client))
#

the cog

little ether
ocean leaf
little ether
ocean leaf
#

i just copied and pasted the url from mongodb and changed the <password> with my password

#

without space

#

i think it is correct

#

it is correct

#

i chacked

mental cairn
ocean leaf
#

have u made the boolean?

mental cairn
#

i want it to ignore reply mentions

mental cairn
ocean leaf
#

make it

#

thats whi it says

#

also

#

if u want the bot to reply but it will not tag him

mental cairn
#

thts not what im saying, ive my bot reply to mentions with its syntax and help command, and i want it to ignore mentions that are from replies

ocean leaf
#

idk really but ig it is await message.reply(mention_author = False)

mental cairn
#

but thats for making the bot reply

#

right?

ocean leaf
#

yes

mental cairn
#

im not talking about that

mental cairn
#

you know how when u mention bots, they reply with what their prefix is

ocean leaf
#

yes

mental cairn
#

my bot does that, and i want it to ignore mentions that are from replies

ocean leaf
#

ok

mental cairn
#

is that possible?

ocean leaf
#

so i think it is

#

is there message.type? idk

#

wait

#

lemme see docs

#

this can help

slate swan
#

would this work

slate swan
amber stratus
#

Hello i had a small doubt

#

I want my bot to send the message in one line itself

#

but it says the message.send() takes only one argument

slate swan
amber stratus
#

sure

#
if message.content=="/hello":
        await message.channel.send("Hello there!")
        await message.channel.send(a)```
#

I want to send it in one message

unkempt canyonBOT
#

Creating a Python string with your variables using the + operator can be difficult to write and read. F-strings (format-strings) make it easy to insert values into a string. If you put an f in front of the first quote, you can then put Python expressions between curly braces in the string.

>>> snake = "pythons"
>>> number = 21
>>> f"There are {number * 2} {snake} on the plane."
"There are 42 pythons on the plane."

Note that even when you include an expression that isn't a string, like number * 2, Python will convert it to a string for you.

slate swan
#

Does this help?

#

Also think on making commands instead of waiting for a message

#

As rather soon you won't be able to do it, message intents will be there.

amber stratus
#

Thanks a lot it worked

amber stratus
slate swan
slate swan
amber stratus
#

Also everyone here uses pycord right

slate swan
#

oh yea

so before.guild will work though right*

#

yep

slate swan
#

i dont trust any forks of dpy as of rn

#

thanks

boreal ravine
amber stratus
#

Nice

amber stratus
slate swan
#

nop not until 1 of them standsout

#

also

boreal ravine
slate swan
#

also i dont think bots will be a thing anymore in 2023

slate swan
#

discords making bots use slash commands and adding message intents in 2022 what will you think they add or remove in 2023

#

also