K
K
kopatych37562021-10-26 00:19:09
Python
kopatych3756, 2021-10-26 00:19:09

Writes two messages instead of one. What to do?

What to do bot sends two or three identical messages instead of one. What to do?
import discord

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):
    message.content = message.content.lower()
    if message.author == client.user:
        return

    if message.content == ('ghbdtn' or 'ghbdtn!' or 'ghbdtn)'):
        await message.channel.send(f'>>> **_{message.author}_  хотел сказать:**  Привет!')
        await message.delete()
    if message.content == ('gjrf' or 'gjrf!' or 'gjrf)'):
        await message.channel.send(f'>>> **_{message.author}_  хотел сказать:**  Пока!')
        await message.delete()
    if message.content == ('cgc' or 'cgc!' or 'cgc)' or 'cgfcb,j' or 'cgfcb,j!' or 'cgfcb,j)'):
        await message.channel.send(f'>>> **_{message.author}_  хотел сказать:**  Спасибо!')
        await message.delete()
    if message.content == ('rfr ltkf' or 'rfr ltkf?' or 'rfr ltkf)' or 'rfr ltkf,' or 'rfr ltkbirb'):
        await message.channel.send(f'>>> **_{message.author}_  хотел сказать:**  Как дела?')
        await message.delete()

client.run('token')


And such error gets out.

Ignoring exception in on_message
Traceback (most recent call last):
  File "D:\Play\Project\discord-bot\venv\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "D:\Play\Project\discord-bot\main.py", line 21, in on_message
    await message.delete()
  File "D:\Play\Project\discord-bot\venv\lib\site-packages\discord\message.py", line 1023, in delete
    await self._state.http.delete_message(self.channel.id, self.id)
  File "D:\Play\Project\discord-bot\venv\lib\site-packages\discord\http.py", line 250, in request
    raise NotFound(r, data)
discord.errors.NotFound: 404 Not Found (error code: 10008): Unknown Message

Answer the question

In order to leave comments, you need to log in

5 answer(s)
S
shurshur, 2021-10-26
@kopatych3756

A record of the form: indicates a complete ignorance of the Python language. Accordingly, without knowing the language, nothing good can be written. Great happiness that this code at least does not control nuclear warheads. You have to start with the basics.
if xxx == ('a' or 'b' or 'c'):

S
Simple Developer, 2021-10-26
@Andriy-Kosmenyuk

message_content in ("first_string", "second_string")

X
xmoonlight, 2015-01-14
@xmoonlight

This is better not to do.
Get Raphael.js...

N
Nikolai Novosad, 2015-01-15
@nik_neman

Thanks for answers.
Those. if I have a file called A Postscript File with the name name.ai, is there already a ready-made map?
Embed it in html with <img>?

D
Dmitry Shishkin, 2015-01-15
@aerohorn

Can be done on D3 . There is also a jQuery library for drawing maps - jQuery Mapael

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question