R
R
Romeo5582022-04-06 15:06:37
Python
Romeo558, 2022-04-06 15:06:37

How to send a message to all server admins where there is a message bot (discord.py)?

I have a discord bot on ~4 servers at the same time. I often update the bot and fix bugs, add new features. I had an idea to create messages to server moderators about an upcoming or upcoming update. For example, there is a message text and you need to confirm this through the console. I know about the " await asyncio.run_coroutine_threadsafe()" method, but I don't know how to apply it correctly.
Here is a small code example:

async def send_up_to_date_message():
    update_message = f''''''
    owners =  #админы серверов
    owners.send()
@bot.command()
@commands.has_permissions(administrator = True)
async def send_update_message():
    answer = input('Вы действительно хотите отправить сообщение о обновлении бота?   ')
    if answer == 'yes':
        await asyncio.run_coroutine_threadsafe(send_update_message)

(I know it's buggy and not complete, I'm just pasting it as an example.)
Question: how do I list all server admins and how can they send a PM message at the same time?
Almost all (did not check) more or less good bots or start-up projects have this. Help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Shandy, 2022-04-08
@Romeo558

This is not a good idea. Sending a PM to a large group of people may exceed the request limit. It is better to limit yourself to sending a message to a private channel using a webhook

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question