Giter Site home page Giter Site logo

scp-079-tip's Introduction

SCP-079-TIP

This bot is used to send tips.

How to use

Requirements

  • Python 3.6 or higher
  • Debian 10: sudo apt update && sudo apt install opencc pybind11-dev -y
  • Google RE2 installed
    • sudo apt install build-essential git python3-dev -y
    • git clone https://github.com/google/re2.git ~/re2
    • cd ~/re2
    • make
    • make test
    • sudo make install
    • make testinstall
    • sudo ldconfig
  • pip: pip install -r requirements.txt

Files

  • examples
    • config.ini -> ../data/config/config.ini : Configuration example
    • join.txt -> ../data/config/join.txt : Join template example
    • start.txt -> ../data/config/start.txt : Start template example
  • plugins
    • functions
      • channel.py : Functions about channel
      • command.py : Functions about command
      • config.py : Functions about group settings
      • decorators.py : Some decorators
      • etc.py : Miscellaneous
      • file.py : Save files
      • filters.py : Some filters
      • group.py : Functions about group
      • ids.py : Modify id lists
      • markup.py : Get reply markup
      • program.py : Functions about program
      • receive.py : Receive data from exchange channel
      • telegram.py : Some telegram functions
      • timers.py : Timer functions
      • tip.py : Functions about tips
      • user.py : Functions about user and channel object
    • handlers
      • callback.py : Handle callbacks
      • command.py : Handle commands
      • message.py: Handle messages
    • checker.py : Check the format of config.ini
    • glovar.py : Global variables
    • start.py : Execute before client start
    • version.py : Execute before main script start
  • .gitignore : Ignore
  • Dockerfile : Assemble the docker image
  • LICENSE : GPLv3
  • main.py : Start here
  • README.md : This file
  • requirements.txt : Managed by pip

Contribution

Contributions are always welcome, whether it's modifying source code to add new features or bug fixes, documenting new file formats or simply editing some grammar.

You can also join the discuss group if you are unsure of anything.

Translation

License

Licensed under the terms of the GNU General Public License v3.

scp-079-tip's People

Contributors

borschts avatar chaosrun avatar dependabot[bot] avatar septs avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

scp-079-tip's Issues

在 Telegram 支持多置顶消息后,兼容性不佳

遇到的问题

当群组绑定了频道,且频道发送了新消息,导致群内最新的置顶被频道消息替换后,机器人无法及时恢复原有置顶,通常会一直重试,直到 30 分钟左右才能解决。

猜测

此问题可能由当前采用的 Pyrogram 版本不兼容 Layer 122 导致,将在尝试更新依赖后查看是否解决。

扩展 TIP 支持的关键词匹配模式

原因

当前 TIP 支持的关键词匹配模式不足以满足精细的消息控制需求。

扩展后的匹配模式列表

  • include:包含匹配。
  • exact:全匹配。
  • case:大小写敏感。
  • regex:使用正则匹配模式,每个以 || 分隔的关键词都被当做一条独立的正则表达式,正则表达式的语法请参照 Google RE2 的 Wiki
  • pure:去除名称、简介中的干扰字符。
  • forward:仅匹配被转发的消息。
  • user:仅匹配转发自用户的消息。
  • channel:仅匹配转发自频道的消息。
  • reply:仅匹配以「回复」形式发出的消息。
  • discuss:仅匹配对频道消息的评论。
  • strange:仅匹配非本群的群员对频道消息的评论。
  • mentioned:仅匹配含有 mention 的消息。
  • service:仅匹配服务消息。
  • join:仅匹配用户入群消息。
  • leave:仅匹配用户退群消息。
  • name:仅匹配名称(用户名、消息转发来源名)。
  • bio:仅匹配用户入群时的个人简介。
  • media:仅匹配媒体消息。
  • edit:仅匹配被编辑的消息。
  • url:仅匹配消息中的网址。
  • filename:仅匹配任意媒体消息中的文件名。
  • audio:仅匹配包含音频的消息,同时检查文件名,音频标题,演奏者。
  • document:仅匹配包含文档的消息,同时检查文件名。
  • photo:仅匹配包含图片的消息。
  • sticker:仅匹配表情贴纸消息,同时检查文件名,表情包的名称和其代号名(set_name)。
  • animation:仅匹配包含动图的消息,同时检查文件名。
  • game:仅匹配包含游戏的消息,同时检查游戏标题,代号名(short_name),游戏描述。
  • score:仅匹配用户游戏得分的服务消息,同时检查用户名。
  • video:仅匹配包含视频的消息,同时检查文件名。
  • voice:仅匹配包含语音的消息。
  • video_note:仅匹配包含圆视频的消息。
  • caption:仅匹配包含媒体内容的消息内的附文(caption)。
  • contact:仅匹配包含联系人卡片的消息,同时检查联系人电话号码,用户昵称。
  • location:仅匹配包含定位信息的消息。
  • venue:仅匹配包含定位地址的消息,同时检查标题,详细地址。
  • web_page:仅匹配以预览形式发出的消息,同时检查预览网址,预览内容。
  • poll:仅匹配投票消息,同时检查问题,选项。
  • dice:仅匹配骰子类表情消息,同时检查具体 emoji。
  • via_bot:仅匹配通过机器人发送的消息。
  • reply_markup:仅匹配包含链接按钮的消息,同时检查按钮的链接。

支持「任意使用」模式

原因

当前 TIP 的实例要求使用者进行申请方可在工作组授权后使用,并且要求 USER 在群组中为管理员。

考虑到 TIP 并不使用运营者所设置的全局规则,因此在某些情况下,可以考虑让群组自行拉入 TIP 机器人来使用。

需要解决的问题

需要抉择:「任意使用」模式下是否应该转发证据、是否应该遵循证据优先原则。这个选择决定了 TIP 是否应该使用阻塞式的方式来排队处理消息,因为在需要转发证据的情况下,为了保持证据频道的展示直观,需要原始证据和附加消息紧连、顺序地呈现,如果采用非阻塞的方式处理群组消息,则无法保证这一点,证据频道的消息存放顺序有可能产生混乱;而在「任意使用」模式下,假设使用机器人的群组较多,使用阻塞式的方式来处理消息,则可能会导致机器人受「证据优先」原则的限制,导致反应变慢。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.