Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make a sweet API #164

Open
pengrad opened this issue May 9, 2019 · 5 comments · May be fixed by #331
Open

Make a sweet API #164

pengrad opened this issue May 9, 2019 · 5 comments · May be fixed by #331

Comments

@pengrad
Copy link
Owner

pengrad commented May 9, 2019

Call all methods as bot methods:

SendResponse response = bot.sendMessage(chatId, "Hello")
        .parseMode(ParseMode.Markdown)
        .execute();

Async

bot.sendMessage(chatId, "Hello")
        .parseMode(ParseMode.Markdown)
        .execute(callback);

execute(callback) or execute(onSuccess, onFailure)?

@AlexSocol
Copy link

Think there should be both methods, first for those on j7 with anonymous inner classes and second for j8 coders, who can use lambdas (because two aic'es will look terrible) 🤔

@sintyaaaaaa
Copy link

Call all methods as bot methods:

SendResponse response = bot.sendMessage(chatId, "Hello")
        .parseMode(ParseMode.Markdown)
        .execute();

Async

bot.sendMessage(chatId, "Hello")
        .parseMode(ParseMode.Markdown)
        .execute(callback);

execute(callback) or execute(onSuccess, onFailure)?

@HarryZalessky
Copy link
Contributor

I'll work on it :)

@HarryZalessky
Copy link
Contributor

The change is ready guys :)

@rufus20145
Copy link

rufus20145 commented Mar 16, 2024

What is the purpose of these changes? In the current version, you can easily pick out a module in the bot that will send requests to BotAPI, taking into its restrictions and repeat them in case of errors e.g. The new version introduces coupling, which will make such a split very difficult. In addition, they are so breaking that all projects using this library will require large code changes.

As an example of this look at my bot. I split it into modules which process different types of updates received by bot and return requests that need to be executed. Executor module is not ready yet, but I`m working on it. Also these changes will create a lot of circular references in projects that are built in a similar way to my current one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants