Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions sql/schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
-- One-Task-bit-Bot DB Scheme --

-- ENUM's --
CREATE TYPE lan AS ENUM ('UKRANIAN', 'ENGLISH');

-- TABLE users
CREATE TABLE users (
id BIGSERIAL PRIMARY KEY,
user_name VARCHAR(255) NOT NULL UNIQUE,
language lan NOT NULL DEFAULT 'ENGLISH',
register_date TIMESTAMP NOT NULL DEFAULT NOW()
);

-- TABLE tasks
CREATE TABLE tasks (
id SERIAL PRIMARY KEY,
user_id BIGINT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
task_name VARCHAR(255) NOT NULL,
status BOOLEAN NOT NULL DEFAULT FALSE,
start_time TIMESTAMP,
creation_date TIMESTAMP NOT NULL DEFAULT NOW()
);

-- TABLE ideas
CREATE TABLE ideas (
id SERIAL PRIMARY KEY,
user_id BIGINT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
idea_name VARCHAR(255) NOT NULL,
creation_date TIMESTAMP NOT NULL DEFAULT NOW()
);


31 changes: 29 additions & 2 deletions telegram_bot_project/bot/commands.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,34 @@
from typing import Any
from aiogram.types import Message

async def start_command(message: Message, **kwargs: Any) -> None:
await message.answer("Hello!")
from messages import *

# Start Command Handler
async def start_command(message: Message)-> None:

user_id: int = message.from_user.id
user_name: str = message.from_user.username

print(f"--[INFO] - User {user_id} ({user_name}) - started the bot")

await message.answer(START_MSG)

# Help Command Handler
async def help_command(message: Message) -> None:

user_id: int = message.from_user.id
user_name: str = message.from_user.username

print(f"--[INFO] - User {user_id} ({user_name}) - asked for help")

await message.answer(HELP_MSG)

# Menu Command Handler
async def menu_command(message: Message) -> None:

user_id: int = message.from_user.id
user_name: str = message.from_user.username

print(f"--[INFO] - User {user_id} ({user_name}) - asked for menu")

await message.answer(MENU_MSG)
13 changes: 12 additions & 1 deletion telegram_bot_project/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,29 @@
from aiogram.types import Message

from config import TOKEN
from bot.commands import start_command
from bot.commands import *

dp: Dispatcher = Dispatcher()

# Commands Handlers
@dp.message(Command("start"))
async def start(message: Message):
await start_command(message)

@dp.message(Command("help"))
async def help(message: Message):
await help_command(message)

@dp.message(Command("menu"))
async def menu(message: Message):
await menu_command(message)

# Main Function
async def main():
bot: Bot = Bot(token=TOKEN)
await dp.start_polling(bot)

# Start point
if __name__ == "__main__":
print("-- STARTING ROCKY --\n")
asyncio.run(main())
20 changes: 20 additions & 0 deletions telegram_bot_project/messages.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
START_MSG: str = "👋 Hey there!\nI'm 🦝 Rocky — your personal focus assistant.\nReady to configure language?"
START_MSG_AGAIN: str = "👋 Welcome back, legend.\nRocky missed you. Let’s keep crushing it 💥"

HELP_MSG: str = "❓ Need help? Just type \n /add to create a task, \n /idea to save an idea, \n /done to complete your task."

MAKE_TASK_MSG: str = "🧠 What's your next focus task?"
TASK_CREATED_MSG: str = "✅ Got it! Your task has been created."
TASK_COMPLETED_MSG: str = "🎯 Boom! Task completed. Great job!"
TASK_DELETED_MSG: str = "🗑️ Task removed from your queue."
TASK_UPDATED_MSG: str = "🔁 Task updated successfully."

IDEAS_MSG: str = "💡 Here are all your brilliant ideas:"
CREATE_IDEA_MSG: str = "💬 What's your idea? Type it below:"
IDEA_CREATED_MSG: str = "✨ Idea saved! Never lose a thought again."
DELETE_IDEA_MSG: str = "⚠️ Are you sure you want to delete this idea?"

ERROR_MSG: str = "⚠️ Oops! Something went wrong. Try again or send /help."

MENU_MSG = "📋 Your Main Menu:\n\n✅ /add – Create a new task\n💡 /idea – Save an idea\n🎯 /myday – View your day\n🔧 /settings – Settings & preferences\n✨ /help – Need guidance?\n\nRocky is here to help you stay focused! 🦝"