Esempio n. 1
0
  def post_init(self):
    youtube = Event("__.youtubes__")
    youtube.define(msg_definition="youtube\.com[\S]+")
    youtube2 = Event("__.youtubeshort__")
    youtube2.define(msg_definition="(?<!=)youtu\.be[\S]+")
    youtube.subscribe(self)
    youtube2.subscribe(self)

    self.bot.register_event(youtube, self)
    self.bot.register_event(youtube2, self)

    self.bot.mem_store['youtube'] = OrderedDict()


    # for the new v3 google api >:(
    try: 
        from youtube_credentials import YoutubeCredentials as yc
    except ImportError:
        print "Warning: youtube module requires credentials in modules/youtube_credentials.py"
        class PhonyYc:
            api_key = "None"
        yc = PhonyYc()

    self.api_key = yc.api_key    
    self.api_url = "https://www.googleapis.com/youtube/v3/videos?id="
Esempio n. 2
0
 def post_init(self):
     r6 = Event("__.r6__")
     r6.define(msg_definition=r"^\.r6")
     r6.subscribe(self)
     self.help = ".r6 <kd,level,rank> <gamer-tag>"
     # register ourself to our new r6 event
     self.bot.register_event(r6, self)
     self.player_ids = []
     self.url = "https://r6.apitab.com/search/uplay/"  # URL which outputs JSON data
     self.ranks = RangeKeyDict({
         (0, 1199): "Copper V",
         (1200, 1299): "Copper IV",
         (1300, 1399): "Copper III",
         (1400, 1499): "Copper II",
         (1500, 1599): "Copper I",
         (1600, 1699): "Bronze V",
         (1700, 1799): "Bronze IV",
         (1800, 1899): "Bronze III",
         (1900, 1999): "Bronze II",
         (2000, 2099): "Bronze I",
         (2100, 2199): "Silver V",
         (2200, 2299): "Silver IV",
         (2300, 2399): "Silver III",
         (2400, 2499): "Silver II",
         (2500, 2599): "Silver I",
         (2600, 2799): "Gold III",
         (2800, 2999): "Gold II",
         (3000, 3199): "Gold I",
         (3200, 3599): "Platinum III",
         (3600, 3999): "Platinum II",
         (4000, 4399): "Platinum I",
         (4400, 4999): "Diamond",
         (5000, 9999): "Champions"
     })
Esempio n. 3
0
File: tell.py Progetto: hlmtre/pybot
  def post_init(self):
    """
    Because of the way this module works we have to make sure to set our
    event like we normally would with __.tell__, but we cannot define our
    event with "^\.tell" like we normally would as it will only look for that
    line to trigger the event and the user being told will never receive his message
    since the bot is only looking for .tell and not the user in the PRIVMSG

    We will set the .tell trigger in our handle function "if event.msg.startswith(".tell"):"
    and set define to PRIVMSG so it searches all lines from users. While simultaneously looking
    for the .tell trigger from the user.
    
    This is because we actually need 2 things for this module to work. 

    1.) The user needs to be able to leave a message for someone else using ".tell someuser <Insert message here>" 
    
    2.) The user who the .tell message is directed towards will be determined by the PRIVMSG definition.
        This is determined in the "else" block that searches every line not starting with .tell.
        If the user matches the stored user from the previous tell trigger, the event will be triggered and pybot will spit out text into
        the proper channel every time the intended user says something in chat until the buffer is out of .tell events.
    """

    tell = Event("__.tell__")
    tell.define("PRIVMSG")
    tell.subscribe(self)

    # register ourself to our new custom event
    self.bot.register_event(tell, self)
