Jump to content

CodeFling Creator Bot 1.0.1

$14.99
   (0 reviews)

9 Screenshots

  • 190
  • 4
  • 25.53 kB

Self Hosted

This is a self-hosted Discord bot which will require a hosting environment. Host for free on your own or find a reliable host!

Get Hosting

About CodeFling Creator Bot

CodeFling Creator Bot is a Discord bot, written in Python using Discord.py.

The bot monitors users specified in the config and using the CodeFling API, sends notifications to Discord for various actions:

- New Releases (Plugins, Maps, Tools etc)

- Plugin/Release Updates

- New Comments/Discussion Posts

- New Reviews

- New Private Messages

The bot is lightweight and written with efficiency and reliability in mind. It makes only the API calls it needs and stores data in an SQLite database for use later. When guild members use the bot commands, the data is pulled from the local database and doesn’t make extra calls to the API, which means you don’t need to worry about rate limiting or getting banned by the API.

The bot polls the API looking for new content at set periods as set in the config, notifying about new content and then updating the database with new data.

PLEASE NOTE: Requires Python 3.6 or higher.

 

README:

CodeFling Creator Bot 1.0.1

Discord Bot by ZEODE

==========================================

Minimum requirements:

Python 3.6 or higher

Dependacies:

Discord.py
aiohttp

Using pip:

pip install -U discord.py
pip install -U aiohttp

The -U flag just means “upgrade to the latest version if already installed.”

Using apt:

apt install python3-discord
apt install python3-aiohttp

This file explains each configuration option in config.json

*************** DEFAULT CONFIG FILE IS CREATED ON FIRST RUN ***************

DISCORD SETTINGS
----------------

Make sure your Discord bot has at least "Send Messages", "Read Message History" and "Embed Links" permissions.

bot_token:
  Your Discord bot token from the Discord Developer Portal.
  Get it from: https://discord.com/developers/applications
  
release_channel_id:
  Discord channel ID where file release/update notifications will be posted.
  To get channel ID: Enable Developer Mode in Discord settings, right-click channel, "Copy ID"
  
purchase_channel_id:
  Discord channel ID for purchase notifications (recommend private channel).
  Shows when someone buys one of your paid plugins.
  
support_channel_id:
  Discord channel ID for support request notifications.
  HOPEFULLY COMING SOON - Currently the API endpoints do not provide the necessary information 
                          to provide this (I have asked for it, so watch this space).

comments_channel_id:
  Discord channel ID for comment/discussion notifications.
  Shows when users comment on your files (excludes file author replies).

downloads_channel_id:
  Discord channel ID for file downloads notifications (recommend private channel).
  Shows when users download your files.

reviews_channel_id:
  Discord channel ID for file review notifications.
  Shows when users review a monitored file.

messages_channel_id:
  Discord channel ID for user message notifications (recommend private channel).
  Notifys when a monitored user receives a message on CodeFling.

commands_channel_id:
  Discord channel ID for people to use bot commands.
  People can use bot ! commands here, all user messages can be cleaned automatically, see below.

admin_commands_channel_id:
  Channel for users with the bot admin role to use admin commands away from public channels
  All normal commands also work here for bot admin role users to use here too

clean_commands_channel:
  If true, users messages are automatically deleted shortly after they are sent to the channel.

max_number_files_to_list:
  Number of files to return when users use the "!list plugins" command

bot_admin_role_id:
  Users need this role to use the admin only commands

ping_release_channel:
  If this is true, new releases or updates to files will be notified with the @everyone tag

NOTE:
 - Leaving any of the channel IDs blank will disable notifications for those actions
 - Although there are separate channels for each type in the config, this is just for anyone
   wanting this, if you want you can put the same channel ID in more than one channel config


CODEFLING SETTINGS
------------------

monitored_users:
  Dictionary of Codefling user IDs and their API tokens.
  Format: "user_id": "api_token"
  
  How to get your User ID:
    - Visit your Codefling profile
    - Hover over or click on "See my activity"
    - Your user ID is in the URL: https://codefling.com/profile/USER_ID-username/content/
    - Copy just the numbers, without the "-username" part
  
  How to get API Token:
    - Visit: https://codefling.com/settings/apps/
    - Click "Add App" > "Creator API"
    - Select "All" under scopes
    - Copy the access token to paste in your config
  
  Example:
    "monitored_users": {
        "user_id_1": "your_api_token_here",
        "user_id_2": "another_api_token"
    }
  
  Note: Each user needs to use their own API token.

