Skip to content

Commit

Permalink
fix groups owner logic
Browse files Browse the repository at this point in the history
  • Loading branch information
dongweiming committed Jul 27, 2017
1 parent 31ad84c commit 22a11b3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
请言行遵守群内规定,违规者将被永远T出。
群成员可发起移出成员投票,语句是 `移出|移除|踢出|T @XXX`
如果你是群管理员,群成员可发起移出成员投票,语句是 `移出|移除|踢出|T @XXX`
更多功能请向群主发送 help 获得更多功能'''
kick_text = '''
Expand Down
6 changes: 3 additions & 3 deletions libs/listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def pattern_map(self):
KICK_KEY = 'kick:members'
KICK_SENDER_KEY = 'kick:senders'

groups = [g for g in bot.groups() if g.owner.puid == uid]
groups = [g for g in bot.groups() if g.is_owner]


def get_creators():
Expand Down Expand Up @@ -144,13 +144,13 @@ def kick(msg):
if current < settings.kick_quorum_n:
period = settings.kick_period * 60
if current == 1:
r.expire(KICK_KEY, period)
for key in (KICK_SENDER_KEY, KICK_KEY):
r.expire(key, period)
return settings.kick_text.format(
current=current, member=to_kick.nick_name,
total=settings.kick_quorum_n, period=period)
msg.chat.remove_members([to_kick])
to_kick.set_remark_name('[黑名单]-' + get_time())
msg.chat.remove_members([to_kick])
return '成功移出 @{}'.format(to_kick.nick_name)


Expand Down
8 changes: 7 additions & 1 deletion wechat/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def listener():
@app.task
def retrieve_data():
with json_api.app_context():
_retrieve_data()
_retrieve_data(True)


@app.task
Expand All @@ -169,6 +169,12 @@ def update_group(update=False):
_update_group(bot, update=update)


@app.task
def update_mp(update=False):
with json_api.app_context():
_update_mp(bot, update=update)


@periodic_task(run_every=timedelta(seconds=60), time_limit=5)
def send_notify():
count = Notification.count_by_receiver_id(bot.self.puid)
Expand Down

0 comments on commit 22a11b3

Please sign in to comment.