#452·wxpy

Cannot auto reply with @bot.register()

Author: sjt-moonCreated Apr 14, 2020Updated Apr 14, 2020

I created a bot and added a method to send msg back to friend with @bot.register(friend), however, it cannot echo message back, no matter I use embed() or bot.join(). If I use embed, then in the console I can send msg with friend variable.

bot = Bot()
friend = bot.search('kakaluote')[0]
@bot.register(friend)
def print_msg(msg):
  print('[Received]: ' % msg)
  msg = '[AutoEcho]: ' + str(msg)
  friend.send(msg)

bot.join()