discord python add number code example

Example 1: discord.py optional argument

@client.command()
async def hellothere(ctx, *, msg):
    await ctx.send("General Kenobi")
#to add an optional Argument simply add an =None (anything else alowed to) after msg
#the * means that it gives you everthing after the command
async def hellothere(ctx, *, msg=''):

Example 2: unknown amount of arguments discord py

# Include a asterisk (*) before the variable name, eg:

async def repeatback(context, *words):
	# Function code

Tags:

Misc Example