%first/%rand/%last image

This commit is contained in:
Klemek
2021-05-19 13:31:07 +02:00
parent 13447ff869
commit 516eb75b5c
8 changed files with 129 additions and 55 deletions
+11 -7
View File
@@ -9,13 +9,17 @@ from utils import generate_help
class RandomScanner(HistoryScanner):
@staticmethod
def help() -> str:
return generate_help("rand", "Read a random message (add text to filter like %find)")
return generate_help(
"rand",
"Read a random message (add text to filter like %find)",
args=["image - pull an image instead of a message"],
)
def __init__(self):
super().__init__(help=RandomScanner.help(), allow_queries=True)
super().__init__(help=RandomScanner.help())
def allow_message(self, *_) -> bool:
return True
def get_results(self, intro: str) -> List[str]:
return self.history.to_string(type="random")
async def get_results(self, intro: str) -> List[str]:
if self.images_only:
return await self.history.to_string_image(type="random")
else:
return self.history.to_string(type="random")