Skip to content

Commit

Permalink
Public Refactor (#199)
Browse files Browse the repository at this point in the history
* transfer MOST hard coded ids to reference

* whoops, the toml was just an idea

* continue replacing hard coded ids

* continue transfering values to reference

* split global_listeners and BirdTree into separate files

* move files around and enable recursive cog loading

* move files into app dir, deleted antiraid and roleassign

* Fixed hopefully most internal imports to now start with app
Transitioned to using a new error system within utils/errors.py
Transitioned to using a new check system which works for both app commands and text commands

* patreon role reference was not being called as it should

* remove slash command reminder on text command input

* banners update to use buttons and text command error change
banners.py have been updated to use a single view instance for listening to acceptance or denial.
text command error handling didnt prioritize handling InternalErrors but now it does

* move load_extensions into client.setup_hook

* needed to __init__ the constructor for banners view

* Refactor & Remove Unused Files (#137)

* move BirdTree into Birdbot

* remove unused imports and ununsed code

* dont need these files

* convert certain class configs to properties

* convert mod and above to property

* convert config to staticmethod

* added needed imports for birdtree after move

* check_server_moments forgot the ()

* type hint startbot

* more type checking

* readding cls to class method, I have no idea where it went

* Fix/git (#147)

* make interaction respond with edited message

* name now appears in infraction list embed

* forgot to add cls argument to classmethod

* fixes and re-enabled banner uploads to mongo

---------

Co-authored-by: arcinfini <[email protected]>
Co-authored-by: UtkarshPatel <[email protected]>

* Get emoji strings from config (#150)

* fix reference to config file

* inform user on banner approval

* Refactor/topic suggest (#148)

* transition to using views for topic accepting/denial

* check_server_moments forgot the ()

* type hint startbot

* more type checking

* readding cls to class method, I have no idea where it went

* Fix/git (#147)

* make interaction respond with edited message

* name now appears in infraction list embed

* forgot to add cls argument to classmethod

* fixes and re-enabled banner uploads to mongo

---------

Co-authored-by: arcinfini <[email protected]>
Co-authored-by: UtkarshPatel <[email protected]>

* Inform user how to avoid waiting after modal cancel
add await to tree.on_error call

* Get emoji strings from config (#150)

* fix reference to config file

* move to variable emoji reference and uncomment db update

* communicate with user on topic approval

---------

Co-authored-by: KvantOrav <[email protected]>
Co-authored-by: sloth <[email protected]>
Co-authored-by: Siddharth Narayanan <[email protected]>
Co-authored-by: UtkarshPatel <[email protected]>

* Refactor/intro (#156)

* staff intro with modals, wip

* some fixes for intros

* intro changes

* reordered the intro logic

* IntroModals, now with more methods

* changes to intro: close modal before sending messages, other improvements

* type hinting, cleanup and also black (oops)

* asyncio lock for reordering intros

* intro permissions, removed unnecessary lines from config.json

* changed intro reorder logic

* self.kgs_guild on init, revert if this is wrong

* intro async lock

* Revert "self.kgs_guild on init, revert if this is wrong"

This reverts commit 5af38b8.

* changes to intro commands

* of course i forgot to change permissions

* fix with intro role color and kurz maintenance role

---------

Co-authored-by: arcinfini <[email protected]>

* giveaway bias in config.py

* Meta/workflows (#154)

* make interaction respond with edited message

* name now appears in infraction list embed

* forgot to add cls argument to classmethod

* fixes and re-enabled banner uploads to mongo

* staff intro with modals, wip

* some fixes for intros

* intro changes

* reordered the intro logic

* IntroModals, now with more methods

* changes to intro: close modal before sending messages, other improvements

* type hinting, cleanup and also black (oops)

* asyncio lock for reordering intros

* linting workflows

* Update lint.yml

* black reformat

* Update lint.yml

* Update lint.yml

* yml is annoying

* install requirements at lint

* sort inputs

* formatting

* issue template

* format

* PR template

* contributor guide and codeowners

* Update CODEOWNERS

---------

Co-authored-by: arcinfini <[email protected]>
Co-authored-by: UtkarshPatel <[email protected]>
Co-authored-by: KvantOrav <[email protected]>
Co-authored-by: arcinfini <[email protected]>

* Type Checking  (#158)

* make interaction respond with edited message

* name now appears in infraction list embed

* forgot to add cls argument to classmethod

* fixes and re-enabled banner uploads to mongo

* staff intro with modals, wip

* some fixes for intros

* intro changes

* reordered the intro logic

* IntroModals, now with more methods

* changes to intro: close modal before sending messages, other improvements

* type hinting, cleanup and also black (oops)

* asyncio lock for reordering intros

* Get latest changes from public-refactor (#153)

* readding cls to class method, I have no idea where it went

* Fix/git (#147)

* make interaction respond with edited message

* name now appears in infraction list embed

* forgot to add cls argument to classmethod

* fixes and re-enabled banner uploads to mongo

---------

Co-authored-by: arcinfini <[email protected]>
Co-authored-by: UtkarshPatel <[email protected]>

* Get emoji strings from config (#150)

* fix reference to config file

* inform user on banner approval

* Refactor/topic suggest (#148)

* transition to using views for topic accepting/denial

* check_server_moments forgot the ()

* type hint startbot

* more type checking

* readding cls to class method, I have no idea where it went

* Fix/git (#147)

* make interaction respond with edited message

* name now appears in infraction list embed

* forgot to add cls argument to classmethod

* fixes and re-enabled banner uploads to mongo

---------

Co-authored-by: arcinfini <[email protected]>
Co-authored-by: UtkarshPatel <[email protected]>

* Inform user how to avoid waiting after modal cancel
add await to tree.on_error call

* Get emoji strings from config (#150)

* fix reference to config file

* move to variable emoji reference and uncomment db update

* communicate with user on topic approval

---------

Co-authored-by: KvantOrav <[email protected]>
Co-authored-by: sloth <[email protected]>
Co-authored-by: Siddharth Narayanan <[email protected]>
Co-authored-by: UtkarshPatel <[email protected]>

---------

Co-authored-by: arcinfini <[email protected]>
Co-authored-by: arcinfini <[email protected]>
Co-authored-by: UtkarshPatel <[email protected]>
Co-authored-by: KvantOrav <[email protected]>
Co-authored-by: arcinfini <[email protected]>

* linting workflows

* Update lint.yml

* black reformat

* Update lint.yml

* Update lint.yml

* yml is annoying

* install requirements at lint

* sort inputs

* formatting

* issue template

* format

* PR template

* contributor guide and codeowners

* delete quiz cog

* update CODEOWNERS

* move meta files around

* update toml and workflow

* type hinting

* add pyright action

* update workflow file

* fix actions;

* conflicts

* delete quiz cog

* fix actions yaml

* Update requirements.txt

* Update banner.py

* fix conflicts (#159)

* fix hopefully?

* formatting

* typing.Union gone

* BirdBot type hint

* helpful functions for type hinting in BirdBot class

* User and Member union

* fixed

* removed unnecessary fetch_channel

* unnecessary member fetch removed

* handle message NotFound

* small fixes

* small rewrite, should actually rewrite it though

* More type hinting and get reference channels through the new function

* more type checking, black format

* added pyright requirement

* ran isort and pyright

* Use reusable workflow from .github repo

* Update lint.yml

* pls work

* Update lint.yml

* Update lint.yml

* Some improvements to type checking

* forgot isort

* Enhancements/type hinting+ (#160)

* typing.Union gone

* BirdBot type hint

* helpful functions for type hinting in BirdBot class

* User and Member union

* fixed

* removed unnecessary fetch_channel

* unnecessary member fetch removed

* handle message NotFound

* small fixes

* small rewrite, should actually rewrite it though

* More type hinting and get reference channels through the new function

* more type checking, black format

* added pyright requirement

* ran isort and pyright

* Some improvements to type checking

* forgot isort

* upgrade py version in toml

* upgrade discord version

* remove translate cmd

* type hint patreon.py

* format

* better impl for banner rotation

---------

Co-authored-by: Siddharth Narayanan <[email protected]>
Co-authored-by: sloth <[email protected]>

* formatting

* remove new member webhook

* format

* delete unused deployment files

* remove unused templates infavor of org level templates

---------

Co-authored-by: arcinfini <[email protected]>
Co-authored-by: UtkarshPatel <[email protected]>
Co-authored-by: KvantOrav <[email protected]>
Co-authored-by: arcinfini <[email protected]>
Co-authored-by: arcinfini <[email protected]>

* temp fix (#165)

* temp fix

* fixed

* add mov to filetype

* update channel refs for server rework

* remove server moments and mod alert logic

* add enhanced role color selection

* isort color_select

* giveaway fix hopefully

* simplified _get_channel()

* fixed giveaway and moved the giveaway task to on_ready

* back to cog_load

* Server rework (#167)

* update channel refs for server rework

* remove server moments and mod alert logic

* add enhanced role color selection

* isort color_select

* giveaway fix hopefully

* simplified _get_channel()

* fixed giveaway and moved the giveaway task to on_ready

* back to cog_load

---------

Co-authored-by: arcinfini <[email protected]>
Co-authored-by: KvantOrav <[email protected]>

* Fix/post server rework (#171)

* fix issue where those who didnt have access to color could still have it

* remove the verified role from code

* black formatting

* fix banner rotation

* update banner cycler

* fix typos

* remove print statements

* add perch to automod

* add perch to config

* fix + type hinting

* topix fix 2

* Bug Fix: Infraction embed field exceeding max length of 1024

Splitted array into multiple fields if string length exceeds 1000 characters.

* Genericiterator (#183)

* generic cycler for banner and topic

* update cycle list without changing order

* change the dequeueueue variable name so the tests dont fail

* quick black formatting

* an implementation for syncing the iterator list with bot list

* banner message ids are stored and images fetched from messages

* -typo seriously why is it so many ue

* Cycle update_list function should be unnecessary

* gif support + fixes

* fix banner add

* filename_from_url cleanup

* iterator queue moved into init

* Banner rotation error logging

* fix topics_db variable name mismatch

* queue has to be outside of init for this to work

* more and less type hinting

* changed logging

* added more comments

* add pre-commit functionality check (#190)

* Inclusion of GNU License (#186)

* license creation and preamble in source files

* Add reusable license check

* Update lint.yml

---------

Co-authored-by: Siddharth Narayanan <[email protected]>

* Docs/public refactor (#193)

* Some doc formatting.

* MOAR DOCS

* doc grammar and clarification

---------

Co-authored-by: KvantOrav <[email protected]>
Co-authored-by: arcinfini <[email protected]>

* rebase

* Update deploy.yml (#195)

* delete infraction log to mod_actions (#196)

* Update README (#197)

* Update README

* Added isort in README.md

* Bumping dependencies (#198)

* Bumping dependencies and removed unused deps

* Updated black formatted misc

---------

Co-authored-by: UtkarshPatel <[email protected]>

---------

Co-authored-by: arcinfini <[email protected]>
Co-authored-by: arcinfini <[email protected]>
Co-authored-by: KvantOrav <[email protected]>
Co-authored-by: UtkarshPatel <[email protected]>
Co-authored-by: arcinfini <[email protected]>
Co-authored-by: Utkarsh-Patel-13 <[email protected]>
  • Loading branch information
7 people authored Mar 28, 2024
1 parent 7b78781 commit bb5c54f
Show file tree
Hide file tree
Showing 50 changed files with 4,991 additions and 3,768 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @sloth-ontabasco @Utkarsh-Patel-13 @arcinfini @KvantOrav
Binary file added .github/images/birdbot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Deploy Birdbot

on:
push:
branches:
- 'master'
- 'main'
- 'public-refactor'
- 'staging'
- 'staging-deploy'

jobs:
deploy:
uses: kurzgesagt-in-a-nutshell/.github/.github/workflows/deploy-birdbot.yml@self-hosted-runner
16 changes: 16 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Lint Python and check license headers

on:
pull_request:
branches:
- '**'
push:
branches:
- 'master'
- 'main'

jobs:
lint:
uses: kurzgesagt-in-a-nutshell/.github/.github/workflows/python-lint.yml@main
license-checker:
uses: kurzgesagt-in-a-nutshell/.github/.github/workflows/license-check.yml@main
26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-merge-conflict
- id: check-yaml
- repo: local
hooks:
- id: black-format
name: black-format
entry: black
language: system
types: [python]
- id: isort-format
name: isort-format
entry: isort
language: system
types: [python]
stages: [commit, push, manual]
- id: pyright
name: pyright
entry: pyright .
language: system
types: [python]
pass_filenames: false
stages: [commit, push, manual]
13 changes: 0 additions & 13 deletions Dockerfile

This file was deleted.

674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

66 changes: 64 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,65 @@
# Kurzgesagtbot
<h1 align="center">
<br>
<a href="https://github.com/kurzgesagt-in-a-nutshell/"><img src=".github/images/birdbot.png" height="150" alt="Bird Bot"></a>
<br>
Bird Bot
<br>
</h1>

A multi-purpose discord bot for [Kurzgesagt Discord](https://discord.gg/kurzgesagt).
<h4 align="center">The almighty and powerful Bird Bot helps run the Kurzgesagt discord server like a well oiled machine</h4>

# ➡️ Getting Started

## ⚙️ Prerequisites

- [Python 3.11 or higher](https://www.python.org/)
- [MongoDB](https://www.mongodb.com/)

## 📦 Installation

Follow these steps to get the bot up and running in your system
- Run the following commands

```
# clone the repository
git clone https://github.com/kurzgesagt-in-a-nutshell/kurzgesagtbot
# install virtualenv if you haven't already (Or use another Virtual Environment manager)
pip install virtualenv
# Setup a venv
python3.11 -m venv birdbot
source birdbot/bin/activate
# install the dependencies
pip install -r requirements.txt
```

- Navigate to /app/utils/config.py and change the values of the variables according to your requirements

- Create a file named `.env` and paste the following lines in it. Change the values of the variables according to your requirements
```
MAIN_BOT_TOKEN='INSERT_MAIN_BOT_TOKEN'
BETA_BOT_TOKEN='INSERT_BETA_BOT_TOKEN'
ALPHA_BOT_TOKEN='INSERT_ALPHA_BOT_TOKEN'
DB_KEY='INSERT_MONGODB_DATABASE_CONNECTION_URL'
```

- Run the bot with, use the `-a` or `-b` option to run testing versions of the bot
```
python3 startbot.py [-b] [-a]
```

If you need additional help you may join our [Discord Server](https://discord.gg/kurzgesagt)

# 🤲 Contributing

Please read our contributor guidelines [here](https://github.com/kurzgesagt-in-a-nutshell/.github/blob/main/CONTRIBUTING.md) before contributing

Before submitting a pull request please ensure you conform to our [PyRight](https://github.com/microsoft/pyright) standards and be sure to use [ISort](https://pycqa.github.io/isort/#using-isort) import sorter and the [Black](https://github.com/psf/black) code formatter.
Run these commands (preferably in the given order) and make sure they do not throw any errors:
```
pyright .
isort .
black .
```
7 changes: 0 additions & 7 deletions antiraid.json

This file was deleted.

Loading

0 comments on commit bb5c54f

Please sign in to comment.