Discord Bot for SurPath Hub's server

Overview

Dayong

Dayong is dedicated to helping Discord servers build and manage their communities.

  • Multipurpose —lots of features, lots of automation.
  • Self-hosted and easy to deploy —just a few more steps to take.
  • Free and open-source —tinker with it, and feel free to contribute to its improvement!
  • Modular —easily add extensions and features.
  • Written in Python —beautiful syntax and supports rapid development.

Installation

Download the source code:

git clone https://github.com/SurPathHub/Dayong.git

Bot Account Setup

Follow the instructions here: https://discordpy.readthedocs.io/en/stable/discord.html

Project Setup

  1. Go to the project root directory.

    cd Dayong
    
  2. Create a copy of .env.example. Don't forget to omit the .example at the end.

    On Linux and Unix

    cp .env.example .env
    

    On Windows

    copy .env.example .env
    
  3. Edit the .env file and add your credentials to the corresponding variables.

  4. Install poetry. Check if poetry is installed by running poetry --version.

  5. Run poetry shell. This will create or start the virtual environment.

  6. Run poetry install. This will install the project and its dependencies.

Usage

  1. From the project root directory, run:

    python dayong
    
  2. Open your Discord application. Go to the server where you invited the bot and run [your command prefix]help. For instance: .help or !help. The dot prefix is the default.

Welcome Message for New Member

  1. Modify the welcome message by changing the value(s) of the following in Dayong\dayong\embeddings.json.
    "greetings_channel":"<channel name where the greetings will be prompted>",
    "readme_channel_id": <id of the channel you want to tag>,
    "description": "<your greetings>",
    "color": <integer value of the color you want to use>
    
    "greetings_field": {
        "<n>": {
            "name": "field's name"
            "value": "field's value"
        }
        , ...
    }
    

You can have as many as greetings_fields you want. However, make sure that its inner key(s) is an integer (starting with 0) since it will be used inside a for loop.

