Jimmies.get_jimmies_status()   B
last analyzed

Complexity

Conditions 1

Size

Total Lines 29

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
dl 0
loc 29
rs 8.8571
c 0
b 0
f 0
1
from event import Event
2
import random 
3
4
class Jimmies:
5
    def __init__(self, events=None, printer_handle=None, bot=None, say=None):
6
        self.events = events
7
        self.printer = printer_handle
8
        self.interests = ['__.jimmies__']
9
        self.bot = bot
10
        self.say = say
11
12
        jimmies = Event("__.jimmies__")
13
        jimmies.define(msg_definition="^\.jimmies")
14
        jimmies.subscribe(self)
15
        self.bot.register_event(jimmies, self)
16
17
        self.help = ".jimmies <nick>" 
18
19
    def get_jimmies_status(self):
20
        """Randomly selects and returns a string with a "jimmies" status."""
21
        status = [" Rustled [ ] Not Rustled", 
22
                  "Rustled as fuck", 
23
                  "Rustled as fuark", 
24
                  "Rustled 'n' hustled", 
25
                  "Professor James  R. Russel, Department of Primatology", 
26
                  "le monkey face", 
27
                  "No rustling. Only dreams now.", 
28
                  "Y'all rusting in a jimmies thread", 
29
                  "Haha. Oh god. Mah jimmies.", 
30
                  "The jimmies have been compromised.", 
31
                  "A gorillion jimmies.", 
32
                  "Boku no rustled", 
33
                  "Rustle of the Planet of the Jimmies", 
34
                  "You just rustled my jimmy card", 
35
                  "Micky Rourke as The Rustler", 
36
                  ">he thinks his jimmies are unrustled", 
37
                  "WWE Rustlemania", 
38
                  "Teach Me How To Jimmie", 
39
                  "#3 Rustle Wilson", 
40
                  "Rustle-it Ralph", 
41
                  "All those people. All that rustling.", 
42
                  "Rustle Brand", 
43
                  "Everyone's getting rustled!", 
44
                  "Did someone rustle your jimmies? Show me on the doll where they rustled you.", 
45
                  "Oh shit! My jimmies!"
46
                  ]
47
        return "[X] " + random.choice(status)
48
49
    def handle(self, event):
50
        _z = event.msg.split(None, 1)
51
        jimmies_status = self.get_jimmies_status()
52
        try:
53
            self.say(event.channel, "Jimmies status for " + _z[1]+ ": " + jimmies_status)
54
        except IndexError:
55
            self.say(event.channel, "You didn\'t specify whose jimmies you wanted to check. " + event.user + "\'s jimmies status: " + jimmies_status) 
56
        except TypeError:
57
            print "DEBUG: TypeError: ",
58
            print event.channel,
59
            print event.user
60