From 834f21bb2815f648d7890179be6927d21f180110 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 6 Feb 2026 10:12:24 +0300 Subject: [PATCH] joke --- .DS_Store | Bin 6148 -> 6148 bytes jokes_bot/.DS_Store | Bin 6148 -> 6148 bytes jokes_bot/README.md | 2 +- jokes_bot/v4.0/.DS_Store | Bin 6148 -> 6148 bytes ...oke Bot v2 - Community Ratings Added!.html | 969 ---------------- jokes_bot/v4.0/clean_sample_data.sql | 42 +- jokes_bot/v4.0/database.py | 5 +- jokes_bot/v4.0/jokes.db | Bin 16384 -> 16384 bytes jokes_bot/v4.0/jokes.py | 197 +--- jokes_bot/v4.0/populate_db.py | 7 - .../Final_Telegram Joke Bot Development.html | 1023 +++++++++++++++++ .../Speaking Cards - Joke Bot Project.html | 374 ++++++ 12 files changed, 1438 insertions(+), 1181 deletions(-) delete mode 100644 jokes_bot/v4.0/AI Joke Bot v2 - Community Ratings Added!.html create mode 100644 projects/Final_Telegram Joke Bot Development.html create mode 100644 projects/Speaking Cards - Joke Bot Project.html diff --git a/.DS_Store b/.DS_Store index a9b1ab4c62ac49f7a72006be70bd64406022eab7..7672f28cecc6781b4dd7d27540907c314de9d846 100644 GIT binary patch literal 6148 zcmeHKO-~a+7@mPjyCAZZQh{i)NfQ$j6skfX9xSECpe7JnYmtw2w>vE>yF1P9mV!vq zyWac(-n@JC;Khsn0lj+n^!@(vx5-A*}9QNNJa?7 zpfQZ}L)S%^pS2F@5fyF_Cxq0r8q?n}2;|B*>6y91N#!6teKkF)%*@Xo z9!jy%)YSD=b;q(D`jm5t;nNeypuiS91EtH<46khIaH}k>i@O5;U%1Wkt{?`#Z4vWH z9v0NZr2c`^gJ*{1;rK`*J{nIZlZmrq$?=JabE-U|YvrA)%O<@@E$U{iI$5u}rjf5{ zWz(sae6r`~&BsKQ<3EJ15@YMgRM@XUOybB8l)L2;;so`UD;1CUB~>2s$}Y9673!J3 zNu9Me@7e=xuOPxxYV>_Y}Z297h(%P(cN|KI%i`TuxQ zcoi}bGVot9fFrqlE(=o_P_qCCJzu~2NHo}wrt0|NsP3otMgGsH6_G2}Cpq@_$ORA*$Itj{hsS%#Ho uvj~SU%f<#b=FRLJ{2V}?n*}+(Gf(Ch(d7hbJ^;iFlWlmUH^+!9VFm!!3lvoV diff --git a/jokes_bot/.DS_Store b/jokes_bot/.DS_Store index 3bdfc7d6d23b400e001a0dd5a09161629eba871a..eb5142957e590af008c418b3c5527134bd72941f 100644 GIT binary patch delta 311 zcmZoMXfc=|#>B)qF;Q%yo}wr_0|Nsi1A_oVQh9MfQcivnkiT>DLdNBc^&lx0hB5{d z20aD?Wa*@WoXp}91A}XfOw25-Z0ziu?A+|J!5R7G!6k_$rNvH(MbRK$NPd1!5{#Xg z6qcD<9xou`oS#>cn3B`mu~2NHo}v&d0|Nsi1A_oVT1s(pQht68B`mu~2NHo}wr#0|Nsi1A_nqLn=cuLkUAMgDykv#KPtEAPH`U0)`@n ze1_{E%6VW%CDSE~d@w9Q+(W?*m1?Gf(ChvE%?b4;TVWn*&6) GFarRTnLzgd literal 6148 zcmeHKO-}+b5Pd}s7%v<>_T))jKVrOYR!Gz!#(*ZA6lEiXF9S=WxBcn9X&VedkLbqC zkm;Mw$4+@ATMED=i{3F%1yG?1mbN*3BN7)~lTz>q8utu~1XE;qgk8&4M-ds2z1zn% zcWsE2yY{tzZO%v3SIp4Gn6W)-3wLN>z&)1iD@>f_b29p;^cD&qMp&}GU~_kB_6QPDQBByqZ!!P7~@6!iRqe@0cD_o z3>d$r%1!~-rb|)=l!3oxK;93QDi{aMJ-Sy12X_S^mg#mvTkaB4V*|zkbB~Nrj4vhn zQWLHi#+TD?LtY#(_vp)ETxUKfbT;9JVqACntxJcAJ?f|oCzb OKLU;h9h8AzW#AJH*Ir5h diff --git a/jokes_bot/v4.0/AI Joke Bot v2 - Community Ratings Added!.html b/jokes_bot/v4.0/AI Joke Bot v2 - Community Ratings Added!.html deleted file mode 100644 index 05213f0..0000000 --- a/jokes_bot/v4.0/AI Joke Bot v2 - Community Ratings Added!.html +++ /dev/null @@ -1,969 +0,0 @@ - - - - - - AI Joke Bot v2 - Community Ratings Added! - - - -
Slide 1 of 12
- -
- -
-
-
๐Ÿค–โœจ
-
Joke Bot v2.0 Launch!
-
AI + Community = Super Smart Bot!
-
Now with community ratings and smarter AI!
-
- -
- - -
-
- - -
-

Class Rules

- -
-

How to Earn Points Today:

- -

+2 Points - You're here and ready to learn!

-

+1 Point - You listen during instruction

-

+1 Point - You try all the activities

-

+1 Point - You complete all the work

- -
-

โœจ Cool Fact: You helped build this bot! Your ratings make it smarter!

-
-
- -
- - -
-
- - -
-

What's New in v2.0?

-

Our joke bot got a MAJOR upgrade!

- -
-
    -
  1. ๐ŸŽญ Community Voting: Rate jokes with ๐Ÿ‘, ๐Ÿ‘Ž, or ๐Ÿ˜
  2. -
  3. ๐Ÿง  AI vs Humans: Compare computer guesses with real votes
  4. -
  5. ๐Ÿ—ณ๏ธ Many-to-One: Many people can rate each joke
  6. -
  7. ๐Ÿ“Š Smart Statistics: See what jokes are REALLY popular
  8. -
  9. ๐Ÿ’พ Database Upgrade: New table for storing all votes
  10. -
-
- -
-

๐ŸŽฎ Think of it like this: Our joke bot was good, but now it's like adding multiplayer mode to a game!

-
- -
- - -
-
- - -
-

The Big Upgrade: Community Ratings!

- -
-

v1.0: Just AI Guesses

-

Old system: Only the computer guessed if jokes were funny.

-
-
-

AI Says: ๐Ÿ˜Š Positive

-

"Why don't eggs tell jokes?"

- Score: +0.90 -
-
-
- -
-

v2.0: AI + REAL People!

-

New system: Both computer AND humans vote on jokes!

- -
-
๐Ÿ‘ 85%
-
๐Ÿ˜ 10%
-
๐Ÿ‘Ž 5%
-
- -

Example Joke: "Why don't scientists trust atoms?"

-

AI Thinks: ๐Ÿ˜Š Positive (Score: +0.75)

-

Community Says: ๐Ÿ‘ 92% funny! (46 votes)