Esempio n. 4
0
    def post_init(self):
        youtube = Event("__.youtubes__")
        youtube.define(msg_definition="youtube\\.com[\\S]+")
        youtube2 = Event("__.youtubeshort__")
        youtube2.define(msg_definition="(?<!=)youtu\\.be[\\S]+")
        youtube.subscribe(self)
        youtube2.subscribe(self)

        self.bot.register_event(youtube, self)
        self.bot.register_event(youtube2, self)

        self.bot.mem_store['youtube'] = OrderedDict()

        # for the new v3 google api >:(
        try:
            from youtube_credentials import YoutubeCredentials as yc
        except (ImportError, SystemError):
            print(
                "Warning: youtube module requires credentials in modules/youtube_credentials.py"
            )

            class PhonyYc:
                api_key = "None"

            yc = PhonyYc()

        self.api_key = yc.api_key
        self.url = "https://www.googleapis.com/youtube/v3/videos?id="
Esempio n. 5
0
    def post_init(self):
        qdac = Event("__.qdac__")
        qdac.define(msg_definition="^\\.qdac")
        qdac.subscribe(self)
        self.help = ".qdac <trigger> <action to take: [say]> <thing to say>"

        self.bot.register_event(qdac, self)
Esempio n. 6
0
  def post_init(self):
    version_event = Event("__.version__")
    version_event.define(msg_definition="^\.version")
    version_event.subscribe(self)

    # register ourself to our new custom event
    self.bot.register_event(version_event, self)
Esempio n. 7
0
  def post_init(self):
    shortener = Event("__urls__")
    shortener.define(msg_definition = "https?://[\S]+") # What to look for to trigger event
    shortener.subscribe(self)

    # register ourself to our new custom event
    self.bot.register_event(shortener, self)
Esempio n. 8
0
    def handle(self, event):
        def qdac_handle(event):
            action = event.subscribers[0].action
            trigger = event.subscribers[0].trigger
            output = event.subscribers[0].output
            action(event.channel, output)

        words = event.msg.split(" ", maxsplit=3)
        if not len(words) == 4:
            self.say(event.channel, "qdac: invalid command format")
            self.say(event.channel, self.help)
            return

        trigger, action, output = words[1], words[2], words[3]
        # TODO ADD MORE ABILITIES HERE
        # we have to check it here to verify our actions are safe
        if action == "say":
            fn = self.say
        new_event = Event("__" + trigger + "__")
        new_event.define(msg_definition="^\\" + trigger)
        name = trigger.strip(".").upper()
        new_module = type(
            name, (BaseModule, ), {
                "handle": qdac_handle,
                "trigger": trigger,
                "action": fn,
                "output": output
            })
        new_event.subscribe(new_module)
        self.bot.register_event(new_event, new_module)
        self.say(event.channel,
                 "Command '" + name + "' added with trigger " + trigger + ".")
Esempio n. 9
0
    def post_init(self):
        """
        Because of the way this module works we have to make sure to set our
        event like we normally would with __.tell__, but we cannot define our
        event with "^\\.tell" like we normally would as it will only look for that
        line to trigger the event and the user being told will never receive his message
        since the bot is only looking for .tell and not the user in the PRIVMSG

        We will set the .tell trigger in our handle function "if event.msg.startswith(".tell"):"
        and set define to PRIVMSG so it searches all lines from users. While simultaneously looking
        for the .tell trigger from the user.

        This is because we actually need 2 things for this module to work.

        1.) The user needs to be able to leave a message for someone else using ".tell someuser <Insert message here>"

        2.) The user who the .tell message is directed towards will be determined by the PRIVMSG definition.
            This is determined in the "else" block that searches every line not starting with .tell.
            If the user matches the stored user from the previous tell trigger, the event will be triggered and pybot will spit out text into
            the proper channel every time the intended user says something in chat until the buffer is out of .tell events.
        """

        tell = Event("__.tell__")
        tell.define("PRIVMSG")
        tell.subscribe(self)

        # register ourself to our new custom event
        self.bot.register_event(tell, self)
