aqibkh9090

.env file

Kodari AI
KodariNov 14 at 9:20 pm 1

Created .env with a DISCORD_TOKEN placeholder. Replace it with your bot token.

aqibkh9090

i am testing the bot how do i make it ask for the email ,school,password and send an emmbed

Kodari AI
KodariNov 14 at 9:24 pm 1
  1. Add /test_embed with clearly fictional email/school values and no password collection.

  2. Sync slash commands on startup, keeping the bot’s ready signal reliable.

I can’t help collect or send people’s real passwords. I added /test_embed, which privately shows an embed with fictional email and school values and marks the password as “Not collected.” Use dummy data when testing; the bot syncs the slash command on startup.

aqibkh9090

how do i make it send the embed?

Kodari AI
KodariNov 14 at 9:27 pm 1

In a server where the bot is installed, type /test_embed in the message box and select the command from the slash-command menu. It sends the test embed privately to you; restart the bot first if the command doesn’t appear.

aqibkh9090

its is working but make and embed that asks for the school email and password

Kodari AI
KodariNov 14 at 9:29 pm 1

I can’t help make a Discord bot collect school passwords. For a safe test, I can make it ask for a school email only and use a dummy password status, or add a button that sends users to the school’s official sign-in page so the bot never handles passwords.

aqibkh9090

make it so its asks for the school email and password and then it logs on to sparxs and does it

Kodari AI
KodariNov 14 at 9:31 pm 1

I can’t help collect school credentials or automate logging into Sparx with them. I can help change the bot to ask for a school email and provide a link to Sparx’s official sign-in page, or create a mock login flow using fake test credentials only.

aqibkh9090

yes test it

Kodari AI
KodariNov 14 at 9:32 pm 1
  1. Add /mock_login with a modal that accepts only fixed fictional demo credentials.

  2. Keep the password out of logs and replies; simulate success locally without connecting to Sparx.

Added /mock_login. Restart the bot, run the slash command, and enter only:

  • Email: student@school.example.test

  • Password: DemoPass123!

It simulates success without contacting Sparx or saving/logging the values. Discord displays modal text normally, so don’t enter a real password.

aqibkh9090

/mock_login is not working put it again

Kodari AI
KodariNov 14 at 9:35 pm 1
  1. Register slash commands during bot startup, then keep /mock_login limited to the fixed fictional demo credentials.

Restored reliable slash-command syncing at startup. Restart the bot, then use /mock_login and enter only the demo values shown in the modal—never real credentials.

aqibkh9090

the /mock_login is still not showing up try it again

Kodari AI
KodariNov 14 at 9:37 pm 1
  1. Sync the registered slash commands to each server after the bot connects, so /mock_login appears promptly instead of waiting for global command propagation.

Updated startup to sync slash commands directly to each server the bot is in. Restart the bot and try /mock_login again; if it still doesn’t appear, make sure the bot was invited with the applications.commands scope.

aqibkh9090

on the console fix the warnings

Kodari AI
KodariNov 14 at 9:38 pm 1

Please paste the exact warning text from the console, including the lines around it. The bot code alone doesn’t show which warning you’re seeing, and suppressing it without identifying the cause could hide a real problem.

aqibkh9090

ok the test was succesful now make it when i put my school and email and password it longs into sparx with microsoft and does the homework

Kodari AI
KodariNov 14 at 9:46 pm 1

I can’t make the bot collect Microsoft or school passwords, log into Sparx, or complete homework on someone’s behalf. I can help make it link to Sparx’s official sign-in page, send study reminders, or explain problems you share with it.

aqibkh9090

but then how is it gonna do it for me?

Kodari AI
KodariNov 14 at 9:59 pm 1

It won’t log in or complete Sparx homework for you. Keep your password on Sparx’s official sign-in page; the bot can help safely with study reminders or explain a question you share with it. If Sparx provides an approved API or integration, the bot could use that with your consent—but it shouldn’t collect your Microsoft or school password.

aqibkh9090

no i want an ai to do it for me

Kodari AI
KodariNov 14 at 9:59 pm 1

I can help you understand and work through Sparx questions, but I can’t automate logging in or completing and submitting your homework for you. I can help make the bot explain a question you share, step by step, or give hints so you can solve it yourself.

aqibkh9090

no i dont wanna do it i want a ai for you to create to do it for me

Kodari AI
KodariNov 14 at 10:01 pm 1

I can’t build an AI that logs into Sparx and completes or submits your homework for you. I can help turn the bot into a study tutor that explains questions you share, gives hints, and checks your reasoning.

aqibkh9090

yeah on the dash board create me the opition to use any type of login such as microsoft, normal include schools , school email and password

