Skip to content

Commit

Permalink
Update entry.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Autumn-Leaf620 authored Aug 13, 2024
1 parent 98db518 commit ec251d9
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions chatbridge/impl/cqhttp/entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ def on_message(self, _, message: str):
self.logger.info('!!ping command triggered')
self.send_text('pong!!')

if len(args) >= 2 and args[0] == '!!mc':
self.logger.info('!!mc command triggered')
if len(args) >= 1:
self.logger.info('Command triggered')
sender = data['sender']['card']
if len(sender) == 0:
sender = data['sender']['nickname']
text = html.unescape(data['raw_message'].split(' ', 1)[1])
text = html.unescape(data['raw_message'])
chatClient.broadcast_chat(text, sender)

if len(args) == 1 and args[0] == '!!online':
Expand Down Expand Up @@ -128,15 +128,8 @@ def on_chat(self, sender: str, payload: ChatPayload):
if cq_bot is None:
return
try:
try:
prefix, message = payload.message.split(' ', 1)
except:
pass
else:
if prefix == '!!qq':
self.logger.info('Triggered command, sending message {} to qq'.format(payload.formatted_str()))
payload.message = message
cq_bot.send_message(sender, payload.formatted_str())
self.logger.info('Sending message {} to qq'.format(payload.formatted_str()))
cq_bot.send_message(sender, payload.formatted_str())
except:
self.logger.exception('Error in on_message()')

Expand Down Expand Up @@ -189,3 +182,4 @@ def main():

if __name__ == '__main__':
main()

0 comments on commit ec251d9

Please sign in to comment.