Skip to content

Developers

Scott edited this page Mar 3, 2019 · 26 revisions

Below is a guide on how to start developing Modix. Depending on the nature of the features you want to add/work on, there's a few different workflows you might want to use, each of which have different requirements.

Prerequisites

To work on Modix, you need a few things:

  • A Discord application set up - go here to create one, add a bot to it, and copy the token from the page. You can then add the bot to your server by going to https://discordapp.com/oauth2/authorize?scope=bot&permissions=0&client_id=[ID HERE], replacing [ID HERE] with the Client ID of your bot (not the token).
  • Under https://discordapp.com/developers/applications/{CLIENT ID HERE}/oauth make sure to add redirect to your domain such as http://localhost:5000/signin-discord and make sure it is appended with /signin-discord
  • The latest .NET Core SDK for your chosen platform (currently 2.1.402)
  • PostgreSQL database server. A docker container also works.
  • Optional: Docker. You do not need Docker if you're just developing locally - it's mostly just to test if your changes are significant enough that they might break CI, or if you prefer to keep your dev environment clean. If you're on Windows, make sure you switch to Linux containers.

The Core Bot

If you're working on a feature that involves Modix's core services, and only needs to work with the Discord bot frontend, then you can do all your development with your C# IDE of choice by opening Modix.sln. First, make sure you have some environment variables set, either through your Project properties -> Debug tab, or however you prefer.

Environment Variables

  • Required

    • DbConnection - this is the connection string to your PostgreSQL instance. When developing locally, it'll probably be easiest to run Postgres in a container, or install it onto your development OS - whatever works. A simple connection string looks like: Server=127.0.0.1;Port=5432;Database=myDataBase;User Id=myUsername;Password=myPassword;
    • DiscordToken - this is the bot token Modix should use to connect to the Discord API. See above.
  • Optional

    • DiscordClientId - also taken from the Discord API page for your bot, this is needed for the web frontend's OAuth stuff to work properly. Can be ignored if you aren't working on/with the web frontend.
    • DiscordClientSecret - same as above.
    • MessageCacheSize - An integer value defining the internal Discord.Net message cache size - used for logging deleted messages. Should be around 10 or more, but you don't need it unless you're testing message deletion.
    • LogWebhookId - The ID of the Discord webhook to log to. Only necessary if you want log messages to appear in a channel on the server.
      • https://discordapp.com/api/webhooks/[this part]/asda2ed2klkm5lkn42n34jk
    • LogWebhookToken - Same as above, but the token of the webhook.
      • https://discordapp.com/api/webhooks/000000000000000000/[this part]
    • SentryToken - The token to a Sentry server, for external logging
    • ReplToken - The token for the REPL service, if you want to use it
    • StackoverflowToken - A token for the StackOverflow API, if you need to use the StackOverflow module

After setting all this up, you can move on to learning about how modix starts!

Clone this wiki locally