Class GuildTemplate

    • Constructor Detail

      • GuildTemplate

        public GuildTemplate​(GatewayDiscordClient gateway,
                             discord4j.discordjson.json.TemplateData data)
        Constructs a GuildTemplate with an associated GatewayDiscordClient and Discord data.
        Parameters:
        gateway - The GatewayDiscordClient associated to this object, must be non-null.
        data - The raw data as represented by Discord, must be non-null.
    • Method Detail

      • getData

        public discord4j.discordjson.json.TemplateData getData()
        Gets the data of the template.
        Returns:
        The data of the template.
      • getCode

        public String getCode()
        Gets the template code (unique ID).
        Returns:
        The template code (unique ID).
      • getGuildId

        public Snowflake getGuildId()
        Gets the ID of the guild this template is associated with.
        Returns:
        The source guild ID.
      • getName

        public String getName()
        Gets the name of the template.
        Returns:
        The template name.
      • getDescription

        public Optional<String> getDescription()
        Gets the description of the template, if present.
        Returns:
        The template description.
      • getUsageCount

        public int getUsageCount()
        Gets the number of times the template has been used.
        Returns:
        The number of times the template has been used.
      • getCreatorId

        public Snowflake getCreatorId()
        Gets the ID of the user who created the template.
        Returns:
        The ID of the user who created the template.
      • getCreator

        public User getCreator()
        Gets the user who created the template.
        Returns:
        The user who created the template.
      • getCreatedAt

        public Instant getCreatedAt()
        Gets when the template was created.
        Returns:
        When the template was created.
      • getUpdatedAt

        public Instant getUpdatedAt()
        Gets when the template was last updated.
        Returns:
        When the template was last updated.
      • getSourceGuild

        public discord4j.discordjson.json.SerializedSourceGuildData getSourceGuild()
        Gets the guild snapshot of the template.
        Returns:
        The guild snapshot.
      • createGuild

        public discord4j.core.spec.GuildCreateFromTemplateMono createGuild​(String name)
        Requests to create a new guild from this template. Properties specifying how to create a new guild from this template can be set via the withXxx methods of the returned GuildCreateFromTemplateMono.
        Parameters:
        name - the name of the guild to create
        Returns:
        A GuildCreateFromTemplateMono where, upon successful completion, emits the created guild. If an error is received, it is emitted through the GuildCreateFromTemplateMono.
      • createGuild

        public Mono<Guild> createGuild​(discord4j.core.spec.GuildCreateFromTemplateSpec spec)
        Requests to create a new guild from this template.
        Parameters:
        spec - an immutable object that specifies how to create a new guild from this template
        Returns:
        A Mono where, upon successful completion, emits the created guild. If an error is received, it is emitted through the Mono.
      • sync

        public Mono<GuildTemplate> sync()
        Requests to sync this template with the guild's current state.
        Returns:
        a Mono that, upon subscription, syncs a template with its guild. If an error is received, it will be emitted through the Mono.
      • edit

        public discord4j.core.spec.GuildTemplateEditMono edit()
        Requests to edit this guild template. Properties specifying how to edit this template can be set via the withXxx methods of the returned GuildTemplateEditMono.
        Returns:
        A GuildTemplateEditMono where, upon successful completion, emits the edited GuildTemplate. If an error is received, it is emitted through the GuildTemplateEditMono.
      • edit

        public Mono<GuildTemplate> edit​(discord4j.core.spec.GuildTemplateEditSpec spec)
        Requests to edit this guild template.
        Parameters:
        spec - an immutable object that specifies how to edit this template
        Returns:
        A Mono where, upon successful completion, emits the edited GuildTemplate. If an error is received, it is emitted through the Mono.
      • delete

        public Mono<GuildTemplate> delete()
        Requests to delete this template.
        Returns:
        A Mono where, upon successful completion, emits the deleted template. If an error is received, it is emitted through the Mono.