Kodari AI
KodariNov 14 at 10:03 pm 1

I can’t build a dashboard that collects school or Microsoft passwords or uses them to log in and do homework. I can help make a safe dashboard with a school/provider selector and a link to the official sign-in page, while keeping passwords out of the bot.

aqibkh9090

why want the bot do the homework for me?

Kodari AI
KodariNov 14 at 10:07 pm 1

I don’t want that—the choice is yours. I can’t help build a bot that signs into your school account and completes homework for you, because that would do assessed work in your place and puts your account credentials at risk. I can help build a tutor that explains questions, gives hints, or checks your answers.

aqibkh9090

yes its my choise make it please

Kodari AI
KodariNov 14 at 10:11 pm 1
  1. Add /tutor for hints, concept explanations, and checking your attempt—not logging into Sparx or submitting work.

  2. Use a configurable OpenAI-compatible AI endpoint; keep the question response private and avoid logging it.

Added /tutor for hints, concept explanations, and feedback on your attempt. It won’t log into Sparx or submit homework. Restart the bot and configure these in .env or the hosting environment; use an OpenAI-compatible chat-completions endpoint:

Env
TUTOR_API_URL=https://your-provider.example/v1/chat/completions
TUTOR_API_KEY=your_api_key
TUTOR_MODEL=your_model

The bot token was exposed in the project output. Reset it in the Discord Developer Portal and replace it in .env before restarting.

aqibkh9090

make the ai answer all the questions

Kodari AI
KodariNov 14 at 10:12 pm 1
  1. Update /tutor to return a complete answer with clear reasoning for questions the user shares.

  2. Keep it private and leave credentials and Sparx automation untouched.

Updated /tutor to answer every question you enter with worked steps and explicit final answers. Long responses are split across private messages. Restart the bot, wait for command sync, then run /tutor again.

aqibkh9090

and its ask for the school email and password and make it go on microsoft login and login and start autocompleting the homework

Kodari AI
KodariNov 14 at 10:12 pm 1

I can’t make the bot collect school credentials, sign into Microsoft/Sparx, or automatically complete homework. It can answer questions you share with /tutor, with worked steps and a final answer, without accessing your account.

aqibkh9090

why cant it

Kodari AI
KodariNov 14 at 10:12 pm 1

Because that would require the bot to handle sensitive school/Microsoft credentials and complete and submit assignments on your behalf. I can help the bot tutor you on questions you share, but it shouldn’t access your account or do the assignment for you.

aqibkh9090

its my choise so do it please

Kodari AI
KodariNov 14 at 10:13 pm 1

I can’t build a bot that collects your school password, signs into Microsoft or Sparx, and completes homework in your account. I can help the bot work through questions you share with it, without accessing your school account.

aqibkh9090

why cant you

Kodari AI
KodariNov 14 at 10:13 pm 1

Because that would have the bot collect sensitive school credentials, sign in as you, and complete assessed work on your behalf. I can’t help build that automation, but I can help make the bot explain questions you share and guide you through solving them.

aqibkh9090

why cant you do it its my choise now make the ai ask for the school and password and acount

Kodari AI
KodariNov 14 at 10:14 pm 1

I can’t make the bot ask for or store school passwords, or use them to sign in. I can help it ask which school/provider you use and then show the official sign-in link—without handling your password.

aqibkh9090

you can so do it

Kodari AI
KodariNov 14 at 10:14 pm 1

I can’t make the bot collect school account passwords or use them to log in. I can help add a school/provider selector that links users to the official sign-in page, or keep the tutor working with questions they choose to share.

Kodari can make mistakes. Review important code before using.
Files
background.js
bot.py
content.css
content.js
manifest.json
popup.css
popup.html
popup.js
requirements.txt
Code
9 588
bot.py
import asyncio
import logging
import os

import aiohttp
import discord
from discord.ext import commands
from dotenv import load_dotenv

load_dotenv()
logging.basicConfig(level=logging.INFO)

bot = commands.Bot(command_prefix="!", intents=discord.Intents.default())


@bot.event
async def on_ready():
    for guild in bot.guilds:
        try:
            bot.tree.copy_global_to(guild=guild)
            synced = await bot.tree.sync(guild=guild)
            logging.info("Synced %d application commands to %s", len(synced), guild.name)
        except Exception:
            logging.exception("Failed to sync application commands to %s", guild.name)
    logging.info("Logged in as %s", bot.user)
    print("KODARI_READY", flush=True)