Comments
  • Implement configuration checking

    Implement configuration checking

    To some degree, Dayong allows high-level customization through the config.json file. Although we only use it now to change how we experience commands and interactions, it's likely to cause erroneous behaviors, especially as the config file becomes larger as we add more features that rely on it.

    Configuration checking helps us avoid any problems that may arise from using the config.json file by first verifying that software requirements are met. It's basically just a process that tells us whether a configuration is good or bad. Dayong does not have that kind of functionality yet.

    enhancement help wanted hacktoberfest 
    opened by huenique 6
  • Addition of end command and greetings.py

    Addition of end command and greetings.py

    End Command in utils.py

    • Allows the termination of the bot in a shorter time. This will help developers that run their programs without IDE.

    Test.py

    • This is a test file.
    • Provides a basic how-to of text embeddings and mentioning a user (currently the author of the message).
    enhancement 
    opened by chraem 6
  • Commands/features missing from documentation

    Commands/features missing from documentation

    The whois command is missing from the commands documentation.

    https://github.com/SurPathHub/Dayong/blob/3abcf95101f61c2ce7a819bd26024729ed17e5ad/dayong/components/privilege_component.py#L45


    Also, please document event listeners/handlers. They should be in a table, in a separate file called events.md, inside the docs directory. The table should have a name and a description column. In the name column is the event listener's function name, and in the description column, the first paragraph of the function docstring.

    An event listener has this decorator: https://github.com/SurPathHub/Dayong/blob/3abcf95101f61c2ce7a819bd26024729ed17e5ad/dayong/components/event_component.py#L17

    documentation good first issue help wanted hacktoberfest 
    opened by huenique 4
  • Replace d.py with hikari and hikari-tanjun

    Replace d.py with hikari and hikari-tanjun

    Resolves #4

    After much deliberation, I've decided to rebuild Dayong with a different library, hikari.

    Extending discord.py was initially our first choice. Developing, testing, and implementing the extension would take months, so that was out. The obvious, best step was to use already existing libraries for that purpose. The best option was discord-interactions out there, which seemed like the answer at first, but after taking a peek at the source code of the current stable build, I determined it wasn’t. I’d rather not deal with endless lines of inefficient spaghetti code. The unstable build is a lot better, but who knows when that'll be ready.

    Active forks of d.py do exist, but they were still in the process of monkey-patching, and devs were still developing and testing the interactions module. Moreover, none of them seem to be fully supportive of type hints from python 3.9 and above.

    There are a few minor issues regarding the usage of hikari. It particularly involves newbie python developers or maybe beginner programmers in general. I’m mainly concerned with its documentation. It’s not very newbie-friendly, as compared to discord.py's documentation. New contributors will definitely have a hard time implementing features and fixing bugs because they’ll be having a hard time finding the methods and classes they need, but only until they get used to it.

    enhancement 
    opened by huenique 4
  • Add shields/badges to README.md

    Add shields/badges to README.md

    Shields or badges allow you to show the state of a project to users. Sometimes they also show how much effort and dedication are put into the project. For now, we want to show the python version (3.9 and above), license (MIT), ~~project version~~, and commit activity.

    documentation help wanted hacktoberfest 
    opened by huenique 2
  • docs: Updated commands.md and created events.md

    docs: Updated commands.md and created events.md

    This is the Pull Request for Issue #12 I hope I did everything correct 🙃

    If there are issues please let me know and I will try to fix them.

    Greetings, lokerhp

    documentation hacktoberfest-accepted 
    opened by lokerhp 1
  • Migrate Dayong's design model and implement slash commands

    Migrate Dayong's design model and implement slash commands

    The sole maintainer of discord.py has ceased the development of their API wrapper. This is my first time making a complete discord bot, so I wasn't aware of this matter.

    The reason I chose discord.py was because of its popularity and that it was a fast and mature library. Now that discord.py is essentially dead, we're left with a few options:

    1. Rebuild the bot in another language.
    2. Rebuild the bot with another library.
    3. Extend discord.py to support slash commands.

    If you read Danny's announcement, Discord is forcing bot developers to use slash commands. Dayong will die in 8 or 9 months if we continue using discord.py's design model.

    Regarding our remaining options, from a project maintainer's point of view, the first one sounds like our top choice, but we don't have to abandon Python just yet. Personally, I think the second or third is our best option. For number 2, I'm looking into other libraries, such as hikari, which is starting to gain traction after the announcement. For number 3, there's discord-interactions, which is a discord.py extension for supporting slash commands.

    enhancement question 
    opened by huenique 1
  • Event listeners raising unexpected and unwanted exceptions

    Event listeners raising unexpected and unwanted exceptions

    Dayong's features are contained within cogs, otherwise known as extensions. As such, it makes sense to define an event listener in the cog for certain features. However, due to how discord.py implements event listeners for bots or cogs, overriding an event like on_message is a fatal mistake. Doing so will overwrite any other explicitly defined on_message method or function found somewhere else in the codebase. It may be fine for a bot with a fixed number of features, but for a multipurpose bot, like Dayong, at scale, it's bound to cause a number of issues.

    Solution I thought about moving the event listeners in a separate directory with each event having its own module. We only have to overwrite an event listener once. I think this looks OK:

    Dayong
    ├── README.md
    └── dayong
        └── listeners
            └── on_message.py
    
    # on_message.py
    from dayong.cogs import moderator
    
    @Cog.listener()
    async def on_message(self, message):
        # Mod is a cog loaded in another module so it doesn't need to be
        # instantiated here. I would recommend using static methods or
        # functions for features that require the use of event listeners.
        mod = moderator.Mod
    
        # Run coroutine that checks if there are bad words in the message.
        # delete_vulgar_message() is a static method denoted by the `staticmethod`
        # decorator.
        await mod.delete_vulgar_message(message)
        ...
    

    In the above code, I registered the delete_vulgar_message() feature from the cog moderator.py. The feature takes the Message instance as an argument and does its job on it.

    Additional Context External event listeners allow you to hear and handle multiple events from different servers, channels, users, etc. A single listener for a specific event is usually enough to handle different operations.

    • https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.Bot.listen
    • https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.Cog.listener
    bug enhancement 
    opened by huenique 1
  • Decompose Dayong into microservices

    Decompose Dayong into microservices

    As we add more features and integrate third-party software into Dayong, the more monolithic the bot becomes. Monolithic software is hard to maintain and develop. It is also prone to low cohesion and tight coupling, which we prevent by implementing interfaces and design patterns. However, it still takes a few days for new developers/contributors to start writing productive code. From now on, I suggest we implement extendable/big features that take a lot of resources as a microservice.

    Untitled Diagram

    The fitting approach is to decompose Dayong by following an API gateway pattern, where large, resource-intensive features/services are collectively or individually packaged and deployed to their own domains. This results in a stable architecture and services that are cohesive and loosely coupled. This also allows users to integrate their preferred or private services into Dayong with minimal code and labor.

    For more information on microservices, see:

    • https://www.infoq.com/articles/microservices-intro/
    • https://microservices.io/patterns/decomposition/decompose-by-business-capability.html
    • https://microservices.io/patterns/decomposition/decompose-by-subdomain.html
    enhancement help wanted 
    opened by huenique 0
  • Dayong raises KeyError when trying to greet a new member

    Dayong raises KeyError when trying to greet a new member

    Dayong has an event listener called greet_new_member(). It fires whenever a new member joins the server.

    https://github.com/SurPathHub/Dayong/blob/3a2fc34614f6509a9385e556f447a994f4e6d7fa/dayong/components/event_component.py#L76

    The code above is supposed to retrieve nested objects from the config.json file in the greetings_field key.

    Expected result:

    Dayong greets the new member in a channel specified in the config.json file.

    bug help wanted 
    opened by huenique 0
  • Add simple and easy to understand example component

    Add simple and easy to understand example component

    We think it's only appropriate to provide an example component for users who want to add their own commands/features. Although the libraries Dayong uses already provide the needed examples, we believe adding our own would make the bot more user-friendly.

    Using hikari-tanjun, please provide a descriptive, simple, and easy-to-understand example of a message command, a slash command, and an event listener.

    Here are basic examples provided by tanjun we can use as reference: https://github.com/FasterSpeeding/Tanjun/tree/master/examples

    enhancement help wanted hacktoberfest 
    opened by huenique 2