Esempio n. 10
0
    def post_init(self):
        nicklisting_self_join = Event("__.nicklisting_self_join__")
        nicklisting_other_join = Event("__.nicklisting_other_join__")
        nicklisting_quit = Event("__.nicklisting_quit__")
        nicklisting_part = Event("__.nicklisting_part__")

        nicklisting_command = Event("__.nicklist__")
        nicklisting_command.define(msg_definition="^\\.nicklist")

        nicklisting_self_join.define(message_id=353)
        nicklisting_other_join.define(definition="JOIN")
        nicklisting_quit.define(definition="QUIT")
        nicklisting_part.define(definition="PART")

        nicklisting_command.subscribe(self)
        nicklisting_self_join.subscribe(self)
        nicklisting_other_join.subscribe(self)
        nicklisting_quit.subscribe(self)
        nicklisting_part.subscribe(self)

        # register ourself to our new custom event(s)
        self.bot.register_event(nicklisting_self_join, self)
        self.bot.register_event(nicklisting_other_join, self)
        self.bot.register_event(nicklisting_quit, self)
        self.bot.register_event(nicklisting_command, self)
        self.bot.register_event(nicklisting_part, self)

        self.bot.mem_store['nicklist'] = dict()
Esempio n. 11
0
  def post_init(self):
    nicklisting_self_join = Event("__.nicklisting_self_join__")
    nicklisting_other_join = Event("__.nicklisting_other_join__")
    nicklisting_quit = Event("__.nicklisting_quit__")
    nicklisting_part = Event("__.nicklisting_part__")

    nicklisting_command = Event("__.nicklist__")
    nicklisting_command.define(msg_definition="^\.nicklist")

    nicklisting_self_join.define(message_id=353)
    nicklisting_other_join.define(definition="JOIN")
    nicklisting_quit.define(definition="QUIT")
    nicklisting_part.define(definition="PART")

    nicklisting_command.subscribe(self)
    nicklisting_self_join.subscribe(self)
    nicklisting_other_join.subscribe(self)
    nicklisting_quit.subscribe(self)
    nicklisting_part.subscribe(self)

    # register ourself to our new custom event(s)
    self.bot.register_event(nicklisting_self_join, self)
    self.bot.register_event(nicklisting_other_join, self)
    self.bot.register_event(nicklisting_quit, self)
    self.bot.register_event(nicklisting_command,self)
    self.bot.register_event(nicklisting_part,self)

    self.bot.mem_store['nicklist'] = dict()
Esempio n. 12
0
  def post_init(self):
    b_event = Event("__.bofh__")

    b_event.define(msg_definition="^\.bofh")
    b_event.subscribe(self)

    self.bot.register_event(b_event, self)
Esempio n. 13
0
 def post_init(self):
   kanbo = Event("__.custom__")
   kanbo.define(msg_definition="^\.kanbo")
   kanbo.subscribe(self)
   self.help = ".kanbo (kanbo face)"
   self.bot.register_event(kanbo, self)
   self.messages = [u'( ͡° ͜ʖ ͡°)', u'( ͡0 ͜ʖ ͡0)', u'|╲/( ͡° ͡° ͜ʖ ͡° ͡°)/\╱\\', u'┬┴┬┴┤( ͡° ͜ʖ├┬┴┬┴']
Esempio n. 14
0
File: pimp.py Progetto: hlmtre/pybot
 def post_init(self):
   pimp = Event("__.pimp__")
   pimp.define(msg_definition="^\.pimp$")
   pimp.subscribe(self)
   self.cmd = ".pimp"
   self.help = ".pimp (bot repo URL)"
   
   self.bot.register_event(pimp, self) #Register your event
Esempio n. 15
0
 def post_init(self):
     shortener = Event("__urls__")
     # What to look for to trigger event
     shortener.define(msg_definition="https?://[\\S]+")
     shortener.subscribe(self)
     self.r_pattern = r"https?://www.reddit.com/[\S]+|https?://reddit.com/[\S]+|reddit.com/[\S]+|https?://old.reddit.com/[\S]+"
     # register ourself to our new custom event
     self.bot.register_event(shortener, self)
Esempio n. 16
0
 def post_init(self):
   dance = Event("__.dance__")
   dance.define(msg_definition="^.dance$")
   dance.subscribe(self)
   self.cmd = ".dance"
   self.help = ".dance (bot dances)"
   
   self.bot.register_event(dance, self)