poll_interval_seconds:
  How often (in seconds) the bot checks Codefling for new content.
  Default: 120 (2 minutes)
  
  Suggested values:
  
 | Type                    | Safe poll interval | Notes                               |
 | ----------------------- | ------------------ | ----------------------------------- |
 | Light use (1–2 authors) | 60 s               | Feels instant, safe if few requests |
 | Medium (3–5 authors)    | 120 s              | Recommended default                 |
 | Heavy use (5+ authors)  | 300 s              | Low strain, good scaling            |
 | Massive / strict API    | 600–900 s          | Extremely safe                      |

 Note: Too frequent polling may hit API rate limits.

retention_days:
  How many days of historical data to track and store.
  Default: 7 days
  
  The bot will:
    - Only notify about content within this time window
    - Automatically clean up older data daily
    - On first run, load existing content from this period
  
  Recommended values:
    - 7 days (minimal storage)
    - 30 days (balanced)
    - 90 days (extended history)


LOGGING SETTINGS
----------------

timestamp_date_format:
  The format for timestamps in the console/log output.
  Availble:
    - %d
    - %m
    - %y

  e.g: %d-%m-%y would make something like 30-10-25

timestamp_time_format:
  Specify the format for the timestamp.
    - 12h
    - 24h

log_file_path:
  Set the path to the OPTIONAL log file. If left blank, no log file will be used.


API OPTIONS
-----------

Note: You can usually leave this as is and it will work absolutely fine.

max_attempts:
  How many times to try an API request if it fails before giving up on that attempt
  Useful for occasional CloudFare errors/timeouts

timeout_seconds:
  How long to wait before retrying a API request due to timeout


config_version:
  DO NOT EDIT THIS


COMMANDS
------------------

NOTE: Commands by users do not query the CodeFling API every time. They only retreive data from
the SQLite database, so you don't have to worry about rate limiting or banning from users abusing
the commands on Discord. This also means it is much quicker with results. The database is updated
with all the info every time the API is queried as per the poll rate in the config only.

Non-Admin Commands:

!help
  Lists all available commands

!stats [username]
  Get own stats without parameter if you are monitored by the bot or get stats for the user specified

!list files
  List all files monitored by the plugin (config option to limit results)

!list authors
  List all file authors/devs monitored by the bot

!file <FileName> / !file <file_id>
  Give information about that file

Admin Commands:

!user add <user_id> <api_token>
  Add the specified user ID and API token to the bot, save in the config and begin monitoring

!user remove <user_id> 
  Stops monitoring and removes the specified user ID from the bot and config

!rotate
  Immediately rotate the log file and begin a new blank log file (rotated files saved in logs/)

!cleardb
  Immediately clear the SQLite database and re-seed a new database (ALL DATA WILL BE CLEARED)

!test <review|download|purchase|comment|message>
  Send a test notification to Discord for the most recent entry of the given type

!test <file> [new|updated]
  Send a test notification to Discord for the most recent entry for files/releases,
  using the new or updated parameter accordingly/

FIRST RUN BEHAVIOR
------------------

On first run, the bot will:
  1. Create a SQLite database (codefling_bot.db)
  2. Load/Cache all users existing files.
  3. Load/Cache all existing content from the last N days (retention_days)
  4. DOES NOT send any notifications for existing content
  5. Only notify about NEW content after initialization

On subsequent runs:
  1. Check for content created while bot was offline
  2. Send notifications for missed content
  3. Continue normal monitoring


TROUBLESHOOTING
---------------

No notifications appearing:
  - Verify channel IDs are correct
  - Check bot has "Send Messages", "Read Message History" and "Embed Links" permissions
  - Confirm API tokens are valid and have correct scopes

Getting rate limited:
  - Increase poll_interval_seconds value
  - Default 300 seconds (5 minutes) should be safe

Bot sends old notifications on startup:
  - This is normal if content was created while bot was offline
  - Bot catches up on missed content within retention period
  - On first run, no old notifications should appear


SUPPORT
-------

For issues with the bot, check console output for error messages.
Get more support in my Discord: https://discord.gg/jnyg3FvDnc

For Codefling API issues, see: https://codefling.com/developers

 

logo2.png

discord.png


User Feedback

2m

Downloads

Total number of downloads.

9.5k

Customers

Total customers served.

137.9k

Files Sold

Total number of files sold.

2.9m

Payments Processed

Total payments processed.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.