Releases(0.2.9)
  • 0.2.9(Nov 10, 2021)

    0.2.9 (2021-11-10)

    Features

    • add support for other third-party content providers (f12250f)

    Bug Fixes

    • adjust email cred checking logic (f1a1938)
    • consolidate dependency injection (adeda5f)
    • greatly reduce resource consumption (3f2d0f6)
    • make scheduled tasks purely optional (a603e07)
    • prevent queueing the same task (e217c44)
    • prioritize scheduler execution (5fd42d7)
    • resolve err on job exec (8afca6a)
    • resolve UndefinedTableError when starting scheduled tasks with slash command (2a219f1)
    Source code(tar.gz)
    Source code(zip)
Owner
SurPath Hub
Inclusive community for Filipino students | House of the GitHub Campus Expert 🇵🇭 - Inspired by @EddieHubCommunity
SurPath Hub
Acc-discord-rpc - Assetto Corsa Competizione Discord Rich Presence Client

A simple Assetto Corsa Competizione Rich Presence client. This app only works in

6 Dec 18, 2022
A Telegram Repo For Devs To Controll The Bots Under Maintenance.This Bot Is For Developers, If Your Bot Is Down, Use This Repo To Give Your Dear Subscribers Some Support By Providing Them Response.

Maintenance Bot A Telegram Repo For Devs To Controll The Bots Under Maintenance About This Bot This Bot Is For Developers, If Your Bot Is Down, Use Th

Vɪᴠᴇᴋ 47 Dec 29, 2022
A hyper-user friendly bot framework built on hikari

Framework A hyper-user friendly bot framework built on hikari. Framework is based off the blocking discord library disco, In both modularity and struc

Vincent 1 Jan 10, 2022
A library that allows you to easily mock out tests based on AWS infrastructure.

Moto - Mock AWS Services Install $ pip install moto[ec2,s3,all] In a nutshell Moto is a library that allows your tests to easily mock out AWS Services

Steve Pulec 6.5k Jan 02, 2023
Projeto de teste para acesso a API SWAPI.

SwapiTest Projeto de teste para acesso a API Swapi com informações sobre Star Wars. Como rodar o programa Foi utilizado o pipenv, então basta clonar o

Gabriel de Souza Alves 1 Nov 23, 2021
Python functions to run WASS stereo wave processing executables, and load and post process WASS output files.

wass-pyfuns Python functions to run the WASS stereo wave processing executables, and load and post process the WASS output files. General WASS (Waves

Mika Malila 3 May 13, 2022
Discord ToolBox is a discord bot developed by DJD320 created for the purpose of having some convenient tools in the form of a single bot.

Discord ToolBox Discord ToolBox is a discord bot developed by DJD320 created for the purpose of having some convenient tools in the form of a single b

3 Aug 07, 2021
This is a Telegram video compress bot repo. By Binary Tech💫

This is a Telegram Video Compress Bot. Prouduct By Binary Tech 💫 Features Compresse videos and generate screenshots too.You can set custom video name

silentz lk 7 Mar 03, 2022
BanAllBot - Telegram Code To Ban All Group Members very fast

BanAllBot Telegram Code To Ban All Group Members very fast FORK AND KANG WITH CR

27 May 13, 2022
A Telegram AntiChannel bot to ban users who using channel to send message in group

Anti-Channel-bot A Telegram AntiChannel bot to ban users who using channel to send message in group. BOT LINK: Features: Automatic ban Whitelist Unban

Jigar varma 36 Oct 21, 2022
Buscar y descargar canciones de YouTube automáticamente desde la web

🎶 DescargarCanciones 🎶 Buscar y descargar canciones o playlist de Spotify o YouTube automáticamente con todos los metadatos de la canciones en forma

1 Dec 20, 2021
A simple API wrapper for the Tenor API

Gifpy A simple API wrapper for the Tenor API Installation Python 3.9 or higher is recommended python3 -m pip install gifpy Clone repository: $ git cl

Juan Ignacio Battiston 4 Dec 22, 2021
Um simples bot público para todos usarem no discord!

Discord Bot - Código Público Características: Linguagem de Programação: Python Quantidade de comandos: 17 Comandos: Prefixo do bot: O prefixo desse bo

Kevin 3 Dec 31, 2021
Maestral is an open-source Dropbox client written in Python.

Maestral - A light-weight and open-source Dropbox client for macOS and Linux

2.6k Jan 03, 2023
A Python implementation of a Youtube Subscription manager & feed viewer, also does thumbnails

BUILDING Building requires python3.10, and the build package, which can be installed via pip: python3.10 -m pip install build To install, run python3.

2 Feb 28, 2022
A high level library for building Discord bots.

Qord A high level library for building Discord bots. 🚧 This library is currently in development. Questions that you are having What is this? This is

Izhar Ahmad 16 May 14, 2022
Pybt: a BaoTa panel python sdk

About Pybt is a BaoTa panel python sdk. Pybt 是一个宝塔面板API的Python版本sdk封装库。 公司很多服务器都装了宝塔面板,通过宝塔来部署、安装、维护一些服务,服务器的数量上以后,导致了维护的不方便,这个时候就想使用宝塔提供的API来开发一个运维平台

Adam Zhang 9 Dec 05, 2022
A Python Instagram Scraper for Downloading Profile's Posts, stories, ProfilePic and See the Details of Particular Instagram Profile.

✔ ✔ InstAstra ⚡ ⚡ ⁜ Description ~ A Python Instagram Scraper for Downloading Profile's Posts, stories, ProfilePic and See the Details of Particular In

12 Jun 23, 2022
Get notifications in your Discord server of any software releases from Apple.

Apple Releases Get notifications in your Discord server of any software releases from Apple. Running To locally host your own instance, create a Disco

adam 17 Oct 22, 2022