# Path: hypebot/commands/command_lib.py
# class BaseCommand(object):
# class BasePublicCommand(BaseCommand):
# class TextCommand(BaseCommand):
#   DEFAULT_PARAMS = params_lib.HypeParams({
#       # See _Ratelimit for details.
#       'ratelimit': {
#           'enabled': True,
#           # One of USER, GLOBAL, or CHANNEL. Calls from the same scope are
#           # rate-limitted.
#           'scope': 'USER',
#           # Minimum number of seconds to pass between calls.
#           'interval': 5,
#           # Will only ratelimit if _Handle returns a value.
#           'return_only': False,
#       },
#       # Which channels (rooms) should handle the message.
#       #
#       # This operates in addition to the parsers and is useful for surfacing
#       # different commands for different communities. E.g., !who could be
#       # handled by different commands for a LoL or Overwatch channel.
#       #
#       # Default allows all channels to utilize command.  Otherwise, supply a
#       # list of channels where the specified id must be a prefix of the incoming
#       # message's channel.id.
#       'channels': [''],
#       # Alternatively, which channels should not handle the message. This takes
#       # precedence over 'channels'.
#       #
#       # Default allows all channels to handle the message.
#       'avoid_channels': [],
#       # By default, parsers may provide a `target_user` in their kwargs which
#       # gets auto-converted into a User proto if the correponsing user exists.
#       # If the user does not exist, the command will respond "Unknown user
#       # $target_user" and not call the underlying `_Handle` method. If you
#       # override this to `True`, it will create a fake user with user_id and
#       # display_name set to target_user if the user does not exist.
#       'target_any': False,
#       # If the command should only be invoked in channels with PRIVATE
#       # visibility (aka private messages, or DMs as the kids say).
#       'private_channels_only': False,
#   })
#   _DEFAULT_SCOPE = 'all'
#   DEFAULT_PARAMS = params_lib.MergeParams(BaseCommand.DEFAULT_PARAMS,
#                                           {'ratelimit': {
#                                               'enabled': False
#                                           }})
#   DEFAULT_PARAMS = params_lib.MergeParams(
#       BaseCommand.DEFAULT_PARAMS,
#       {'choices': ['Do not forget to override me.']})
#   def __init__(self, params, core):
#   def Handle(self, channel: channel_pb2.Channel, user: user_pb2.User,
#              message: Text) -> hype_types.CommandResponse:
#   def _InScope(self, channel: channel_pb2.Channel):
#   def _Ratelimit(self, channel: channel_pb2.Channel, user: user_pb2.User, *args,
#                  **kwargs):
#   def _ParseCommandTarget(self, user: user_pb2.User, target_user: Text,
#                           message: Text) -> Optional[user_pb2.User]:
#   def _Reply(self, *args, **kwargs):
#   def _Spook(self, user: user_pb2.User) -> None:
#   def _Handle(self, channel: channel_pb2.Channel, user: user_pb2.User, *args,
#               **kwargs):
# def _AddParserInInit(cls, parser: Callable, has_prefix: bool = False) -> None:
#   def NewInit(self, *args, **kwargs):
# def _ParseArgs(match):
# def CommandRegexParser(pattern: Text,
#                        flags: int = re.DOTALL,
#                        reply_to_public: bool = True,
#                        reply_to_private: bool = True,
#                        reply_to_system: bool = False):
#   def Parser(channel: channel_pb2.Channel, unused_user: user_pb2.User,
#              message: Text,
#              command_prefix: Text) -> Tuple[bool, List[Any], Dict[Text, Any]]:
#   def Decorator(cls):
# def SystemCommandRegexParser(pattern: Text, flags: int = re.DOTALL):
# def RegexParser(pattern):
#   def Parser(unused_channel: channel_pb2.Channel, unused_user: user_pb2.User,
#              message: Text) -> Tuple[bool, List, Dict]:
#   def Decorator(cls):
# def PublicParser(cls):
#   def Parser(channel: channel_pb2.Channel, unused_user: user_pb2.User,
#              message: Text) -> Tuple[bool, List[Any], Dict]:
# def LimitPublicLines(max_lines: int = 6):
#   def Decorator(fn):
#     def Wrapped(fn_self, channel: channel_pb2.Channel, user: user_pb2.User,
#                 *args, **kwargs):
# def HumansOnly(message='I\'m sorry %s, I\'m afraid I can\'t do that'):
#   def Decorator(fn):
#     def Wrapped(fn_self, channel: channel_pb2.Channel, user: user_pb2.User,
#                 *args, **kwargs):
# def RequireReady(obj_name):
#   def Decorator(fn):
#     def Wrapped(fn_self, *args, **kwargs):
#   def __init__(self, *args):
#   def _Handle(self, channel: channel_pb2.Channel, user: user_pb2.User):


from hypebot.commands import command_lib
# Copyright 2018 The Hypebot Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""League trivia commands."""



@command_lib.CommandRegexParser(r'trivia ?([0-9]*)')
class TriviaAddCommand(command_lib.BaseCommand):

  def _Handle(self, channel, user, num_questions):
    if not self._core.trivia.IsTrivaChannel(channel):
      return
    num_questions = min(int(num_questions or 1), 10)
    self._core.trivia.AddQuestions(channel, num_questions)


@command_lib.PublicParser

