originprotocol / telegram-moderator Goto Github PK
View Code? Open in Web Editor NEWTelegram bot for controlling spam, logging, and more
License: MIT License
Telegram bot for controlling spam, logging, and more
License: MIT License
When there is bandwidth, could we have the bot immediately delete .exe files and ban the user. They are still getting through (saw a few this past week). Thanks ๐
Basic steps here:
https://github.com/python-telegram-bot/python-telegram-bot/wiki/Extensions-%E2%80%93-Your-first-Bot#your-first-bot-step-by-step
Just need to get chat id for admin group, get way of defining patterns (regex?)
From Kevin Lee:
Muting is a function in Telegram
So we can mute somebody from talking in the group for 1 hour, 1 day, 1 week or forever
So maybe make it easier to mute like, typing a code
When we reply on certain message, the message we reply will be deleted and we get to choose how many hours they will be muted
In binance
Their bot will do it with this code/pmute 70
(this is muting for 70 hours, also deleting the message they are replying to)/mute 70 (muting for 70 hours only)
/pban (ban and delete message)
/ban (just banning)
If a user signs up with the exact same name or profile picture as any of our admins, just ban them.
Possibly send them message with reason for ban.
api to ban: https://core.telegram.org/bots/api#kickchatmember
api to delete: https://core.telegram.org/bots/api#deletemessage
2018-01-29 07:14:24,477 - telegram.ext.updater - ERROR - Error while getting Updates: Timed out
2018-01-29 07:14:24,508 - telegram.ext.dispatcher - ERROR - An uncaught error was raised while handling the error
Traceback (most recent call last):
File "/Users/stan/Documents/Origin/origin-telegram-logger-bot/origin-telegram-logger-bot/lib/python2.7/site-packages/telegram/ext/dispatcher.py", line 271, in process_update
self.dispatch_error(None, update)
File "/Users/stan/Documents/Origin/origin-telegram-logger-bot/origin-telegram-logger-bot/lib/python2.7/site-packages/telegram/ext/dispatcher.py", line 384, in dispatch_error
callback(self.bot, update, error)
File "bot.py", line 92, in error
logger.warning('Update "%s" caused error "%s"', update, error)
AttributeError: 'function' object has no attribute 'warning'
Commands to be added
Price - /p
Chart - /c
Developement stats - /d
Social - /s <Reddit/Twitter/Medium>
Cir.Supply - /circsup
Here are examples on how to use the commands:
Price
Example:
/price
/p
Returns->
USD : $x
BTC : เธฟx
ETH : โขx
Mkt Cap: $x
Volume : $x
24hr % : x%
7d % : x%
30d % : x%
1y % : x%
#Note: have the metrics be from the same source as in https://www.originprotocol.com/en/dashboard
Chart
Example:
/chart 7
/c 7
Returns->
image of the 7 day chart (source: coingecko perhaps)
Development Stats
Example:
/d
/dev
Returns->
Developer Data
Stars : x
Subscribers : x
Total Issues : x
Closed Issued : x
PR Merged : x
PR Contributors: x
4-wk Commit : x
Social Media Update
Example:
/s Twitter
/social Twitter
Returns->
Last twitter post
Circ.Supply
Example:
/circsup
Returns->
Circulating Supply: X OGN (same source as in the Dashboard)
Hi, your project telegram-moderator(commit id: 4c7a662) requires "textblob==0.15.3" in its dependency. After analyzing the source code, we found that the following versions of textblob can also be suitable, i.e., textblob 0.9.0, 0.9.1, 0.10.0, 0.11.0, 0.11.1, 0.12.0, 0.13.0, 0.13.1, 0.14.0, 0.15.0, 0.15.1, 0.15.2, 0.16.0, 0.17.0, 0.17.1, since all functions that you directly (1 APIs: textblob.blob.TextBlob.init) or indirectly (propagate to 5 textblob's internal APIs and 0 outsider APIs) used from the package have not been changed in these versions, thus not affecting your usage.
Therefore, we believe that it is quite safe to loose your dependency on textblob from "textblob==0.15.3" to "textblob>=0.9.0,<=0.17.1". This will improve the applicability of telegram-moderator and reduce the possibility of any further dependency conflict with other projects.
May I pull a request to further loosen the dependency on textblob?
By the way, could you please tell us whether such an automatic tool for dependency analysis may be potentially helpful for maintaining dependencies easier during your development?
A channel admin should be able to set a period message to be sent every N
minutes.
/periodic [N minutes] My message
Discontinue
/periodicstop
A secondary request for this was adding CTA buttons. This may need to be split off into a separate issue.
Seen with a forwarded message that was pinned to the channel by an admin:
155 <190>1 2020-05-10T19:42:10.212729+00:00 app worker.1 - - Error[292]: 'NoneType' object has no attribute 'from_user'
176 <190>1 2020-05-10T19:42:10.212766+00:00 app worker.1 - - Error on line 439 AttributeError 'NoneType' object has no attribute 'from_user'
138 <190>1 2020-05-10T19:42:13.572402+00:00 app worker.1 - - Expecting value: line 1 column 1 (char 0)
1237 <190>1 2020-05-10T19:42:13.580390+00:00 app worker.1 - - 2020-05-10T12:42:13 777000 (b'Telegram None') : b"\xf0\x9f\x8e\x8a At Origin we're grateful for the support we get from our loyal fans and community. If you would like to help us build and improve Origin, there are three main ways you can get involved:\n\n1. If you know how to read and write more than two languages, including English, you can be part of our team of translators at: https://crowdin.com/profile/OriginProtocol\n\n2. We are looking for people who are interested in testing Origin Deals. If you are planning to make a purchase on Origin Deals and would like to provide your feedback to one of our engineers in a 1-on-1 sessions please fill in the following form: https://docs.google.com/forms/d/e/1FAIpQLSeflisy6u6GG6r2YMPutyGl57eJvZ-cUjZAYzye_i-WGOa8qw/viewform?usp=send_form\n\n3. For all the developers out there, we invite you to participate in our open-source engineering process! Everyone is welcome. All you need to do is introduce yourself in our public Discord engineering channel, find an open issue in our monorepo and tell us that you would like to solve it. With that done you can merge your first pull request!"
1209 <190>1 2020-05-10T19:42:13.581265+00:00 app worker.1 - - โ HIDE FORWARDED: b"\xf0\x9f\x8e\x8a At Origin we're grateful for the support we get from our loyal fans and community. If you would like to help us build and improve Origin, there are three main ways you can get involved:\n\n1. If you know how to read and write more than two languages, including English, you can be part of our team of translators at: https://crowdin.com/profile/OriginProtocol\n\n2. We are looking for people who are interested in testing Origin Deals. If you are planning to make a purchase on Origin Deals and would like to provide your feedback to one of our engineers in a 1-on-1 sessions please fill in the following form: https://docs.google.com/forms/d/e/1FAIpQLSeflisy6u6GG6r2YMPutyGl57eJvZ-cUjZAYzye_i-WGOa8qw/viewform?usp=send_form\n\n3. For all the developers out there, we invite you to participate in our open-source engineering process! Everyone is welcome. All you need to do is introduce yourself in our public Discord engineering channel, find an open issue in our monorepo and tell us that you would like to solve it. With that done you can merge your first pull request!"
125 <190>1 2020-05-10T19:42:14.277485+00:00 app worker.1 - - Error[292]: Chat_id is empty
142 <190>1 2020-05-10T19:42:14.277527+00:00 app worker.1 - - Error on line 492 BadRequest Chat_id is empty
138 <190>1 2020-05-10T19:43:04.136559+00:00 app worker.1 - - Expecting value: line 1 column 1 (char 0)
1236 <190>1 2020-05-10T19:43:04.149970+00:00 app worker.1 - - 2020-05-10T12:43:04 [123456789] (b'[CENSORED]') : b"\xf0\x9f\x8e\x8a At Origin we're grateful for the support we get from our loyal fans and community. If you would like to help us build and improve Origin, there are three main ways you can get involved:\n\n1. If you know how to read and write more than two languages, including English, you can be part of our team of translators at: https://crowdin.com/profile/OriginProtocol\n\n2. We are looking for people who are interested in testing Origin Deals. If you are planning to make a purchase on Origin Deals and would like to provide your feedback to one of our engineers in a 1-on-1 sessions please fill in the following form: https://docs.google.com/forms/d/e/1FAIpQLSeflisy6u6GG6r2YMPutyGl57eJvZ-cUjZAYzye_i-WGOa8qw/viewform?usp=send_form\n\n3. For all the developers out there, we invite you to participate in our open-source engineering process! Everyone is welcome. All you need to do is introduce yourself in our public Discord engineering channel, find an open issue in our monorepo and tell us that you would like to solve it. With that done you can merge your first pull request!"
152 <190>1 2020-05-10T19:43:04.151494+00:00 app worker.1 - - ๐ฎโโ๏ธ Skipping checks. User is admin: [123456789]
Would be great to have Telegram group analytics to track & visualize the following:
Thanks for open sourcing this @wanderingstan & @joshfraser!
We want a parameter where each group has a unique number. This is to prevent random people from starting conversations with it.
Allow community moderation whereby people can reply with /spam
to any message. We'll keep track of how many times a message has been flagged and how many times a specific user has been reported. Moderators should be able to set custom thresholds for their communities above which messages should be automatically deleted and users should be banned.
If user posts something that maches an ETH address (or bitcoin?)
Just ban them.
Possibly send them message with reason for ban.
api to ban: https://core.telegram.org/bots/api#kickchatmember
api to delete: https://core.telegram.org/bots/api#deletemessage
Just a heads up, I believe links to Origin Demo DApp get deleted by the Telegram bot.
Example : my profile URL https://demo.originprotocol.com/#/users/0xCD36AE1201144E08B176FD2598e33E0d87f68Ec0
Thanks! ๐
Soory not in git format, not familiar with it.
You should add this in bot.py so that users get really banned with no first or last name
def security_check_username(self, bot, update):
""" Test username for security violations """
if update.message.from_user.last_name is None:
update.message.from_user.last_name = u''
if update.message.from_user.first_name is None:
update.message.from_user.first_name = u''
full_name = (update.message.from_user.first_name + " "
+ update.message.from_user.last_name)
Add an /everyone
command to tag everyone in the channel.
Thinking an admin could send:
/everyone Hello, world!
Then the bot can delete the previous message and send
Hello, world! @user1 @user2 @user3
Right now the logger records every message the bot sees, even private messages sent right to it.
We should have a group name in config file and only log messages to that group.
Seen on a recent command (/price
) in the spanish channel.
Can't parse entities: can't find end of the entity starting at byte offset 161
[Will update with message details later.]
Hi, CHAT_IDS would seem to need to go in the README somewhere as it doesn't seem possible to monitor a chat without it.
More importantly, I'm getting an error, which I've hacked the python code to see is being logged in logger
at L218. This is after I've gotten it up and running, it's following my chat, and already saw it ignoring my chats as admin. Once I created a dummy user, all I would get was:
Bot started. Montitoring chats: [-1001242314436]
Error 1: must be str, not NoneType
Then, I guessed (by adding "1", "2" to the various error outputs, and discovering that it was at L219 where I stuck that) that some code in logger
was dying because something was unpopulated. E.g., my user didn't have a username. I added that, and got further, only to get another error:
2018-03-04T00:06:56 566488256 (b'SP_telegram') : b'testing'
new
Error 1: must be str, not NoneType
Here's my heroku config anonymized with ...:
CHAT_IDS: ...
DATABASE_URL: postgres://...
MESSAGE_BAN_PATTERNS: testing_auto_admin_MBP
MESSAGE_HIDE_PATTERNS: testing_auto_admin_MHP
NAME_BAN_PATTERNS: testing_auto_admin_NBP
PAPERTRAIL_API_TOKEN: ...
SAFE_USER_IDS: testing_auto_admin_SUI
TELEGRAM_BOT_POSTGRES_URL: postgres://...
TELEGRAM_BOT_TOKEN: ...
EDIT: I should add I saw "user added" for all my test users so far, so that seems to be working.
Let's share this with other projects and help reduce the impact of scammers on the whole community.
We can use the deploy to heroku button to make it really easy for folks to set up.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.