Custom Commands homeCustom Commands
  • Blog
  • Premium
  • Templates
  • Support
Back to blog
// blog

When should I use curly braces and when not for variables?

If you are confused about when you should use curly braces for variables, read more...

Md Shahriyar Alam

2 years ago

·1 min read

There are multiple places we use variables, In Content, Embed, Pre Code and Post Code. But when should we use curly braces to make them work?

When to use?

If you are using variables in Content or Embed then you have to use curly braces to make them work. Otherwise they will be treated as normal texts

Example

py
Hello {user.mention}!

When not to use?

If you are using any variables in the Pre Code or Post Code you don't have to use any curly braces at all. In fact using them will cause errors.

Example

py
add_roles(user, 3904234823402349234)

Loading comments…

{}

Need help?

Have a question, a suggestion, or stuck on something? Reach out — we're happy to help.

Join support server
Custom CommandsCustom Commands

The #1 custom commands Discord bot — build commands, events and databases with zero boilerplate.

Join the support server

Product

  • Overview
  • Why us?
  • Premium
  • Template shop

Resources

  • Blog
  • Support
  • Dashboard

Company

  • Privacy
  • Contact
[email protected]

2 Frederick Street, London, WC1X 0ND

Payments secured by Stripe
{ / } custom commands

© WEiRDSOFT LTD. All rights reserved.