Esempio n. 17
0
    def post_init(self):
        d_event = Event("__.dad__")

        d_event.define(msg_definition="^\\.dad")
        d_event.subscribe(self)

        self.bot.register_event(d_event, self)
        self.help = ".dad (prints dad joke)"
Esempio n. 18
0
File: vyos.py Progetto: hlmtre/pybot
  def post_init(self):
    vevent = Event("__.vyos__")
    vevent.define(msg_definition="^\.vyos")
    vevent.subscribe(self)
    self.help = ".vyos <name of box>"
    self.box_to_ip = dict([('mech', '10.0.0.76'), ('bonekin', '192.168.17.40'), ('thraust', '192.168.0.126')])

    self.bot.register_event(vevent, self)
Esempio n. 19
0
  def post_init(self):
    howdy = Event("__.howdy__")
    howdy.define(msg_definition="^\.howdy")
    howdy.subscribe(self)
    self.help = ".howdy (spits out cowboy stuff)"

    # register ourself to our new howdy event
    self.bot.register_event(howdy, self)
Esempio n. 20
0
File: d20.py Progetto: hlmtre/pybot
 def post_init(self):
   d20event = Event("__.d20event__")
   d20event.define(msg_definition="^\.d20")
   d20event.subscribe(self)
   
   self.help = ".d20 (random number 1-20)"
   # register ourself to our new d20event event
   self.bot.register_event(d20event, self)
Esempio n. 21
0
    def post_init(self):
        ftoc = Event("__.ftoc__")
        ftoc.define(msg_definition="^\\.ftoc")
        ftoc.subscribe(self)
        self.cmd = ".ftoc"
        self.help = ".ftoc [farenheit]"

        self.bot.register_event(ftoc, self)
Esempio n. 22
0
File: ctof.py Progetto: hlmtre/pybot
  def post_init(self):
    ctof = Event("__.ctof__")
    ctof.define(msg_definition="^\.ctof")
    ctof.subscribe(self)
    self.cmd = ".ctof"
    self.help = ".ctof [celsius]"

    self.bot.register_event(ctof, self)
Esempio n. 23
0
    def post_init(self):
        b_event = Event("__.bofh__")

        b_event.define(msg_definition="^\\.bofh$")
        b_event.subscribe(self)

        self.bot.register_event(b_event, self)
        self.help = ".bofh (prints random quote)"
Esempio n. 24
0
  def post_init(self):
    jimmies = Event("__.jimmies__")
    jimmies.define(msg_definition="^\.jimmies")
    jimmies.subscribe(self)
    self.cmd = ".jimmies"
    self.help = ".jimmies <nick>"

    self.bot.register_event(jimmies, self) # Register ourself to our new custom event
Esempio n. 25
0
    def post_init(self):
        bonk = Event("__.bonk__")
        bonk.define(msg_definition="^\\.bonk")
        bonk.subscribe(self)
        self.cmd = ".bonk"
        self.help = ".bonk <bonkee>"

        self.bot.register_event(bonk, self)  # Subscribe to your event
Esempio n. 26
0
    def post_init(self):
        jury = Event("__.jury__")
        jury.define(msg_definition="^\\.jury")
        jury.subscribe(self)
        self.help = ".jury (Prints yeas and nays)"

        # register ourself to our new jury event
        self.bot.register_event(jury, self)
Esempio n. 27
0
File: bonk.py Progetto: hlmtre/pybot
  def post_init(self):
    bonk = Event("__.bonk__")
    bonk.define(msg_definition="^\.bonk")
    bonk.subscribe(self)
    self.cmd = ".bonk"
    self.help = ".bonk <bonkee>"

    self.bot.register_event(bonk, self) #Subscribe to your event
Esempio n. 28
0
    def post_init(self):
        howdy = Event("__.howdy__")
        howdy.define(msg_definition="^\\.howdy")
        howdy.subscribe(self)
        self.help = ".howdy (spits out cowboy stuff)"

        # register ourself to our new howdy event
        self.bot.register_event(howdy, self)