# Path: hypebot/commands/command_lib.py
# class BaseCommand(object):
# class BasePublicCommand(BaseCommand):
# class TextCommand(BaseCommand):
#   DEFAULT_PARAMS = params_lib.HypeParams({
#       # See _Ratelimit for details.
#       'ratelimit': {
#           'enabled': True,
#           # One of USER, GLOBAL, or CHANNEL. Calls from the same scope are
#           # rate-limitted.
#           'scope': 'USER',
#           # Minimum number of seconds to pass between calls.
#           'interval': 5,
#           # Will only ratelimit if _Handle returns a value.
#           'return_only': False,
#       },
#       # Which channels (rooms) should handle the message.
#       #
#       # This operates in addition to the parsers and is useful for surfacing
#       # different commands for different communities. E.g., !who could be
#       # handled by different commands for a LoL or Overwatch channel.
#       #
#       # Default allows all channels to utilize command.  Otherwise, supply a
#       # list of channels where the specified id must be a prefix of the incoming
#       # message's channel.id.
#       'channels': [''],
#       # Alternatively, which channels should not handle the message. This takes
#       # precedence over 'channels'.
#       #
#       # Default allows all channels to handle the message.
#       'avoid_channels': [],
#       # By default, parsers may provide a `target_user` in their kwargs which
#       # gets auto-converted into a User proto if the correponsing user exists.
#       # If the user does not exist, the command will respond "Unknown user
#       # $target_user" and not call the underlying `_Handle` method. If you
#       # override this to `True`, it will create a fake user with user_id and
#       # display_name set to target_user if the user does not exist.
#       'target_any': False,
#       # If the command should only be invoked in channels with PRIVATE
#       # visibility (aka private messages, or DMs as the kids say).
#       'private_channels_only': False,
#   })
#   _DEFAULT_SCOPE = 'all'
#   DEFAULT_PARAMS = params_lib.MergeParams(BaseCommand.DEFAULT_PARAMS,
#                                           {'ratelimit': {
#                                               'enabled': False
#                                           }})
#   DEFAULT_PARAMS = params_lib.MergeParams(
#       BaseCommand.DEFAULT_PARAMS,
#       {'choices': ['Do not forget to override me.']})
#   def __init__(self, params, core):
#   def Handle(self, channel: channel_pb2.Channel, user: user_pb2.User,
#              message: Text) -> hype_types.CommandResponse:
#   def _InScope(self, channel: channel_pb2.Channel):
#   def _Ratelimit(self, channel: channel_pb2.Channel, user: user_pb2.User, *args,
#                  **kwargs):
#   def _ParseCommandTarget(self, user: user_pb2.User, target_user: Text,
#                           message: Text) -> Optional[user_pb2.User]:
#   def _Reply(self, *args, **kwargs):
#   def _Spook(self, user: user_pb2.User) -> None:
#   def _Handle(self, channel: channel_pb2.Channel, user: user_pb2.User, *args,
#               **kwargs):
# def _AddParserInInit(cls, parser: Callable, has_prefix: bool = False) -> None:
#   def NewInit(self, *args, **kwargs):
# def _ParseArgs(match):
# def CommandRegexParser(pattern: Text,
#                        flags: int = re.DOTALL,
#                        reply_to_public: bool = True,
#                        reply_to_private: bool = True,
#                        reply_to_system: bool = False):
#   def Parser(channel: channel_pb2.Channel, unused_user: user_pb2.User,
#              message: Text,
#              command_prefix: Text) -> Tuple[bool, List[Any], Dict[Text, Any]]:
#   def Decorator(cls):
# def SystemCommandRegexParser(pattern: Text, flags: int = re.DOTALL):
# def RegexParser(pattern):
#   def Parser(unused_channel: channel_pb2.Channel, unused_user: user_pb2.User,
#              message: Text) -> Tuple[bool, List, Dict]:
#   def Decorator(cls):
# def PublicParser(cls):
#   def Parser(channel: channel_pb2.Channel, unused_user: user_pb2.User,
#              message: Text) -> Tuple[bool, List[Any], Dict]:
# def LimitPublicLines(max_lines: int = 6):
#   def Decorator(fn):
#     def Wrapped(fn_self, channel: channel_pb2.Channel, user: user_pb2.User,
#                 *args, **kwargs):
# def HumansOnly(message='I\'m sorry %s, I\'m afraid I can\'t do that'):
#   def Decorator(fn):
#     def Wrapped(fn_self, channel: channel_pb2.Channel, user: user_pb2.User,
#                 *args, **kwargs):
# def RequireReady(obj_name):
#   def Decorator(fn):
#     def Wrapped(fn_self, *args, **kwargs):
#   def __init__(self, *args):
#   def _Handle(self, channel: channel_pb2.Channel, user: user_pb2.User):


# Path: hypebot/commands/league/trivia_commands.py
from hypebot.commands import command_lib

# Copyright 2018 The Hypebot Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""League trivia commands."""



@command_lib.CommandRegexParser(r'trivia ?([0-9]*)')
class TriviaAddCommand(command_lib.BaseCommand):

  def _Handle(self, channel, user, num_questions):
    if not self._core.trivia.IsTrivaChannel(channel):
      return
    num_questions = min(int(num_questions or 1), 10)
    self._core.trivia.AddQuestions(channel, num_questions)


@command_lib.PublicParser

class TriviaAnswerCommand(command_lib.BasePublicCommand):