easy_bot_log 1.0.2
easy_bot_log: ^1.0.2 copied to clipboard
Easy bot log service
Init BotLogService #
/// init
final BotLogService botLogService = EasyBotLogFactory.createBotLogService(
/// Telegram Bot
telegramToken: tokenTelegram,
telegramChatId: chatRoomTelegramId,
/// Discord HOOK
discordHookId: discordHookId,
discordHookToken: discordHookToken,
discordBotName: discordBotName,
discordBotAvatar: discordBotAvatar,
/// Slack HOOK
slackTeamId: slackTeamId,
slackServiceId: slackServiceId,
slackHookToken: slackHookToken,
/// Use bot: current support "telegram", "slack", "discord"
/// If you choose "any",
/// the system will send all bots with enough configuration
botUse: botUse,
);
/// use
botLogService.sendMessage("Hello");
Document: #
Slack #
- Create hook Slack: https://api.slack.com/messaging/webhooks
Discord #
- Create hook Discord: https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks
Telegram #
- Create bot Telegram:
Step 1: Create new bot #
- Open telegram -> search "BotFather" and enter message: "/newbot"
Step 2: Enter bot name #
Step 3: Enter username #
- Enter username your bot. It must end in
bot
. Like this, for example: TetrisBot or tetris_bot.
Step 4: Start bot #
- Open your bot
- Start bot
Step 5: Get all bot #
Step 6: Open bot setting and get API TOKEN #
- Select your bot and choose API TOKEN
Step 7: Add bot to group #
Step 8: Get group id #
Step 9: Test send message #
Curl #
curl --location --request GET 'https://api.telegram.org/bot<API_TOKEN>/sendMessage?chat_id=<GROUP_ID>&text=helloworld'