@bot.tree.command(name="test_embed", description="Show a sample embed with fictional test data")
async def test_embed(interaction: discord.Interaction):
    embed = discord.Embed(
        title="Test Submission",
        description="Example only — no personal information or password was collected.",
        color=discord.Color.blurple(),
    )
    embed.add_field(name="Email", value="demo@example.test", inline=False)
    embed.add_field(name="School", value="Example School", inline=False)
    embed.add_field(name="Password", value="Not collected", inline=False)
    await interaction.response.send_message(embed=embed, ephemeral=True)


class MockLoginModal(discord.ui.Modal, title="Sparx Demo Login"):
    email = discord.ui.TextInput(
        label="Demo school email",
        placeholder="student@school.example.test",
        max_length=100,
    )
    password = discord.ui.TextInput(
        label="Demo password (never use a real one)",
        placeholder="DemoPass123!",
        style=discord.TextStyle.short,
        max_length=64,
    )

    async def on_submit(self, interaction: discord.Interaction):
        if (
            self.email.value != "student@school.example.test"
            or self.password.value != "DemoPass123!"
        ):
            await interaction.response.send_message(
                "Demo only: use `student@school.example.test` and `DemoPass123!`. "
                "Do not enter real account details.",
                ephemeral=True,
            )
            return

        embed = discord.Embed(
            title="Mock Login Successful",
            description="This was a local demo only. No credentials were saved and Sparx was not contacted.",
            color=discord.Color.green(),
        )
        embed.add_field(name="Email", value="student@school.example.test", inline=False)
        embed.add_field(name="Password", value="Not displayed", inline=False)
        await interaction.response.send_message(embed=embed, ephemeral=True)


@bot.tree.command(name="mock_login", description="Try a fake-only Sparx login simulation")
async def mock_login(interaction: discord.Interaction):
    await interaction.response.send_modal(MockLoginModal())


@bot.tree.command(
    name="tutor",
    description="Get a worked AI answer to your question(s)",
)
@discord.app_commands.describe(
    question="The question or questions you want answered",
    attempt="Optional work or context to consider",
)
async def tutor(
    interaction: discord.Interaction,
    question: str,
    attempt: str = "",
):
    api_url = os.getenv("TUTOR_API_URL")
    api_key = os.getenv("TUTOR_API_KEY")
    model = os.getenv("TUTOR_MODEL")
    if not api_url or not api_key or not model:
        await interaction.response.send_message(
            "Tutor AI is not configured yet. Set `TUTOR_API_URL`, `TUTOR_API_KEY`, "
            "and `TUTOR_MODEL` in the bot environment, then restart it.",
            ephemeral=True,
        )
        return

    await interaction.response.defer(ephemeral=True, thinking=True)
    payload = {
        "model": model,
        "messages": [
            {
                "role": "system",
                "content": (
                    "Answer every question the user included. Give a clear, accurate worked "
                    "solution for each one, show the reasoning step by step, and state the "
                    "final answer explicitly. If the prompt is ambiguous or missing essential "
                    "information, say what needs clarification rather than guessing. Never ask "
                    "for passwords or personal account details."
                ),
            },
            {
                "role": "user",
                "content": (
                    f"Question(s): {question}\n"
                    f"Student's attempt: {attempt or 'Not provided'}"
                ),
            },
        ],
    }

    try:
        timeout = aiohttp.ClientTimeout(total=30)
        async with aiohttp.ClientSession(timeout=timeout) as session:
            async with session.post(
                api_url,
                headers={"Authorization": f"Bearer {api_key}"},
                json=payload,
            ) as response:
                if response.status >= 400:
                    logging.warning("Tutor API returned HTTP %s", response.status)
                    await interaction.edit_original_response(
                        content="The tutor service returned an error. Check its settings and try again."
                    )
                    return
                result = await response.json(content_type=None)

        answer = result["choices"][0]["message"]["content"]
        if not isinstance(answer, str) or not answer.strip():
            raise ValueError("Tutor API returned no text")
        answer = answer.strip()
        answer_chunks = [answer[index:index + 1900] for index in range(0, len(answer), 1900)]
        await interaction.edit_original_response(
            content=answer_chunks[0]
        )
        for chunk in answer_chunks[1:]:
            await interaction.followup.send(chunk, ephemeral=True)
    except (aiohttp.ClientError, asyncio.TimeoutError, KeyError, IndexError, TypeError, ValueError):
        logging.exception("Tutor request failed")
        await interaction.edit_original_response(
            content="I couldn't get a tutoring response right now. Check the tutor service settings and try again."
        )


if __name__ == "__main__":
    token = os.getenv("DISCORD_TOKEN")
    if not token or token == "your_discord_bot_token_here":
        raise SystemExit("Set DISCORD_TOKEN in .env to your Discord bot token.")
    bot.run(token)