Browse Source

Removed storage related comands

pull/59/head
Jari (LotU) 8 years ago
committed by GitHub
parent
commit
bdb047af85
  1. 24
      examples/basic_plugin.py

24
examples/basic_plugin.py

@ -57,20 +57,6 @@ class BasicPlugin(Plugin):
def on_math_sub_command(self, event, a, b): def on_math_sub_command(self, event, a, b):
event.msg.reply('{}'.format(a - b)) event.msg.reply('{}'.format(a - b))
@Plugin.command('tag', '<name:str> [value:str...]')
def on_tag(self, event, name, value=None):
# Plugins can easily store data locally using Disco's built in storage
tags = self.storage.guild.ensure('tags')
if value:
tags[name] = value
event.msg.reply(u':ok_hand: created tag `{}`'.format(S(name)))
else:
if name in tags:
return event.msg.reply(tags[name])
else:
return event.msg.reply(u'Unknown tag: `{}`'.format(S(name)))
@Plugin.command('test', parser=True) @Plugin.command('test', parser=True)
@Plugin.parser.add_argument('-a', '--asdf', help='wow') @Plugin.parser.add_argument('-a', '--asdf', help='wow')
@Plugin.parser.add_argument('--help', action='store_true') @Plugin.parser.add_argument('--help', action='store_true')
@ -80,13 +66,3 @@ class BasicPlugin(Plugin):
if args.help: if args.help:
return event.msg.reply(event.parser.format_help()) return event.msg.reply(event.parser.format_help())
event.msg.reply(args.asdf) event.msg.reply(args.asdf)
"""
@Plugin.route('/test')
def on_test_route(self):
# Disco has built-in support for Flask (if installed and enabled) which
# allows plugins to create HTTP routes.
from flask import request
print dict(request.headers)
return 'Hi!'
"""

Loading…
Cancel
Save