Removed DocOptDict alias

This commit is contained in:
mrhanky 2017-08-22 15:57:57 +02:00
parent c9f0c1b616
commit 467c2139ed
No known key found for this signature in database
GPG Key ID: 67D772C481CB41B8
15 changed files with 56 additions and 59 deletions

View File

@ -2,8 +2,7 @@
import logging
import irc3
# noinspection PyPackageRequirements
from docopt import Dict as DocOptDict
from docopt import Dict
from irc3.plugins.command import command
from irc3.utils import IrcString
@ -13,8 +12,7 @@ logger = logging.getLogger(__name__)
@command(permission='admin', show_in_help_list=False)
def reload(bot: irc3.IrcBot, mask: IrcString, target: IrcString,
args: DocOptDict):
def reload(bot: irc3.IrcBot, mask: IrcString, target: IrcString, args: Dict):
"""Reloads a plugin or the whole bot.
%%reload [<plugin>]

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import irc3
import requests
from docopt import Dict as DocOptDict
from docopt import Dict
from irc3.plugins.command import command
from irc3.utils import IrcString
@ -21,7 +21,7 @@ class Coins(Plugin):
}
@command
def btc(self, mask: IrcString, target: IrcString, args: DocOptDict):
def btc(self, mask: IrcString, target: IrcString, args: Dict):
"""Gets the Bitcoin values from cryptowatch.
%%btc [<currency>]
@ -29,14 +29,14 @@ class Coins(Plugin):
return self.cryptowat_summary('btc', args)
@command
def eth(self, mask: IrcString, target: IrcString, args: DocOptDict):
def eth(self, mask: IrcString, target: IrcString, args: Dict):
"""Gets the Ethereum values from cryptowatch.
%%eth [<currency>]
"""
return self.cryptowat_summary('eth', args)
def cryptowat_summary(self, crypto: str, args: DocOptDict):
def cryptowat_summary(self, crypto: str, args: Dict):
currency = args.get('<currency>', 'usd')
if currency not in self.CURRENCIES or crypto == currency:

View File

@ -2,7 +2,7 @@
import time
import irc3
from docopt import Dict as DocOptDict
from docopt import Dict
from irc3.plugins.command import command
from irc3.utils import IrcString
@ -20,7 +20,7 @@ class CTCP(Plugin):
def _ctcp(self, name: str, nick: str, reply: str):
return '\x02[{}]\x02 {}: {}'.format(name.upper(), nick, reply)
async def ctcp(self, name: str, mask: IrcString, args: DocOptDict):
async def ctcp(self, name: str, mask: IrcString, args: Dict):
nick = args.get('<nick>', mask.nick)
data = await self.bot.ctcp_async(nick, name.upper(), self.TIMEOUT)
@ -34,7 +34,7 @@ class CTCP(Plugin):
return self._ctcp(name, nick, reply)
@command
async def ping(self, mask: IrcString, target: IrcString, args: DocOptDict):
async def ping(self, mask: IrcString, target: IrcString, args: Dict):
"""Sends ping via CTCP to user and sends the time needed
%%ping [<nick>]
@ -58,7 +58,7 @@ class CTCP(Plugin):
return self._ctcp('ping', nick, reply)
@command
async def time(self, mask: IrcString, target: IrcString, args: DocOptDict):
async def time(self, mask: IrcString, target: IrcString, args: Dict):
"""Gets the client time from nick via CTCP
%%time [<nick>]
@ -66,7 +66,7 @@ class CTCP(Plugin):
return await self.ctcp('time', mask, args)
@command
async def ver(self, mask: IrcString, target: IrcString, args: DocOptDict):
async def ver(self, mask: IrcString, target: IrcString, args: Dict):
"""Gets the client version from nick via CTCP
%%ver [<nick>]

View File

@ -3,7 +3,7 @@ from urllib.parse import urlparse
import irc3
import requests
from docopt import Dict as DocOptDict
from docopt import Dict
from irc3.plugins.command import command
from irc3.utils import IrcString
@ -16,7 +16,7 @@ class Useless(DatabasePlugin):
'bot.plugins.storage']
@command
def isup(self, mask: IrcString, target: IrcString, args: DocOptDict):
def isup(self, mask: IrcString, target: IrcString, args: Dict):
"""Checks if a address is up.
%%isup <address>

View File

