Code Monkey home page Code Monkey logo

blockbot's Introduction

Blockbot

This Discord bot uses the interactions.py module to interface with the Discord API.

For help with using the module, check out the documentation.

Overview

main.py:

  • A custom, dynamic extension (command) loader. Write an extension in the extensions/ directory, and it will automatically be loaded when the bot boots.

extensions/:

  • This directory is home to the custom extensions (known as cogs in discord.py, or command groups) that are loaded when the bot is started. Extensions are classes that encapsulate command logic and can be dynamically loaded/unloaded.

config.py:

  • This module houses the bot configuration. The values are loaded from environment variables, so you can set them in your shell or in a .env file.

Installation

  1. Clone this repository. To switch to a different version, cd into this cloned repository and run git checkout [branch name/version here]
  2. It's generally advised to work in a Python virtual environment. Here are steps to create one (the discord-py-interactions library requires Python 3.10.0 or later):
  • $ python3 -m venv env
  • $ source env/bin/activate
  1. Create a Discord bot token from here
    Register it for slash commands:
  • Under OAuth2 > General, set the Authorization Method to "In-app Authorization"
  • Tick bot and applications.commands
  • Go to OAuth2 > URL Generator, tick bot and applications.commands
  • Copy the generated URL at the bottom of the page to invite it to desired servers
  1. Make a new file called .env inside the repo folder and paste the below code block in the file
TOKEN=<paste Discord bot token here>
  1. Run pip install -r requirements.txt to install packages. You'll need Python 3.10 or later
  2. Once that's done, run the bot by executing python3 main.py in the terminal

If you aren't sure how to obtain your server ID, check out this article

If you get errors related to missing token environment variables, run source .env

blockbot's People

Contributors

jedhazaymeh avatar

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.