Last active
December 12, 2015 13:59
-
-
Save NuckChorris/4782283 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require_relative 'sold/module' | |
| class System < Sold::Module | |
| name 'System' | |
| description 'Commands for managing the bot.' | |
| help :restart, 'Restarts the bot.' | |
| command :restart do |args| | |
| respond 'Restarting...' | |
| exit 1 | |
| end | |
| help :shutdown, 'Shuts the bot down.' | |
| command :shutdown do |args| | |
| respond 'Shutting down...' | |
| exit 0 | |
| end | |
| on :recv_msg do |pkt| | |
| p pkt | |
| end | |
| on :mod_load do | |
| # Connect to database, etc. | |
| end | |
| on :mod_unload do | |
| # Close database connection, collect garbage, etc. | |
| # events and commands are automatically dealt with, | |
| # so you don't have to explicitly clean them up. | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment