This commit is contained in:
bvn13 2024-07-11 00:58:11 +03:00
parent 3adc44fe8e
commit b3aeae64e9
4 changed files with 12 additions and 25 deletions

View File

@ -1,17 +1,5 @@
{
"onMessage": {
"-1001491510225": [
{
"filter": {
"type": "contain",
"value": "Школьный"
},
"action": {
"type": "forward",
"chatId": -1001699667908
}
}
],
"-1002182676107": [
{
"filter": {
@ -23,18 +11,6 @@
"chatId": -1002184916546
}
}
],
"-1001652154331": [
{
"filter": {
"type": "contain",
"value": "Школьный"
},
"action": {
"type": "forward",
"chatId": -1001699667908
}
}
]
}
}

View File

@ -27,6 +27,13 @@ class Bot():
await self.__bot.send_read_acknowledge(event.chat_id, event.message)
raise events.StopPropagation
@self.__bot.on(events.NewMessage(incoming=True, pattern="!config"))
async def onMessageReload(event):
self.__reload()
await event.reply("```\n{0}\n```".format(self.__config.read_as_text()))
await self.__bot.send_read_acknowledge(event.chat_id, event.message)
raise events.StopPropagation
@self.__bot.on(events.NewMessage(incoming=True, pattern="!reload"))
async def onMessageReload(event):
self.__reload()

View File

@ -16,6 +16,10 @@ class Config():
return on_message[chat_id_str]
return None
def read_as_text(self) -> str:
with open(self.__filename, 'r') as f:
return ''.join(f.readlines())
def __read(self) -> None:
with open(self.__filename, 'r') as f:
self.__config = json.load(f)

View File

@ -1 +1 @@
0.1.0
0.1.1