Formattings dopes code and renaming the module

This commit is contained in:
mrhanky 2017-09-06 12:58:38 +02:00
parent eefae51ad2
commit 90035a8249
No known key found for this signature in database
GPG Key ID: 67D772C481CB41B8
2 changed files with 20 additions and 25 deletions

View File

@ -1,15 +1,14 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import random import random
import irc3
from docopt import Dict from docopt import Dict
from irc3.plugins.command import command from irc3.plugins.command import command
from irc3.utils import IrcString from irc3.utils import IrcString
from . import Plugin from . import Plugin
class Dope(Plugin):
class Drugs(Plugin):
# All strains from https://www.leafly.com/explore # All strains from https://www.leafly.com/explore
STRAINS = { STRAINS = {
'sativa': [ 'sativa': [
@ -26,7 +25,7 @@ class Dope(Plugin):
'Maui Wowie', 'Maui Wowie',
'Chocolope', 'Chocolope',
'Harlequin', 'Harlequin',
], ],
'indica': [ 'indica': [
'Granddaddy Purple', 'Granddaddy Purple',
'Bubba Kush', 'Bubba Kush',
@ -45,7 +44,7 @@ class Dope(Plugin):
'Skywalker', 'Skywalker',
'White Rhino', 'White Rhino',
'Hindu Kush', 'Hindu Kush',
], ],
'hybrid': [ 'hybrid': [
'Blue Dream', 'Blue Dream',
'Girl Scout Cookies', 'Girl Scout Cookies',
@ -65,29 +64,28 @@ class Dope(Plugin):
'Platinum Girl Scout Cookies', 'Platinum Girl Scout Cookies',
'Golden Goat', 'Golden Goat',
'Agent Orange', 'Agent Orange',
], ],
} }
ACTIONS = { ACTIONS = {
'joint': [ 'joint': [
('passes', 'to'), ('passes', 'to'),
('rolls', 'for'), ('rolls', 'for'),
('lights', 'for'), ('lights', 'for'),
], ],
'bong': [ 'bong': [
('passes', 'to'), ('passes', 'to'),
('preps', 'for'), ('preps', 'for'),
('lights', 'for'), ('lights', 'for'),
], ],
'vape': [ 'vape': [
('passes', 'to'), ('passes', 'to'),
], ],
'blunt': [ 'blunt': [
('passes', 'to'), ('passes', 'to'),
('rolls', 'for'), ('rolls', 'for'),
('lights', 'for'), ('lights', 'for'),
], ],
} }
@command @command
def dope(self, mask: IrcString, target: IrcString, args: Dict): def dope(self, mask: IrcString, target: IrcString, args: Dict):
@ -95,20 +93,16 @@ class Dope(Plugin):
%%dope [<nick>] %%dope [<nick>]
""" """
strain_types = list(self.STRAINS.keys()) strain_types = list(self.STRAINS.keys())
strain_type = random.choice(strain_types) strain_type = random.choice(strain_types)
strain = random.choice(self.STRAINS[strain_type]) consume_type = random.choice(list(self.ACTIONS.keys()))
action = random.choice(self.ACTIONS[consume_type])
consume_type = random.choice(list(self.ACTIONS.keys())) self.bot.action(target, '{action0} a {consume} of the finest {type} "{strain}" {action1} {nick}'.format(
action = random.choice(self.ACTIONS[consume_type])
nick = args.get('<nick>', mask.nick)
self.bot.action(target, '{action0} a {consume_type} of the finest {strain_type} "{strain}" {action1} {nick}'.format(
action0=action[0], action0=action[0],
action1=action[1], action1=action[1],
consume_type=consume_type, consume=consume_type,
strain_type=strain_type, strain=random.choice(self.STRAINS[strain_type]),
strain=strain, nick=args.get('<nick>', mask.nick),
nick=nick)) type=strain_type,
))

View File

@ -14,6 +14,7 @@
"bot.admin", "bot.admin",
"bot.coins", "bot.coins",
"bot.ctcp", "bot.ctcp",
"bot.drugs",
"bot.isup", "bot.isup",
"bot.linux", "bot.linux",
"bot.mcmaniac", "bot.mcmaniac",