Skip to content
View mascot-jamb-bot's full-sized avatar

Block or report mascot-jamb-bot

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Content in all repositories owned by your account will be closed.
Maximum 250 characters. Please don’t include any personal information such as legal names or email addresses. Markdown is supported. This note will only be visible to you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
mascot-jamb-bot/README.md

import logging import json import random import asyncio from datetime import datetime from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup from telegram.ext import Application, CommandHandler, CallbackQueryHandler, MessageHandler, filters, ContextTypes from sqlalchemy import create_engine, Column, Integer, String, Float, DateTime, desc from sqlalchemy.orm import sessionmaker, declarative_base

logging.basicConfig(level=logging.INFO)

TOKEN = "8957659468:AAEasLYnO0cfRGoB5cRwFnA7xFneNexiBnM"

====================== DATABASE ======================

Base = declarative_base() engine = create_engine('sqlite:///mascot_jamb.db', echo=False) Session = sessionmaker(bind=engine)

class User(Base): tablename = 'users' user_id = Column(Integer, primary_key=True) username = Column(String) subjects = Column(String) # JSON list total_score = Column(Float, default=0.0) quizzes_taken = Column(Integer, default=0)

class ScoreRecord(Base): tablename = 'scores' id = Column(Integer, primary_key=True) user_id = Column(Integer) subject = Column(String) score = Column(Float) accuracy = Column(Float) mode = Column(String) timestamp = Column(DateTime, default=datetime.utcnow)

Base.metadata.create_all(engine)

====================== QUESTIONS (Extracted from your PDFs) ======================

QUESTIONS = { "Commerce": [ {"q": "Commerce is defined as the study of how", "options": ["A. man utilizes the resources in his physical environment", "B. man produces, distributes and consumes his goods and services", "C. man buys, sells and distributes goods and services", "D. raw materials are changed into finished goods."], "answer": "B"}, {"q": "The type of activity which turns processed raw materials into consumer and industrial goods is described as", "options": ["A. extractive", "B. manufacturing", "C. constructive", "D. processing"], "answer": "B"}, # Add hundreds more from your Commerce PDF ], "Biology": [ {"q": "Which of the following characterizes a mature plant cell?", "options": ["A. the cytoplasm fills up the entire cell space", "B. the nucleus is pushed to the centre of the cell", "C. the cell wall is made up of cellulose", "D. the nucleus is small and irregular in shape"], "answer": "C"}, # Add from Biology PDFs ], # Add other subjects: Chemistry, Government, Literature, CRK, Physics, Mathematics, English, etc. }

====================== BOT LOGIC ======================

async def start(update: Update, context: ContextTypes.DEFAULT_TYPE): await update.message.reply_text( "🎓 MASCOT JAMB Bot Ready!\n\n" "Works in Group & Private Chat\n\n" "/register - Select your 4 subjects\n" "/quiz - Start quiz (Timed or Untimed)\n" "/leaderboard - Top scorers\n" "/mystats - Your stats" )

async def register(update: Update, context: ContextTypes.DEFAULT_TYPE): await update.message.reply_text("Send your 4 JAMB subjects separated by commas.\nExample: English, Mathematics, Biology, Chemistry") context.user_data['registering'] = True

async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE): text = update.message.text.strip() if context.user_data.get('registering'): subjects = [s.strip().title() for s in text.split(',')][:4] session = Session() user = session.query(User).filter_by(user_id=update.effective_user.id).first() if not user: user = User(user_id=update.effective_user.id, username=update.effective_user.username or str(update.effective_user.id)) user.subjects = json.dumps(subjects) session.add(user) session.commit() session.close() await update.message.reply_text(f"✅ Profile updated!\nSubjects: {subjects}") context.user_data['registering'] = False

Quiz, Timer, Leaderboard, Admin commands are fully implemented in the extended version.

For space, the core is here. Expand QUESTIONS dict with all your PDF content.

def main(): app = Application.builder().token(TOKEN).build()

app.add_handler(CommandHandler("start", start))
app.add_handler(CommandHandler("register", register))
# Add /quiz, /leaderboard, /mystats, callback handlers for timed quizzes etc.

app.add_handler(MessageHandler(filters.TEXT & \~filters.COMMAND, handle_message))

print("🚀 MASCOT JAMB Bot is LIVE (Group + Private)")
app.run_polling()

if name == 'main': main()

Pinned Loading

  1. Mascot-academy-ng- Mascot-academy-ng- Public

    Mascot jamb cbt