To send messages to your Telegram chat using this application, follow these steps to create a bot and get your API key:
- Open Telegram and search for "BotFather".
- Start a chat with BotFather and send the command
/newbot
. - Follow the prompts to name your bot and choose a username (it must end with
bot
). - Copy the API token provided by BotFather after the bot is created.
- To get your chat ID:
- Send a message to your bot.
- Use the following URL in your browser (replace
<YourBotToken>
with your API token):https://api.telegram.org/bot<YourBotToken>/getUpdates
- Look for
"chat": {"id": YOUR_CHAT_ID}
in the JSON response.
- Update your application with the API token and chat ID.
- Ensure all dependencies are included.
- Compile the Java files:
javac -cp "lib/*" Factory/*.java Observer/*.java Builder/*.java Main.java