upd
This commit is contained in:
parent
3adc44fe8e
commit
b3aeae64e9
@ -1,17 +1,5 @@
|
|||||||
{
|
{
|
||||||
"onMessage": {
|
"onMessage": {
|
||||||
"-1001491510225": [
|
|
||||||
{
|
|
||||||
"filter": {
|
|
||||||
"type": "contain",
|
|
||||||
"value": "Школьный"
|
|
||||||
},
|
|
||||||
"action": {
|
|
||||||
"type": "forward",
|
|
||||||
"chatId": -1001699667908
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"-1002182676107": [
|
"-1002182676107": [
|
||||||
{
|
{
|
||||||
"filter": {
|
"filter": {
|
||||||
@ -23,18 +11,6 @@
|
|||||||
"chatId": -1002184916546
|
"chatId": -1002184916546
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"-1001652154331": [
|
|
||||||
{
|
|
||||||
"filter": {
|
|
||||||
"type": "contain",
|
|
||||||
"value": "Школьный"
|
|
||||||
},
|
|
||||||
"action": {
|
|
||||||
"type": "forward",
|
|
||||||
"chatId": -1001699667908
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -27,6 +27,13 @@ class Bot():
|
|||||||
await self.__bot.send_read_acknowledge(event.chat_id, event.message)
|
await self.__bot.send_read_acknowledge(event.chat_id, event.message)
|
||||||
raise events.StopPropagation
|
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"))
|
@self.__bot.on(events.NewMessage(incoming=True, pattern="!reload"))
|
||||||
async def onMessageReload(event):
|
async def onMessageReload(event):
|
||||||
self.__reload()
|
self.__reload()
|
||||||
|
@ -16,6 +16,10 @@ class Config():
|
|||||||
return on_message[chat_id_str]
|
return on_message[chat_id_str]
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def read_as_text(self) -> str:
|
||||||
|
with open(self.__filename, 'r') as f:
|
||||||
|
return ''.join(f.readlines())
|
||||||
|
|
||||||
def __read(self) -> None:
|
def __read(self) -> None:
|
||||||
with open(self.__filename, 'r') as f:
|
with open(self.__filename, 'r') as f:
|
||||||
self.__config = json.load(f)
|
self.__config = json.load(f)
|
||||||
|
Loading…
Reference in New Issue
Block a user