def get_ai_response( self, message: str, *, unique_id: str = None, dev_name: str = None, bot_name: str = None, language: str = None, ): params: Dict[str, Optional[str]] = {"message": message} if unique_id: params["uid"] = unique_id if dev_name or self.dev_name: params["master"] = dev_name or self.dev_name if language or self.ai_language: params["language"] = dev_name or self.ai_language or "english" if bot_name or self.bot_name: params["bot"] = bot_name or self.bot_name if self.plan: url = f"/{self.plan.value}/ai/" else: url = "/ai/" return Get(url, params=params)
def get_ai_response(self, msg: str, *, lang="en") -> str: """Gets random AI response Parameters: - msg (str): The message on which the response is required. - lang (str): The language in which response is required. It is `en` (English) by default. Returns: - str : The random response. """ return Get("/ai/response", params={"message": msg, "language": lang})
def get_image(self, _type: str = "aww") -> str: """Gets a random image Parameters: - _type (str): The type of joke. Use `any` for a random type. Can be: ('aww', 'duck', 'dog', 'cat', 'memes', 'dankmemes', 'holup', 'art', 'harrypottermemes', 'facepalm', 'any') Returns: - str: The random joke """ _type = _type.lower() if _type not in self._image_types: raise RuntimeError("Unknown image type provided: {}".format(_type)) return Get("/image/" + _type)
def get_joke(self, _type: str = "any") -> dict: """Gets a random joke Parameters: - _type (str): The type of joke. Leave it or use `any` for a random type. Can be: ('dev', 'spooky', 'pun', 'any') Returns: - str: The random joke """ _type = _type.lower() if _type.lower() not in self._joke_types: raise RuntimeError("Unknown joke type provided: {}".format(_type)) return Get("/joke/" + _type)
def get_quiz(self, *, category: Optional[str]=None, limit: Optional[int] = None, difficulty: Optional[str] = None, tags: Union[List[str], str] = None ) -> List[Question]: """ Parameters: category: The category of quiz questions to query limit: Number of questions to query """ tags_final = None if isinstance(tags, list): tags_final = ",".join(tags) elif isinstance(tags, str): tags_final = tags params = {"category": category, "limit": limit, "difficulty": difficulty, "tags": tags_final} params = {k: params[k] for k in list(filter(lambda arg: params[arg], params))} return Get("/questions", params=params)
def get_ai_response( self, message: str, *, unique_id: str = None, dev_name: str = None, bot_name: str = None, language: str = None, ): params: Dict[str, Optional[str]] = {"message": message} if unique_id: params["unique_id"] = unique_id if dev_name or self.dev_name: params["dev_name"] = dev_name or self.dev_name if language or self.ai_language: params["language"] = dev_name or self.ai_language if bot_name or self.bot_name: params["bot_name"] = bot_name or self.bot_name return Get("/ai/response", params=params)
def get_image(self, _type: str = "aww") -> str: _type = _type.lower() if _type not in self._image_types: raise RuntimeError("Unknown image type provided: {}".format(_type)) return Get("/image/", params={"type": _type})
def get_joke(self, _type: str = "any") -> dict: _type = _type.lower() if _type.lower() not in self._joke_types: raise RuntimeError("Unknown joke type provided: {}".format(_type)) return Get("/joke/", params={"type": _type})
def get_ai_response(self, msg: str, *, lang="en") -> str: return Get("/ai/response", params={"message": msg, "language": lang})
def get_all_people(self, *, quantity: int) -> Dict: return Get("/all", params={'quantity': quantity})