Custom Commands homeCustom Commands
  • Blog
  • Privacy
  • Premium
  • 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.

DiscordJoin support server
Custom CommandsCustom Commands

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

Links

HomeBlogPrivacySupport

Contact

[email protected]

2 Frederick StreetLondon, WC1X 0ND

{ / } custom commands

© WEiRDSOFT LTD. All rights reserved.