def channels_invite(self, channel_name):
channel_id = self.find_channel_id(channel_name)
invites = prompt("send invites -> ", completer=WordCompleter(users),
style=DocumentStyle)
for i in invites.split(" "):
user_id = self.find_user_id(i.strip("@"))
url = "https://slack.com/api/channels.invite?token={token}&channel={channel_id}&user={user}".format(
token=settings.token,
channel_id=channel_id,
user=user_id)
response = requests.get(url).json()
if response["ok"]:
os.system("figlet 'Invited " + i + "' | lolcat")
time.sleep(2)
os.system("clear")
else:
print "something goes wrong :( (\u001b[1m\u001b[31m " + response["error"] + "\u001b[0m)"
评论列表
文章目录