Saving Data with Meta

Meta is a new system in ItsMyBot that allows you to save custom data for later use. This makes the scripting system even more powerful. For example, you can easily create a counting channel with it.

A meta consists of several parts:

  • Name
    key
    Type
    string
    Description

    The key is the name of the meta. It can be anything you want, but it should be unique to avoid conflicts with other metas.

  • Name
    type
    Type
    string
    Description

    The type of the meta. Can be number, string or boolean. This is used to determine how the data will be stored and how it can be used.

  • Name
    mode
    Type
    string
    Description

    The mode of the meta. Can be global, user or channel. This is used to determine where the data will be stored. The global mode is used to store data that is shared across all users and channels. The user mode is used to store data that is specific to a user. The channel mode is used to store data that is specific to a channel.

  • Name
    scope
    Type
    string
    Description

    The scope of the meta. It is the ID of the user or channel used to retrieve the stored information. This is only used for user and channel modes.

  • Name
    value
    Type
    any
    Description

    The value is the data that you want to store. It can be anything you want.


How to use Meta

You can use meta in your scripts, custom commands, embeds, and more.

  • You can find the meta actions in the actions section.
  • Meta also have their own placeholders, that you can found in the placeholders section.
  • You can also use commands to interact with meta data. You can find the commands in the commands section.

Examples

actions: # This script will create a counting channel.
  - triggers: messageCreate 
    conditions:
      - id: inChannel
        args:
          value: 'counting-channel' # The channel where the counting will take place.
      - id: '!isBot' # The message must not be sent by a bot.
      - expression: '%content% == %meta_count_channel_number_0%+1' # The message must be the next number in the sequence.
        not-met-actions: # If the message is not the next number in the sequence, send a reply.
          - id: reply
            args:
              components:
                - type: text-display
                  content: "You need to send the next number in the sequence: %math_{meta_counting_channel_number_0}+1%" 
              actions:
                - id: deleteMessage # Delete the reply after 10 seconds.
                  args:
                    delay: 10
          - id: deleteMessage # Delete the original message.
    actions:
      - id: metaAdd # Add the number to the meta data.
        args:
          key: 'counting'
          value: '1' # The value to add to the meta data.
          mode: channel # The mode is channel, so the data will be stored in the channel meta.