All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.annimon.tgbotsmodule.api.methods.info.SetMyCommandsMethod Maven / Gradle / Ivy

The newest version!
package com.annimon.tgbotsmodule.api.methods.info;

import com.annimon.tgbotsmodule.api.methods.interfaces.Method;
import com.annimon.tgbotsmodule.services.CommonAbsSender;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import org.jetbrains.annotations.NotNull;
import org.telegram.telegrambots.meta.api.methods.commands.SetMyCommands;
import org.telegram.telegrambots.meta.api.objects.commands.BotCommand;
import org.telegram.telegrambots.meta.api.objects.commands.scope.BotCommandScope;

public class SetMyCommandsMethod implements Method {

    private final SetMyCommands.SetMyCommandsBuilder method;

    public SetMyCommandsMethod() {
        this(SetMyCommands.builder());
    }

    public SetMyCommandsMethod(@NotNull SetMyCommands.SetMyCommandsBuilder method) {
        this.method = method;
    }

    public List getCommands() {
        return method.build().getCommands();
    }

    public SetMyCommandsMethod setCommands(List commands) {
        method.commands(commands);
        return this;
    }

    public BotCommandScope getScope() {
        return method.build().getScope();
    }

    public SetMyCommandsMethod setScope(BotCommandScope scope){
        method.scope(scope);
        return this;
    }

    public String getLanguageCode() {
        return method.build().getLanguageCode();
    }

    public SetMyCommandsMethod setLanguageCode(String languageCode){
        method.languageCode(languageCode);
        return this;
    }

    @Override
    public Boolean call(@NotNull CommonAbsSender sender) {
        return sender.call(method.build());
    }

    @Override
    public CompletableFuture callAsync(@NotNull CommonAbsSender sender) {
        return sender.callAsync(method.build());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy