-3

my code is on down and I'm getting error 'SyntaxError: invalid syntax' on args

   @client.command(pass_context=True)
   async def render(*args, message):
      """Renders A Growtopia World"""
      mesg = ' '.join(args)
      await client.say(":earth_americas: World Render:")
      return await client.say('https://www.growtopiagame.com/worlds/'mesg'.png')
Sarp
  • 9
  • 1
  • 4

2 Answers2

0

*args, **kwargs always come at the end of the parameters.

async def render(message, *args):
    ...

is correct.

Godron629
  • 302
  • 1
  • 7
0

Sure it's not a Syntax Error on that 'mesg' at the last line? Because that's not the way of concatenating strings in Python.

There are many ways to format or concatenate strings (the most obvious one being just adding them like this: string_sum = string1 + string2), but my personal favorite for string formatting when combining with variables and such, if on Python 3.6+, are f-strings (https://cito.github.io/blog/f-strings/).

So in this case you'd do client.say(f'https://www.growtopiagame.com/worlds/{mesg}.png')

(P-EDIT: Godron is kinda correct depending on if Python 2 or 3. See this SO answer for more details https://stackoverflow.com/a/5940226/4192226)

Lyserg Zeroz
  • 301
  • 2
  • 6