mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-07 12:18:59 +00:00
Change all email/password pair examples to use token.
This commit is contained in:
parent
93edf88ee4
commit
72e84a1b47
@ -57,7 +57,7 @@ async def on_message(message):
|
|||||||
await asyncio.sleep(5)
|
await asyncio.sleep(5)
|
||||||
await client.send_message(message.channel, 'Done sleeping')
|
await client.send_message(message.channel, 'Done sleeping')
|
||||||
|
|
||||||
client.run('email', 'password')
|
client.run('token')
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that in Python 3.4 you use `@asyncio.coroutine` instead of `async def` and `yield from` instead of `await`.
|
Note that in Python 3.4 you use `@asyncio.coroutine` instead of `async def` and `yield from` instead of `await`.
|
||||||
|
@ -505,7 +505,7 @@ class Client:
|
|||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
await client.login('email', 'password')
|
await client.login('token')
|
||||||
|
|
||||||
# or
|
# or
|
||||||
|
|
||||||
|
@ -292,14 +292,14 @@ Basically, before:
|
|||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
client.login('email', 'password')
|
client.login('token')
|
||||||
client.run()
|
client.run()
|
||||||
|
|
||||||
After:
|
After:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
client.run('email', 'password')
|
client.run('token')
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
|
|
||||||
@ -321,7 +321,7 @@ event loop then doing so is quite straightforward:
|
|||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def main_task():
|
def main_task():
|
||||||
yield from client.login('email', 'password')
|
yield from client.login('token')
|
||||||
yield from client.connect()
|
yield from client.connect()
|
||||||
|
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
|
@ -23,7 +23,7 @@ loop = asyncio.get_event_loop()
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
loop.create_task(my_background_task())
|
loop.create_task(my_background_task())
|
||||||
loop.run_until_complete(client.login('email', 'password'))
|
loop.run_until_complete(client.login('token'))
|
||||||
loop.run_until_complete(client.connect())
|
loop.run_until_complete(client.connect())
|
||||||
except Exception:
|
except Exception:
|
||||||
loop.run_until_complete(client.close())
|
loop.run_until_complete(client.close())
|
||||||
|
@ -62,4 +62,4 @@ async def _bot():
|
|||||||
"""Is the bot cool?"""
|
"""Is the bot cool?"""
|
||||||
await bot.say('Yes, the bot is cool.')
|
await bot.say('Yes, the bot is cool.')
|
||||||
|
|
||||||
bot.run('email', 'password')
|
bot.run('token')
|
||||||
|
@ -19,4 +19,4 @@ async def on_message_delete(message):
|
|||||||
fmt = '{0.author.name} has deleted the message:\n{0.content}'
|
fmt = '{0.author.name} has deleted the message:\n{0.content}'
|
||||||
await client.send_message(message.channel, fmt.format(message))
|
await client.send_message(message.channel, fmt.format(message))
|
||||||
|
|
||||||
client.run('email', 'password')
|
client.run('token')
|
||||||
|
@ -21,4 +21,4 @@ async def on_message_edit(before, after):
|
|||||||
fmt = '**{0.author}** edited their message:\n{1.content}'
|
fmt = '**{0.author}** edited their message:\n{1.content}'
|
||||||
await client.send_message(after.channel, fmt.format(after, before))
|
await client.send_message(after.channel, fmt.format(after, before))
|
||||||
|
|
||||||
client.run('email', 'password')
|
client.run('token')
|
||||||
|
@ -34,4 +34,4 @@ async def on_ready():
|
|||||||
print(client.user.id)
|
print(client.user.id)
|
||||||
print('------')
|
print('------')
|
||||||
|
|
||||||
client.run('email', 'password')
|
client.run('token')
|
||||||
|
@ -15,4 +15,4 @@ async def on_ready():
|
|||||||
print(client.user.id)
|
print(client.user.id)
|
||||||
print('------')
|
print('------')
|
||||||
|
|
||||||
client.run('email', 'password')
|
client.run('token')
|
||||||
|
@ -100,4 +100,4 @@ class Bot(discord.Client):
|
|||||||
|
|
||||||
|
|
||||||
bot = Bot()
|
bot = Bot()
|
||||||
bot.run('email', 'password')
|
bot.run('token')
|
||||||
|
@ -19,4 +19,4 @@ async def on_ready():
|
|||||||
print(client.user.id)
|
print(client.user.id)
|
||||||
print('------')
|
print('------')
|
||||||
|
|
||||||
client.run('email', 'password')
|
client.run('token')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user