New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

wumpy-bot

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wumpy-bot

Highly abstracted and easy to use wrapper over the Wumpy project

  • 0.1.0
  • PyPI
  • Socket score

Maintainers
1

Wumpy-bot

Easy to use high abstraction over other Wumpy subpackages.

This is the most beginner-friendly way to use Wumpy, and provides all features of the Discord API. This is the primary package installed from PyPI when you only specify wumpy.

Getting started

All official Wumpy projects prioritise both asyncio and Trio support so you can run the bot under either:

import anyio
from wumpy.bot import Bot


bot = Bot('ABC123.XYZ789')  # Replace with your token and keep it safe!

# This runs the bot with Trio as the event loop (recommended),
# use backend='asyncio' to run it under asyncio.
anyio.run(bot.run, backend='trio')

Registering listeners

Continuing from the previous code, you can register listeners for Discord events using Wumpy's rich event listeners:

import anyio
from wumpy.bot import Bot
from wumpy.bot.events import MessageDeleteEvent


bot = Bot('ABC123.XYZ789')


@bot.listener()
async def log_deleted_messages(event: MessageDeleteEvent):
    print(f'Message {event.message_id} in {event.channel_id} was deleted')


anyio.run(bot.run, backend='trio')

The listener is registered with the @bot.listener() decorator, which tells Wumpy to read the annotation of the first parameter (name does not matter, but here it is called event) and register that function for the type of event that it is typehinted as.

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc