This commit is contained in:
HonusBot 2021-02-09 11:15:42 +01:00
parent 02178e09b0
commit 52fa6899bf
3 changed files with 15 additions and 5 deletions

2
.gitignore vendored
View File

@ -300,3 +300,5 @@ $RECYCLE.BIN/
# End of https://www.gitignore.io/api/vim,linux,macos,python,android,windows
config.ini
launch.sh

16
inline.py Normal file → Executable file
View File

@ -56,7 +56,7 @@ class JSONRequest(object):
self.command = command
self.replyToUserId = 0
self.senderUserId = senderId
self.chatId = 0
self.chatId = 987120603
self.queryText = text
self.rawSingleArgument = False
@ -125,6 +125,7 @@ class InlineBot:
def __init__(self):
self.errorText = "Sowwy mawster, an ewror occuwed. ;;w;;"
self.commands = []
self.inlinecommands = []
self.config = None
self.__loadConfig()
@ -142,7 +143,11 @@ class InlineBot:
self.commands.append(Command("Yiff", "Yiff", "imageurl", "imageUrl"))
self.commands.append(Command("Lewd", "Say hi to the police", "imageurl", "imageUrl"))
self.commands.append(Command("Rasoio", "Dai facciamogli lo scherzo del rasoio!1!!", "genericurl", "htmlDescription"))
self.cancerCommand = Command("Cancer", "Search cancer", "imageurl", "imageUrl")
self.commands.append(Command("Pillon", "Sal🅱ini ti blocca i porno, che fai?", "genericurl", "htmlDescription"))
# self.commands.append(Command("Pillon", "", "genericurl", "htmlDescription"))
self.inlinecommands.append(Command("Cancer", "Search on tbib.org", "imageurl", "imageUrl"))
self.inlinecommands.append(Command("R34", "Search on rule34.xxx", "imageurl", "imageUrl"))
self.inlinecommands.append(Command("Safe", "Search on e926", "imageurl", "imageUrl"))
def callRequest(self, command, senderid, text = ""):
if not command:
@ -225,7 +230,7 @@ class InlineBot:
if command.getMode() == "imageurl":
contentText = InputTextMessageContent("<a href=\"" + resp.getImageUrl() + "\">HonusBot</a>", "HTML")
elif command.getMode() == "genericurl":
contentText = InputTextMessageContent("<a href=\"" + resp.getHtmlDesc() + "\">link</a>", "HTML")
contentText = InputTextMessageContent(resp.getHtmlDesc(), "HTML")
else:
contentText = InputTextMessageContent("Error", "HTML")
@ -245,8 +250,9 @@ class InlineBot:
for command in self.commands:
results.append(self.makeResult(command, senderid))
else:
self.cancerCommand.setDesc("Search cancer about " + query)
results.append(self.makeResult(self.cancerCommand, senderid, query))
for command in self.inlinecommands:
command.setDesc("Search: " + query)
results.append(self.makeResult(command, senderid, query))
context.bot.answer_inline_query(update.inline_query.id, results, 1, False)
InlineBot().start()

2
service.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
python3 inline.py