@ -3,7 +3,7 @@ import random
import irc3
import feedparser
from docopt import Dict as DocOptDict
from docopt import Dict
from irc3.plugins.command import command
from irc3.utils import IrcString
@ -35,7 +35,7 @@ class Linux(Plugin):
self.bot.privmsg(target, GNU_LINUX)
@command
def kernel(self, mask: IrcString, target: IrcString, args: DocOptDict):
def kernel(self, mask: IrcString, target: IrcString, args: Dict):
"""Get Linux kernel releases.
%%kernel

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import irc3
from docopt import Dict as DocOptDict
from docopt import Dict
from irc3.plugins.command import command
from irc3.utils import IrcString
from psycopg2 import Error
@ -16,7 +16,7 @@ class McManiac(DatabasePlugin):
'bot.plugins.storage']
@command(options_first=True)
def mcmaniac(self, mask: IrcString, target: IrcString, args: DocOptDict):
def mcmaniac(self, mask: IrcString, target: IrcString, args: Dict):
"""Get a random McManiaC or by index.
%%mcmaniac [<index>]

View File

@ -2,7 +2,7 @@
import re
import irc3
from docopt import Dict as DocOptDict
from docopt import Dict
from irc3.plugins.command import command
from irc3.utils import IrcString
from psycopg2 import Error
@ -61,7 +61,7 @@ class Quotes(DatabasePlugin):
'''.format(order=order), [nick, index])
@command(options_first=True)
def q(self, mask: IrcString, target: IrcString, args: DocOptDict):
def q(self, mask: IrcString, target: IrcString, args: Dict):
"""Get, add or delete quotes for an user.
%%q <cmd> <nick> <quote>...

View File

@ -2,7 +2,7 @@
import random
import irc3
from docopt import Dict as DocOptDict
from docopt import Dict
from irc3.plugins.command import command
from irc3.utils import IrcString
from psycopg2 import Error
@ -16,7 +16,7 @@ class Rape(DatabasePlugin):
'bot.plugins.storage']
@command
def owe(self, mask: IrcString, target: IrcString, args: DocOptDict):
def owe(self, mask: IrcString, target: IrcString, args: Dict):
"""Shows how much a nick owes.
%%owe [<nick>]
@ -44,7 +44,7 @@ class Rape(DatabasePlugin):
return '{nick} owes: \x03{fines}\x03'.format(nick=nick, fines=fines)
@command
def rape(self, mask: IrcString, target: IrcString, args: DocOptDict):
def rape(self, mask: IrcString, target: IrcString, args: Dict):
"""Rapes a nick and eventually charge for it.
%%rape <nick>

View File

@ -3,7 +3,7 @@ import re
from datetime import datetime
import irc3
from docopt import Dict as DocOptDict
from docopt import Dict
from irc3.plugins.command import command
from irc3.utils import IrcString
from psycopg2 import Error
@ -17,7 +17,7 @@ class Seen(DatabasePlugin):
'bot.plugins.storage']
@command
def seen(self, mask: IrcString, target: IrcString, args: DocOptDict):
def seen(self, mask: IrcString, target: IrcString, args: Dict):
"""Get last seen date and message for a nick.
%%seen [<nick>]

View File

@ -2,7 +2,7 @@
from datetime import datetime
import irc3
from docopt import Dict as DocOptDict
from docopt import Dict
from irc3.plugins.command import command
from irc3.utils import IrcString
from psycopg2 import Error
@ -34,7 +34,7 @@ class Tell(DatabasePlugin):
self.tell_queue[nick].append(res[1:])
@command
def tell(self, mask: IrcString, target: IrcString, args: DocOptDict):
def tell(self, mask: IrcString, target: IrcString, args: Dict):
"""Saves a message for nick to forward on activity
%%tell <nick> <message>...

View File

@ -5,8 +5,7 @@ from datetime import datetime
import irc3
from aiocron import crontab
from docopt import Dict as DocOptDict
from irc3.plugins.command import command
from docopt import Dict
from irc3.utils import IrcString
from psycopg2 import Error
from psycopg2.extras import DictRow
@ -26,7 +25,7 @@ class Timer(DatabasePlugin):
crontab('0 * * * *', func=self.set_timers)
@command
def timer(self, mask: IrcString, target: IrcString, args: DocOptDict):
def timer(self, mask: IrcString, target: IrcString, args: Dict):
"""Sets a timer, delay can be: s, m, h, d, w, mon, y
%%timer <delay> <message>...

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import irc3
import requests
from docopt import Dict as DocOptDict
from docopt import Dict
from irc3.plugins.command import command
from irc3.utils import IrcString
@ -15,7 +15,7 @@ class Urban(Plugin):
URL = 'https://api.urbandictionary.com/v0/define'
@command
def ud(self, mask: IrcString, target: IrcString, args: DocOptDict):
def ud(self, mask: IrcString, target: IrcString, args: Dict):
"""Searches for a term on YouTube and returns first result.
%%ud <term>...

View File

@ -3,7 +3,7 @@ import random
import re
import irc3
from docopt import Dict as DocOptDict
from docopt import Dict
from irc3.plugins.command import command
from irc3.utils import IrcString
from psycopg2 import Error
@ -42,7 +42,7 @@ class Useless(DatabasePlugin):
)
@command(permission='admin', show_in_help=False)
def kim(self, mask: IrcString, target: IrcString, args: DocOptDict):
def kim(self, mask: IrcString, target: IrcString, args: Dict):
"""Kicks Kim, most useful command.
%%kim
@ -83,7 +83,7 @@ class Useless(DatabasePlugin):
self.bot.privmsg(target, '\x02[{} INTENSIFIES]'.format(msg.upper()))
@command
def kill(self, mask: IrcString, target: IrcString, args: DocOptDict):
def kill(self, mask: IrcString, target: IrcString, args: Dict):
"""Kills a user with a random message
%%kill [<nick>]
@ -103,7 +103,7 @@ class Useless(DatabasePlugin):
))
@command
def yiff(self, mask: IrcString, target: IrcString, args: DocOptDict):
def yiff(self, mask: IrcString, target: IrcString, args: Dict):
"""Yiffs a user with a random message
%%yiff [<nick>]
@ -124,7 +124,7 @@ class Useless(DatabasePlugin):
))
@command
def waifu(self, mask: IrcString, target: IrcString, args: DocOptDict):
def waifu(self, mask: IrcString, target: IrcString, args: Dict):
"""Get waifu for a user (set with prefixing the user with =)
%%waifu [<nick>...]
@ -132,7 +132,7 @@ class Useless(DatabasePlugin):
return self.husbando_waifu('waifu', mask, target, args)
@command
def husbando(self, mask: IrcString, target: IrcString, args: DocOptDict):
def husbando(self, mask: IrcString, target: IrcString, args: Dict):
"""Get husbando for a user (set with prefixing the user with =)
%%husbando [<nick>...]
@ -140,7 +140,7 @@ class Useless(DatabasePlugin):
return self.husbando_waifu('husbando', mask, target, args)
@command
def storyofpomfface(self, mask: IrcString, target: IrcString, args: DocOptDict):
def storyofpomfface(self, mask: IrcString, target: IrcString, args: Dict):
"""Story of pomf face
%%storyofpomfface
@ -149,7 +149,7 @@ class Useless(DatabasePlugin):
self.bot.privmsg(target, face)
@command
def choose(self, mask: IrcString, target: IrcString, args: DocOptDict):
def choose(self, mask: IrcString, target: IrcString, args: Dict):
"""Decides between items (separated by comma)
%%choose <items>...
@ -158,7 +158,7 @@ class Useless(DatabasePlugin):
return '{}: {}'.format(mask.nick, choice.strip())
@command
def jn(self, mask: IrcString, target: IrcString, args: DocOptDict):
def jn(self, mask: IrcString, target: IrcString, args: Dict):
"""Decides between yes and no (for a question).
%%jn <question>...
@ -168,7 +168,7 @@ class Useless(DatabasePlugin):
return '{}: \x02\x030{}'.format(mask.nick, choice)
@command
def kiss(self, mask: IrcString, target: IrcString, args: DocOptDict):
def kiss(self, mask: IrcString, target: IrcString, args: Dict):
"""Kisses a user
%%kiss [<nick>]
@ -176,7 +176,7 @@ class Useless(DatabasePlugin):
return '(づ。◕‿‿◕。)\x0304。。・゜゜・。。・゜❤\x03 {} \x0304❤'.format(args.get('<nick>', mask.nick))
@command
def hug(self, mask: IrcString, target: IrcString, args: DocOptDict):
def hug(self, mask: IrcString, target: IrcString, args: Dict):
"""Hugs a user
%%hug [<nick>]
@ -184,7 +184,7 @@ class Useless(DatabasePlugin):
return '\x0304♥♡❤♡♥\x03 {} \x0304♥♡❤♡♥'.format(args.get('<nick>', mask.nick))
@command
def bier(self, mask: IrcString, target: IrcString, args: DocOptDict):
def bier(self, mask: IrcString, target: IrcString, args: Dict):
"""Gives a user a beer
%%bier [<nick>]
@ -193,7 +193,7 @@ class Useless(DatabasePlugin):
self.bot.action(target, 'schenkt ein kühles Blondes an {} aus.'.format(nick))
@command
def fucken(self, mask: IrcString, target: IrcString, args: DocOptDict):
def fucken(self, mask: IrcString, target: IrcString, args: Dict):
"""Kills and fucks a user
%%fucken [<nick>]
@ -202,7 +202,7 @@ class Useless(DatabasePlugin):
self.bot.action(target, 'fuckt {0} und tötet {0} anschließend.'.format(nick, nick))
@command(aliases=['anhero', 'sudoku'])
def seppuku(self, mask: IrcString, target: IrcString, args: DocOptDict):
def seppuku(self, mask: IrcString, target: IrcString, args: Dict):
"""Kicks a user
%%seppuku
@ -210,7 +210,7 @@ class Useless(DatabasePlugin):
self.bot.kick(target, mask.nick, 'Sayonara bonzai-chan...')
@command
def hack(self, mask: IrcString, target: IrcString, args: DocOptDict):
def hack(self, mask: IrcString, target: IrcString, args: Dict):
"""Hacks (a user)
%%hack [<nick>]
@ -219,7 +219,7 @@ class Useless(DatabasePlugin):
return 'hacking{}...'.format(' %s' % nick if nick else '')
@command
def gay(self, mask: IrcString, target: IrcString, args: DocOptDict):
def gay(self, mask: IrcString, target: IrcString, args: Dict):
"""Make someone gay (alias to rainbow)
%%gay <word>...
@ -227,7 +227,7 @@ class Useless(DatabasePlugin):
return self.rainbow(mask, target, args)
@command
def rainbow(self, mask: IrcString, target: IrcString, args: DocOptDict):
def rainbow(self, mask: IrcString, target: IrcString, args: Dict):
"""Colorize a word in rainbow colors
%%rainbow <word>...
@ -242,7 +242,7 @@ class Useless(DatabasePlugin):
return ''.join(word)
@command
def wrainbow(self, mask: IrcString, target: IrcString, args: DocOptDict):
def wrainbow(self, mask: IrcString, target: IrcString, args: Dict):
"""Colorize words in a sentence with rainbow colors
%%wrainbow <words>...
@ -250,7 +250,7 @@ class Useless(DatabasePlugin):
return ' '.join([self._rainbow(i, word) for i, word in enumerate(args['<words>'])])
@command
def halfwidth(self, mask: IrcString, target: IrcString, args: DocOptDict):
def halfwidth(self, mask: IrcString, target: IrcString, args: Dict):
"""Turns UPPERCASE words into halfwidth characters
%%halfwidth <words>...
@ -262,7 +262,7 @@ class Useless(DatabasePlugin):
return '\x02[HALFWIDTH]\x02 {}'.format(re.sub(r'(?:\b)[A-Z]+(?:\b)', replace, ' '.join(args['<words>'])))
@command
def asshole(self, mask: IrcString, target: IrcString, args: DocOptDict):
def asshole(self, mask: IrcString, target: IrcString, args: Dict):
"""Checks how much of an asshole you are
%%asshole [<nick>]
@ -280,7 +280,7 @@ class Useless(DatabasePlugin):
return 'Asshole scan... {} is {}% of an asshole.'.format(nick, asshole_perc)
@command
def assume(self, mask: IrcString, target: IrcString, args: DocOptDict):
def assume(self, mask: IrcString, target: IrcString, args: Dict):
"""Assumes the gender of a nick or yourself
%%assume [<nick>]
@ -290,7 +290,7 @@ class Useless(DatabasePlugin):
return 'Assuming {}\'s gender... they\'re a {}.'.format(nick, gender)
def husbando_waifu(self, field: str, mask: IrcString, target: IrcString, args: DocOptDict):
def husbando_waifu(self, field: str, mask: IrcString, target: IrcString, args: Dict):
nick = args.get('<nick>', mask.nick)
if isinstance(nick, list):
nick = ' '.join(nick)

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import irc3
import requests
from docopt import Dict as DocOptDict
from docopt import Dict
from irc3.plugins.command import command
from irc3.utils import IrcString
@ -17,7 +17,7 @@ class Weather(Plugin):
'(select woeid from geo.places(1) where text="{}")'
@command
def weather(self, mask: IrcString, target: IrcString, args: DocOptDict):
def weather(self, mask: IrcString, target: IrcString, args: Dict):
"""Gets the weather from Yahoo weather API.
%%weather <location>...

View File

@ -4,7 +4,7 @@ import re
import irc3
import requests
from docopt import Dict as DocOptDict
from docopt import Dict
from irc3.plugins.command import command
from irc3.utils import IrcString
@ -61,7 +61,7 @@ class YouTube(Plugin):
self.bot.privmsg(target, data)
@command
def yt(self, mask: IrcString, target: IrcString, args: DocOptDict):
def yt(self, mask: IrcString, target: IrcString, args: Dict):
"""Searches for query on YouTube and returns first result.
%%yt <query>...