-
- -
-

๐Ÿคฏ Mind Blown Fact: This is how YouTube, TikTok, and Netflix work - they combine AI guesses with real user ratings!

-
- -
- - -
-
- - -
-

Try It Yourself! ๐ŸŽฏ

- -
-

Step-by-Step Demo:

-
    -
  1. Step 1: Bot shows you a joke
  2. -
  3. Step 2: You see AI's guess (๐Ÿ˜Š/๐Ÿ˜/๐Ÿ˜’)
  4. -
  5. Step 3: YOU get to vote! ๐Ÿ‘, ๐Ÿ‘Ž, or ๐Ÿ˜
  6. -
  7. Step 4: Your vote gets saved with everyone else's
  8. -
  9. Step 5: Next person sees the community score
  10. -
-
- -
-

๐Ÿ“ฑ What You See Now:

-
-

๐Ÿคฃ "Why don't eggs tell jokes? They'd crack each other up!"

-

๐Ÿค– AI Mood: ๐Ÿ˜Š Positive (Score: +0.90)

-

๐Ÿ‘ฅ Community Rating: ๐Ÿ‘ 85% | ๐Ÿ˜ 10% | ๐Ÿ‘Ž 5%

-

๐Ÿ—ณ๏ธ 124 people voted

-
-

Was this joke funny to YOU?

-

1. ๐Ÿ‘ Upvote 2. ๐Ÿ˜ Neutral 3. ๐Ÿ‘Ž Downvote

-
-
- -
-

๐Ÿ’ก This is like: YouTube comments + TikTok likes + Netflix ratings all in one joke bot!

-
- -
- - -
-
- - -
-

Behind the Scenes: Database Magic ๐Ÿ—„๏ธ

- -
-

OLD Database (v1.0):

-
- jokes table: - โ”œโ”€โ”€ id - โ”œโ”€โ”€ joke_text - โ”œโ”€โ”€ contributor - โ”œโ”€โ”€ published_date - โ”œโ”€โ”€ ai_score โ† Only AI's guess - โ””โ”€โ”€ ai_mood_label -
-
- -
-

NEW Database (v2.0):

-
- jokes table: user_sentiments table: - โ”œโ”€โ”€ id โ”œโ”€โ”€ id - โ”œโ”€โ”€ joke_text โ”œโ”€โ”€ joke_id โ†’ Links to jokes - โ”œโ”€โ”€ contributor โ”œโ”€โ”€ user_name - โ”œโ”€โ”€ published_date โ”œโ”€โ”€ sentiment โ†’ 'up','down','neutral' - โ”œโ”€โ”€ ai_score โ† AI's guess โ””โ”€โ”€ timestamp - โ””โ”€โ”€ ai_mood_label โ””โ”€โ”€ โ† MANY votes per joke! -
-
- -
-

๐Ÿงฉ Many-to-One Relationship:

-
    -
  • One Joke can have MANY votes
  • -
  • Like one YouTube video โ†’ many likes/comments
  • -
  • Like one TikTok โ†’ many hearts
  • -
  • This is called a "foreign key" relationship
  • -
-
- -
- - -
-
- - -
-

The Smart New Code โœจ

- -
-

1. New Database Table:

