Giter VIP home page Giter VIP logo

nma-bot's Introduction

NMA Discord Bot

Description

The NMA Discord Bot is designed to automate various administrative tasks and interactions within the Neuromatch Academy's Discord Server. Its primary features include server and channel setup, member role assignment, member verification, automated pod handling, and dynamic activity generation and handling.

Getting Started

To use this bot, you need to have Python installed in your system. Python 3.8 or higher is recommended. Please also note that you must have a discord token for your bot to run. Instructions for how to obtain a token as well as how to invite your bot into a test server are available here.

Installation

  1. Clone the repository: git clone https://github.com/NeuromatchAcademy/nma-bot
  2. Navigate to the directory: cd nma-bot
  3. Install the necessary packages: pip install -r requirements.txt

Environmental Variables

This bot uses environmental variables stored in a .env file. You need to create this file and store your bot token as follows:

DISCORD_TOKEN=<Your Bot Token>

Contest Instructions

If you're forking this repository to participate in the NMA bot contest, here's some guidance to help you navigate the code:

How to add a command.

In nma-bot.py, under the on_message function, you can see that we split incoming messages based on spaces and if the first string in the list is '--nma', we assume that what follows is a command. From there, all you have to do is add an elif msg_cmd[1] == 'yourcommand' add add your code underneath. A sample command might thus look like this:

elif msg_cmd[1] == 'samplecommand':
    await message.channel.send(f"Sample command response, {message.author}!")

How to add a button.

In nma-bot.py, under the on_ready function, you can see that we send a message with a special view in the activity-center channel. This view is imported from utils/administrator.py, and if you look at the BUTTON_MAPPING dictionary in that file, you might notice that the dictionary's keys correspond to options in the #activity-center dropdown and the dictionary's values correspond to the buttons and dropdowns the bot loads if the appropriate option is picked in the dropdown. These are defined in utils/buttons.py as such:

class SampleButton(discord.ui.Button):
    def __init__(self, par):
        super().__init__(label='Button Label', style=discord.ButtonStyle.green)

    async def callback(self, interaction: discord.Interaction):
        await interaction.response.send_message(f'Sample button response, {interaction.user}!', ephemeral=True)

From there, you'd add buttons.SampleButton into the appropriate list in the BUTTON_MAPPING dictionary in utils/administrator.py.

Key documentation

Disclaimer

This bot is designed to be used in Neuromatch Academy course servers and expects a certain server structure as a result. If you server is misconfigured, it will not work for you.

Licensing

CC BY 4.0

CC BY 4.0 BSD-3

The contents of this repository are shared under under a Creative Commons Attribution 4.0 International License.

Software elements are additionally licensed under the BSD (3-Clause) License.

Derivative works may use the license that is more appropriate to the relevant context.

nma-bot's People

Contributors

rr-n avatar iamzoltan avatar aslgb avatar

Stargazers

Mauro Risonho de Paula Assumpção avatar  avatar  avatar

Watchers

Byron Galbraith avatar Maximilian Puelma Touzel avatar  avatar  avatar  avatar

Forkers

dhanshreea

nma-bot's Issues

Mentor/discord mechanics

For 2023, let's figure out onboarding of mentors onto discord automatically. Just posting this here so we don't forget

Topic discssusions

Right now the topic discussions function doesnt work. We should look into how to get that going

Portal generated verification id

It would be cool if portal created unique ids that the bot would then use to verify. this might improve our verify robustness

it would definitely change our process, instructions, and code

General Refactor

Right now we have to deploy what we got, since we are close to the deadline, but the code base could use some refactoring/cleanup. Some things that come to ming:

  1. get a config file going for dynamic guilds
  2. get the most recent version of the db dump json in one function that we call

Pods.json not found on boot

we should change the logic to grab the db and write it first

this is the same issue with discord-ids.json. This needs to change too

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.