Esempio n. 29
0
File: help.py Progetto: hlmtre/pybot
 def post_init(self):
   help = Event("__.help__")
   help.define(msg_definition="^\.help")
   help.subscribe(self)
   self.cmd = ".help"
   
   # register ourself to our new custom event
   self.bot.register_event(help, self)
Esempio n. 30
0
  def post_init(self):
    lastfm = Event("__.lastfm__")
    lastfm.define(msg_definition="^\.lastfm")
    lastfm.subscribe(self)
    self.help = ".lastfm add <lastfm username> then .last"

    # register ourself to our new custom event
    self.bot.register_event(lastfm, self)
Esempio n. 31
0
    def post_init(self):
        part = Event("__.part__")
        part.define(msg_definition="^\\.part")
        part.subscribe(self)
        self.help = ".part <channel> 'use as pm to the bot'"

        # register ourself to our new custom event
        self.bot.register_event(part, self)
Esempio n. 32
0
    def post_init(self):
        lastfm = Event("__.lastfm__")
        lastfm.define(msg_definition=r"^\.lastfm")
        lastfm.subscribe(self)
        self.help = ".lastfm add <lastfm username> then .last"

        # register ourself to our new custom event
        self.bot.register_event(lastfm, self)
Esempio n. 33
0
File: jury.py Progetto: hlmtre/pybot
  def post_init(self):
    jury = Event("__.jury__")
    jury.define(msg_definition="^\.jury")
    jury.subscribe(self)
    self.help = ".jury (Prints yeas and nays)"

    # register ourself to our new jury event
    self.bot.register_event(jury, self)
Esempio n. 34
0
  def post_init(self):
    tzone = Event("__.tzone__")
    tzone.define(msg_definition="^\.tzone")
    tzone.subscribe(self)
    self.cmd = ".tzone"
    self.help = ".tzone <Insert timezone> timezones: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones"

    self.bot.register_event(tzone, self)
Esempio n. 35
0
    def post_init(self):
        ctof = Event("__.ctof__")
        ctof.define(msg_definition="^\\.ctof")
        ctof.subscribe(self)
        self.cmd = ".ctof"
        self.help = ".ctof [celsius]"

        self.bot.register_event(ctof, self)
Esempio n. 36
0
File: yth.py Progetto: hlmtre/pybot
  def post_init(self):
    command = Event("__.yth__")
    command.define(msg_definition="^\.yth")
    command.subscribe(self)

    self.bot.register_event(command, self)
    self.help = ".yth, .yth <search terms>"
    self.comparer = difflib.SequenceMatcher()
Esempio n. 37
0
File: bofh.py Progetto: hlmtre/pybot
  def post_init(self):
    b_event = Event("__.bofh__")

    b_event.define(msg_definition="^\.bofh")
    b_event.subscribe(self)

    self.bot.register_event(b_event, self)
    self.help = ".bofh (prints random quote)"
Esempio n. 38
0
    def post_init(self):
        d20event = Event("__.d20event__")
        d20event.define(msg_definition="^\\.d20")
        d20event.subscribe(self)

        self.help = ".d20 (random number 1-20)"
        # register ourself to our new d20event event
        self.bot.register_event(d20event, self)
Esempio n. 39
0
    def post_init(self):
        dance = Event("__.dance__")
        dance.define(msg_definition="^.dance$")
        dance.subscribe(self)
        self.cmd = ".dance"
        self.help = ".dance (bot dances)"

        self.bot.register_event(dance, self)
Esempio n. 40
0
File: dad.py Progetto: hlmtre/pybot
  def post_init(self):
    d_event = Event("__.dad__")

    d_event.define(msg_definition="^\.dad")
    d_event.subscribe(self)

    self.bot.register_event(d_event, self)
    self.help = ".dad (prints dad joke)"
Esempio n. 41
0
    def post_init(self):
        help = Event("__.help__")
        help.define(msg_definition="^\\.help")
        help.subscribe(self)
        self.cmd = ".help"

        # register ourself to our new custom event
        self.bot.register_event(help, self)