-
-CREATE TABLE user_sentiments ( - id INTEGER PRIMARY KEY, - joke_id INTEGER, # Which joke - user_name TEXT, # Who voted - sentiment TEXT, # 'up','down','neutral' - timestamp TEXT, # When they voted - FOREIGN KEY (joke_id) REFERENCES jokes(id) # The magic link! -); -
- -

2. Asking for Your Vote:

-
-# After showing a joke... -print("๐Ÿคฃ Why don't eggs tell jokes? They'd crack each other up!") -print("๐Ÿค– AI thinks: ๐Ÿ˜Š Positive (Score: +0.90)") - -# Get community rating -community_score = get_community_rating(joke_id) -print(f"๐Ÿ‘ฅ Community: ๐Ÿ‘ {community_score['up']}%") - -# Ask for YOUR vote! -print("๐Ÿ—ณ๏ธ Was this funny to YOU?") -print("1. ๐Ÿ‘ Upvote 2. ๐Ÿ˜ Neutral 3. ๐Ÿ‘Ž Downvote") -user_choice = input("Your choice: ") - -# Save your vote -save_user_vote(joke_id, your_name, user_choice) -
-
- -
-

โšก Pro Tip: The "FOREIGN KEY" is what links votes to specific jokes. It's like adding @mentions in social media!

-
- -
- - -
-
- - -
-

AI vs Humans - The Showdown! ๐ŸฅŠ

- -
-

Now We Can Compare:

- - - - - - - - - - - - - - - - - - - - - - - - - -
Joke๐Ÿค– AI Guesses๐Ÿ‘ฅ Humans VoteWho's Right?
"Why don't scientists trust atoms?"๐Ÿ˜Š Positive (+0.75)๐Ÿ‘ 92% funnyโœ… Both agree!
"Parallel lines have so much in common..."๐Ÿ˜’ Negative (-0.35)๐Ÿ‘ 78% funnyโŒ AI wrong!
"I told my computer I needed a break..."๐Ÿ˜ Neutral (0.05)๐Ÿ‘Ž 65% not funnyโŒ AI wrong!
-
- -
-

๐ŸŽฏ What This Teaches Us:

-
    -
  • AI gets it right sometimes - Good at obvious jokes
  • -
  • AI gets it wrong sometimes - Bad at sarcasm/complex jokes
  • -
  • Humans are better judges - We understand context
  • -
  • Community voting is powerful - Wisdom of the crowd!
  • -
-
- -
-

๐Ÿง  Real AI Learning: Some AI systems use human votes like this to LEARN and get better! Your votes could train future AI!

-
- -
- - -
-
- - -
-

Where You've Seen This Before ๐ŸŽฌ

- -
-

Everywhere! This is how real apps work:

- -
-
-

๐Ÿ“ฑ YouTube

-

๐Ÿ‘๐Ÿ‘Ž buttons

-

Comments + AI recommendations

- Exactly like our joke bot! -
-
-

๐Ÿ“ธ TikTok/Instagram

-

โค๏ธ hearts = upvotes

-

AI suggests videos you'll like

- Community + AI working together -
-
-

๐ŸŽฎ Online Games

-

Report systems

-

Player ratings

- Community moderation -
-
-
- -
-

๐ŸŽฏ The Big Idea:

-

Modern apps = AI + Community Feedback

-
    -
  • AI starts the guess (like our TextBlob sentiment)
  • -
  • Humans give feedback (your ๐Ÿ‘/๐Ÿ‘Ž votes)
  • -
  • System gets smarter (learns from both)
  • -
  • Better experience for everyone!
  • -
-
- -
-

๐Ÿš€ Career Connection: Knowing how to build AI + community systems is a SUPER valuable skill for app developers!

-
- -
- - -
-
- - -
-

What YOU Built Today ๐Ÿ—๏ธ

- -
-

Think about it - you helped build a system that:

- -
    -
  1. ๐Ÿค– Uses AI to analyze text feelings
  2. -
  3. ๐Ÿ—ณ๏ธ Collects community votes from real people
  4. -
  5. ๐Ÿ’พ Stores everything in a smart database
  6. -
  7. ๐Ÿ”— Links votes to jokes with foreign keys
  8. -
  9. ๐Ÿ“Š Shows statistics comparing AI vs humans
  10. -
- -
-

๐ŸŒŸ That's Professional-Level Work!

-

Companies build apps the exact same way:

-
    -
  • YouTube = videos + likes/dislikes
  • -
  • Amazon = products + star ratings
  • -
  • Netflix = shows + thumbs up/down
  • -
  • Our Joke Bot = jokes + ๐Ÿ‘/๐Ÿ‘Ž ratings!
  • -
-
- -
-

๐Ÿ’ช You're Not Just Learning - You're Building Real Stuff!

-

The skills you learned today (AI + databases + user feedback) are exactly what tech companies look for!

-
-
- -
- - -
-
- - -
-

What Could We Build Next? ๐Ÿš€

- -
-

Discussion Time:

-
    -
  • What jokes did the AI get totally wrong? Why?
  • -
  • Should some people's votes count more? (Like joke experts?)
  • -
  • What if we could "train" the AI with our votes?
  • -
  • Could we predict which jokes will be popular?
  • -
- -
-

๐ŸŽฏ Cool Extension Ideas:

-
    -
  • Personalized Jokes: "Show me jokes that people LIKE ME enjoyed!"
  • -
  • Joke Leaderboard: Top 10 most-liked jokes
  • -
  • AI Trainer: Use votes to make TextBlob smarter
  • -
  • Meme Version: Same system but for memes!
  • -
  • Class Poll System: Use this code for classroom votes
  • -
-
- -
-

๐Ÿง  The Real Magic:

-

You now have a template for ANY voting system:

-

Song ratings, game reviews, teacher feedback, club elections...

-

Change the jokes to something else, keep the voting system!

-
-
- -
- - -
-
- - -
-
-
๐Ÿค–๐Ÿ‘ฅโœจ
-

You Built Version 2.0!

- -
-

๐ŸŽฏ Remember What You Accomplished:

-
    -
  • Started with basic joke storage (v1.0)
  • -
  • Added AI mood detection (v1.5)
  • -
  • Now added COMMUNITY voting (v2.0!)
  • -
  • You built a system used by billion-dollar companies
  • -
  • You understand AI + Human collaboration
  • -
-
- -
-

๐Ÿ“ˆ Career Superpower: You now know how to build interactive, community-driven, AI-enhanced apps. That's literally what modern software development is all about!

-
- -

Next Challenge: Can we make the AI LEARN from our votes? ๐Ÿค”

- -

- ICT & Digital Technologies
- Year 9 - Building Real Apps -

-
- -
- - -
-
- -
- - - - \ No newline at end of file diff --git a/jokes_bot/v4.0/clean_sample_data.sql b/jokes_bot/v4.0/clean_sample_data.sql index 8b9a02e..0d62679 100644 --- a/jokes_bot/v4.0/clean_sample_data.sql +++ b/jokes_bot/v4.0/clean_sample_data.sql @@ -1,22 +1,22 @@ -- Insert 20 dummy jokes with various sentiments -INSERT INTO jokes (joke, contributor, published, sentiment_score, sentiment_label) VALUES -('Why don''t scientists trust atoms? Because they make up everything!', 'ScienceFan', '2024-01-15 10:30:00', 0.75, '๐Ÿ˜Š Positive'), -('I told my wife she was drawing her eyebrows too high. She looked surprised.', 'Joker123', '2024-01-16 14:20:00', 0.35, '๐Ÿ˜Š Positive'), -('Why did the scarecrow win an award? He was outstanding in his field!', 'FarmLife', '2024-01-17 09:15:00', 0.65, '๐Ÿ˜Š Positive'), -('What do you call a fish with no eyes? Fsh!', 'MarineBio', '2024-01-18 16:45:00', 0.25, '๐Ÿ˜Š Positive'), -('I''m reading a book on anti-gravity. It''s impossible to put down!', 'PhysicsNerd', '2024-01-19 11:30:00', 0.45, '๐Ÿ˜Š Positive'), -('Why did the computer go to the doctor? Because it had a virus.', 'TechSupport', '2024-01-20 13:10:00', 0.05, '๐Ÿ˜ Neutral'), -('What do you call a bear with no teeth? A gummy bear.', 'WildlifeFan', '2024-01-21 15:25:00', 0.08, '๐Ÿ˜ Neutral'), -('Why did the bicycle fall over? Because it was two-tired.', 'Cyclist', '2024-01-22 10:00:00', -0.02, '๐Ÿ˜ Neutral'), -('What do you call a sleeping bull? A bulldozer.', 'Cowboy', '2024-01-23 14:35:00', 0.03, '๐Ÿ˜ Neutral'), -('Why did the math book look so sad? Because it had too many problems.', 'Student', '2024-01-24 09:50:00', -0.05, '๐Ÿ˜ Neutral'), -('I used to play piano by ear, but now I use my hands.', 'Musician', '2024-01-25 12:15:00', -0.15, '๐Ÿ˜’ Negative'), -('I told my computer I needed a break, and now it won''t stop sending me Kit-Kat ads.', 'OfficeWorker', '2024-01-26 16:30:00', -0.25, '๐Ÿ˜’ Negative'), -('Parallel lines have so much in common. It''s a shame they''ll never meet.', 'MathTeacher', '2024-01-27 11:40:00', -0.35, '๐Ÿ˜’ Negative'), -('My wife told me to stop impersonating a flamingo. I had to put my foot down.', 'Husband', '2024-01-28 14:55:00', -0.20, '๐Ÿ˜’ Negative'), -('I told my girlfriend she drew her eyebrows too high. She seemed surprised.', 'Boyfriend', '2024-01-29 10:10:00', -0.30, '๐Ÿ˜’ Negative'), -('What''s orange and sounds like a parrot? A carrot!', 'Vegetarian', '2024-01-30 13:20:00', 0.85, '๐Ÿ˜Š Positive'), -('Why don''t eggs tell jokes? They''d crack each other up!', 'Chef', '2024-01-31 15:45:00', 0.90, '๐Ÿ˜Š Positive'), -('I invented a new word: Plagiarism!', 'Writer', '2024-02-01 09:30:00', 0.78, '๐Ÿ˜Š Positive'), -('Why did the golfer bring two pairs of pants? In case he got a hole in one!', 'Golfer', '2024-02-02 12:15:00', 0.82, '๐Ÿ˜Š Positive'), -('What do you call a fake noodle? An impasta!', 'ItalianFood', '2024-02-03 14:40:00', 0.88, '๐Ÿ˜Š Positive'); \ No newline at end of file +INSERT INTO jokes (joke, contributor, created_date, approved, sentiment_score, sentiment_label) VALUES +('Why don''t scientists trust atoms? Because they make up everything!', 'ScienceFan', '2024-01-15 10:30:00', 1, 0.75, '๐Ÿ˜Š Positive'), +('I told my wife she was drawing her eyebrows too high. She looked surprised.', 'Joker123', '2024-01-16 14:20:00', 1, 0.35, '๐Ÿ˜Š Positive'), +('Why did the scarecrow win an award? He was outstanding in his field!', 'FarmLife', '2024-01-17 09:15:00', 1, 0.65, '๐Ÿ˜Š Positive'), +('What do you call a fish with no eyes? Fsh!', 'MarineBio', '2024-01-18 16:45:00', 1, 0.25, '๐Ÿ˜Š Positive'), +('I''m reading a book on anti-gravity. It''s impossible to put down!', 'PhysicsNerd', '2024-01-19 11:30:00', 1, 0.45, '๐Ÿ˜Š Positive'), +('Why did the computer go to the doctor? Because it had a virus.', 'TechSupport', '2024-01-20 13:10:00', 1, 0.05, '๐Ÿ˜ Neutral'), +('What do you call a bear with no teeth? A gummy bear.', 'WildlifeFan', '2024-01-21 15:25:00', 1, 0.08, '๐Ÿ˜ Neutral'), +('Why did the bicycle fall over? Because it was two-tired.', 'Cyclist', '2024-01-22 10:00:00', 1, -0.02, '๐Ÿ˜ Neutral'), +('What do you call a sleeping bull? A bulldozer.', 'Cowboy', '2024-01-23 14:35:00', 1, 0.03, '๐Ÿ˜ Neutral'), +('Why did the math book look so sad? Because it had too many problems.', 'Student', '2024-01-24 09:50:00', 1, -0.05, '๐Ÿ˜ Neutral'), +('I used to play piano by ear, but now I use my hands.', 'Musician', '2024-01-25 12:15:00', 1, -0.15, '๐Ÿ˜’ Negative'), +('I told my computer I needed a break, and now it won''t stop sending me Kit-Kat ads.', 'OfficeWorker', '2024-01-26 16:30:00', 1, -0.25, '๐Ÿ˜’ Negative'), +('Parallel lines have so much in common. It''s a shame they''ll never meet.', 'MathTeacher', '2024-01-27 11:40:00', 1, -0.35, '๐Ÿ˜’ Negative'), +('My wife told me to stop impersonating a flamingo. I had to put my foot down.', 'Husband', '2024-01-28 14:55:00', 1, -0.20, '๐Ÿ˜’ Negative'), +('I told my girlfriend she drew her eyebrows too high. She seemed surprised.', 'Boyfriend', '2024-01-29 10:10:00', 1, -0.30, '๐Ÿ˜’ Negative'), +('What''s orange and sounds like a parrot? A carrot!', 'Vegetarian', '2024-01-30 13:20:00', 1, 0.85, '๐Ÿ˜Š Positive'), +('Why don''t eggs tell jokes? They''d crack each other up!', 'Chef', '2024-01-31 15:45:00', 1, 0.90, '๐Ÿ˜Š Positive'), +('I invented a new word: Plagiarism!', 'Writer', '2024-02-01 09:30:00', 1, 0.78, '๐Ÿ˜Š Positive'), +('Why did the golfer bring two pairs of pants? In case he got a hole in one!', 'Golfer', '2024-02-02 12:15:00', 1, 0.82, '๐Ÿ˜Š Positive'), +('What do you call a fake noodle? An impasta!', 'ItalianFood', '2024-02-03 14:40:00', 1, 0.88, '๐Ÿ˜Š Positive'); \ No newline at end of file diff --git a/jokes_bot/v4.0/database.py b/jokes_bot/v4.0/database.py index 56766d1..9dfd37b 100644 --- a/jokes_bot/v4.0/database.py +++ b/jokes_bot/v4.0/database.py @@ -8,7 +8,8 @@ cursor.execute('''CREATE TABLE IF NOT EXISTS jokes ( id INTEGER PRIMARY KEY AUTOINCREMENT, joke TEXT NOT NULL, contributor TEXT NOT NULL, - published TEXT NOT NULL, + created_date TEXT NOT NULL, + approved BOOLEAN DEFAULT 0, sentiment_score REAL DEFAULT 0.0, sentiment_label TEXT DEFAULT '๐Ÿ˜ Neutral' )''') @@ -23,5 +24,5 @@ cursor.execute('''CREATE TABLE IF NOT EXISTS user_sentiments ( )''') conn.commit() -print("โœ… Database and tables created successfully with AI sentiment columns and user sentiment tracking!") +print("โœ… Database and tables created successfully with approval system and user sentiment tracking!") conn.close() \ No newline at end of file diff --git a/jokes_bot/v4.0/jokes.db b/jokes_bot/v4.0/jokes.db index cb36c5bd63993f68d663e52ad28f91b2b1b83a05..30c1abb46d0c5614ecec54e5f6feeb124378da07 100644 GIT binary patch delta 1202 zcmaKqO=uHA6vtO#t zA88U0k@ixF2f>40L@yqs7eVjpRS?vR7Y~9c-UKiDX5%5P)!mt8{`;TbdvA7Mt;W@A z+@{QhZg(B)2%&xJodQD0BS?t8p*2BzT7MYaGKCi$>Ery8Byl&gjbC)#oLnqgOGW#F z4Nqlk_{^A67=byS&-VuuxU7YR#nMXAR*sI0qZQg8#b|HjPpJ+|<5(-r zO1G27ps8nC$-xLlX_tgD0h@BC4(q+!Nj+<7gRP{~iP2=QK^i^X(Z>7eNy2pyRPTwy zn||pkKC=g-Q6`>9r|?V|qbm^*zL3(e;$hKQuAAMf#M=g{mnl9~ zAr%f(7!I?wo|*}%lyDx2n<>o}%W>A;l%7Z8C-If|NW3M^iUm;y`nEWnPiv1fUq^{41=_h@p^HT{2?hN)(ib~ko( zTkK}@0S-fzPX}B+vXh5DuB$R}P46zInv=0>dUl#x25N3-ha*)@H(eq7{;SrIIU5}?_4nQ4=HrNq1b`753{_Xt+NHiMH delta 1006 zcmaKq%TE(g6vpp#=-k`K%ut~n+M#wxgKUJfz2)H;HAaXrAs7`S3tUW@7N(CW=>sf6 zThs+%h0exAjT#f(VsK?h+!A-X(2a>``~%!zT$t!-*%+u!a+CS)cfa4cXXe!FOuf!* z$c+1L_qh%?8d&e-5kf4lB4JN>#;aQ%WyifG@!O1pFj$f#=62rtB&iD?zMARcbjzi)t;g?Vq0{kOB?0)4QbA53ooj;wkj<1es@`0rBZ~PpG zxovKN<6f@5x7SP`Mm0aheHTonG?!FTTF%H;lzd8=(M;1wXxXBo!7g|OMK_>uUr8&L zDvD<6N>S7M21bpXri{iSv7!D*w4X+lXjG*q)OhsGF7yP?_s93|DHF+Atz;}DN4*%G z@>9}#wot0%bEl6hSz{(+n6u65i&{3jZyewase=?a8^9@-3R*VViP21$TAMzNpbmmo zd;HW2NK5$I5sWUu`$Oq6Har+rywv(3={VhvQND*-iLMl3#YP}Rt#@5j!U`aIWok|N ztHj2Gkb(Qzzd{5zh-fdhl7TgxabZ*rQfn`eB1=v%yb#gl5>7ZUGN9nDd>!WqMk}yC z);))F7y>}rmA%&6?knU52O$S+919l6O*;r4#M59IC)zO5;5M5+pA|oPo-DHsJk+{# zbdj(&5MdB)p%t>sfbjItt@Tj4eSmi`ti+`AnPkz|7$07!BJrEJBfb#V#Edv0M#WAT zr;oyG;ek+vk(w52GH*wWhx*F%e|_M{Nb`pc2i;(LsZGx>ng{F=HAZDuGwVH+9abaJ zZl@hNytGAhP>sifjwaa^Z|TP(GHIgOLujhTB3AT_x7N60L&)5JPRjPCX={lIwl(k2 hs=Ed_#6klyHTUQ1K>PG0oCw(9gon0-2bh0*e*i53?u-Bc diff --git a/jokes_bot/v4.0/jokes.py b/jokes_bot/v4.0/jokes.py index 863c280..57d8467 100644 --- a/jokes_bot/v4.0/jokes.py +++ b/jokes_bot/v4.0/jokes.py @@ -2,21 +2,6 @@ import sqlite3 import random from datetime import datetime -from textblob import TextBlob # Simple NLP library - -def analyze_joke_sentiment(joke_text): - """Use AI to analyze the sentiment of a joke""" - analysis = TextBlob(joke_text) - polarity = analysis.sentiment.polarity - - if polarity > 0.1: - label = "๐Ÿ˜Š Positive" - elif polarity < -0.1: - label = "๐Ÿ˜’ Negative" - else: - label = "๐Ÿ˜ Neutral" - - return polarity, label def get_user_sentiment_for_joke(db, joke_id): """Get the average user sentiment for a specific joke""" @@ -37,7 +22,7 @@ def get_user_sentiment_for_joke(db, joke_id): ''', (joke_id,)) result = cursor.fetchone() - avg_sentiment, total_votes = result + avg_sentiment, total_votes = result if result else ('๐Ÿ˜ Neutral', 0) return avg_sentiment, total_votes def add_user_sentiment(db, joke_id, user_choice): @@ -58,33 +43,29 @@ def main(): while True: print("\n" + "="*30) - print("๐Ÿค– AI-ENHANCED JOKE BOT ๐Ÿค–") + print("๐Ÿค– JOKE BOT ๐Ÿค–") print("="*30) print("1. Get random joke") print("2. Add new joke") - print("3. Analyze joke sentiment") - print("4. Get joke by mood") - print("5. View all jokes with sentiment") - print("6. Quit") + print("3. Quit") choice = input("\nYour choice: ").strip() if choice == "1": - # Get random joke with sentiment info + # Get random approved joke cursor = db.execute(''' - SELECT id, joke, contributor, published, sentiment_label + SELECT id, joke, contributor FROM jokes + WHERE approved = 1 ORDER BY RANDOM() LIMIT 1 ''') joke_data = cursor.fetchone() if joke_data: - joke_id, joke, contributor, published, sentiment = joke_data + joke_id, joke, contributor = joke_data print(f"\n๐Ÿคฃ {joke}") print(f" ๐Ÿ‘ค Contributor: {contributor}") - print(f" ๐Ÿ“… Published: {published}") - print(f" ๐Ÿง  AI Mood Analysis: {sentiment}") # Get and display user sentiment stats avg_sentiment, total_votes = get_user_sentiment_for_joke(db, joke_id) @@ -94,20 +75,14 @@ def main(): # Ask user for their sentiment print(f"\n๐ŸŽฏ Rate this joke: ๐Ÿ‘ (U)p, ๐Ÿ‘Ž (D)own, or (N)eutral?") user_input = input("Your choice (u/d/n): ").strip().lower() - - if user_input in ['u', 'up']: - user_choice = 'up' - elif user_input in ['d', 'down']: - user_choice = 'down' - else: - user_choice = 'neutral' + user_choice = 'up' if user_input in ['u', 'up'] else 'down' if user_input in ['d', 'down'] else 'neutral' if add_user_sentiment(db, joke_id, user_choice): print(f"โœ… Your rating ({'๐Ÿ‘ Up' if user_choice == 'up' else '๐Ÿ‘Ž Down' if user_choice == 'down' else '๐Ÿ˜ Neutral'}) recorded!") else: print("โŒ Could not save your rating.") else: - print("๐Ÿ“ญ No jokes in the database yet!") + print("็ฏ“ No approved jokes in the database yet!") elif choice == "2": new_joke = input("Enter your joke: ").strip() @@ -117,172 +92,32 @@ def main(): name = input("Your name (or press Enter for 'Anonymous'): ").strip() or "Anonymous" - # AI Analysis - score, label = analyze_joke_sentiment(new_joke) - print(f"\n๐Ÿค– AI Analysis Results:") - print(f" Sentiment Score: {score:.2f}") - print(f" Mood Label: {label}") - # Get current date/time current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S") try: cursor = db.cursor() cursor.execute(''' - INSERT INTO jokes (joke, contributor, published, sentiment_score, sentiment_label) - VALUES (?, ?, ?, ?, ?) - ''', (new_joke, name, current_time, score, label)) + INSERT INTO jokes (joke, contributor, created_date, approved) + VALUES (?, ?, ?, 0) + ''', (new_joke, name, current_time)) # Get the ID of the newly inserted joke new_joke_id = cursor.lastrowid db.commit() - print("โœ… Joke saved with AI analysis!") - - # Ask user for their sentiment on the new joke - print(f"\n๐ŸŽฏ Rate your own joke: ๐Ÿ‘ (U)p, ๐Ÿ‘Ž (D)own, or (N)eutral?") - user_input = input("Your choice (u/d/n): ").strip().lower() - - if user_input in ['u', 'up']: - user_choice = 'up' - elif user_input in ['d', 'down']: - user_choice = 'down' - else: - user_choice = 'neutral' - - if add_user_sentiment(db, new_joke_id, user_choice): - print(f"โœ… Your rating ({'๐Ÿ‘ Up' if user_choice == 'up' else '๐Ÿ‘Ž Down' if user_choice == 'down' else '๐Ÿ˜ Neutral'}) recorded!") + print("โœ… Submitted for approval!") except Exception as e: print(f"โŒ Error saving joke: {e}") elif choice == "3": - joke_text = input("Enter a joke to analyze: ").strip() - if joke_text: - score, label = analyze_joke_sentiment(joke_text) - print(f"\n๐Ÿ“Š AI Analysis Results:") - print(f" Joke: '{joke_text}'") - print(f" Sentiment Score: {score:.2f}") - print(f" Mood Label: {label}") - - # Interpretation - print(f"\n๐Ÿ“ˆ Interpretation:") - if score > 0.5: - print(" Very positive joke! ๐Ÿ˜„") - elif score > 0.1: - print(" Positive joke! ๐Ÿ˜Š") - elif score < -0.5: - print(" Very negative/sarcastic joke! ๐Ÿ˜ ") - elif score < -0.1: - print(" Negative joke! ๐Ÿ˜’") - else: - print(" Neutral joke! ๐Ÿ˜") - else: - print("โŒ Please enter a joke to analyze.") - - elif choice == "4": - print("\n๐ŸŽญ Choose mood:") - print("1. ๐Ÿ˜Š Positive jokes") - print("2. ๐Ÿ˜’ Negative jokes") - print("3. ๐Ÿ˜ Neutral jokes") - print("4. ๐Ÿ˜„ Very positive jokes (score > 0.5)") - print("5. ๐Ÿ˜  Very negative jokes (score < -0.5)") - - mood_choice = input("Your choice: ").strip() - - mood_queries = { - "1": ("๐Ÿ˜Š Positive", "sentiment_label = '๐Ÿ˜Š Positive'"), - "2": ("๐Ÿ˜’ Negative", "sentiment_label = '๐Ÿ˜’ Negative'"), - "3": ("๐Ÿ˜ Neutral", "sentiment_label = '๐Ÿ˜ Neutral'"), - "4": ("๐Ÿ˜„ Very Positive", "sentiment_score > 0.5"), - "5": ("๐Ÿ˜  Very Negative", "sentiment_score < -0.5") - } - - if mood_choice in mood_queries: - mood_name, query = mood_queries[mood_choice] - - cursor = db.execute(f''' - SELECT id, joke, contributor, sentiment_score - FROM jokes - WHERE {query} - ORDER BY RANDOM() - LIMIT 1 - ''') - - joke_data = cursor.fetchone() - - if joke_data: - joke_id, joke, contributor, score = joke_data - print(f"\n{mood_name} joke:") - print(f"๐Ÿคฃ {joke}") - print(f" ๐Ÿ‘ค Contributor: {contributor}") - print(f" ๐Ÿ“Š Sentiment Score: {score:.2f}") - - # Get and display user sentiment stats - avg_sentiment, total_votes = get_user_sentiment_for_joke(db, joke_id) - if total_votes > 0: - print(f" ๐Ÿ‘ฅ Community Rating: {avg_sentiment} ({total_votes} votes)") - - # Ask user for their sentiment - print(f"\n๐ŸŽฏ Rate this joke: ๐Ÿ‘ (U)p, ๐Ÿ‘Ž (D)own, or (N)eutral?") - user_input = input("Your choice (u/d/n): ").strip().lower() - - if user_input in ['u', 'up']: - user_choice = 'up' - elif user_input in ['d', 'down']: - user_choice = 'down' - else: - user_choice = 'neutral' - - if add_user_sentiment(db, joke_id, user_choice): - print(f"โœ… Your rating ({'๐Ÿ‘ Up' if user_choice == 'up' else '๐Ÿ‘Ž Down' if user_choice == 'down' else '๐Ÿ˜ Neutral'}) recorded!") - else: - print(f"๐Ÿ“ญ No {mood_name.lower()} jokes yet!") - else: - print("โŒ Invalid choice!") - - elif choice == "5": - print("\n๐Ÿ“‹ ALL JOKES IN DATABASE:") - print("-" * 70) - - cursor = db.execute(''' - SELECT j.id, j.joke, j.contributor, j.sentiment_label, j.sentiment_score - FROM jokes j - ORDER BY j.id DESC - ''') - - jokes = cursor.fetchall() - - if jokes: - for i, (joke_id, joke, contributor, label, score) in enumerate(jokes, 1): - print(f"\n{i}. {joke}") - print(f" ๐Ÿ‘ค {contributor} | AI: {label} | Score: {score:.2f}") - - # Get and display user sentiment stats - avg_sentiment, total_votes = get_user_sentiment_for_joke(db, joke_id) - if total_votes > 0: - print(f" ๐Ÿ‘ฅ Community Rating: {avg_sentiment} ({total_votes} votes)") - - print(f"\n๐Ÿ“Š Total jokes: {len(jokes)}") - else: - print("๐Ÿ“ญ No jokes in the database yet!") - - elif choice == "6": - print("\n๐Ÿ‘‹ Goodbye! Thanks for using the AI Joke Bot!") + print("\n๐Ÿ‘‹ Goodbye!") break else: - print("โŒ Invalid choice. Please select 1-6.") + print("โŒ Invalid choice. Please select 1-3.") db.close() if __name__ == "__main__": - # Check if textblob is installed - try: - import textblob - main() - except ImportError: - print("โŒ ERROR: textblob library is not installed!") - print("\n๐Ÿ“ฆ Please install it using:") - print(" pip install textblob") - print(" python -m textblob.download_corpora") - print("\nThen run this script again.") \ No newline at end of file + main() \ No newline at end of file diff --git a/jokes_bot/v4.0/populate_db.py b/jokes_bot/v4.0/populate_db.py index 60eac7e..1a0a66b 100644 --- a/jokes_bot/v4.0/populate_db.py +++ b/jokes_bot/v4.0/populate_db.py @@ -84,13 +84,6 @@ def populate_database(): conn.commit() print(f"โœ… Added sample user sentiments for {len(jokes_with_sentiment)} joke entries") - # Show sentiment distribution - cursor.execute('SELECT sentiment_label, COUNT(*) FROM jokes GROUP BY sentiment_label') - distribution = cursor.fetchall() - print(f'\n๐Ÿ“ˆ AI Sentiment distribution:') - for label, cnt in distribution: - print(f' {label}: {cnt} jokes') - # Show user sentiment distribution if the table exists try: cursor.execute('SELECT user_sentiment, COUNT(*) FROM user_sentiments GROUP BY user_sentiment') diff --git a/projects/Final_Telegram Joke Bot Development.html b/projects/Final_Telegram Joke Bot Development.html new file mode 100644 index 0000000..8dad192 --- /dev/null +++ b/projects/Final_Telegram Joke Bot Development.html @@ -0,0 +1,1023 @@ + + + + + + Telegram Joke Bot Development + + + +
+ +
+
+
+

Telegram Joke Bot Development

+

From Hardcoded Jokes to Community-Driven Platform

+ +
+
+ Technolyceum Programming Project +
+ +
+ Student Developers: ะ”ะฐัˆัƒะฝะธะฝ ะ”ะผะธั‚ั€ะธะน, ะ•ั€ะพั…ะธะฝ ะ”ะฐะฝะธะธะป, ะžะฒะณะฐะฝะพะฒะฐ ะ˜ะฝะฝะฐ, ะŸะพะปะบะพะฒะฝะธะบะพะฒ ะั€ั‚ั‘ะผ, ะ›ะฐะทะฐั€ะตะฒ ะ”ะผะธั‚ั€ะธะน +
+ +
+ Supervisor: Bob Santos +
+ +
+ Academic Year 2025-2026 +
+
+
+
+
+ + +
+

Development Journey

+ +
+

Objective

+

Progressively develop a Telegram bot from basic joke delivery to a community-driven platform with AI integration.

+
+ +
+
+
1
+
+ Phase 1: Hardcoded Jokes
+ Initial Telegram bot with static joke list for API testing +
+
+ +
+
2
+
+ Phase 2: AI-Generated Jokes
+ Integration with Yandex AI API for dynamic joke generation +
+
+ +
+
3
+
+ Phase 3: User-Generated Content
+ Database integration with voting and approval system +
+
+
+
+ + +
+

Phase 1: Hardcoded Jokes

+

Initial implementation testing Telegram Bot API with static content.

+ +
+# app.py โ€” Teacher-Only Telegram Joke Bot +from telegram import Update +from telegram.ext import ApplicationBuilder, CommandHandler, ContextTypes +import random + +# ๐Ÿ”‘ REPLACE WITH REAL TOKEN FROM @BotFather +BOT_TOKEN = "7864875699:AAEWf6ff1DYNzPvW6Dbn7D2W5aavg9KPhgY" + +# --- COPY STUDENT JOKES HERE BEFORE CLASS --- +JOKE_LIST = [ + "Why did the robot go to school? To recharge his brain! ๐Ÿ”‹", + "Knock knock!\\nWho's there?\\nBoo!\\nBoo who?\\nDon't cry! ๐Ÿ˜‚", + "Why don't eggs tell jokes? They'd crack each other up! ๐Ÿฅš", + "What do you call a penguin in the desert? Lost! ๐Ÿง", + # Add student jokes here +] + +async def start(update: Update, context: ContextTypes.DEFAULT_TYPE): + await update.message.reply_text("๐Ÿค– Hi! I'm your Joke Bot!\\nType /joke for a funny joke in English! ๐Ÿ˜„") + +async def send_joke(update: Update, context: ContextTypes.DEFAULT_TYPE): + joke = random.choice(JOKE_LIST) + await update.message.reply_text(joke) + +def main(): + print("๐Ÿš€ Starting Joke Bot...") + app = ApplicationBuilder().token(BOT_TOKEN).build() + app.add_handler(CommandHandler("start", start)) + app.add_handler(CommandHandler("joke", send_joke)) + print("โœ… Bot is running! Press Ctrl+C to stop.") + app.run_polling() + +if __name__ == "__main__": + main()
+ +
+

Initial Implementation Features

+
    +
  • Basic Telegram Bot API integration
  • +
  • Static list of pre-approved jokes
  • +
  • /start and /joke command handlers
  • +
  • Random joke selection from hardcoded list
  • +
+
+
+ + +
+

Phase 2: AI-Generated Jokes

+

Integration with Yandex AI API for dynamic content generation.

+ +
+import os +import random +from telegram import Update +from telegram.ext import Application, CommandHandler, MessageHandler, filters +import requests +from dotenv import load_dotenv + +# Load environment variables +load_dotenv() + +YANDEX_API_URL = 'https://llm.api.cloud.yandex.net/foundationModels/v1/completion' +YANDEX_FOLDER_ID = os.getenv('YANDEX_FOLDER_ID') +YANDEX_API_KEY = os.getenv('YANDEX_API_KEY') + +# Store conversation history per user +user_histories = {} + +async def start(update: Update, context): + # Check if Yandex credentials are configured + if not YANDEX_API_KEY or YANDEX_API_KEY == 'your_yandex_api_key_here' or \\ + not YANDEX_FOLDER_ID or YANDEX_FOLDER_ID == 'your_yandex_folder_id_here': + await update.message.reply_text( + "โš ๏ธ Bot not properly configured!\\n\\n" + "Please set up your Yandex Cloud credentials in the .env file:\\n" + "- YANDEX_API_KEY\\n" + "- YANDEX_FOLDER_ID\\n\\n" + "Check the README for setup instructions." + ) + return + + await update.message.reply_text("Hi! I'm a joke bot powered by Yandex AI. Send me any message and I'll respond with a joke! ๐Ÿ˜„") + +async def handle_message(update: Update, context): + """Handle incoming messages and respond using Yandex AI""" + user_id = update.effective_user.id + user_message = update.message.text + + # Initialize user history if not exists + if user_id not in user_histories: + user_histories[user_id] = [ + { + "role": "system", + "text": "You are a funny chatbot that responds with jokes. Keep responses concise and family-friendly." + } + ] + + # Add user message to history + user_histories[user_id].append({ + "role": "user", + "text": user_message + }) + + try: + headers = { + "Authorization": f"Api-Key {YANDEX_API_KEY}", + "Content-Type": "application/json" + } + + data = { + "modelUri": f"gpt://{YANDEX_FOLDER_ID}/yandexgpt-lite", + "completionOptions": { + "stream": False, + "temperature": 0.8, + "maxTokens": 100 + }, + "messages": user_histories[user_id] + } + + response = requests.post(YANDEX_API_URL, headers=headers, json=data, timeout=10) + response.raise_for_status() + + ai_response = response.json()["result"]["alternatives"][0]["message"]["text"] + + # Add AI response to history + user_histories[user_id].append({ + "role": "assistant", + "text": ai_response + }) + + await update.message.reply_text(ai_response) + + except Exception as e: + await update.message.reply_text(f"โŒ Failed to generate response: {str(e)}") + +def main(): + """Start the bot.""" + BOT_TOKEN = os.getenv("BOT_TOKEN", "7864875699:AAEWf6ff1DYNzPvW6Dbn7D2W5aavg9KPhgY") + + app = Application.builder().token(BOT_TOKEN).build() + app.add_handler(CommandHandler("start", start)) + app.add_handler(MessageHandler(filters.TEXT & ~filters.COMMAND, handle_message)) + + print("Bot is running... Press Ctrl+C to stop.") + app.run_polling() + +if __name__ == "__main__": + main()
+
+ + +
+

Phase 3: User-Generated Content

+

Final implementation with database, voting, and approval system.

+ +
+import sqlite3 +import random +from datetime import datetime + +# Calculate average user sentiment for a joke +def get_user_sentiment_for_joke(db, joke_id): + cursor = db.execute(''' + SELECT + CASE + WHEN AVG(CASE WHEN user_sentiment = 'up' THEN 1 + WHEN user_sentiment = 'down' THEN -1 + ELSE 0 END) > 0.1 THEN '๐Ÿ‘ Up' + WHEN AVG(CASE WHEN user_sentiment = 'up' THEN 1 + WHEN user_sentiment = 'down' THEN -1 + ELSE 0 END) < -0.1 THEN '๐Ÿ‘Ž Down' + ELSE '๐Ÿ˜ Neutral' + END as avg_sentiment, + COUNT(*) as total_votes + FROM user_sentiments + WHERE joke_id = ? + ''', (joke_id,)) + + result = cursor.fetchone() + avg_sentiment, total_votes = result if result else ('๐Ÿ˜ Neutral', 0) + return avg_sentiment, total_votes + +# Record user sentiment for a joke +def add_user_sentiment(db, joke_id, user_choice): + try: + db.execute(''' + INSERT INTO user_sentiments (joke_id, user_sentiment) + VALUES (?, ?) + ''', (joke_id, user_choice)) + db.commit() + return True + except Exception as e: + print(f"โŒ Error saving sentiment: {e}") + return False
+ +
+

Final System Features

+
    +
  • SQLite database for joke storage
  • +
  • User-generated content with administrative approval
  • +
  • Community voting system (๐Ÿ‘, ๐Ÿ‘Ž, ๐Ÿ˜)
  • +
  • Sentiment analysis and rating calculation
  • +
  • Command-line interface for joke management
  • +
+
+
+ + +
+

System Demonstration

+ +
+
Final System - Joke Retrieval
+
$ python joke_bot.py
+
+
๐Ÿค– JOKE BOT
+
==============================
+
1. Get random joke
+
2. Add new joke
+
3. Quit
+
+
Your choice: 1
+
+
๐Ÿคฃ Why don't scientists trust atoms?
+
Because they make up everything!
+
+
๐Ÿ‘ค Contributor: ScienceFan42
+
๐Ÿ‘ฅ Community Rating: ๐Ÿ‘ Up (24 votes)
+
+
๐ŸŽฏ Rate this joke: ๐Ÿ‘ (U)p, ๐Ÿ‘Ž (D)own, or (N)eutral?
+
Your choice (u/d/n): u
+
โœ… Your rating (๐Ÿ‘ Up) recorded!
+
+
+ + +
+

Technology Stack

+ +
+
Python 3.9+
+
Telegram Bot API
+
SQLite Database
+
Yandex AI API
+
Command-Line Interface
+
Modular Architecture
+
+ +
+
+
๐Ÿ“ฑ
+
+ Telegram Platform
+ Bot API for user interaction and message handling +
+
+ +
+
๐Ÿค–
+
+ AI Integration
+ Yandex GPT for dynamic content generation during Phase 2 +
+
+ +
+
๐Ÿ—„๏ธ
+
+ Database System
+ SQLite for storing jokes, votes, and user preferences +
+
+
+
+ + +
+

Learning Outcomes

+ +
+
+
๐Ÿ’ป
+
API Integration
+

Telegram Bot API and Yandex AI API implementation

+
+ +
+
๐Ÿ—„๏ธ
+
Database Design
+

SQLite database architecture and management

+
+ +
+
๐Ÿ”„
+
Iterative Development
+

Progressive implementation from basic to complex features

+
+
+ +
+

Development Methodology

+

The project followed an iterative approach: starting with a simple working prototype (hardcoded jokes), adding AI capabilities, and finally implementing a full database system with user-generated content and community features.

+
+
+ + +
+

Future Applications

+ +
+
+
๐Ÿซ
+
Educational Platform
+

Adapt voting system for feedback collection in school communication platforms.

+
+ +
+
๐Ÿ“Š
+
Survey System
+

Repurpose database structure for structured feedback collection.

+
+ +
+
๐Ÿค–
+
Hybrid AI System
+

Combine user-generated content with AI moderation and enhancement.

+
+
+ +
+

Scalable Architecture

+

The modular design allows adaptation for various educational and institutional applications beyond joke sharing.

+
+
+ + +
+

Conclusion

+ +
+

This project demonstrates practical application of Python programming, API integration, and database design through a progressive development approach.

+
+ +
+
+
๐ŸŽฏ
+
Technical Implementation
+

Three-phase development from simple to complex system

+
+ +
+
๐Ÿ“ˆ
+
Iterative Approach
+

Progressive feature addition and system refinement

+
+ +
+
๐Ÿ‘จโ€๐Ÿซ
+
Educational Framework
+

Practical learning in API usage and database management

+
+
+ +
+

Thank You

+

Questions about the Telegram Joke Bot development process?

+
+
+ + + +
+ + + + \ No newline at end of file diff --git a/projects/Speaking Cards - Joke Bot Project.html b/projects/Speaking Cards - Joke Bot Project.html new file mode 100644 index 0000000..9686c25 --- /dev/null +++ b/projects/Speaking Cards - Joke Bot Project.html @@ -0,0 +1,374 @@ + + + + + + Speaking Cards - Joke Bot Project + + + + +
+
+ +
+
1
+
+ Slide 1: Title Slide + "Good morning! We are students from Technolyceum, and today we'll present our Joke Bot Development project." +

+ "I'm [Your Name], and with me are my teammates: [List names]. We chose as a team to do a joke bot. Our supervisor is Bob Santos." +

+ "Our journey took us from hardcoded jokes to a community-driven platform with AI integration." +
+
45 sec
+
+ + +
+
2
+
+ Slide 2: Development Journey + "Our project followed a development with three distinct stages." +

+ "Stage 1 started with hardcoded jokes using Telegram API for testing." +

+ "Stage 2 explored Yandex AI API for dynamic joke generation." +

+ "Stage 3 added database functionality with user-generated content and interactive voting." +
+
50 sec
+
+ + +
+
3
+
+ Slide 3: Phase 1 - Hardcoded Jokes + "Let's look at Phase 1. This was our simplest implementation using the Telegram Bot API." +

+ "We created a basic bot with two commands: /start for greeting users, and /joke to deliver a random joke from a pre-approved list." +

+ "The jokes were hardcoded into the Python script and had limited user interaction." +

+ "This stage helped introduce us to Python coding, basic bot functionality and API integration." +
+
55 sec
+
+ + +
+
4
+
+ Slide 4: Phase 2 - AI Integration + "For Phase 2, we briefly explored Yandex's AI API to generate jokes dynamically." +

+ "Instead of static jokes, the bot used Yandex GPT to create original, context-aware humor." +

+ "However the jokes were not so humorous. But it gave us some exposure to AI API services." +
+
50 sec
+
+ + +
+
5
+
+ Slide 5: Phase 3 - User-Generated Content + "Phase 3 introduced us to databases, user sentiment capture and transformed our project into a community driven platform." +

+ "We added an SQLite database to store jokes, user information, and a feature to allow users to rate jokes." +

+ "Users could now submit their own jokes which required administrative approval before publication." +

+ "We implemented a voting system where users rate jokes with thumbs up, down, or neutral." +

+ "This user sentiment analysis is a feature often used in AI systems." +
+
55 sec
+
+ + +
+
6
+
+ Slide 6: System Demonstration + "Let me demonstrate our final system's functionality." +

+ "The command-line interface allows users to: get random jokes, add new jokes, and quit the program." +

+ "Users can rate jokes immediately after viewing them, which can later be used for user sentiment analysis." +

+ "This demonstrates a system with database, voting, and content management." +
+
60 sec
+
+ + +
+
7
+
+ Slide 7: Technology Stack + "Our project utilized several key technologies." +

+ "Python 3.9+ formed our programming foundation." +

+ "The Telegram Bot API handled all user interactions." +

+ "SQLite managed our database needs for Phase 3." +

+ "Yandex AI API provided AI capabilities in Phase 2." +
+
55 sec
+
+ + +
+
8
+
+ Slide 8: Learning Outcomes + "Through this project, we gained valuable technical skills." +

+ "We learned API integration with both Telegram." +

+ "Database design and management with SQLite." +

+ "We practiced iterative development, starting simple and adding complexity." +

+ "The three-phase approach taught us progressive system enhancement." +
+
45 sec
+
+
+
+ + +
+
+ +
+
9
+
+ Slide 9: Future Applications + "Besides being able to integrate our joke bot with the schools existing Technolyceum_bot, our system's architecture has potential beyond joke sharing." +

+ "It could adapt for capturing feedback from students, parents and school staff and to do sentiment analysis." +

+ "The database structure could be scaled to work with surveys and polling systems." +

+ "The design allows adaptation for various institutional needs." +
+
50 sec
+
+ + +
+
10
+
+ Slide 10: Conclusion + "In conclusion, our Telegram Joke Bot demonstrates practical application of programming concepts." +

+ "We implemented a three-phase development from simple to complex." +

+ "We practiced iterative improvement and feature addition." +

+ "The project provided hands-on learning in API usage and database management." +

+ "Thank you for your attention. We're happy to answer any questions about our development process." +
+
50 sec
+
+ + +
+
๐Ÿค–
+
+ DEMO SCRIPT - Slide 6 + "Now, let me show you our system in action." +

+ "Here's our command-line interface. I'll select option 1 to get a random joke." +

+ [Show joke display] +

+ "You can see the joke, the contributor, and the community rating." +

+ "Now I'll rate this joke with 'u' for thumbs up." +

+ "The system confirms my rating has been recorded in the database." +
+
DEMO
+
+ + +
+
!
+
+ Technical Terms: +

+ โ€ข API = Application Programming Interface +
+ โ€ข SQLite = Lightweight database +
+ โ€ข GPT = Generative Pre-trained Transformer +
+ โ€ข CLI = Command Line Interface +
+
-
+
+ + +
+
Q
+
+ Possible Questions: +

+ โ€ข Why did you choose a joke bot? +
+ โ€ข What was the hardest part? +
+ โ€ข How do you moderate jokes? +
+ โ€ข Can this work with school systems? +
+
-
+
+ + +
+
โฑ๏ธ
+
+ Timing: +

+ โ€ข Total: 8 minutes +
+ โ€ข Demo: 1 minute +
+ โ€ข Q&A: 2 minutes +
+ โ€ข Keep to time! +
+
-
+
+ + +
+
๐ŸŽค
+
+ Presenter Tips: +

+ โ€ข Speak clearly and slowly +
+ โ€ข Look at the audience +
+ โ€ข Point to relevant code/screens +
+ โ€ข Smile and be confident! +
+
-
+
+
+
+ + + \ No newline at end of file