[Docs] Add awaits and missing imports in usage examples (#2860)

Well, the modlog examples had to be changed a lot, because `await` obviously won't work in regular method.
This commit is contained in:
jack1142
2019-07-14 03:30:11 +02:00
committed by Toby Harradine
parent be184b57dd
commit 3e80edcdfd
2 changed files with 49 additions and 33 deletions

View File

@@ -16,15 +16,16 @@ Basic Usage
.. code-block:: python
from redbot.core import bank
from redbot.core import bank, commands
import discord
class MyCog:
class MyCog(commands.Cog):
@commands.command()
async def balance(self, ctx, user: discord.Member=None):
async def balance(self, ctx, user: discord.Member = None):
if user is None:
user = ctx.author
bal = bank.get_balance(user)
currency = bank.get_currency_name(ctx.guild)
bal = await bank.get_balance(user)
currency = await bank.get_currency_name(ctx.guild)
await ctx.send(
"{}'s balance is {} {}".format(
user.display_name, bal, currency