Skip to content

Short Update on the future of Nemesis and the general direction of the Karatek Network





It has been very quite here, and a lot of things changed in the meantime, so I think it is time for a quick update.

Changes to our Privacy Policy

In the past months, a lot of incidents regarding disrespectful handling of personal information occurred inside our team. This is why I am about to change our privacy policy. Our current policies allow us to do really much with the data we collect. While this is pretty helpful for some tasks, it is not strictly necessary. We are about to rewrite the entire policy in order to create a new, more transparent, readable version of it, which is more user-friendly. We won't collect anymore information which are not strictly necessary in the future.

What about Nemesis?

It has been pretty quite in Nemesis's repository for quite some time: Image
Picture: Screenshot/Karatek_HD

I'd like to explain why. Nemesis uses an old version of the python-telegram-bot-api, and needs to be ported to the latest version:
Image Picture: Screenshot/Karatek_HD

I just cannot figure out how to fix one error in particular, and do not have the motivation to dive that much into it right now. If someone has an idea about how to fix this error, any help is appreciated, please contact me at kontakt@karatek.net or write a comment below:

[2020-10-15 15:42:36,090 | DEBUG] Getting updates: [810669973]
[2020-10-15 15:42:36,090 | DEBUG] [<telegram.update.Update object at 0x7f570a3dfd00>]
[2020-10-15 15:42:36,090 | DEBUG] Exiting: get_updates
[2020-10-15 15:42:36,090 | DEBUG] Entering: get_updates
[2020-10-15 15:42:36,091 | DEBUG] Processing Update: {'update_id': 810669973, 'message': {'message_id': 123, 'date': 1602769356, 'chat': {'id': -1001153616526, 'type': 'supergroup', 'title': 'Beta'}, 'text': '/purge', 'entities': [{'type': 'bot_command', 'offset': 0, 'length': 6}], 'caption_entities': [], 'photo': [], 'new_chat_members': [], 'new_chat_photo': [], 'delete_chat_photo': False, 'group_chat_created': False, 'supergroup_chat_created': False, 'channel_chat_created': False, 'from': {'id': 540549815, 'first_name': 'Karatek', 'is_bot': False, 'username': 'Karatek_HD', 'language_code': 'en'}}}
[2020-10-15 15:42:36,203 | ERROR] No error handlers are registered, logging exception.
Traceback (most recent call last):
  File "/home/jens/Development/NemesisPY/venv/lib64/python3.8/site-packages/telegram/ext/dispatcher.py", line 340, in process_update
    handler.handle_update(update, self, check, context)
  File "/home/jens/Development/NemesisPY/venv/lib64/python3.8/site-packages/telegram/ext/handler.py", line 118, in handle_update
    self.collect_additional_context(context, update, dispatcher, check_result)
  File "/home/jens/Development/NemesisPY/venv/lib64/python3.8/site-packages/telegram/ext/commandhandler.py", line 191, in collect_additional_context
    context.args = check_result[0]
TypeError: 'bool' object is not subscriptable
#  Nemesis - Powerful  Telegram group managment bot
#  Copyright (C) 2017 - 2019 Paul Larsen
#  Copyright (C) 2019 - 2020 KaratekHD
#
#  This program is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <https://www.gnu.org/licenses/>.

import html
from typing import Optional, List

from telegram import Message, Chat, Update, Bot, User, update, ParseMode
from telegram.error import BadRequest
from telegram.ext import CommandHandler, Filters, CallbackContext
from telegram.ext.dispatcher import run_async
from telegram.utils.helpers import mention_html

from tg_bot import dispatcher, LOGGER
from tg_bot.modules.helper_funcs.chat_status import user_admin, can_delete
from tg_bot.modules.log_channel import loggable

@run_async
@user_admin
@loggable
def purge(update: Update, context: CallbackContext) -> str:
    bot = context.bot
    args = context.args
    msg = update.effective_message  # type: Optional[Message]
    if msg.reply_to_message:
        user = update.effective_user  # type: Optional[User]
        chat = update.effective_chat  # type: Optional[Chat]
        if can_delete(chat, bot.id):
            message_id = msg.reply_to_message.message_id
            delete_to = msg.message_id - 1
            if args and args[0].isdigit():
                new_del = message_id + int(args[0])
                # No point deleting messages which haven't been written yet.
                if new_del < delete_to:
                    delete_to = new_del

            for m_id in range(delete_to, message_id - 1, -1):  # Reverse iteration over message ids
                try:
                    bot.deleteMessage(chat.id, m_id)
                except BadRequest as err:
                    if err.message == "Message can't be deleted":
                        bot.send_message(chat.id, "Cannot delete all messages. The messages may be too old, I might "
                                                  "not have delete rights, or this might not be a supergroup.")

                    elif err.message != "Message to delete not found":
                        LOGGER.exception("Error while purging chat messages.")

            try:
                msg.delete()
            except BadRequest as err:
                if err.message == "Message can't be deleted":
                    bot.send_message(chat.id, "Cannot delete all messages. The messages may be too old, I might "
                                              "not have delete rights, or this might not be a supergroup.")

                elif err.message != "Message to delete not found":
                    LOGGER.exception("Error while purging chat messages.")

            bot.send_message(chat.id, "Purge complete.")
            return "<b>{}:</b>" \
                   "\n#PURGE" \
                   "\n<b>Admin:</b> {}" \
                   "\nPurged <code>{}</code> messages.".format(html.escape(chat.title),
                                                               mention_html(user.id, user.first_name),
                                                               delete_to - message_id)

    else:
        msg.reply_text("Reply to a message to select where to start purging from.")

    return ""

DELETE_HANDLER = CommandHandler("del", del_message, filters=Filters.group)
PURGE_HANDLER = CommandHandler("purge", purge, filters=Filters.group, pass_args=True)
PURGE2_HANDLER = CommandHandler("p", purge, filters=Filters.group, pass_args=True)

dispatcher.add_handler(DELETE_HANDLER)
dispatcher.add_handler(PURGE_HANDLER)
dispatcher.add_handler(PURGE2_HANDLER)

Anyway, this is the reason nothing happens right now - the few changes I made are not yet ready to show to the public, and I have some personal problems at the moment as well.

~Karatek_HD

Comments:


Last update: October 15, 2020