Skip to content

DenizenScript/DenizenMetaBot

Repository files navigation

DenizenMetaBot

A Discord bot for Denizen 1.x (Bukkit) meta documentation.

This is a C#/.NETCore based Discord bot.

Created by mcmonkey and the DenizenScript team.

Setup

Gathering the files note:

  • In addition to a git clone of this repository, you need to clone the sub-repository, using a command like git submodule update --init --recursive.

You need screen and dotnet-6-sdk installed.

The start.sh file is used by the restart command and should be maintained as correct to the environment to launch a new bot program instance... points of note:

  • It starts with a git pull command to self-update. If this is not wanted, remove it. Be careful what repository this will pull from (a fork you own vs. the original repository vs. some other one...)
  • It uses a screen command to launch the bot quietly into a background screen. The screen program must be installed for that to work. Alternately, replace it with some other equivalent background terminal program.
  • The restart command will run this script equivalently to the following terminal command: bash ./start.sh 12345 where 12345 is the ID number for the channel that issued a restart command.

To configure the bot:

  • Create directory config within this bot's directory.
  • Within the config directory, create file token.txt containing only the Discord bot token without newlines or anything else.
    • To create a bot token, refer to official Discord documentation. Alternately, you can follow the bot-user-creation parts of https://discordpy.readthedocs.io/en/stable/discord.html (ignore the coding parts, just follow the first bits about creating a bot user on the Discord application system, and getting the token).
  • Optionally, within the config directory, create file quotes.txt, with a list of quotes for !quote, separated by double-newlines (ie, one complete blank line between each distinct quote).
  • Within the config directory, create file config.fds (a FreneticDataSyntax file) with the following options (See also the full file text sample below) (most lines are optional):
    • valid_channels set to a whitelist of channels the bot responds in (left out = responds anywhere).
    • info_replies set to a submapping of info commands and their replies, which allows comma-separated list keys. The first listed name on each line is the primary name. Type \n to add a line break.
    • project_details set to a submapping of project names to project details map, as follows:
      • update set to an update message for the project.
      • github set to a GitHub repo URL (if applicable)
      • icon set to a .png icon image URL.
    • channel_details set to a submapping of channels to details specific to the channel. Within each channel ID key is a submapping of the details, as follows:
      • updates set to what projects they correspond to (for the update command).
      • docs set to whether meta docs are allowed in this channel.
    • url_base set to the base URL of the meta website.
    • rules set to a submapping of rule IDs to their text.
    • command_prefix set to the command prefix (for non-ping-based usages of the bot).
    • build_numbers set to a submapping of project names to build number tracker details.
      • name set to the name that appears in the plugin.yml.
      • jenkins_job set to the Jenkins job name.
      • regex set to a RegEx matcher, with one capturing group to capture the build number from a larger version string.
      • max_behind set to an integer, representing how many builds behind one can safely be before a warning symbol should be displayed.
    • acceptable_server_versions set to a list of server MC versions (just the main version without sub-version, like "1.15", not "1.15.1") that are acceptable + tracked (older = outdated, newer = unknown).
    • additional_meta_sources set to a list of additional meta source URLs (should be direct zip links, like https://github.com/DenizenScript/Denizen/archive/dev.zip).
    • reload_webhooks set to an optional list of URLs to set a POST request to when reloads are triggered.
    • rss_feeds set to an optional submap of RSS feeds, with keys url (direct rss.xml link), channels (list of channel ids), and check_rate (in minutes, decimals allowed)
    • slash_cmd_version can be incremented to force a slash command re-registration at next startup

config.fds sample text content (the channel IDs are the actual ones on the Denizen Discord group):

valid_channels:
# denizen-lobby
- 315163488085475337
# bot-spam
- 315616018846318593
info_replies:
    new,newb,noob,newbie: Welcome new user! Please read the rules at the bottom of the #info channel, and feel free after that to ask for help in the most relevant channel!
url_base: https://meta.denizenscript.com/Docs/
command_prefix: !
project_details:
    Denizen:
        update: Latest **Denizen** dev builds are at <https://ci.citizensnpcs.co/job/Denizen_Developmental/>.\nLatest Denizen stable release builds are at <https://ci.citizensnpcs.co/job/Denizen/>.\nSpigot release of Denizen are at <https://www.spigotmc.org/resources/denizen.21039/>.
        github: https://github.com/DenizenScript/Denizen
        icon: https://i.alexgoodwin.media/i/for_real_usage/ec5694.png
channel_details:
    315163488085475337:
        updates: denizen spigot
        docs: true
rules:
    all: Here's all the rules though!
    1: This is an important rule!
build_numbers:
    denizen_release:
        name: Denizen
        jenkins_job: Denizen
        regex: [\d.]+(?:-SNAPSHOT)? \(build (\d+)-REL\)
        max_behind: 2
acceptable_server_versions:
    - 1.15
reload_webhooks:
- https://example.com
rss_feeds:
    f1:
        url: https://example.com/rss.xml
        channels:
        - 123456
        check_rate: 5
slash_cmd_version: 0

To start the bot up:

  • Run ./start.sh while in the bot's directory.

To view the bot's terminal:

  • Connect to the screen - with an unaltered start.sh file, the way to connect to that is by running screen -r DenizenMetaBot.

Copyright/Legal Info

The MIT License (MIT)

Copyright (c) 2019-2024 The DenizenScript Team

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

The Meta bot on the Denizen Discord

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published