Dispy - package for creating bots
Project description
Dispy
Advantages
- Package for
async/await
support - Registering events with wrappers
- Easy code with syntax sugar
Needs minimal 3.8 python version
Dispy is package for creating bots in Discord. This package use discord API and discord Gateway for handle events or, for example, sending messages. Bot use for different goals; handle information on your server, creating mini games in discord, auto moderation in your discord server and other. For example, you can send messages use this code:
import disspy # Import package
bot = disspy.DisBot(token="YOUR_TOKEN", application_id=00000) # Create a bot
async def test(): # Send messages needs to execute in the async function
channel_id = 000000 # Yours channel id
channel = bot.get_channel(channel_id) # Get the channel for sending to this channel a message
await channel.send(content="Message!") # Sending a message
if __name__ == '__main__': # If file is started as a main file
from asyncio import run # Import asyncio.run
run(test()) # Run async function
Download package
Download stable version
# Windows
pip install --upgrade disspy
# MacOS
py3 -m pip install --upgrade disspy
# Linux
sudo pip install --upgrade disspy
Download dev version
git clone https://github.com/itttgg/dispy.git
cd dispy
pip install --upgrade .
Links
https://github.com/itttgg/dispy - GitHub repo
https://pypi.org/project/disspy - Project site on PyPi
https://dispy-api-docs.readthedocs.io/en/latest - Site with docs for package
Using
Creating and running bot
import disspy
bot = disspy.DisBot(token="YOUR_TOKEN")
bot.run()
bot.on("ready")
import disspy
bot = disspy.DisBot(token="YOUR_TOKEN")
@bot.on("ready")
async def on_ready():
print("Ready!")
bot.run()
bot.on("messagec")
message create event
import disspy
bot = disspy.DisBot(token="YOUR_TOKEN", flags=disspy.DisFlags.messages())
@bot.on("messagec")
async def on_messagec(message: disspy.DisMessage):
await message.channel.send("Content: " + message.content)
bot.run()
bot.on("messageu")
message update event
import disspy
bot = disspy.DisBot(token="YOUR_TOKEN", flags=disspy.DisFlags.messages())
@bot.on("messageu")
async def on_messageu(message: disspy.DisMessage):
await message.channel.send("New content of message: " + message.content)
bot.run()
bot.on("messaged")
message delete event
import disspy
bot = disspy.DisBot(token="YOUR_TOKEN", flags=disspy.DisFlags.messages())
@bot.on("messaged")
async def on_messaged(e: disspy.MessageDeleteEvent):
await e.channel.send("You deleted message!")
bot.run()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
disspy-0.5.3.2.tar.gz
(29.1 kB
view hashes)