简体   繁体   中英

Using Python to send messages in Discord

Is it possible to make a Python program that sends messages in a Discord chat every 2 minutes, but without other users being able to see that it is a program?

This can be useful https://newbedev.com/discord-python-send-message-code-example

Here's how to send messages in a discord using python.

You can make a bot to send message every two minutes using the below code

from discord.ext import commands,tasks
@tasks.loop(seconds=120)
async def determine_winner():
  message=#Message to be sent
  channel_id=#Gives the id of channel where to send
  client.get_channel(channel_id).send(message)

If you want to send this message in multiple channel. You should get the id of each channel where the message to be sent and store it in database or json file and fetch it at the time of sending the message.
But self-botting is against discord'sTOS if they found you self-botting they will ban you from discord permanently

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM