redact videos when censoring, and include uncensor powerlevel config
This commit is contained in:
@@ -74,6 +74,11 @@ join_notification_message: |
|
|||||||
# this bot, bot admins and bot moderators are immune to censorship.
|
# this bot, bot admins and bot moderators are immune to censorship.
|
||||||
censor: false
|
censor: false
|
||||||
|
|
||||||
|
# if censoring content, what minimum Power Level is required to not be censored?
|
||||||
|
# this allows easy permission of trusted users in a room to post images or files on demand.
|
||||||
|
# rooms usually default to 0 power level for normal users.
|
||||||
|
uncensor_pl: 1
|
||||||
|
|
||||||
# whether to redact file and image uploads. this will apply to all rooms defined
|
# whether to redact file and image uploads. this will apply to all rooms defined
|
||||||
# in the censor variable (either boolean or a list of room IDs).
|
# in the censor variable (either boolean or a list of room IDs).
|
||||||
censor_files: true
|
censor_files: true
|
||||||
|
|||||||
+6
-1
@@ -38,6 +38,7 @@ class Config(BaseProxyConfig):
|
|||||||
helper.copy_dict("greeting_rooms")
|
helper.copy_dict("greeting_rooms")
|
||||||
helper.copy_dict("greetings")
|
helper.copy_dict("greetings")
|
||||||
helper.copy("censor")
|
helper.copy("censor")
|
||||||
|
helper.copy("uncensor_pl")
|
||||||
helper.copy("censor_wordlist")
|
helper.copy("censor_wordlist")
|
||||||
helper.copy("censor_files")
|
helper.copy("censor_files")
|
||||||
helper.copy("banlists")
|
helper.copy("banlists")
|
||||||
@@ -124,7 +125,7 @@ class CommunityBot(Plugin):
|
|||||||
return report
|
return report
|
||||||
|
|
||||||
def flag_message(self, msg):
|
def flag_message(self, msg):
|
||||||
if msg.content.msgtype in [MessageType.FILE, MessageType.IMAGE]:
|
if msg.content.msgtype in [MessageType.FILE, MessageType.IMAGE, MessageType.VIDEO]:
|
||||||
return self.config['censor_files']
|
return self.config['censor_files']
|
||||||
|
|
||||||
for w in self.config['censor_wordlist']:
|
for w in self.config['censor_wordlist']:
|
||||||
@@ -294,10 +295,14 @@ class CommunityBot(Plugin):
|
|||||||
|
|
||||||
@event.on(EventType.ROOM_MESSAGE)
|
@event.on(EventType.ROOM_MESSAGE)
|
||||||
async def update_message_timestamp(self, evt: MessageEvent) -> None:
|
async def update_message_timestamp(self, evt: MessageEvent) -> None:
|
||||||
|
power_levels = await self.client.get_state_event(evt.room_id, EventType.ROOM_POWER_LEVELS)
|
||||||
|
user_level = power_levels.get_user_level(evt.sender)
|
||||||
|
self.log.debug(f"DEBUGDEBUG user {evt.sender} has power level {user_level}")
|
||||||
if self.flag_message(evt):
|
if self.flag_message(evt):
|
||||||
# do we need to redact?
|
# do we need to redact?
|
||||||
if evt.sender not in self.config['admins'] and \
|
if evt.sender not in self.config['admins'] and \
|
||||||
evt.sender not in self.config['moderators'] and \
|
evt.sender not in self.config['moderators'] and \
|
||||||
|
user_level < self.config['uncensor_pl'] and \
|
||||||
evt.sender != self.client.mxid and \
|
evt.sender != self.client.mxid and \
|
||||||
self.censor_room(evt):
|
self.censor_room(evt):
|
||||||
try:
|
try:
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
maubot: 0.1.0
|
maubot: 0.1.0
|
||||||
id: org.jobmachine.communitybot
|
id: org.jobmachine.communitybot
|
||||||
version: 0.1.11
|
version: 0.1.12
|
||||||
license: MIT
|
license: MIT
|
||||||
modules:
|
modules:
|
||||||
- community
|
- community
|
||||||
|
|||||||
Reference in New Issue
Block a user