original_docstring: Calculates the CW Weight of a callsign.
docstring: Calculates the CW Weight of a callsign.
docstring_tokens: Calculates the CW Weight of a callsign .
code: async def weight(ctx, msg : str):
      '''Calculates the CW Weight of a callsign.'''
      with ctx.typing():
          msg = msg.upper()
          weight = 0
          for char in msg:
              try:
                  cwChar = ascii2morse[char].replace('-', '==')
                  weight += len(cwChar) * 2 + 2
              except:
                  res = f'Unknown character {char} in callsign'
                  await ctx.send(res)
                  return
          res = f'The CW weight is **{weight}**'
          embed = discord.Embed(title=f'CW Weight of {msg}', description=res, colour=green)
      await ctx.send(embed=embed)
code_tokens: async def weight ( ctx , msg : str ) : with ctx . typing ( ) : msg = msg . upper ( ) weight = 0 for char in msg : try : cwChar = ascii2morse [ char ] . replace ( '-' , '==' ) weight += len ( cwChar ) * 2 + 2 except : res = f'Unknown character {char} in callsign' await ctx . send ( res ) return res = f'The CW weight is **{weight}**' embed = discord . Embed ( title = f'CW Weight of {msg}' , description = res , colour = green ) await ctx . send ( embed = embed )
short_docstring: Calculates the CW Weight of a callsign.
short_docstring_tokens: Calculates the CW Weight of a callsign .
comment: '''Calculates the CW Weight of a callsign.'''