本文整理汇总了Python中discord.Client.login方法的典型用法代码示例。如果您正苦于以下问题:Python Client.login方法的具体用法?Python Client.login怎么用?Python Client.login使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类discord.Client
的用法示例。
在下文中一共展示了Client.login方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: check
# 需要导入模块: from discord import Client [as 别名]
# 或者: from discord.Client import login [as 别名]
delay = 5 # 5 seconds
def check(address):
addr = address.split(':')[0]
port = address.split(':')[1]
try:
# 0.5 second timeout
s = socket.create_connection((addr, port), 0.5)
s.close()
return True
except:
return False
client = Client()
client.login(secrets.email, secrets.password)
@asyncio.coroutine
@client.event
def on_alert():
users = get_users()
for user in users:
user = User('', user, '', '')
client.send_message(user, 'MapleStory is back online!')
clear_users()
@asyncio.coroutine
@client.event
def on_message(message):
示例2: log_in_client
# 需要导入模块: from discord import Client [as 别名]
# 或者: from discord.Client import login [as 别名]
def log_in_client(c: discord.Client):
with open('account') as f:
line = f.read()
name, pw = line.strip().split(' ')
c.login(name, pw)