GithubHelp home page GithubHelp logo

zorakbot's Introduction

ZorakBot

ZorakBot is the House bot of the Practical Python discord server.

Its purpose is to moderate, log, and provide necessary features that the community deems worthy. Anyone from our community is welcome to join us in developing the bot. Zorak uses Py-Cord with cogged slash commands, and ties into a Mongo Database.

The bot features:

  • Reaction roles
  • A points system
  • Music functions
  • Admin commands
  • Full server logging
  • Spam prevention
  • Raid protection.

Deployment / Running Zorak

Clone the bot into a folder of your choice.

git clone https://github.com/Xarlos89/ZorakBot

The bot is deployed using docker. Create an .env file from '.env.example'. Docker will use these env variables to spin up your instance of Zorak. Replace the DISCORD_TOKEN env variable with your discord bot token.

Development / testing

The easiest way to get started is to run Zorak locally and in our test server (Contact a repo admin for an invite!).

  • -ssp: Variable that sets the location to the server settings to use.
  • -dd: Flag that allows you to drop the database.
  • -cl: Flag that enables streaming logs to console.
docker-compose up -d

And then after making a change, rebuild only zorak.

docker build -t zorak .
docker run --env-file ./.env zorak -dd True -dt <DISCORD_TOKEN_HERE>

Production

All environment settings are found in your .env file.

  1. Update the .env file to use 'prod' as the ENVIRONMENT
  2. Update your .env file to point the SETTINGS variable to Resources/ServerConfig/PracticalPython
  3. Run the command:
docker-compose up -d

Get Involved with development

Contributing to Zorak is encouraged for everyone. Especially those who are part of our Discord community. We use a Prod / Development git-flow.

Branches

To add a feature / make a bugfix, first create a new branch from the Development branch. This will have the most up to date changes. Please name your branch in the following format:

  • feature/whatever your feature is
  • bugfix/whatever your bugfix is
  • refactor/whatever your refactor is

Pull Requests

Make all your commits on that branch, and then make a Pull Request to merge your branch back into Development. Please name your pull request in the following format:

  • major: Title of your major changes
  • minor: Title of your minor changes
  • fix: Title of your bugfixes

We require approvals on all PRs that go back into Dev. If your PR is linked to a Github Issue, please link the issue in the PR.

Changes will be merged into Main when necessary

Git-Flow chart

The chart below demonstrates one feature, and one bugfix. Main and Development already exist. You would want to make a new branch for whatever you're going to do.

git-flow

Version Bumping through PR titles

Our repository uses an automated versioning system that relies on the naming convention of the pull request titles. When you merge a pull request into the dev branch, the version number of the project is automatically bumped and a new tag is created, based on the prefix in your PR title.

The version number follows the MAJOR.MINOR.FIX format, where:

MAJOR version increments indicate significant changes or enhancements in the project, often including breaking changes. MINOR version increments indicate backwards-compatible new features or enhancements. FIX version increments indicate backwards-compatible bug fixes or minor changes. To specify the type of changes you have made in your pull request, prefix your PR title with one of the following:

major: - to increment the MAJOR version (e.g., from 1.0.0 to 2.0.0). minor: - to increment the MINOR version (e.g., from 0.1.0 to 0.2.0). fix: - to increment the FIX version (e.g., from 0.0.1 to 0.0.2). For example, if you have made a minor change, your PR title could be: minor: Add new feature XYZ.

If your PR title does not include any of the specified prefixes, the GitHub Action will not increment the version or create a new tag. This can be useful for non-functional changes like updates to documentation or code refactoring that don't require a version bump.

When your PR is merged into main, the GitHub Action will increment the version according to the prefix in the PR title and create a new tag.

Please ensure you follow this convention to maintain a well-structured and meaningful version history for our project.

zorakbot's People

Contributors

xarlos89 avatar renovate[bot] avatar jammassey avatar jefethepug avatar pennybelle avatar richardphi1618 avatar 777advait avatar itzhapp avatar minus-hates-school avatar peregrine05 avatar jaffacat avatar adamgarai98 avatar lunacodedemon avatar crambor avatar denzio231 avatar