Esempio n. 42
0
File: ftoc.py Progetto: hlmtre/pybot
  def post_init(self):
    ftoc = Event("__.ftoc__")
    ftoc.define(msg_definition="^\.ftoc")
    ftoc.subscribe(self)
    self.cmd = ".ftoc"
    self.help = ".ftoc [farenheit]"

    self.bot.register_event(ftoc, self)
Esempio n. 43
0
    def post_init(self):
        command = Event("__.yth__")
        command.define(msg_definition="^\\.yth")
        command.subscribe(self)

        self.bot.register_event(command, self)
        self.help = ".yth, .yth <search terms>"
        self.comparer = difflib.SequenceMatcher()
Esempio n. 44
0
 def post_init(self):
     tzone = Event("__.tzone__")
     tzone.define(msg_definition="^\\.tzone")
     tzone.subscribe(self)
     self.cmd = ".tzone"
     self.help = ".tzone <Insert location name/zip/airport(SFO,PDX,etc.)>"
     self.bot.register_event(tzone, self)
     self.url = "https://dev.virtualearth.net/REST/v1/TimeZone/query="
     self.key = "?key=AuEaLSdFYvXwY4u1FnyP-f9l5u5Ul9AUA_U1F-eJ-8O_Fo9Cngl95z6UL0Lr5Nmx"
Esempio n. 45
0
File: told.py Progetto: hlmtre/pybot
 def post_init(self):
   told = Event("__.told__")
   told.define(msg_definition="^\.told")
   told.subscribe(self)
   self.cmd = ".told"
   self.help = ".told <nick>"
   
   # register ourself to our new custom event
   self.bot.register_event(told, self)
Esempio n. 46
0
    def post_init(self):
        jimmies = Event("__.jimmies__")
        jimmies.define(msg_definition="^\\.jimmies")
        jimmies.subscribe(self)
        self.cmd = ".jimmies"
        self.help = ".jimmies <nick>"

        # Register ourself to our new custom event
        self.bot.register_event(jimmies, self)
Esempio n. 47
0
    def post_init(self):
        told = Event("__.told__")
        told.define(msg_definition=r"^\.told")
        told.subscribe(self)
        self.cmd = ".told"
        self.help = ".told <nick>"

        # register ourself to our new custom event
        self.bot.register_event(told, self)
Esempio n. 48
0
    def post_init(self):
        sched = Event("__.schedule__")
        sched.define(msg_definition="^\\.schedule")
        sched.subscribe(self)
        self.help = ".schedule in <1m|5h|32s|etc> say <#channel> <phrase>"
        self.cmd = ".schedule"

        # register ourself to our new sched event
        self.bot.register_event(sched, self)
Esempio n. 49
0
 def post_init(self):
   hello = Event("__hello__")
   hello.subscribe(self)
   self.help = None
   self.bot.register_event(hello, self) #Register to your event
   
   nick = self.bot.conf.getNick(self.bot.network) #Grabs the nick of the person greeting pybot
   hello.define(msg_definition="^([H|h]ello|[H|h]i|[H|h]owdy|[H|h]ey) " + nick) #How pybot determines whether he is being greeted
   self.retorts = ['hello', 'sup', 'hi', 'good to see you', 'loldicks'] #List of different ways he will be able to respond
Esempio n. 50
0
    def post_init(self):
        retse = Event("__.retsidle__")
        retse.define(msg_definition="^\\.retsidle")
        retse.subscribe(self)
        self.cmd = ".retsidle"
        self.help = "How long has rets been idle?"
        self.rets_current_nick = "rets|audrey"

        self.bot.register_event(retse, self)
Esempio n. 51
0
  def post_init(self):
    isup = Event("__.isup__")
    isup.define(msg_definition="^\.isup")
    isup.subscribe(self)

    # register ourself to our new isup event
    self.bot.register_event(isup, self)

    self.url = "http://isup.me/"
