神圣不和谐机器人列表的官方python包装
pyddblapi的Python项目详细描述
ddblapi.py
神圣不和谐机器人列表的官方python包装器
要求
安装
使用pip:
sudo pip install pyddblapi
示例用法
importdiscordfromddblapiimportDivineAPIowner_id=''# Your account IDbot_id=''# Your Bot IDbot_token=''# Your Bot tokenapi_key=''# Your bot divinediscordbots.com API_KEYddbl=DivineAPI(bot_id=bot_id,api_key=api_key)classBot(discord.Client):asyncdefon_ready(self):# Post stats exampleserver_count=len(self.guilds)post_stats=awaitddbl.post_stats(server_count)ifpost_stats['error']:print('An error has occured:\n{}'.format(post_stats['response']))else:print('Successfully posted stats on Divine Discord Bot List !')# Get stats exampleget_stats=awaitddbl.get_stats(self.user.id)ifget_stats['error']:print('An error has occured:\n{}'.format(get_stats['response']))else:print(get_stats['response'])# Get hasvoted24 examplehas_voted=awaitddbl.get_hasvoted24(owner_id)ifhas_voted['error']:print('An error has occured:\n{}'.format(has_voted['response']))else:print(has_voted['response'])Bot().run(bot_token)