Stargazers

 avatar Alex avatar  avatar Trendsolate  avatar Thomas Kafetzis avatar Surena avatar  avatar Harriet O'Brien avatar  avatar  avatar  avatar  avatar Bunch of cells avatar  avatar  avatar

Watchers

Kostas Georgiou avatar  avatar  avatar

zorakbot's Issues

Points leaderboard

Users should be able to use a slash command that provides an embed with the top 20 point earners in the server

Cog Refactor

Cogs need to be cleaned up and larger cogs need to be split into smaller parts

/ticket broken

When creating a ticket, an error is thrown:
Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/discord/ui/view.py", line 414, in _scheduled_task await item.callback(interaction) File "/src/cogs/general_tickets.py", line 30, in button_callback support = await self.bot.fetch_channel(mod_channel["server_support"]) AttributeError: 'make_a_ticket' object has no attribute 'bot'

and the ticket is not created

Update welcome message

image

Need to update a few items in the welcome message.

  • Roles needs to be /roles
  • Website needs proper link
  • email doesn't seem to work
  • invite link doesnt seem to work

Logging refactor

Refactor logging in-server using the audit log, rather than listeners for a more accurate logging experience.

dont forget to add Maszi's logging handler in there.

FEATURE - birthday list for server users

This would be a series of simple commands, such as:
/birthday add {date}
/birthday update {date}
/birthday - perhaps shows the next birthday on the server
/birthday list - shows a list of birthdays (paginated) in order of closest-first

BUG - Disable admin logging for cleanup tasks

          is this behaviour intended? even if a user is an admin, if any of the roles they have are not admin values it would still send a message right? meaning every user that has a non-admin role would have this logging occur

if you wanted to NOT show admins, you should instead do a check like
is_admin = any(role.id in admin_roles.values() for role in message_before.author.roles)
and then compare against this variable

Originally posted by @Crambor in #86 (comment)

BUG - Permissions error when re-building container

We experience an error when attempting to update the running prod contianers.

When rebuilding the zorak_bot container from a new image, the container does not have permissions to read from the existing mongo container.

[Some-USERr@###-###-##-##]$ docker-compose -f dc-prod.yaml up -d Building zorak error checking context: 'no permission to read from '/srv/prod/db/WiredTiger.turtle''. ERROR: Service 'zorak' failed to build : Build failed

Currently the fix is to open the permissions on the db folder, which allows all users access, but I dont like this.

Possible solution is to run the containers both as the same user from the dockerfile

Handle Reaction Roles

Currently we have a "Python level" role, as well as a "country" role.

This should be handled by Zorak.

Deleted channel breaks verification

HAS BEEN HOTFIXED, but need to be updated in the next release

File "/zorak_bot/cogs/verification_on_verified.py", line 46, in verify_button_callback If you have any questions, feel free to post your question in {bot.get_channel(normal_channel['new_to_python']).mention} or {bot.get_channel(normal_channel['python_help_1']).mention} AttributeError: 'NoneType' object has no attribute 'mention'

Remove {bot.get_channel(normal_channel['new_to_python']) and update TOML files

Update bot descriptions

The "about me" and the help command are out of date + need updating. We should move this info into a TOML to pave the way for it to be added to a database.

BUG - Logging: Message_edit throws error when text is too long

Ignoring exception in on_message_edit Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/discord/client.py", line 377, in _run_event await coro(*args, **kwargs) File "/src/cogs/logging_message_edit.py", line 44, in on_message_edit await logs_channel.send(f"{username.mention}", embed=embed) File "/usr/local/lib/python3.9/site-packages/discord/abc.py", line 1606, in send data = await state.http.send_message( File "/usr/local/lib/python3.9/site-packages/discord/http.py", line 366, in request raise HTTPException(response, data) discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body In embeds.0.fields.0.value: Must be 1024 or fewer in length. In embeds.0.fields.1.value: Must be 1024 or fewer in length.

Message edits that are more than 1024 characters throw an error. This can be handled by breaking the text into blocks of 1024 chars, and adding new feilds for every block.

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.