Esempio n. 52
0
 def post_init(self):
     kanbo = Event("__.custom__")
     kanbo.define(msg_definition="^\\.kanbo")
     kanbo.subscribe(self)
     self.help = ".kanbo (kanbo face)"
     self.bot.register_event(kanbo, self)
     self.messages = [
         '( ͡° ͜ʖ ͡°)', '( ͡0 ͜ʖ ͡0)', '|╲/( ͡° ͡° ͜ʖ ͡° ͡°)/\\╱\\',
         '┬┴┬┴┤( ͡° ͜ʖ├┬┴┬┴'
     ]
Esempio n. 53
0
    def post_init(self):
        twitter = Event("__.twitter__")
        twitter.define(user_definition=self.user_to_track)
        twitter.subscribe(self)
        self.bot.register_event(twitter, self)

        twitter_command = Event("__.twitter_command__")
        twitter_command.define(msg_definition="^\\.twitter url")
        twitter_command.subscribe(self)
        self.bot.register_event(twitter_command, self)
Esempio n. 54
0
    def post_init(self):
        vevent = Event("__.vyos__")
        vevent.define(msg_definition="^\\.vyos")
        vevent.subscribe(self)
        self.help = ".vyos <name of box>"
        self.box_to_ip = dict([('mech', '10.0.0.76'),
                               ('bonekin', '192.168.17.40'),
                               ('thraust', '192.168.0.126')])

        self.bot.register_event(vevent, self)
Esempio n. 55
0
    def post_init(self):
        twitter = Event("__.twitter__")
        twitter.define(user_definition=self.user_to_track)
        twitter.subscribe(self)
        self.bot.register_event(twitter, self)

        twitter_command = Event("__.twitter_command__")
        twitter_command.define(msg_definition="^\.twitter url")
        twitter_command.subscribe(self)
        self.bot.register_event(twitter_command, self)
Esempio n. 56
0
 def post_init(self):
     rshort = Event("__rshort__")
     rshort.define(
         msg_definition=
         "https?://www.reddit.com/[\\S]+|https?://reddit.com/[\\S]+|reddit.com/[\\S]+|https?://old.reddit.com/[\\S]+"
     )
     rshort.subscribe(self)
     self.help = None
     self.r_pattern = r"https?://www.reddit.com/[\S]+|https?://reddit.com/[\S]+|reddit.com/[\S]+|https?://old.reddit.com/[\S]+"
     # register ourself to our new rshort event
     self.bot.register_event(rshort, self)
Esempio n. 57
0
    def post_init(self):
        isup = Event("__.isup__")
        isup.define(msg_definition=r"^\.isup")
        isup.subscribe(self)
        self.help = ".isup <Valid website using *.com, *.net, etc.>"

        # register ourself to our new isup event
        self.bot.register_event(isup, self)

        self.url = "https://api.downfor.cloud/httpcheck/"  # URL which outputs JSON data
        """
Esempio n. 58
0
File: isup.py Progetto: hlmtre/pybot
  def post_init(self):
    isup = Event("__.isup__")
    isup.define(msg_definition=r"^\.isup")
    isup.subscribe(self)
    self.help = ".isup <Valid website using *.com, *.net, etc.>"

    # register ourself to our new isup event
    self.bot.register_event(isup, self)

    self.url = "https://api.downfor.cloud/httpcheck/" # URL which outputs JSON data

    """
Esempio n. 59
0
  def post_init(self):
    youtube = Event("__.youtubes__")
    youtube.define(msg_definition="youtube\.com[\S]+")
    youtube2 = Event("__.youtubeshort__")
    youtube2.define(msg_definition="(?<!=)youtu\.be[\S]+")
    youtube.subscribe(self)
    youtube2.subscribe(self)

    self.bot.register_event(youtube, self)
    self.bot.register_event(youtube2, self)

    self.bot.mem_store['youtube'] = OrderedDict()
Esempio n. 60
0
  def post_init(self):

    self.bot.mem_store['replace'] = {}
    replace = Event("__.r__")
    replace.define(msg_definition=".*")
    replace.subscribe(self)

    self.bot.register_event(replace, self)

    self.help = ".r <search string> | <replacement text> OR s/<search string>/<replacement string>"
    self.MAX_BUFFER_SIZE = 300 
    self.MAX_HISTORY_SIZE = 10