mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-20 18:06:08 -05:00
[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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user