- Python 3.10+
- A Discord Bot Token (from Discord Developer Portal)
git clone https://github.com/developer51709/Niko.git
cd Nikopip install -r requirements.txtCreate a .env file or set the following environment variables:
DISCORD_BOT_TOKEN: Your bot's secret token.DISCORD_PUBLIC_KEY(optional): Your application's Public Key from the Developer Portal. Required by the Interactions Endpoint URL (see below); the bot also reads it from the application object when it is unset, and caches what it read.DISCORD_INTERACTION_BUDGET_SECONDS(optional): How long the interactions endpoint waits for a handler before answering Discord with202(default2.0, maximum3.0).FAL_KEY(optional, required for premium image moderation): API key from fal.ai. The NSFW image filter callsfal-ai/imageutils/nsfwand is a premium perk, so a guild only runs it while its subscription is active.FAL_NSFW_URL/NSFW_THRESHOLD(optional): Override the model endpoint and the confidence threshold (0.85by default) for the image filter.OXAPAY_API_KEY(optional, required for payments): OxaPay Merchant API key from Dashboard → Merchant → API Key. It powers the white-label crypto checkout used by both premium subscriptions and/donate, and signs the payment webhooks.PROXY_WORKER_TOKEN(optional): Shared secret for the optional Discord API proxy workers. Set the same value as each worker'sAUTH_TOKENsecret. Proxy worker registration and routing require the shared MongoDB database (MONGODB_URL); without MongoDB they stay unavailable and the bot keeps its normal egress.TOPGG_WEBHOOK_TOKEN(optional): The webhook authorization token from your top.gg listing. Required to credit vote rewards (coins, streaks and voting badges) and send the thank-you DM. Leave it unset to disable the vote webhook.TWITCH_CLIENT_ID/TWITCH_CLIENT_SECRET(optional): Application credentials from a Twitch developer app. Used for the notifier's Twitch tracking and for Twitch profile cards on the team page. Leave them unset to disable Twitch support; every other notifier platform still works without credentials.
python src/bot.pyDiscord can POST every slash command, button, select and modal to this bot instead of handing them over the gateway, and then expects the answer in that same response. Nothing has to leave the process to reply, which keeps commands and menus working when the host cannot reach Discord's API.
- Make sure this deployment is reachable from the internet on a stable HTTPS URL — the same origin the dashboard is served from.
- In the Developer Portal, open General Information and copy the
Public Key into
DISCORD_PUBLIC_KEY. - In the same page, set Interactions Endpoint URL to
https://<your public host>/api/discord/interactions. Discord sends a PING to check it and keeps the URL only if the endpoint answers it.
Delivery is either the gateway or the endpoint, never both, so the endpoint then
answers every interaction. Followups, edits and deletes still go out to Discord
over REST. Clear the URL in the portal to return to gateway delivery.
docs/maintenance.md covers the response budget and the 202 fallback.
Note:
the bot will automatically handle the ai model installation on the first run and uses a lightweight model that uses less than 1GB of storage and should not require advanced hardware to run.
If you are using Replit, simply:
- Import the repository.
- Add your
DISCORD_BOT_TOKENto the Secrets tool. - Click the "Run" button.
- The Agent will handle the environment setup.