def _is_user(self, user):
     if user in ["beginbot", "beginbotbot"]:
         return True
     elif user in STREAM_GODS:
         return True
     elif self.allow_random_user:
         # we need to add the WelcomeCommittee here as well
         return (user in self.all_user_names or user == "random"
                 or user in WelcomeCommittee().present_users())
     else:
         return (user in self.all_user_names
                 or user in WelcomeCommittee().present_users())
Beispiel #2
0
    def build_response(self) -> Optional[str]:
        if self.user == "nightbot":
            return

        if self.user not in BLACKLISTED_LOG_USERS:
            self._logger.info(f"{self.user}: {self.msg}")
            WelcomeCommittee().welcome_new_users(self.user)

        success(f"\n{self.user}: {self.msg}")

        if self.user in STREAM_GODS:
            print(f"Oh Look we got a Stream God over here: {self.user}")
            if self.command == "curb_your_begin":
                return BreakingNews(" ".join(self.irc_msg.args), category="curb").save()

            if self.command in ["iasip", "alwayssunny"]:
                BreakingNews(" ".join(self.irc_msg.args), category="iasip").save()
                return

        parser = CommandParser(
            user=self.user, command=self.command, args=self.args
        ).parse()

        for Router in ROUTERS:
            try:
                if result := Router(self.user, self.command, self.args, parser).route():

                    # TODO: Sort out this Result Concept Better
                    if isinstance(result, Result):
                        # TODO: Update This
                        UserEvent(
                            user=self.irc_msg.user,
                            command=self.irc_msg.command,
                            msg=self.irc_msg.msg,
                            result=[],
                            # result=result,
                        ).save()
                    else:
                        UserEvent(
                            user=self.irc_msg.user,
                            command=self.irc_msg.command,
                            msg=self.irc_msg.msg,
                            result=result,
                        ).save()

                    return result
            except Exception as e:
                traceback.print_exc()
                # raise e

        if self.command in OBS_COMMANDS and self.user in STREAM_LORDS:
            print(f"executing OBS Command: {self.command}")
            return os.system(f"so {self.command}")

        if self.command in SoundeffectsLibrary.fetch_soundeffect_names():
            if self.command:
                PlaySoundeffectRequest(user=self.user, command=self.command).save()
 def _subject():
     return WelcomeCommittee(welcome_file=welcome_file)
 def _add_soundeffect_args(self):
     args = [self.youtube_id, self.name, self.start_time, self.end_time]
     if self.name in WelcomeCommittee().present_users():
         args = args + ["theme"]
     return args
Beispiel #5
0
    def build_response(self) -> Optional[str]:
        if self.user == "nightbot":
            return

        if self.user not in BLACKLISTED_LOG_USERS:
            self._logger.info(f"{self.user}: {self.msg}")
            WelcomeCommittee().welcome_new_users(self.user)

        success(f"\n{self.user}: {self.msg}")

        if self.user in STREAM_GODS:
            print(f"Oh Look we got a Stream God over here: {self.user}")
            if self.command == "curb_your_begin":
                return BreakingNews(" ".join(self.irc_msg.args), category="curb").save()

            if self.command in ["iasip", "alwayssunny"]:
                BreakingNews(" ".join(self.irc_msg.args), category="iasip").save()
                return

        parser = CommandParser(
            user=self.user, command=self.command, args=self.args
        ).parse()

        for Router in ROUTERS:
            try:
                if result := Router(self.user, self.command, self.args, parser).route():

                    # TODO: Sort out this Result Concept Better
                    if isinstance(result, Result):
                        # TODO: Update This
                        UserEvent(
                            user=self.irc_msg.user,
                            command=self.irc_msg.command,
                            msg=self.irc_msg.msg,
                            result=[],
                            # result=result,
                        ).save()
                    else:
                        UserEvent(
                            user=self.irc_msg.user,
                            command=self.irc_msg.command,
                            msg=self.irc_msg.msg,
                            result=result,
                        ).save()

                    return result
            except Exception as e:
                traceback.print_exc()
                # raise e

        if self.command == "whylua":
            os.system(f"scene codin_and_teej")

        pack_config = {
            "teej_pack" : [],
            "dean_pack" : [],
            "erik_pack" : [],
            "vim_pack" : [],
            "pokemon_pack" : [],
            "sandstorm_pack" : [],
            "linux_pack" : [],
            "eightbit_pack" : [ "8bitmack", "8bitymca", "8bitmackintro",
                "8bitsk8erboi", "8bitmacarena", "8bitrickandmorty", "8bitimperial",
                "8bitfriday", "8bitghostbusters1", "8bitghostbuster2",
                "8bitfatbottomedgirls", "8bittoto", "8bitbitesthedust",
                "8bitchampions", "8bitbohemian", "8bitbagpipes", "8bitwreckingball",
                "8bitzelda", "8bitonemoretime", "8bitabout", "8bitblue",
                "8bithammer", "8bitafrica", "8bitrugrats", "8bitroll",
                "8bitparadise", "8bitrangers", "8bitcalifornialove" ],
            "silicon_valley_pack" : [],
            "gaming_pack" : [],
            "begin_pack" : [ "itsmedavid", "penisinspected", "bestsound",
                "beginsing", "beginvimeyes", "crack" ],
            "yacht_pack" : [],
            "luke_pack" : [ "gcc", "alpine", "xoomers", "inspiredme", "i3", "i3v2", "python" ],
            "wesley_willis_pack" : [],
            "art_matt_pack" : ["thisiscoke", "easyartmatt", "zenofartmatt", "moremore", "thisslaps"],
            "shannon_pack" : [],
            "meme_pack" : [],
            "i3_pack" : [],
            "prime_pack" : [ "primetrollsbegin", "primebegin", "primeslam", "primeagen", "primeagenpity", "begin_v_prime", "nevervim", ]
        }

        if self.command in pack_config["prime_pack"]:
            os.system(f"scene primetime")

        if self.command == "droppack" and self.user in STREAM_GODS and self.args[0] in pack_config.keys():
            sounds = pack_config[ self.args[0] ]
            for sound in sounds:
                drop_effect(parser.target_user, sound)
            return f"Dropping the {self.args[0]} Pack for {parser.target_user}"

        if self.command in OBS_COMMANDS and self.user in STREAM_LORDS:
            print(f"executing OBS Command: {self.command}")
            return os.system(f"so {self.command}")

        if self.command == "trollbegin" and User(self.user).mana() > 0:
            User(self.user).kill()
            pause = 1
            if parser.amount > 10:
                return "Trolling is the Art of Sublety"

            for _ in range(0, parser.amount):
                spin_begin(pause / parser.amount)
            return

        if self.command == "hottub" and self.user in STREAM_LORDS:
            return os.system("scene hottub")

        if self.command in SoundeffectsLibrary.fetch_soundeffect_names():
            if self.command:
                return PlaySoundeffectRequest(
                    user=self.user, command=self.command
                ).save()

        from pathlib import Path

        user_msgs_path = Path(__file__).parent.parent.joinpath("logs/user_msgs.log")
        if self.user not in BLACKLISTED_LOG_USERS:
            with open(user_msgs_path, "a") as log_file:
                log_file.write(f"{self.user}: {self.msg}\n")
Beispiel #6
0
 def _is_user(self, user):
     return user in WelcomeCommittee().present_users() or user == "random"