Implemented god_mode for super admins and updated dependencies
This commit is contained in:
parent
2e3029a0e3
commit
617254fcda
|
@ -1,7 +1,8 @@
|
|||
FROM python:3.6.1-slim
|
||||
FROM python:3.6.2-alpine3.6
|
||||
ENV CONFIG_PATH "cfg/main.docker.cfg"
|
||||
RUN mkdir /code
|
||||
RUN mkdir /code/
|
||||
WORKDIR /code
|
||||
ADD requirements.txt /code/
|
||||
RUN pip install -r requirements.txt
|
||||
ADD . /code/
|
||||
CMD ["python", "-u", "run.py"]
|
||||
|
|
|
@ -2,14 +2,15 @@ version: '2.1'
|
|||
services:
|
||||
bot:
|
||||
build: .
|
||||
command: python run.py
|
||||
volumes:
|
||||
- .:/code
|
||||
depends_on:
|
||||
- redis
|
||||
restart: unless-stopped
|
||||
redis:
|
||||
image: redis:3.2.8-alpine
|
||||
image: healthcheck/redis:alpine
|
||||
volumes:
|
||||
- ./storage:/data
|
||||
ports:
|
||||
- "6379:6379"
|
||||
restart: unless-stopped
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
python-telegram-bot==5.3.0
|
||||
redis==2.10.5
|
||||
python-telegram-bot==6.1.0
|
||||
redis==2.10.6
|
||||
Pillow==4.1.0
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
[bot]
|
||||
token=
|
||||
name=
|
||||
god_mode=
|
||||
anchors=bot,бот,imaginary_friend,ImaginaryFriend,ImaginaryFriendBot,@ImaginaryFriendBot
|
||||
purge_interval=43200.0
|
||||
default_chance=5
|
||||
|
|
|
@ -5,7 +5,7 @@ import os
|
|||
encoding = 'utf-8'
|
||||
|
||||
sections = {
|
||||
'bot': ['token', 'name', 'anchors', 'purge_interval', 'default_chance', 'spam_stickers'],
|
||||
'bot': ['token', 'name', 'anchors', 'god_mode', 'purge_interval', 'default_chance', 'spam_stickers'],
|
||||
'grammar': ['chain_length', 'separator', 'stop_word', 'end_sentence', 'all'],
|
||||
'logging': ['level'],
|
||||
'updates': ['mode'],
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
from .base import Base
|
||||
from src.config import trigram_repository
|
||||
from src.config import config, trigram_repository
|
||||
|
||||
|
||||
class Moderate(Base):
|
||||
aliases = ['mod_f', 'mod_d']
|
||||
super_admins = config.getlist('bot', 'god_mode')
|
||||
|
||||
@staticmethod
|
||||
def execute(bot, command):
|
||||
|
@ -30,4 +31,4 @@ class Moderate(Base):
|
|||
user_id = entity.message.from_user.id
|
||||
admin_ids = list(map(lambda m: m.user.id, bot.get_chat_administrators(entity.chat_id)))
|
||||
|
||||
return user_id in admin_ids
|
||||
return user_id in admin_ids or user_id in Moderate.super_admins
|
||||
|
|
Loading…
Reference in New Issue