All Projects → mail-ru-im → bot-java

mail-ru-im / bot-java

Licence: other
No description or website provided.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to bot-java

Fondbot
Chatbot framework
Stars: ✭ 102 (+500%)
Mutual labels:  bot-api
Jda
Java wrapper for the popular chat & VOIP service: Discord https://discord.com
Stars: ✭ 2,598 (+15182.35%)
Mutual labels:  bot-api
Bots Framework
Golang framework to build multilingual bots for messengers (Telegram, FB Messenger, Skype, Line, Kik, WeChat) hosted on AppEngine, Amazon, Azure, Heroku or standalone
Stars: ✭ 189 (+1011.76%)
Mutual labels:  bot-api
Mattata
A powerful, plugin-based, multi-purpose Telegram bot designed to serve a wide variety of purposes
Stars: ✭ 107 (+529.41%)
Mutual labels:  bot-api
Linebottemplate
A simple Golang LINE bot Template and tutorial how to setup on Heroku for LINE bot API
Stars: ✭ 156 (+817.65%)
Mutual labels:  bot-api
Whatsapp Bot
BOT - WhatsApp Web in TypeScript
Stars: ✭ 170 (+900%)
Mutual labels:  bot-api
Mypackbot
🤖 Your own unlimited pack of Telegram-stickers
Stars: ✭ 18 (+5.88%)
Mutual labels:  bot-api
fastlane-plugin-slack bot
A Fastlane plugin to customize your automation workflow(s) with a Slack Bot 🤖🚀
Stars: ✭ 26 (+52.94%)
Mutual labels:  bot-api
Slimbot
Telegram Bot API for Node.js
Stars: ✭ 157 (+823.53%)
Mutual labels:  bot-api
Bot Connector
Bot Connector allows you to connect your bot to multiple messaging channels.
Stars: ✭ 185 (+988.24%)
Mutual labels:  bot-api
Framework
Chatbot framework
Stars: ✭ 130 (+664.71%)
Mutual labels:  bot-api
Pyrogram
Telegram MTProto API Client Library and Framework in Pure Python for Users and Bots
Stars: ✭ 2,252 (+13147.06%)
Mutual labels:  bot-api
Eddi
Scalable Open Source Chatbot Platform. Build multiple Chatbots with NLP, Behavior Rules, API Connector, Templating. Developed in Java, provided with Docker, orchestrated with Kubernetes or Openshift.
Stars: ✭ 171 (+905.88%)
Mutual labels:  bot-api
Botogram
Just focus on your bots.
Stars: ✭ 106 (+523.53%)
Mutual labels:  bot-api
Core
PHP Telegram Bot based on the official Telegram Bot API
Stars: ✭ 2,899 (+16952.94%)
Mutual labels:  bot-api
Discord4j
Discord4J is a fast, powerful, unopinionated, reactive library to enable quick and easy development of Discord bots for Java, Kotlin, and other JVM languages using the official Discord Bot API.
Stars: ✭ 973 (+5623.53%)
Mutual labels:  bot-api
Whatsapp Web.js
A WhatsApp client library for NodeJS that connects through the WhatsApp Web browser app
Stars: ✭ 4,103 (+24035.29%)
Mutual labels:  bot-api
nestjs-telegraf
🤖 Powerful Nest module for easy and fast creation Telegram bots
Stars: ✭ 300 (+1664.71%)
Mutual labels:  bot-api
tiff-java
Tagged Image File Format Java Library
Stars: ✭ 65 (+282.35%)
Mutual labels:  java-sdk
Instabotai
Instagram AI bot with face detection. It works without instagram api, need only login and password.
Stars: ✭ 181 (+964.71%)
Mutual labels:  bot-api

Java interface for bot API

Build Status codecov

Maven Central

Install

Group ids io.github.mail-ru-im and ru.mail will no longer being maintained. We moved this artifact to the ru.mail.im group id.

Maven

    <repositories>
        ...
        <repository>
            <id>mavencentral</id>
            <name>Maven Central Repository</name>
            <url>http://repo1.maven.org/maven2</url>
        </repository>
        ...
    </repositories>
    
    <dependencies>
        ...
        <dependency>
            <groupId>ru.mail.im</groupId>
            <artifactId>bot-api</artifactId>
            <version>1.2.3</version>
        </dependency>
        ...
    </dependencies>

Gradle

repositories {
    mavenCentral()
}

dependencies {
    implementation 'ru.mail.im:bot-api:1.2.3'
}

Usage

Create your own bot by sending the /newbot command to Metabot and follow the instructions.

Note a bot can only reply after the user has added it to his contacts list, or if the user was the first to start a dialogue.

Create your bot

// For ICQ New/Agent: create bot with token received from Metabot
BotApiClient client = new BotApiClient(token);
// For Myteam: create bot with token from Metabot and host url (for example `https://myteam.mail.ru/`)
BotApiClient client = new BotApiClient(apiBaseUrl, token);

BotApiClientController controller = BotApiClientController.startBot(client);
client.addOnEventFetchListener(events -> { 
    //subscribe to new events
});

// send actions
controller.sendActions(chatId, ChatAction.TYPING);

// send message
long messageId = controller.sendTextMessage(
    new SendTextRequest()
        .setChatId(chatId)
        .setText("Bot message")
).getMsgId();

// edit message
controller.editText(
    new EditTextRequest()
        .setChatId(chatId)
        .setMsgId(messageId)
        .setNewText("Edited bot message")
);  

// reply message
controller.sendTextMessage(
    new SendTextRequest()
        .setChatId(chatId)
        .setText("Reply msg")
        .setReplyMsgId(Collections.singletonList(messageId))
);

File file = new File("myfile.txt");
// send file
controller.sendFile(
    new SendFileRequest()
        .setChatId(chatId)
        .setFile(file)
);

// reply file
MessageResponse sendFileResponse = controller.sendFile(
    new SendFileRequest()
        .setChatId(chatId)
        .setFile(file)
        .setCaption("Awesome file")
        .setReplyMsgId(Collections.singletonList(messageId))
);
if (!sendFileResponse.isOk()) { // sent successfully or not
    // and get the error description if sending failed
    String errorDescription = sendFileResponse.getDescription();
}

client.stop(); // stop when work done

Changelog

1.2.3

  • Catch all exceptions in IOBackoff.execute

1.2.2

  • Support text formats: MarkdownV2, HTML
  • Support button's style for inline keyboard
  • Moved from JCenter with ru.mail group id to Maven Central with ru.mail.im group id

1.2.1

  • Api response status check possibility

1.2.0

  • Support inline keyboards
  • Moved from io.github.mail-ru-im to ru.mail group id
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].