Repository: discordextremelist/bot Branch: main Commit: ca8b2c5e6cd4 Files: 40 Total size: 152.0 KB Directory structure: gitextract_hd1m2h4_/ ├── .dockerignore ├── .github/ │ ├── ISSUE_TEMPLATE/ │ │ ├── bug-report.md │ │ └── feature-request.md │ ├── config.yml │ ├── stale.yml │ └── workflows/ │ ├── add_to_project.yml │ ├── deploy.yml │ ├── project_high_priority.yml │ ├── project_low_priority.yml │ ├── project_medium_priority.yml │ └── project_on_hold.yml ├── .gitignore ├── .mergify.yml ├── CODEOWNERS ├── Dockerfile ├── LICENSE ├── README.md ├── SECURITY.md ├── bot.py ├── cogs/ │ ├── admin.py │ ├── help.py │ ├── notes.py │ ├── tags.py │ ├── tickets.py │ ├── types/ │ │ ├── __init__.py │ │ ├── botTypes.py │ │ ├── discordTypes.py │ │ ├── globalTypes.py │ │ ├── serverTypes.py │ │ ├── tagTypes.py │ │ ├── templateTypes.py │ │ ├── ticketTypes.py │ │ ├── userStaffTrackingTypes.py │ │ └── userTypes.py │ └── utility.py ├── docs/ │ └── STATUS_TYPES.md ├── ext/ │ ├── checks.py │ └── context.py ├── requirements.txt └── settings.example.json ================================================ FILE CONTENTS ================================================ ================================================ FILE: .dockerignore ================================================ settings.json ================================================ FILE: .github/ISSUE_TEMPLATE/bug-report.md ================================================ --- name: Bug Report about: Create a report to help us improve title: '' labels: bug assignees: '' --- **Describe the Bug** **Steps to Reproduce** 1. 2. 3. **Expected Behavior** **Screenshots** **Environment** - OS: - Browser: - Version: **Additional context** ================================================ FILE: .github/ISSUE_TEMPLATE/feature-request.md ================================================ --- name: Feature Request about: Suggest an idea for this project title: '' labels: feature request assignees: '' --- **Is your feature request related to a problem? Please describe.** A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] **Describe the solution you'd like** A clear and concise description of what you want to happen. **Describe alternatives you've considered** A clear and concise description of any alternative solutions or features you've considered. **Additional context** Add any other context or screenshots about the feature request here. ================================================ FILE: .github/config.yml ================================================ todo: keyword: "todo" ================================================ FILE: .github/stale.yml ================================================ # Number of days of inactivity before an issue becomes stale daysUntilStale: 90 # Number of days of inactivity before a stale issue is closed daysUntilClose: 7 # Issues with these labels will never be considered stale exemptLabels: - help wanted # Label to use when marking an issue as stale staleLabel: stale # Comment to post when marking an issue as stale. Set to `false` to disable markComment: > This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. # Comment to post when closing a stale issue. Set to `false` to disable closeComment: false ================================================ FILE: .github/workflows/add_to_project.yml ================================================ name: Add new issue/pr to Awaiting triage on: [issues, pull_request] jobs: add-new-issues-to-project-column: runs-on: ubuntu-latest steps: - name: add-new-issues-to-organization-based-project-column uses: docker://takanabe/github-actions-automate-projects:v0.0.1 if: github.event_name == 'issues' && github.event.action == 'opened' env: GITHUB_TOKEN: ${{ secrets.DELLYBOT_SECRET }} GITHUB_PROJECT_URL: https://github.com/orgs/discordextremelist/projects/1 GITHUB_PROJECT_COLUMN_NAME: Awaiting triage ================================================ FILE: .github/workflows/deploy.yml ================================================ name: Deploy on: push: tags: - "v*-Release" jobs: build: runs-on: ubuntu-latest steps: - name: 'Login to GitHub Container Registry' uses: docker/login-action@v1 with: registry: ghcr.io username: ${{github.actor}} password: ${{secrets.GITHUB_TOKEN}} - uses: actions/checkout@v3 - name: Build run: docker build -t ghcr.io/discordextremelist/bot:${GITHUB_REF#refs/tags/} . - name: Push run: docker push ghcr.io/discordextremelist/bot:${GITHUB_REF#refs/tags/} deploy: needs: build runs-on: ubuntu-latest steps: - name: Login run: | mkdir ~/.kube echo "${{ secrets.KUBE_CONFIG }}" > ~/.kube/config - name: Set image run: kubectl set image deployment/bot bot=ghcr.io/discordextremelist/bot:${GITHUB_REF#refs/tags/} - name: Rollout status run: kubectl rollout status deployment/bot ================================================ FILE: .github/workflows/project_high_priority.yml ================================================ name: Move issue/pr to correct column when on hold label applied on: issues: types: [labeled] jobs: Move_Labeled_Issue_On_Project_Board: runs-on: ubuntu-latest steps: - uses: konradpabjan/move-labeled-or-milestoned-issue@v2.0 with: action-token: "${{ secrets.DELLYBOT_SECRET }}" project-url: "https://github.com/orgs/discordextremelist/projects/1" column-name: "High Priority" label-name: "high priority" ================================================ FILE: .github/workflows/project_low_priority.yml ================================================ name: Move issue/pr to correct column when on hold label applied on: issues: types: [labeled] jobs: Move_Labeled_Issue_On_Project_Board: runs-on: ubuntu-latest steps: - uses: konradpabjan/move-labeled-or-milestoned-issue@v2.0 with: action-token: "${{ secrets.DELLYBOT_SECRET }}" project-url: "https://github.com/orgs/discordextremelist/projects/1" column-name: "Low Priority / Delayed" label-name: "low priority" ================================================ FILE: .github/workflows/project_medium_priority.yml ================================================ name: Move issue/pr to correct column when on hold label applied on: issues: types: [labeled] jobs: Move_Labeled_Issue_On_Project_Board: runs-on: ubuntu-latest steps: - uses: konradpabjan/move-labeled-or-milestoned-issue@v2.0 with: action-token: "${{ secrets.DELLYBOT_SECRET }}" project-url: "https://github.com/orgs/discordextremelist/projects/1" column-name: "Moderate Priority" label-name: "moderate priority" ================================================ FILE: .github/workflows/project_on_hold.yml ================================================ name: Move issue/pr to correct column when on hold label applied on: issues: types: [labeled] jobs: Move_Labeled_Issue_On_Project_Board: runs-on: ubuntu-latest steps: - uses: konradpabjan/move-labeled-or-milestoned-issue@v2.0 with: action-token: "${{ secrets.DELLYBOT_SECRET }}" project-url: "https://github.com/orgs/discordextremelist/projects/1" column-name: "Low Priority / Delayed" label-name: "on hold" ================================================ FILE: .gitignore ================================================ # Created by .ignore support plugin (hsz.mobi) ### Python template # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ pip-wheel-metadata/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover *.py,cover .hypothesis/ .pytest_cache/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py db.sqlite3 db.sqlite3-journal # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder target/ # Jupyter Notebook .ipynb_checkpoints # IPython profile_default/ ipython_config.py # pyenv .python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. #Pipfile.lock # PEP 582; used by e.g. github.com/David-OConnor/pyflow __pypackages__/ # Celery stuff celerybeat-schedule celerybeat.pid # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .pyre/ # Configuration settings.json # Redis dump.rdb # IDEs .vscode/ .idea/ ================================================ FILE: .mergify.yml ================================================ pull_request_rules: - name: Automatic merge when required reviews are approved conditions: - base=master - "#approved-reviews-by>=1" - status-success=DeepScan actions: merge: method: merge ================================================ FILE: CODEOWNERS ================================================ * @Carolina2k22 @TheMoksej LICENSE @Carolina2k22 CODEOWNERS @Carolina2k22 ================================================ FILE: Dockerfile ================================================ FROM python:3.8 WORKDIR /app COPY . . RUN pip install -U -r requirements.txt CMD ["python", "./bot.py"] ================================================ FILE: LICENSE ================================================ GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software. A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public. The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version. An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU Affero General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Remote Network Interaction; Use with the GNU General Public License. Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements. You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see . ================================================ FILE: README.md ================================================ # DEL Bot for DEL Website v5.x.x Licensing information viewable in LICENSE.md # Setup ## Requirements ### Python 3 Python 3 is required for the DEL bot to function as it is built using python. **NOTE:** This has only been tested in Python 3.8 and may be broken on newer or older versions of Python 3. ### PM2 (Optional) PM2 is optional and allows the DEL bot to auto-restart on crash. ### MongoDB A MongoDB instance is required - it must match the configuration in the `settings.json` file and the values must be the same as the website instance. ## Setup Install all of the dependencies by running `pip install -r requirements.txt` ## Running ### Without PM2 Run the `python bot.py` command, please note python may be python3 on some platforms. ### With PM2 Run the `pm2 start bot.py --name DEL-BOT` command. ================================================ FILE: SECURITY.md ================================================ # Security Policy ## Supported Versions | Version | Supported | | ------- | ------------------ | | 1.1.x | 🟢 Supported | | 1.0.x | 🔴 No Support | ## Reporting a Vulnerability You can report a vulnerability by contacting us at [contact@discordextremelist.xyz](mailto:contact@discordextremelist.xyz). ================================================ FILE: bot.py ================================================ # Discord Extreme List - Discord's unbiased list. # Copyright (C) 2020-2025 Carolina Mitchell, Advaith Jagathesan, John Burke # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . import datetime import json import logging import colouredlogs import discord from discord.ext import commands from motor.motor_asyncio import AsyncIOMotorClient from ext.checks import NoMod, NoSomething from ext.context import EditingContext colouredlogs.install() with open("settings.json") as content: settings = json.load(content) logging.basicConfig(level=logging.INFO) logging.getLogger("discord").setLevel(logging.WARNING) logging.info("Starting bot") db = AsyncIOMotorClient(settings["mongo"]["uri"])[settings["mongo"]["db"]] botExtensions = [ "cogs.help", "cogs.utility", "cogs.tickets", "cogs.tags", "cogs.notes", "cogs.admin", "jishaku" ] async def get_prefix(bot, message): if not message.guild: prefixes = "" return prefixes else: prefixes = settings["prefix"] return commands.when_mentioned_or(*prefixes)(bot, message) intents = discord.Intents(guilds=True, members=True, messages=True, reactions=True) allowed_mentions = discord.AllowedMentions(roles=False, users=False, everyone=False) if settings["ownership"]["multiple"]: bot = commands.Bot(command_prefix=get_prefix, case_insensitive=True, owner_ids=settings["ownership"]["owners"], allowed_mentions=allowed_mentions, intents=intents) else: bot = commands.Bot(command_prefix=get_prefix, case_insensitive=True, owner_id=settings["ownership"]["owner"], allowed_mentions=allowed_mentions, intents=intents) bot.db = db bot.remove_command("help") bot.settings = settings bot.cmd_edits = {} if __name__ == "__main__": for ext in botExtensions: try: bot.load_extension(ext) logging.info(f"{ext} has been loaded") except Exception as err: logging.exception(f"An error occurred whilst loading {ext}", exc_info=err) @bot.event async def on_ready(): logging.info(f"Connection established! - Logged in as {bot.user} ({bot.user.id})") game = discord.Game(name="discordextremelist.xyz", type=discord.ActivityType.watching) await bot.change_presence(status=discord.Status.online, activity=game) if not hasattr(bot, "uptime"): bot.uptime = datetime.datetime.utcnow() @bot.event async def on_guild_join(guild): logging.info(f"Joined guild - {guild.name} ({guild.id})") @bot.event async def on_user_update(_, after): if after.bot: db_bot = db["bots"].find_one({"_id": str(after.id)}) if db_bot: db["bots"].update_one({"_id": str(after.id)}, { "$set": { "name": after.name, "avatar": { "hash": after.avatar, "url": f"https://cdn.discordapp.com/avatars/{after.id}/{after.avatar}" # ffs stay consistent } } }) else: user = db["users"].find_one({"_id": str(after.id)}) if user: db["users"].update_one({"_id": str(after.id)}, { "$set": { "name": after.name, "discrim": after.discriminator, "fullUsername": f"{after.name}#{after.discriminator}", "avatar": { "hash": after.avatar, "url": f"https://cdn.discordapp.com/avatars/{after.id}/{after.avatar}" # ffs } } }) @bot.event async def on_member_join(member): if member.bot: db_bot = await db.bots.find_one({"_id": str(member.id)}) if str(member.guild.id) == settings["guilds"]["main"]: if db_bot: if db_bot["status"]["premium"]: await member.add_roles(discord.Object(id=int(settings["roles"]["premiumBot"])), reason="Bot is Premium on the website.") else: await member.add_roles(discord.Object(id=int(settings["roles"]["bot"])), reason="Bot is Approved on the website.") else: await member.add_roles(discord.Object(id=int(settings["roles"]["unlisted"])), reason="Bot is not listed on the website.") elif str(member.guild.id) == settings["guilds"]["staff"]: if db_bot: if db_bot["status"]["approved"]: await member.add_roles(discord.Object(id=int(settings["roles"]["unapprovedBot"])), reason="Bot is not approved on the website.") elif str(member.guild.id) == settings["guilds"]["bot"]: if db_bot: if db_bot["status"]["approved"]: await member.add_roles(discord.Object(id=int(settings["roles"]["botServer"]["listed"])), reason="Bot is already approved and listed on the website.") elif str(member.guild.id) == settings["guilds"]["main"]: db_bot = await db.bots.find_one({"owner": {"id": str(member.id)}}) if db_bot is not None and db_bot["status"]["approved"]: await member.add_roles(discord.Object(id=int(settings["roles"]["developer"])), reason="User is a Developer on the website.") @bot.event async def on_command_error(ctx, error): if isinstance(error, (discord.Forbidden, commands.CommandNotFound)): return if isinstance(error, NoMod): return await ctx.channel.send(f"{settings['formats']['noPerms']} **Invalid permission(s):** You need " f"to be a Moderator to execute this command.") if isinstance(error, NoSomething): return await ctx.channel.send(settings['formats']['error'] + error.message) if isinstance(error, commands.MissingRequiredArgument): return await ctx.send(f"{settings['formats']['error']} **Missing arguments:** Argument `{error.param.name}` " f"is required.") if isinstance(error, commands.CheckFailure) and error.args: return await ctx.channel.send(error) if isinstance(error, commands.CommandError) and error.args: return await ctx.channel.send(error) logging.exception("something done fucked up", exc_info=error) @bot.event async def on_message(msg): if not msg.author.bot: ctx = await bot.get_context(msg, cls=EditingContext) await bot.invoke(ctx) ticket = await bot.db.tickets.find_one({ "ids.channel": str(ctx.channel.id) }) if ticket and ticket["status"] == 0: bot_db = await ctx.bot.db.bots.find_one({ "_id": str(ticket["ids"]["bot"]) }) if bot_db and bot_db["owner"]["id"] == str(ctx.author.id): message = await ctx.channel.fetch_message(int(ticket["ids"]["message"])) embed = message.embeds[0] embed.colour = 0x0fb9fc embed.set_author(name=f"Approval Feedback - {ticket['_id']} [DEV REPLIED]", icon_url=ctx.bot.settings["images"]["dev_replied"]) await message.edit(embed=embed) await ctx.send(f"{bot.settings['formats']['ticketStatus']} **Ticket update:** Changed ticket " f"status to `Dev Replied`.", mention_author=False) ticket = await bot.db.tickets.find_one({ "ids.message": str(message.id) }) log_msg = await ctx.guild.get_channel(int(bot.settings["channels"]["ticketLog"])) \ .fetch_message(int(ticket["ids"]["log"])) embed2 = log_msg.embeds[0] embed2.colour = 0x0fb9fc embed2.set_author(name=f"Approval Feedback - {ticket['_id']} [DEV REPLIED]", icon_url=ctx.bot.settings["images"]["dev_replied"]) await log_msg.edit(embed=embed2) await ctx.bot.db.tickets.update_one({"_id": ticket["_id"]}, { "$set": { "status": 3 } }) @bot.event async def on_message_edit(old_msg, new_msg): if not old_msg.author.bot and new_msg.content != old_msg.content: ctx = await bot.get_context(new_msg, cls=EditingContext) await bot.invoke(ctx) bot.run(settings["token"], bot=True, reconnect=True) ================================================ FILE: cogs/admin.py ================================================ # Discord Extreme List - Discord's unbiased list. # Copyright (C) 2020-2025 Carolina Mitchell, Advaith Jagathesan, John Burke # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . import datetime import discord from discord.ext import commands from ext.checks import NoSomething from .types import userTypes, globalTypes class AdminCog(commands.Cog, name="Admin"): def __init__(self, bot): self.bot = bot self.help_icon = f"{self.bot.settings['emoji']['coder']}" async def embed_colour(self, ctx): global colour bot_guild_member = await ctx.guild.fetch_member(ctx.bot.user.id) if len(str(bot_guild_member.colour.value)) == 1: colour = 0xFFFFFA else: colour = bot_guild_member.colour.value return colour @commands.command(name="admintoken", usage="admintoken", description="Allows you to get your temporary DELADMIN access token.") async def admin_token(self, ctx): """ Allows you to get your temporary DELADMIN access token. """ async with ctx.channel.typing(): db_user: userTypes.DelUser = await self.bot.db.users.find_one({"_id": str(ctx.author.id)}) if not db_user: raise NoSomething(ctx.author) token: globalTypes.DelAdminToken = await self.bot.db.adminTokens.find_one({"_id": str(ctx.author.id)}) if token: embed = discord.Embed(colour=await self.embed_colour(ctx)) embed.add_field(name=f"{self.bot.settings['emoji']['clock']} Valid From", value=datetime.datetime.utcfromtimestamp(token["lastUpdate"] / 1000).strftime( f"%I:%M%p - %a, %d %b %Y (GMT)")) embed.add_field(name=f"{self.bot.settings['emoji']['timer']} Valid Until", value=datetime.datetime.utcfromtimestamp(token["validUntil"] / 1000).strftime( f"%I:%M%p - %a, %d %b %Y (GMT)")) embed.add_field(name=f"{self.bot.settings['emoji']['cog']} Token", value=f"```{token['token']}```", inline=False) embed.set_thumbnail(url=ctx.author.avatar_url) try: await ctx.author.send(embed=embed) await ctx.send( f"{self.bot.settings['formats']['success']} Your current admin token has been dmed to you.") except: await ctx.send("Your dms appear to be closed") else: await ctx.send( f"{self.bot.settings['formats']['noPerms']} **Invalid permission(s):** You need to be a " f"DEL admin to obtain one of these.") def setup(bot): bot.add_cog(AdminCog(bot)) ================================================ FILE: cogs/help.py ================================================ # Discord Extreme List - Discord's unbiased list. # Copyright (C) 2020-2025 Carolina Mitchell, Advaith Jagathesan, John Burke # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . import json import discord from discord.ext import commands from .types import userTypes with open("settings.json") as content: settings = json.load(content) class BotClass: settings = settings class HelpCommand(commands.HelpCommand): def __init__(self, *args, **kwargs): self.bot = BotClass self.show_hidden = False self.verify_checks = True self.mod_cogs = ["Tickets", "Notes"] self.admin_cogs = ["Admin", "Jishaku"] self.jishaku_under_cog = "Admin" self.ignore_cogs = ["Events"] super().__init__(command_attrs={ "help": "Shows the help about the bot and/or commands.", "brief": "See cog/command help", "usage": "[category / command]", "name": "help" }) async def embed_colour(self, ctx): global colour bot_guild_member = await ctx.guild.fetch_member(ctx.bot.user.id) if len(str(bot_guild_member.colour.value)) == 1: colour = 0xFFFFFA else: colour = bot_guild_member.colour.value return colour def get_command_signature(self, command): return command.qualified_name async def command_callback(self, ctx, *, command=None): """|coro| The actual implementation of the help command. It is not recommended to override this method and instead change the behaviour through the methods that actually get dispatched. - :meth:`send_bot_help` - :meth:`send_cog_help` - :meth:`send_group_help` - :meth:`send_command_help` - :meth:`get_destination` - :meth:`command_not_found` - :meth:`subcommand_not_found` - :meth:`send_error_message` - :meth:`on_help_command_error` - :meth:`prepare_help_command` """ await self.prepare_help_command(ctx, command) if command is None: mapping = self.get_bot_mapping() return await self.send_bot_help(mapping) # Check if it's a cog cog = ctx.bot.get_cog(command.title()) if command.title().lower() != "jishaku": if cog is not None: return await self.send_cog_help(cog) else: return await self.send_group_help(ctx.bot.get_command("jishaku")) maybe_coro = discord.utils.maybe_coroutine # If it's not a cog then it's a command. # Since we want to have detailed errors when someone # passes an invalid subcommand, we need to walk through # the command group chain ourselves. keys = command.split(' ') cmd = ctx.bot.all_commands.get(keys[0]) if cmd is None: string = await maybe_coro(self.command_not_found, self.remove_mentions(keys[0])) return await self.send_error_message(string) for key in keys[1:]: try: found = cmd.all_commands.get(key) except AttributeError: string = await maybe_coro(self.subcommand_not_found, cmd, self.remove_mentions(key)) return await self.send_error_message(string) else: if found is None: string = await maybe_coro(self.subcommand_not_found, cmd, self.remove_mentions(key)) return await self.send_error_message(string) cmd = found if isinstance(cmd, commands.Group): return await self.send_group_help(cmd) else: return await self.send_command_help(cmd) async def send_bot_help(self, mapping): """ Sends bot help. """ embed = discord.Embed(color=await self.embed_colour(self.context)) embed.title = f"{self.context.bot.settings['emoji']['home']} Help: Menu" embed.description = f"All commands use the prefix `{self.bot.settings['prefix'][0]}` or " \ f"`@{str(self.context.bot.user)}`." for extension in self.context.bot.cogs.values(): if extension.qualified_name in self.ignore_cogs or extension.qualified_name == "Jishaku": continue db_user: userTypes.DelUser = await self.context.bot.db.users.find_one({"_id": str(self.context.author.id)}) if db_user: if extension.qualified_name in self.mod_cogs and not db_user["rank"]["mod"]: continue if extension.qualified_name in self.admin_cogs and not db_user["rank"]["admin"]: continue else: if extension.qualified_name in self.mod_cogs or extension.qualified_name in self.admin_cogs: continue extension_commands = "" for command in set(extension.get_commands()): if not command.hidden: mod = False for check in command.checks: if check.__qualname__.startswith("mod_check"): mod = True if mod and db_user: if db_user["rank"]["mod"]: if len(extension_commands) == 0: extension_commands += f"`{command.qualified_name}`" else: extension_commands += f", `{command.qualified_name}`" else: continue elif mod and not db_user: continue else: if len(extension_commands) == 0: extension_commands += f"`{command.qualified_name}`" else: extension_commands += f", `{command.qualified_name}`" else: continue if extension.qualified_name == self.jishaku_under_cog: jsk_extension = self.context.bot.get_cog("Jishaku") if not jsk_extension.jsk.hidden: extension_commands += ", `jishaku`" embed.add_field(name=f"{extension.help_icon} {extension.qualified_name}", value=extension_commands, inline=False) await self.context.send(embed=embed) async def send_command_help(self, command): """ Sends help for a specific command. """ db_user: userTypes.DelUser = await self.context.bot.db.users.find_one({"_id": str(self.context.author.id)}) if db_user: if command.cog_name in self.ignore_cogs: return await self.send_error_message(self.command_not_found(command.name)) if command.cog_name in self.mod_cogs and not db_user["rank"]["mod"]: return await self.send_error_message(self.command_not_found(command.name)) if self.context.bot.settings["ownership"]["multiple"]: if command.cog_name in self.admin_cogs and self.context.author.id not in \ self.bot.settings["ownership"]["owners"]: return await self.send_error_message(self.command_not_found(command.name)) else: if command.cog_name in self.admin_cogs and self.context.author.id != \ self.bot.settings["ownership"]["owner"]: return await self.send_error_message(self.command_not_found(command.name)) if command.hidden: return await self.send_error_message(self.command_not_found(command.name)) else: pass aliases = '`' + '`, `'.join(command.aliases) + "`" if aliases == "``" or aliases == '`': aliases = "No aliases were found." if command.help: description = str(command.help) else: description = "No description provided." command.help_icon = self.bot.settings["emoji"]["info"] command.help_name = command.qualified_name embed = discord.Embed(description=description, colour=await self.embed_colour(self.context)) embed.title = f"{command.help_icon} Help: {command.help_name}" embed.add_field(name="Usage", value=f"{self.clean_prefix}{command.signature}") embed.add_field(name="Aliases", value=aliases) await self.context.send(embed=embed) async def send_group_help(self, group): """ Sends help for a specific group. """ db_user: userTypes.DelUser = await self.context.bot.db.users.find_one({"_id": str(self.context.author.id)}) if db_user: if group.cog_name in self.ignore_cogs: return await self.send_error_message(self.command_not_found(group.name)) if group.cog_name in self.mod_cogs and not db_user["rank"]["mod"]: return await self.context.channel.send(f"{self.bot.settings['formats']['noPerms']} **Invalid " f"permission(s):** The specified command requires you to have " f"Moderator permissions to access.") if self.context.bot.settings["ownership"]["multiple"]: if group.cog_name in self.admin_cogs and self.context.author.id not in \ self.bot.settings["ownership"]["owners"] and not db_user["rank"]["admin"]: return await self.context.channel.send(f"{self.bot.settings['formats']['noPerms']} **Invalid " f"permission(s):** The specified command requires you to " f"have Administrator permissions to access.") else: if group.cog_name in self.admin_cogs and self.context.author.id != \ self.bot.settings["ownership"]["owner"] and not db_user["rank"]["admin"]: return await self.context.channel.send(f"{self.bot.settings['formats']['noPerms']} **Invalid " f"permission(s):** The specified command requires you to " f"have Administrator permissions to access.") if group.hidden: return await self.send_error_message(self.command_not_found(group.name)) else: pass sub_commands = "" for group_command in group.commands: sub_commands += '`' + group_command.name + f'`, ' aliases = "`" + '`, `'.join(group_command.root_parent.aliases) + '`' if aliases == "``": aliases = "No aliases were found." if group_command.root_parent == self.context.bot.get_command("jishaku"): cmd_signature = "jishaku [subCommand]" else: cmd_signature = group_command.root_parent if group_command.root_parent.help: description = str(group_command.root_parent.help) else: description = "No help provided." group.help_icon = self.bot.settings["emoji"]["info"] group.help_name = self.get_command_signature(group_command.root_parent) if group.cog_name.lower() == "jishaku": group.help_icon = self.bot.settings["emoji"]["coder"] group.help_name = "Jishaku" embed = discord.Embed(description=description, colour=await self.embed_colour(self.context)) embed.title = f"{group.help_icon} Help: {group.help_name}" embed.add_field(name="Usage", value=f"{self.clean_prefix}{cmd_signature}") embed.add_field(name="Aliases", value=aliases) embed.add_field(name=f"Subcommands ({len(group.commands)})", value=sub_commands[:-2], inline=False) await self.context.send(embed=embed) async def send_cog_help(self, cog): """ Sends help for a specific cog. """ db_user: userTypes.DelUser = await self.context.bot.db.users.find_one({"_id": str(self.context.author.id)}) if db_user: if cog.qualified_name in self.ignore_cogs: return await self.send_error_message(self.command_not_found(cog.qualified_name)) if cog.qualified_name in self.mod_cogs and not db_user["rank"]["mod"]: return await self.context.channel.send(f"{self.bot.settings['formats']['noPerms']} **Invalid " f"permission(s):** The specified cog requires you to have " f"Moderator permissions to access.") if self.context.bot.settings["ownership"]["multiple"]: if cog.qualified_name in self.admin_cogs and self.context.author.id not in \ self.bot.settings["ownership"]["owners"] and not db_user["rank"]["admin"]: return await self.context.channel.send(f"{self.bot.settings['formats']['noPerms']} **Invalid " f"permission(s):** The specified cog requires you to have " f"Administrator permissions to access.") else: if cog.qualified_name in self.admin_cogs and self.context.author.id != \ self.bot.settings["ownership"]["owner"] and not db_user["rank"]["admin"]: return await self.context.channel.send(f"{self.bot.settings['formats']['noPerms']} **Invalid " f"permission(s):** The specified cog requires you to have " f"Administrator permissions to access.") else: pass cog_commands = "" for command in cog.get_commands(): if command.hidden: continue if command.description is None: brief = "No information." else: brief = command.description cog_commands += f"`{command.qualified_name}` - {brief}\n" if cog.qualified_name == "Jishaku": cog.help_icon = self.bot.settings["emoji"]["coder"] cog_commands += f"*For information on the command type:* `{self.bot.settings['prefix'][0]}help jsk`." elif cog.qualified_name == self.jishaku_under_cog: jsk_extension = self.context.bot.get_cog("Jishaku") if not jsk_extension.jsk.hidden: cog_commands += "`jishaku` - The Jishaku debug and diagnostic commands." embed = discord.Embed(description=cog_commands, colour=await self.embed_colour(self.context)) embed.title = f"{cog.help_icon} Help: {cog.qualified_name} ({len(cog.get_commands())})" await self.context.send(embed=embed) def command_not_found(self, string): return f"{self.bot.settings['formats']['error']} **Not found:** No command or cog called " \ f"**\"**{discord.utils.escape_markdown(string, as_needed=False)}**\"** found." def setup(bot): bot.help_command = HelpCommand() ================================================ FILE: cogs/notes.py ================================================ # Discord Extreme List - Discord's unbiased list. # Copyright (C) 2020-2025 Carolina Mitchell, Advaith Jagathesan, John Burke # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . import datetime import time import discord from discord.ext import commands from cogs.types import botTypes from ext.checks import mod_check, NoSomething import typing def check_s_end(string): if string.endswith("s"): return True else: return False class BotNotesCog(commands.Cog, name="Notes"): def __init__(self, bot): self.bot = bot self.help_icon = f"{self.bot.settings['emoji']['notepad']}" async def embed_colour(self, ctx): """ Gets the bots display colour and returns a colour code able to be used on embeds. """ global colour bot_guild_member = await ctx.guild.fetch_member(self.bot.user.id) if len(str(bot_guild_member.colour.value)) == 1: colour = 0xFFFFFA else: colour = bot_guild_member.colour.value return colour async def check_bot(self, ctx, bot: typing.Union[discord.User, str]): """ Runs the inputted string or discord.User object through various tests to determine if it is a Discord bot in the site database, and a valid user, etc. """ if isinstance(bot, discord.User): pass elif isinstance(bot, str): if bot.isdigit(): try: bot = await ctx.bot.fetch_user(bot) except Exception as e: return await ctx.send( f"{self.bot.settings['formats']['error']} **An error occurred:**\n```py\n{e}```") elif not bot.isdigit(): return await ctx.send( f"{self.bot.settings['formats']['error']} **Unknown bot:** We could not find a bot with the " f"arguments you provided - Try using an ID so I can fetch it?") if not bot.bot: return await ctx.send(f"{self.bot.settings['formats']['error']} **Invalid bot:** {bot} is not a bot.") return bot @commands.command(name="add-note", aliases=["addnote", "insertnote"], usage="add-note ", description="Allows moderators to add a note to a bot in the site database.") @commands.guild_only() @mod_check() async def add_note(self, ctx, bot: typing.Union[discord.User, str], *, note: str): """ Allows moderators to add a note to a bot in the site database. """ bot = await self.check_bot(ctx, bot) bot_db: botTypes.DelBot = await ctx.bot.db.bots.find_one({ "_id": str(bot.id) }) if not bot_db: raise NoSomething(bot) notes_db = bot_db["reviewNotes"] notes_db.append({ "note": note, "author": str(ctx.author.id), "date": time.time() * 1000 }) await ctx.bot.db.bots.update_one({"_id": str(bot_db["_id"])}, { "$set": { "reviewNotes": notes_db } }) return await ctx.send(f"{self.bot.settings['formats']['success']} **Success:** I have successfully added your " f"note to {bot_db['name']}.") @commands.command(name="remove-note", aliases=["removenote", "delnote", "del-note", "delete-note", "deletenote"], usage="remove-note ", description="Allows moderators to remove a note from a bot.") @commands.guild_only() @mod_check() async def remove_note(self, ctx, bot: typing.Union[discord.User, str], *, note: int): """ Allows moderators to remove a note from a bot. """ bot = await self.check_bot(ctx, bot) bot_db: botTypes.DelBot = await ctx.bot.db.bots.find_one({ "_id": str(bot.id) }) if not bot_db: raise NoSomething(bot) notes_db = bot_db["reviewNotes"] if note > len(notes_db) or note < 1: return await ctx.send(f"{self.bot.settings['formats']['error']} **Doesn't exist:** The note you're trying " f"to delete doesn't exist.") del notes_db[(note - 1)] await ctx.bot.db.bots.update_one({"_id": str(bot_db["_id"])}, { "$set": { "reviewNotes": notes_db } }) return await ctx.send( f"{self.bot.settings['formats']['success']} **Success:** I have successfully removed note #{note} " f"from {bot_db['name']}.") @commands.command(name="notes", usage="notes ", description="Allows moderators to view all of a bots notes.") @commands.guild_only() @mod_check() async def notes(self, ctx, *, bot: typing.Union[discord.User, str]): """ Allows moderators to view all of a bots notes. """ bot = await self.check_bot(ctx, bot) bot_db: botTypes.DelBot = await ctx.bot.db.bots.find_one({ "_id": str(bot.id) }) if not bot_db: raise NoSomething(bot) if not bot_db["reviewNotes"]: return await ctx.send(f"{self.bot.settings['formats']['info']} **No notes:** This bot does not have " f"any notes.") if check_s_end(bot_db["name"]): title = f"{bot_db['name']}' Notes" else: title = f"{bot_db['name']}'s Notes" embed = discord.Embed(title=title, colour=await self.embed_colour(ctx)) embed.set_thumbnail(url=bot.avatar_url if not bot_db.get("avatar") else bot_db["avatar"]["url"]) pos = 1 for note in bot_db["reviewNotes"]: try: user = str(await self.bot.fetch_user(note["author"])) except discord.NotFound: user = str(note["author"]) date = datetime.datetime.utcfromtimestamp(note["date"] / 1000).strftime(f"%I:%M%p - %a, %d %b %Y (GMT)") embed.add_field(name=f"Note #{pos}", value=f"-> **{discord.utils.escape_markdown(user, as_needed=False)} " f"- {date}**\n" + note["note"], inline=False) pos += 1 await ctx.send(embed=embed) def setup(bot): bot.add_cog(BotNotesCog(bot)) ================================================ FILE: cogs/tags.py ================================================ # Discord Extreme List - Discord's unbiased list. # Copyright (C) 2020-2025 Carolina Mitchell, Advaith Jagathesan, John Burke # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . import asyncio import time from typing import List, Union, Optional from io import BytesIO import discord from discord.ext import commands from ext.checks import mod_check from .types import tagTypes class TagsCog(commands.Cog, name="Tags"): def __init__(self, bot): self.bot = bot self.help_icon = f"{self.bot.settings['emoji']['label']}" async def embed_colour(self, ctx): """ Gets the bots display colour and returns a colour code able to be used on embeds. """ global colour bot_guild_member = await ctx.guild.fetch_member(self.bot.user.id) if len(str(bot_guild_member.colour.value)) == 1: colour = 0xFFFFFA else: colour = bot_guild_member.colour.value return colour async def tag_name_exists(self, name: str) -> Union[List[bool], Optional[tagTypes.DelTag]]: """ Checks if a tag name or alias matching the name specified exists in the database. Returns a boolean stating whether the tag exists in an array in position 0. If boolean in pos 0 is True, pos 1 will contain the tag. """ all_tags = self.bot.db.tags.find() async for tag in all_tags: if tag["_id"] == name.lower(): return [True, tag] if tag["aliases"] is not None and len(tag["aliases"]) > 0: for alias in tag["aliases"]: if alias == name.lower(): return [True, tag] return [False] async def tag_exists_error(self, ctx, name): """ Sends an error message stating that there is a tag name/alias conflict. """ return await ctx.send(f"{self.bot.settings['formats']['error']} **Name conflict:** A tag or tag alias with " f"the name **\"**{discord.utils.escape_markdown(name, as_needed=False)}**\"** already" f" exists.") async def tag_nf_error(self, ctx, name): """ Sends an error message stating that the specified tag does not exist. """ return await ctx.send(f"{self.bot.settings['formats']['error']} **Not found:** A tag with the name of " f"**\"**{discord.utils.escape_markdown(name, as_needed=False)}**\"** was not found.") @commands.command(name="create-tag", aliases=["newtag", "new-tag", "add-tag", "addtag"], usage="create-tag ", description="Allows moderators to create a tag.") @commands.guild_only() @mod_check() async def create_tag(self, ctx, name: str, *, tag: str): """ Allows moderators to create a tag. """ tag_name_exists = await self.tag_name_exists(name) if tag_name_exists[0]: return await self.tag_exists_error(ctx, name) try: def check(r, u): return r.message.id == language_picker.id and u.id != ctx.bot.user.id language_picker = await ctx.send("Which language are you creating this tag in?") await language_picker.add_reaction(self.bot.settings["emoji"]["flags"]["britian"]) await language_picker.add_reaction(self.bot.settings["emoji"]["flags"]["turkey"]) await language_picker.add_reaction(self.bot.settings["emoji"]["flags"]["france"]) await language_picker.add_reaction(self.bot.settings["emoji"]["flags"]["portugal"]) await language_picker.add_reaction(self.bot.settings["emoji"]["flags"]["spain"]) responded = False languages = [] languages_dict = self.bot.settings["emoji"]["flags"] for language in languages_dict: languages.append(languages_dict[language]) while not responded: reaction, user = await self.bot.wait_for("reaction_add", check=check, timeout=30.0) if user.id != ctx.author.id: await language_picker.remove_reaction(reaction, user) elif str(reaction) not in languages: await language_picker.remove_reaction(reaction, user) elif user.id == ctx.author.id: await language_picker.clear_reactions() contents = { "en": "", "tr": "", "fr": "", "pt": "", "es": "" } reaction_name = "" if str(reaction) == self.bot.settings["emoji"]["flags"]["britian"]: contents["en"] = tag reaction_name = "English" elif str(reaction) == self.bot.settings["emoji"]["flags"]["turkey"]: contents["tr"] = tag reaction_name = "Turkish" elif str(reaction) == self.bot.settings["emoji"]["flags"]["france"]: contents["fr"] = tag reaction_name = "French" elif str(reaction) == self.bot.settings["emoji"]["flags"]["portugal"]: contents["pt"] = tag reaction_name = "Portuguese" elif str(reaction) == self.bot.settings["emoji"]["flags"]["spain"]: contents["es"] = tag reaction_name = "Spanish" await self.bot.db.tags.insert_one({ "_id": name.lower(), "creator": str(ctx.author.id), "creationDate": 0, "contents": contents, "aliases": [] }) return await ctx.channel.send(f"{self.bot.settings['formats']['success']} **Tag created:** A tag " f"with the name of " f"**\"**{discord.utils.escape_markdown(name, as_needed=False)}**\"**," f" in the language {reaction} **{reaction_name}** was successfully " f"created.") except asyncio.TimeoutError: return @commands.command(name="edit-tag", aliases=["modify-tag", "update-tag", "change-tag", "edittag"], usage="edit-tag ", description="Allows moderators to edit a tag.") @commands.guild_only() @mod_check() async def edit_tag(self, ctx, name: str, *, content: str): """ Allows moderators to edit a tag. """ tag = await self.tag_name_exists(name) if tag[0]: try: def check(r, u): return r.message.id == language_picker.id and u.id != ctx.bot.user.id language_picker = await ctx.send("Which language of this tag are you editing/adding?") await language_picker.add_reaction(self.bot.settings["emoji"]["flags"]["britian"]) await language_picker.add_reaction(self.bot.settings["emoji"]["flags"]["turkey"]) await language_picker.add_reaction(self.bot.settings["emoji"]["flags"]["france"]) await language_picker.add_reaction(self.bot.settings["emoji"]["flags"]["portugal"]) await language_picker.add_reaction(self.bot.settings["emoji"]["flags"]["spain"]) responded = False languages = [] languages_dict = self.bot.settings["emoji"]["flags"] for language in languages_dict: languages.append(languages_dict[language]) while not responded: reaction, user = await self.bot.wait_for("reaction_add", check=check, timeout=30.0) if user.id != ctx.author.id: await language_picker.remove_reaction(reaction, user) elif str(reaction) not in languages: await language_picker.remove_reaction(reaction, user) elif user.id == ctx.author.id: await language_picker.clear_reactions() contents = { "en": tag[1]["contents"]["en"], "tr": tag[1]["contents"]["tr"], "fr": tag[1]["contents"]["fr"], "pt": tag[1]["contents"]["pt"], "es": tag[1]["contents"]["es"] } contents_backup = \ discord.File(BytesIO((str(contents)).encode("utf-8")), filename=f"{tag[1]['_id']}-{time.time()}.json") reaction_name = "" if str(reaction) == self.bot.settings["emoji"]["flags"]["britian"]: contents["en"] = content reaction_name = "English" elif str(reaction) == self.bot.settings["emoji"]["flags"]["turkey"]: contents["tr"] = content reaction_name = "Turkish" elif str(reaction) == self.bot.settings["emoji"]["flags"]["france"]: contents["fr"] = content reaction_name = "French" elif str(reaction) == self.bot.settings["emoji"]["flags"]["portugal"]: contents["pt"] = content reaction_name = "Portuguese" elif str(reaction) == self.bot.settings["emoji"]["flags"]["spain"]: contents["es"] = content reaction_name = "Spanish" await ctx.bot.db.tags.update_one({"_id": tag[1]["_id"]}, { "$set": { "contents": contents } }) await ctx.author.send(content=f"Here's a backup of the tag " f"**\"**{discord.utils.escape_markdown(name, as_needed=False)}" f"**\"** which you just edited, before your edits were made. " f"Just in case!", file=contents_backup) return await ctx.channel.send(f"{self.bot.settings['formats']['success']} **Tag edited:** A tag" f" with the name of " f"**\"**{discord.utils.escape_markdown(name, as_needed=False)}**" f"\"**, in the language {reaction} **{reaction_name}** was " f"successfully edited.") except asyncio.TimeoutError: return else: return await self.tag_nf_error(ctx, name) @commands.command(name="tag-aliases", aliases=["alias-tag"], usage="tag-aliases ", description="Allows users to view a tag's aliases.") @commands.guild_only() async def tag_aliases(self, ctx, *, name: str): tag = await self.tag_name_exists(name) if tag[0]: if len(tag[1]["aliases"]) > 0: return await ctx.send(f"{self.bot.settings['formats']['info']} **Aliases:** This tag has the following " f"aliases - {'`' + '`, `'.join(tag[1]['aliases']) + '`'}.") else: return await ctx.send(f"{self.bot.settings['formats']['info']} **Aliases:** This tag has no aliases.") else: return await self.tag_nf_error(ctx, name) @commands.command(name="add-tag-alias", usage="add-tag-alias ", description="Allows moderators to add" " an alias for a tag.") @commands.guild_only() @mod_check() async def add_tag_aliases(self, ctx, name: str, *, alias: str): """ Allows moderators to add an alias for a tag. """ exists = await self.tag_name_exists(alias) tag = await self.tag_name_exists(name) if not exists[0] and tag[0]: if len(alias) > 20: return await ctx.send(f"{self.bot.settings['formats']['error']} **Too longth:** The alias name you " f"inputted is too long.") elif len(alias) < 2: return await ctx.send(f"{self.bot.settings['formats']['error']} **Too longth:** The alias name you " f"inputted is too short.") aliases = tag[1]["aliases"] aliases.append(alias.lower()) await ctx.bot.db.tags.update_one({"_id": tag[1]["_id"]}, { "$set": { "aliases": aliases } }) return await ctx.send(f"{self.bot.settings['formats']['success']} **Added alias:** The alias was " f"successfully added.") else: if exists[0]: return await ctx.send(f"{self.bot.settings['formats']['error']} **Duplicated alias:** This tag already " f"has this alias.") else: return await self.tag_nf_error(ctx, name) @commands.command(name="remove-tag-alias", usage="remove-tag-alias ", aliases=["del-tag-alias", "rm-tag-alias"], description="Allows moderators to remove an alias for " "a tag.") @commands.guild_only() @mod_check() async def remove_tag_alias(self, ctx, name: str, *, alias: str): """ Allows moderators to remove an alias for a tag. """ tag = await self.tag_name_exists(name) if tag[0]: if alias.lower() in tag[1]["aliases"]: aliases = tag[1]["aliases"] aliases.remove(alias.lower()) await ctx.bot.db.tags.update_one({"_id": tag[1]["_id"]}, { "$set": { "aliases": aliases } }) return await ctx.send(f"{self.bot.settings['formats']['success']} **Removed alias:** The alias was " f"successfully removed.") else: return await ctx.send(f"{self.bot.settings['formats']['error']} **Not found:** The specified alias " f"does not belong to the specified tag.") else: return await self.tag_nf_error(ctx, name) @commands.command(name="tags", usage="tags", aliases=["list-tags", "tag-list", "list-tag"], description="Shows all of the saved tags.") @commands.guild_only() async def tags(self, ctx): """ Shows all of the saved tags. """ all_tags = self.bot.db.tags.find() tags = "" async for tag in all_tags: tags += "`" + tag["_id"] + f"`, " if len(tags) > 0: await ctx.send(f"{self.bot.settings['formats']['info']} **Tags:** A full list of tags is available below:" f"\n\n{tags[:-2]}") else: await ctx.send(f"{self.bot.settings['formats']['info']} **Tags:** There are no saved tags.") @commands.command(name="raw-tag", usage="raw-tag ", aliases=["tag-raw", "txt-tag"], description="Allows moderators to get the content of a specific language of a tag in a raw file.") @commands.guild_only() @mod_check() async def raw_tag(self, ctx, *, name: str): """ Allows moderators to get the content of a specific language of a tag in a raw file. """ tag = await self.tag_name_exists(name) if tag[0]: try: def check(r, u): return r.message.id == language_picker.id and u.id != ctx.bot.user.id language_picker = await ctx.send("Which language do you want to get the raw text in for this tag?") if len(tag[1]["contents"]["en"]) > 0: await language_picker.add_reaction(self.bot.settings["emoji"]["flags"]["britian"]) if len(tag[1]["contents"]["tr"]) > 0: await language_picker.add_reaction(self.bot.settings["emoji"]["flags"]["turkey"]) if len(tag[1]["contents"]["fr"]) > 0: await language_picker.add_reaction(self.bot.settings["emoji"]["flags"]["france"]) if len(tag[1]["contents"]["pt"]) > 0: await language_picker.add_reaction(self.bot.settings["emoji"]["flags"]["portugal"]) if len(tag[1]["contents"]["es"]) > 0: await language_picker.add_reaction(self.bot.settings["emoji"]["flags"]["spain"]) responded = False languages = [] languages_dict = self.bot.settings["emoji"]["flags"] for language in languages_dict: languages.append(languages_dict[language]) while not responded: reaction, user = await self.bot.wait_for("reaction_add", check=check, timeout=30.0) if user.id != ctx.author.id: await language_picker.remove_reaction(reaction, user) elif str(reaction) not in languages: await language_picker.remove_reaction(reaction, user) elif user.id == ctx.author.id: await language_picker.clear_reactions() locale = "" if str(reaction) == self.bot.settings["emoji"]["flags"]["britian"]: locale = "en" elif str(reaction) == self.bot.settings["emoji"]["flags"]["turkey"]: locale = "tr" elif str(reaction) == self.bot.settings["emoji"]["flags"]["france"]: locale = "fr" elif str(reaction) == self.bot.settings["emoji"]["flags"]["portugal"]: locale = "pt" elif str(reaction) == self.bot.settings["emoji"]["flags"]["spain"]: locale = "es" raw_tag = discord.File(BytesIO((str(tag[1]["contents"][locale])).encode("utf-8")), filename=f"{tag[1]['_id']}-{time.time()}.txt") return await ctx.send(file=raw_tag) except asyncio.TimeoutError: return else: return await self.tag_nf_error(ctx, name) @commands.command(name="tag", aliases=["show-tag", "view-tag"], usage="tag ", description="Allows users to view a tag.") @commands.guild_only() async def tag(self, ctx, *, name: str): """ Allows users to view a tag. """ tag = await self.tag_name_exists(name) if tag[0]: try: def check(r, u): return r.message.id == language_picker.id and u.id != ctx.bot.user.id language_picker = await ctx.send("Which language do you want to view this tag in?") if len(tag[1]["contents"]["en"]) > 0: await language_picker.add_reaction(self.bot.settings["emoji"]["flags"]["britian"]) if len(tag[1]["contents"]["tr"]) > 0: await language_picker.add_reaction(self.bot.settings["emoji"]["flags"]["turkey"]) if len(tag[1]["contents"]["fr"]) > 0: await language_picker.add_reaction(self.bot.settings["emoji"]["flags"]["france"]) if len(tag[1]["contents"]["pt"]) > 0: await language_picker.add_reaction(self.bot.settings["emoji"]["flags"]["portugal"]) if len(tag[1]["contents"]["es"]) > 0: await language_picker.add_reaction(self.bot.settings["emoji"]["flags"]["spain"]) responded = False languages = [] languages_dict = self.bot.settings["emoji"]["flags"] for language in languages_dict: languages.append(languages_dict[language]) while not responded: reaction, user = await self.bot.wait_for("reaction_add", check=check, timeout=30.0) if user.id != ctx.author.id: await language_picker.remove_reaction(reaction, user) elif str(reaction) not in languages: await language_picker.remove_reaction(reaction, user) elif user.id == ctx.author.id: await language_picker.clear_reactions() locale = "" if str(reaction) == self.bot.settings["emoji"]["flags"]["britian"]: locale = "en" elif str(reaction) == self.bot.settings["emoji"]["flags"]["turkey"]: locale = "tr" elif str(reaction) == self.bot.settings["emoji"]["flags"]["france"]: locale = "fr" elif str(reaction) == self.bot.settings["emoji"]["flags"]["portugal"]: locale = "pt" elif str(reaction) == self.bot.settings["emoji"]["flags"]["spain"]: locale = "es" return await ctx.send(tag[1]["contents"][locale]) except asyncio.TimeoutError: return else: return await self.tag_nf_error(ctx, name) @commands.command(name="delete-tag", usage="delete-tag ", aliases=["remove-tag", "del-tag"], description="Allows moderators to delete a tag.") @commands.guild_only() @commands.cooldown(1, 120, commands.BucketType.user) @mod_check() async def delete_tag(self, ctx, *, name: str): """ Allows moderators to delete a tag. """ tag = await self.tag_name_exists(name) if tag[0]: try: def check(r, u): return r.message.id == language_picker.id and u.id != ctx.bot.user.id language_picker = await ctx.send("Are you sure you want to **__delete__** this tag?") await asyncio.sleep(1.75) await language_picker.add_reaction(self.bot.settings["emoji"]["check"]) await language_picker.add_reaction(self.bot.settings["emoji"]["cross"]) responded = False responses = [self.bot.settings["emoji"]["check"], self.bot.settings["emoji"]["cross"]] while not responded: reaction, user = await self.bot.wait_for("reaction_add", check=check, timeout=30.0) if user.id != ctx.author.id: await language_picker.remove_reaction(reaction, user) elif str(reaction) not in responses: await language_picker.remove_reaction(reaction, user) elif user.id == ctx.author.id: await language_picker.clear_reactions() if str(reaction) == self.bot.settings["emoji"]["check"]: tag_backup = \ discord.File(BytesIO((str(tag[1])).encode("utf-8")), filename=f"{tag[1]['_id']}-{time.time()}.json") await ctx.author.send(content=f"Here's a backup of the tag **\"**" f"{discord.utils.escape_markdown(name, as_needed=False)}" f"**\"** which you just deleted, Just in case!", file=tag_backup) await ctx.bot.db.tags.delete_one({"_id": tag[1]["_id"]}) return await ctx.send( f"{self.bot.settings['formats']['success']} **Deleted:** Successfully deleted the " f"specified tag.") else: return await ctx.send( f"{self.bot.settings['formats']['success']} **Cancelled:** Safely cancelled the " f"deletion of the specified tag.") except asyncio.TimeoutError: return else: return await self.tag_nf_error(ctx, name) def setup(bot): bot.add_cog(TagsCog(bot)) ================================================ FILE: cogs/tickets.py ================================================ # Discord Extreme List - Discord's unbiased list. # Copyright (C) 2020-2025 Carolina Mitchell, Advaith Jagathesan, John Burke # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . import discord from discord.ext import commands from ext.checks import mod_check from datetime import datetime import traceback import snowflake import typing from io import BytesIO from .types import ticketTypes class TicketCog(commands.Cog, name="Tickets"): def __init__(self, bot): self.bot = bot self.help_icon = f"{self.bot.settings['emoji']['ticket']}" self.generator = snowflake.Generator() self.closed = 0xdd2e44 self.awaiting_response = 0x77ff77 self.awaiting_fixes = 0xf4dd1a async def snowflake_generate(self): """ Generates a snowflake ID and checks to ensure it is not a duplicate. """ while True: generated = self.generator.generate() check_db: ticketTypes.DelTicket = await self.bot.db.tickets.find_one({"_id": str(generated)}) if not check_db: return generated @commands.command(name="open-ticket", aliases=["new-ticket", "nt", "ot", "request-changes", "rc", "create-ticket", "open", "create"], usage="open-ticket ", description="Allows you to open a ticket with the specified bots' developer.") @commands.guild_only() @mod_check() async def open_ticket(self, ctx, bot: typing.Union[discord.User, str]): """ Allows you to open a ticket with the specified bots' developer. """ if isinstance(bot, discord.User): pass elif isinstance(bot, str): if bot.isdigit(): try: bot = await ctx.bot.fetch_user(bot) except Exception as e: return await \ ctx.send(f"{self.bot.settings['formats']['error']} **An error occurred:**\n```py\n{e}```") elif not bot.isdigit(): return await ctx.send(f"{self.bot.settings['formats']['error']} **Unknown bot:** We could not find a " f"bot with the arguments you provided - Try using an ID so I can fetch it?") if not bot.bot: return await ctx.send(f"{self.bot.settings['formats']['error']} **Invalid bot:** {bot} is not a bot.") for channel in ctx.guild.channels: if channel.name == bot.name.lower(): return await ctx.send(f"{self.bot.settings['formats']['error']} **Duplicated channel:** there is " f"already a channel for this bot.") try: bot_db = await ctx.bot.db.bots.find_one({ "_id": str(bot.id) }) ticket_id = await self.snowflake_generate() category = ctx.guild.get_channel(int(self.bot.settings["channels"]["ticketCategory"])) owner = ctx.guild.get_member(int(bot_db["owner"]["id"])) mods = ctx.guild.get_role(int(self.bot.settings["roles"]["mod"])) serverbots = ctx.guild.get_role(int(self.bot.settings['roles']['botpower'])) if owner is None: return await ctx.send(f"{self.bot.settings['formats']['error']} **Owner Missing:** The bot owner is " f"not in the server!") overwrites = { ctx.guild.default_role: discord.PermissionOverwrite(read_messages=False), owner: discord.PermissionOverwrite(read_messages=True, send_messages=True), mods: discord.PermissionOverwrite(read_messages=True, send_messages=True), serverbots: discord.PermissionOverwrite(read_messages=True, send_messages=True) } channel = await category.create_text_channel(name=bot.name.lower(), overwrites=overwrites, reason=f"Approval feedback channel - {ctx.author.id}", topic=f"{self.bot.settings['website']['url']}/bots/{bot.id}") embed = discord.Embed(colour=self.awaiting_response, description="Hello, whilst reviewing your bot we found some issues, please refer to " "the message(s) the staff member has sent below. Please do not ping staff members " "when replying.", timestamp=datetime.utcnow()) embed.set_author(name=f"Approval Feedback - {ticket_id} [AWAITING RESPONSE]", icon_url=self.bot.settings["images"]["awaiting_response"]) embed.set_footer(text=f"{str(bot)} ({bot.id})", icon_url=str(bot.avatar_url)) message = await channel.send(content=owner.mention, embed=embed, allowed_mentions=discord.AllowedMentions(users=True)) await message.pin() await ctx.send(f"{self.bot.settings['formats']['success']} **Ticket created:** Successfully created " f"ticket - <#{channel.id}>.") embed2 = discord.Embed(color=self.awaiting_response) embed2.set_author(name=f"Approval Feedback - {ticket_id} [AWAITING RESPONSE]", icon_url=self.bot.settings["images"]["awaiting_response"]) embed2.set_footer(text=f"{str(bot)} ({bot.id})", icon_url=str(bot.avatar_url)) embed2.add_field(name="Channel", value=f"<#{channel.id}>") embed2.add_field(name="Developer", value=f"[{str(owner)}]({self.bot.settings['website']['url']}/users/" f"{owner.id}) (`{owner.id}`)") testguild = self.bot.get_guild(int(self.bot.settings['guilds']['staff'])) fixesrole = testguild.get_role(int(self.bot.settings['roles']['fixesBot'])) memberbot = testguild.get_member(bot.id) if memberbot is not None: await memberbot.add_roles(fixesrole, reason='Bot is Awaiting Fixes.') log_channel = ctx.guild.get_channel(int(self.bot.settings["channels"]["ticketLog"])) log_msg = await log_channel.send(embed=embed2) await self.bot.db.tickets.insert_one({ "_id": str(ticket_id), "ids": { "channel": str(channel.id), "message": str(message.id), "log": str(log_msg.id), "bot": str(bot.id) }, "status": 0, "closureReason": None }) except Exception as e: return await ctx.send(f"{self.bot.settings['formats']['error']} **An error occurred:**\n```{e}```") @commands.command(name="awaiting-fixes", aliases=["awaiting-changes", "af", "ac", "fixes", "changes"], usage="awaiting-fixes", description="Updates the current ticket channel's status to Awaiting " "Fixes.") @commands.guild_only() @mod_check() async def awaiting_fixes(self, ctx): """ Updates the current ticket channel's status to Awaiting Fixes. """ await ctx.message.delete() status_check: ticketTypes.DelTicket = await self.bot.db.tickets.find_one({ "ids.channel": str(ctx.channel.id) }) if status_check: message = await ctx.channel.fetch_message(int(status_check["ids"]["message"])) embed = message.embeds[0] embed.colour = self.awaiting_fixes embed.set_author(name=f"Approval Feedback - {status_check['_id']} [AWAITING FIXES]", icon_url=self.bot.settings["images"]["awaiting_fixes"]) await message.edit(embed=embed) await ctx.send(f"{self.bot.settings['formats']['ticketStatus']} **Ticket update:** Changed ticket " f"status to `Awaiting Fixes`.") ticket: ticketTypes.DelTicket = await self.bot.db.tickets.find_one({ "ids.message": str(message.id) }) log_msg = await ctx.guild.get_channel(int(self.bot.settings["channels"]["ticketLog"])) \ .fetch_message(int(ticket["ids"]["log"])) embed2 = log_msg.embeds[0] embed2.colour = self.awaiting_fixes embed2.set_author(name=f"Approval Feedback - {status_check['_id']} [AWAITING FIXES]", icon_url=self.bot.settings["images"]["awaiting_fixes"]) await log_msg.edit(embed=embed2) await ctx.bot.db.tickets.update_one({"ids.channel": str(ctx.channel.id)}, { "$set": { "status": 1 } }) elif status_check and status_check["status"] == 1: return await ctx.send(f"{self.bot.settings['formats']['error']} **No changes:** This ticket is already set " f"as `Awaiting Fixes`.", delete_after=5) else: return await ctx.send(f"{self.bot.settings['formats']['error']} **Invalid channel:** This is not a valid " f"ticket channel.") @commands.command(name="close-ticket", aliases=["ct", "close"], usage="close-ticket", description="Closes the ticket whose ticket channel you run it in.") @commands.guild_only() @mod_check() async def close_ticket(self, ctx, *, reason: str): """ Closes the ticket whose ticket channel you run it in. """ try: message_id: ticketTypes.DelTicket = await self.bot.db.tickets.find_one({ "ids.channel": str(ctx.channel.id) }) if len(reason) > 500: return await ctx.send( f"{self.bot.settings['formats']['error']} **Invalid length:** The reason you provided is too " f"long. (`{len(reason) / 500}`)") if message_id: channel_name = ctx.channel.name messages = [] for message in await ctx.channel.history().flatten(): messages.append(f"[{message.created_at}] {message.author} - {message.content}\n") messages.reverse() file = discord.File(BytesIO(("".join(messages)).encode("utf-8")), filename=f"{message_id['_id']}.txt") await ctx.channel.delete(reason=f"Approval feedback closed - Author: {ctx.author.id}, Ticket ID: " f"{message_id['_id']}") log_message = await ctx.guild.get_channel(int(self.bot.settings["channels"]["ticketLog"])) \ .fetch_message(message_id["ids"]["log"]) guild = self.bot.get_guild(int(self.bot.settings["guilds"]["messageLog"])) message_history = await guild.get_channel(int(self.bot.settings["channels"]["messageLog"])) \ .send(content=log_message.jump_url, file=file) embed = log_message.embeds[0] embed.colour = self.closed embed.remove_field(0) embed.insert_field_at(0, name="Channel", value=f"[#{channel_name}](https://txt.discord.website/?txt=" f"{self.bot.settings['channels']['messageLog']}" f"/{message_history.attachments[0].id}/" f"{message_id['_id']})") embed.set_author(name=f"Approval Feedback - {message_id['_id']} [CLOSED]", icon_url=self.bot.settings["images"]["closed"]) await log_message.edit(embed=embed) await ctx.bot.db.tickets.update_one({"_id": str(message_id['_id'])}, { "$set": { "status": 2, "closureReason": reason, "ids.history": str(message_history.id) } }) else: return await ctx.send(f"{self.bot.settings['formats']['error']} **Invalid channel:** This is not a " f"valid ticket channel.") except Exception as e: tb = traceback.format_exception(type(e), e, e.__traceback__) print("".join(tb)) await ctx.author.send(f"Error occured! {e}") def setup(bot): bot.add_cog(TicketCog(bot)) ================================================ FILE: cogs/types/__init__.py ================================================ # Discord Extreme List - Discord's unbiased list. # Copyright (C) 2020-2025 Carolina Mitchell, Advaith Jagathesan, John Burke # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . ================================================ FILE: cogs/types/botTypes.py ================================================ # Discord Extreme List - Discord's unbiased list. # Copyright (C) 2020-2025 Carolina Mitchell, Advaith Jagathesan, John Burke # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . from typing import TypedDict, List, Optional from .globalTypes import DelOwner, DelImage from .discordTypes import DiscordUserFlags class DelBotReviewNote(TypedDict): note: str author: str date: int class DelBotVotes(TypedDict): positive: List[str] negative: List[str] class DelBotLinks(TypedDict): invite: str support: str website: str donation: str repo: str privacyPolicy: str class DelBotSocial(TypedDict): twitter: str class DelBotTheme(TypedDict): useCustomColour: bool colour: bool banner: str class DelBotWidgetBot(TypedDict): channel: str options: str server: str class DelBotStatus(TypedDict): approved: bool premium: bool siteBot: bool archived: bool class DelBot(TypedDict): _id: str clientID: str name: str prefix: str library: str tags: List[str] vanityUrl: str serverCount: int shardCount: int inServer: Optional[bool] token: str flags: DiscordUserFlags shortDesc: str longDesc: str modNotes: str reviewNotes: List[DelBotReviewNote] editors: List[str] owner: DelOwner avatar: DelImage votes: DelBotVotes links: DelBotLinks social: DelBotSocial theme: DelBotTheme widgetbot: DelBotWidgetBot status: DelBotStatus ================================================ FILE: cogs/types/discordTypes.py ================================================ # Discord Extreme List - Discord's unbiased list. # Copyright (C) 2020-2025 Carolina Mitchell, Advaith Jagathesan, John Burke # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . from typing import TypedDict, List, Optional from enum import Enum class DiscordUserFlags(Enum): Nil = 0 DiscordEmployee = 1 DiscordPartner = 2 DiscordHypeSquadEvents = 4 BugHunterLevel1 = 8 HypeSquadHouseBravery = 64 HypeSquadHouseBrilliance = 128 HypeSquadHouseBalance = 256 EarlySupporter = 512 TeamUser = 1024 System = 4096 BugHunterLevel2 = 16384 VerifiedBot = 65536 VerifiedBotDeveloper = 131072 class DiscordUserPremiumType(Enum): Nil = 0 NitroClassic = 1 Nitro = 2 class DiscordUser(TypedDict): id: str username: str discriminator: str avatar: str bot: Optional[bool] system: Optional[bool] mfa_enabled: Optional[bool] locale: Optional[str] verified: Optional[bool] email: Optional[str] flags: Optional[DiscordUserFlags] premium_type: DiscordUserPremiumType public_flags: Optional[DiscordUserFlags] class DiscordRoleTags(TypedDict): bot_id: Optional[str] # premium_subscriber: None integration_id: Optional[str] class DiscordRole(TypedDict): id: str name: str color: int hoist: bool position: int permissions: int # DEPRECATED - Use permissions_new instead permissions_new: str managed: bool mentionable: bool tags: Optional[DiscordRoleTags] class DiscordPartialChannel(TypedDict): id: str type: str name: str class DiscordOverwriteTypes(Enum): Member = "member" Role = "role" class DiscordOverwrites(TypedDict): id: str type: DiscordOverwriteTypes allow: int # DEPRECATED - Use allow_new instead allow_new: str deny: int # DEPRECATED - Use deny_new instead deny_new: str class DiscordChannel(DiscordPartialChannel): guild_id: Optional[str] position: int permission_overwrites: Optional[List[DiscordOverwrites]] topic: Optional[str] nsfw: Optional[bool] last_message_id: Optional[str] bitrate: Optional[int] user_limit: Optional[int] rate_limit_per_user: Optional[int] recipients: Optional[DiscordUser] icon: Optional[str] owner_id: Optional[str] application_id: Optional[str] parent_id: Optional[str] last_pin_timestamp: Optional[str] ================================================ FILE: cogs/types/globalTypes.py ================================================ # Discord Extreme List - Discord's unbiased list. # Copyright (C) 2020-2025 Carolina Mitchell, Advaith Jagathesan, John Burke # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . from typing import TypedDict class DelOwner(TypedDict): id: str class DelImage(TypedDict): hash: str url: str class DelAdminToken(TypedDict): _id: str token: str lastUpdate: int validUntil: int ================================================ FILE: cogs/types/serverTypes.py ================================================ # Discord Extreme List - Discord's unbiased list. # Copyright (C) 2020-2025 Carolina Mitchell, Advaith Jagathesan, John Burke # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . from typing import TypedDict, List from .globalTypes import DelOwner, DelImage class DelServerLinks(TypedDict): invite: str website: str donation: str class DelServerStatus(TypedDict): reviewRequired: bool class DelServer(TypedDict): _id: str inviteCode: str name: str shortDesc: str longDesc: str tags: List[str] previewChannel: str owner: DelOwner icon: DelImage links: DelServerLinks status: DelServerStatus ================================================ FILE: cogs/types/tagTypes.py ================================================ # Discord Extreme List - Discord's unbiased list. # Copyright (C) 2020-2025 Carolina Mitchell, Advaith Jagathesan, John Burke # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . from typing import TypedDict, List, Optional class DelTagContents(TypedDict): en: str tr: str fr: str pt: str class DelTag(TypedDict): _id: str creator: str creationDate: int contents: DelTagContents aliases: Optional[List[str]] ================================================ FILE: cogs/types/templateTypes.py ================================================ # Discord Extreme List - Discord's unbiased list. # Copyright (C) 2020-2025 Carolina Mitchell, Advaith Jagathesan, John Burke # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . from typing import TypedDict, List from .globalTypes import DelOwner, DelImage from .discordTypes import DiscordRole, DiscordChannel class DelTemplateLinks(TypedDict): linkToServerPage: bool template: str class DelTemplate(TypedDict): _id: str name: str region: str locale: str afkTimeout: int verificationLevel: int defaultMessageNotifications: int explicitContent: int roles: List[DiscordRole] channels: List[DiscordChannel] usageCount: int shortDesc: str longDesc: str tags: List[str] fromGuild: str owner: DelOwner icon: DelImage links: DelTemplateLinks ================================================ FILE: cogs/types/ticketTypes.py ================================================ # Discord Extreme List - Discord's unbiased list. # Copyright (C) 2020-2025 Carolina Mitchell, Advaith Jagathesan, John Burke # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . from typing import TypedDict, Optional from enum import Enum class DelTicketIds(TypedDict): channel: str message: str log: str bot: str history: Optional[str] class DelTicketStatus(Enum): AwaitingResponse = 0 AwaitingFixes = 1 Closed = 2 class DelTicket(TypedDict): _id: str ids: DelTicketIds status: DelTicketStatus closureReason: Optional[str] ================================================ FILE: cogs/types/userStaffTrackingTypes.py ================================================ # Discord Extreme List - Discord's unbiased list. # Copyright (C) 2020-2025 Carolina Mitchell, Advaith Jagathesan, John Burke # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . from typing import TypedDict, List, Optional class DelStaffTrackingDetailsAway(TypedDict): status: bool message: str class DelStaffTrackingDetails(TypedDict): away: DelStaffTrackingDetailsAway standing: str country: str timezone: str managementNotes: str languages: List[str] class DelStaffTrackingLastAccessed(TypedDict): time: int page: str class DelStaffTrackingPunishmentsSub(TypedDict): executorName: Optional[str] executor: str reason: str date: int class DelStaffTrackingPunishmentsStrike(DelStaffTrackingPunishmentsSub): pass class DelStaffTrackingPunishmentsWarning(DelStaffTrackingPunishmentsSub): pass class DelStaffTrackingPunishments(TypedDict): strikes: DelStaffTrackingPunishmentsStrike warnings: DelStaffTrackingPunishmentsWarning class DelStaffTrackingHandledSub(TypedDict): total: int approved: int unapprove: Optional[int] declined: int remove: int class DelStaffTrackingHandled(TypedDict): allTime: DelStaffTrackingHandledSub prevWeek: DelStaffTrackingHandledSub thisWeek: DelStaffTrackingHandledSub class DelStaffTracking(TypedDict): details: DelStaffTrackingDetails lastLogin: int lastAccessed: DelStaffTrackingLastAccessed punishments: DelStaffTrackingPunishments handledBots: DelStaffTrackingHandled handledServers: DelStaffTrackingHandled handledTemplates: DelStaffTrackingHandled ================================================ FILE: cogs/types/userTypes.py ================================================ # Discord Extreme List - Discord's unbiased list. # Copyright (C) 2020-2025 Carolina Mitchell, Advaith Jagathesan, John Burke # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . from typing import TypedDict, List from .globalTypes import DelImage from .discordTypes import DiscordUserFlags from .userStaffTrackingTypes import DelStaffTracking class DelUserPreferences(TypedDict): customGlobalCss: str defaultColour: str defaultForegroundColour: str enableGames: bool experiments: bool theme: int class DelUserProfileLinks(TypedDict): website: str github: str gitlab: str twitter: str instagram: str snapchat: str class DelUserProfile(TypedDict): bio: str css: str links: DelUserProfileLinks class DelUserGameSnakes(TypedDict): maxScore: int class DelUserGame(TypedDict): snakes: DelUserGameSnakes class DelUserRank(TypedDict): admin: bool assistant: bool mod: bool premium: bool tester: bool translator: bool covid: bool class DelUser(TypedDict): _id: str token: str name: str discrim: str fullUsername: str locale: str flags: DiscordUserFlags avatar: DelImage preferences: DelUserPreferences profile: DelUserProfile game: DelUserGame rank: DelUserRank staffTracking: DelStaffTracking ================================================ FILE: cogs/utility.py ================================================ # Discord Extreme List - Discord's unbiased list. # Copyright (C) 2020-2025 Carolina Mitchell, Advaith Jagathesan, John Burke # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . import discord from discord.ext import commands from ext.checks import * from time import monotonic from .types import botTypes, userTypes class UtilityCog(commands.Cog, name="Utility"): def __init__(self, bot): self.bot = bot self.help_icon = f"{self.bot.settings['emoji']['toolbox']}" async def embed_colour(self, ctx): global colour bot_guild_member = await ctx.guild.fetch_member(self.bot.user.id) if len(str(bot_guild_member.colour.value)) == 1: colour = 0xFFFFFA else: colour = bot_guild_member.colour.value return colour @commands.command(name="ping", aliases=["latency", "pingpong", "pong"], usage="ping", description="Allows you to get the bots' current ping.") async def ping(self, ctx): """ Allows you to get the bots' current ping. """ before = monotonic() await ctx.trigger_typing() ping = (monotonic() - before) * 1000 # you gotta have the ping pong paddle await ctx.message.add_reaction('🏓') await ctx.send(f"{self.bot.settings['emoji']['ping']} | **Pong! My ping is:** `{int(ping)}ms`") # noinspection DuplicatedCode @commands.command(name="userinfo", aliases=["ui", "profile"], usage="userinfo ", description="Allows you to get your own or another user's DEL profile information.") @commands.guild_only() async def user_info(self, ctx, *, user: discord.User = None): """ Allows you to get your own or another user's DEL profile information. """ if user is None: user = ctx.author db_user: userTypes.DelUser = await self.bot.db.users.find_one({"_id": str(user.id)}) if not db_user: raise NoSomething(user) embed = discord.Embed(colour=await self.embed_colour(ctx)) acknowledgements = [] badges = [] if db_user["rank"]["admin"]: acknowledgements.append("Website Administrator") badges.append(self.bot.settings["emoji"]["crown"]) if db_user["rank"]["assistant"]: acknowledgements.append("Website Assistant") badges.append(self.bot.settings["emoji"]["assistant"]) if db_user["rank"]["mod"]: acknowledgements.append("Website Moderator") badges.append(self.bot.settings["emoji"]["hammer"]) if db_user["rank"]["premium"]: acknowledgements.append("Donator") badges.append(self.bot.settings["emoji"]["heart"]) if db_user["rank"]["tester"]: acknowledgements.append("Tester") badges.append(self.bot.settings["emoji"]["tube"]) if db_user["rank"]["translator"]: acknowledgements.append("Translator") badges.append(self.bot.settings["emoji"]["url"]) if db_user["rank"]["covid"]: acknowledgements.append("COVID-19 Donator") badges.append(self.bot.settings["emoji"]["shield"]) embed.add_field(name=f"{self.bot.settings['emoji']['shadows']} Username", value=f"{db_user['fullUsername']}" f" {' '.join(badges)}") embed.add_field(name=f"{self.bot.settings['emoji']['id']} ID", value=db_user["_id"]) if acknowledgements != []: embed.add_field(name=f"{self.bot.settings['emoji']['crown']} Acknowledgements", value="\n".join(acknowledgements), inline=False) embed.add_field(name=f"{self.bot.settings['emoji']['url']} Profile URL", value=f"{self.bot.settings['website']['url']}/users/{db_user['_id']}", inline=False) embed.set_thumbnail(url=f"{db_user['avatar']['url']}") await ctx.send(embed=embed) # noinspection DuplicatedCode @commands.command(name="botinfo", aliases=["bi"], usage="botinfo ", description="Allows you to get information of a bot.") @commands.guild_only() async def robot_info(self, ctx, *, bot: discord.User): """ Allows you to get information of a bot. """ if not bot.bot: return await ctx.send("That's no bot") db_bot: botTypes.DelBot = await self.bot.db.bots.find_one({"_id": str(bot.id)}) if not db_bot: raise NoSomething(bot) bot_owner: userTypes.DelUser = await self.bot.db.users.find_one({"_id": db_bot["owner"]["id"]}) embed = discord.Embed(colour=await self.embed_colour(ctx)) embed.add_field(name=f"{self.bot.settings['emoji']['shadows']} Bot Name", value=db_bot["name"]) embed.add_field(name=f"{self.bot.settings['emoji']['id']} ID", value=db_bot["_id"]) embed.add_field(name=f"{self.bot.settings['emoji']['crown']} Developer", value=f"[{bot_owner['fullUsername']}]({self.bot.settings['website']['url']}/users/{bot_owner['_id']})") embed.add_field(name=f"{self.bot.settings['emoji']['infoBook']} Library", value=db_bot["library"]) if db_bot["prefix"]: embed.add_field(name=f"{self.bot.settings['emoji']['speech']} Prefix", value=db_bot["prefix"]) embed.add_field(name=f"{self.bot.settings['emoji']['shield']} Server Count", value=str(db_bot["serverCount"])) embed.add_field(name=f"{self.bot.settings['emoji']['url']} Listing URL", value=f"{self.bot.settings['website']['url']}/bots/{db_bot['_id']}", inline=False) embed.set_thumbnail(url=bot.avatar_url) await ctx.send(embed=embed) @commands.command(name="token", aliases=["delapitoken", "apikey", "apitoken"], usage="token ", description="Allows you to get the DELAPI token of the specified bot (provided you own it).") @commands.guild_only() async def token(self, ctx, *, bot: discord.User): """ Allows you to get the DELAPI token of the specified bot (provided you own it). """ db_bot: botTypes.DelBot = await self.bot.db.bots.find_one({"_id": str(bot.id)}) if not db_bot: raise NoSomething(bot) if db_bot["owner"]["id"] == str(ctx.author.id): embed = discord.Embed(colour=await self.embed_colour(ctx)) embed.add_field(name=f"{self.bot.settings['emoji']['shadows']} Bot Name", value=db_bot["name"]) embed.add_field(name=f"{self.bot.settings['emoji']['id']} ID", value=db_bot["_id"]) embed.add_field(name=f"{self.bot.settings['emoji']['cog']} Token", value=f"```{db_bot['token']}```", inline=False) embed.set_thumbnail(url=f"{db_bot['avatar']['url']}.png") try: await ctx.author.send(embed=embed) await ctx.send( f"{self.bot.settings['formats']['success']} {bot}'s token has been dm'ed to you") except: await ctx.send("Your dms appear to be closed") else: await ctx.send( f"{self.bot.settings['formats']['noPerms']} **Invalid permission(s):** You need to be the " f"owner of the specified bot to access it's token.") @commands.command(name="cssreset", aliases=["resetcss", "ohshitohfuck"], description="Allows you to reset your 'Custom CSS' if you've broken something.") @commands.guild_only() async def css_reset(self, ctx): """ Allows you to reset your 'Custom CSS' if you've broken something. """ db_user: userTypes.DelUser = await self.bot.db.users.find_one({"_id": str(ctx.author.id)}) if not db_user: raise NoSomething(ctx.author) if db_user: await self.bot.db.users.update_one({"_id": str(ctx.author.id)}, { "$set": { "profile.css": "" } }) return await ctx.send( f"{self.bot.settings['formats']['success']} **Success:** Your custom css was reset.") else: return await ctx.send( f"{self.bot.settings['formats']['error']} **Unknown account:** You need to have authenticated on " f"our website before to use this command.") @commands.command(name="showbots", aliases=["bl", "hasbots", "hasbot", "bots"], usage="showbots ", description="Allows you to view the bots a specified user has.") @commands.guild_only() async def show_bots(self, ctx, *, user: discord.User = None): """ Allows you to view the bots a specified user has. """ user = user or ctx.author db_bots = self.bot.db.bots.find({"owner": {"id": str(user.id)}}) if user.bot: return await ctx.send( f"{self.bot.settings['formats']['error']} **Bots can't own bots:** Bots can't make bots... " f"AI robots please don't kill me...") formatted_bots = [] async for db_bot in db_bots: db_bot: botTypes.DelBot formatted_bots.append( f"• [{db_bot['name']}]({self.bot.settings['website']['url']}/bots/{db_bot['_id']}) " f"(`{db_bot['_id']}`)") if not formatted_bots: return await ctx.send( f"{self.bot.settings['formats']['error']} **No bots:** This user has no bots listed.") embed = discord.Embed(colour=await self.embed_colour(ctx)) embed.add_field(name=f"{self.bot.settings['emoji']['robot']} {str(user)}'s Bot(s)", value="\n".join(formatted_bots), inline=False) embed.set_thumbnail(url=f"{user.avatar_url}") await ctx.send(embed=embed) @commands.command(name="subscribe", aliases=["unsubscribe", "unsub", "sub"], usage="subscribe", description="Allows you to subscribe or unsubscribe from @Subscribers pings.") @commands.guild_only() async def subscribe(self, ctx): """ Allows you to subscribe or unsubscribe from @Subscribers pings. """ guild = self.bot.get_guild(int(self.bot.settings["guilds"]["main"])) subscribe_role = guild.get_role(int(self.bot.settings["roles"]["subscribers"])) if subscribe_role not in ctx.author.roles: await ctx.author.add_roles(subscribe_role, reason="User has subscribed.") await ctx.send( f"{self.bot.settings['formats']['success']} You have been subscribed to news pings.") else: await ctx.author.remove_roles(subscribe_role, reason="User has un-subscribed.") await ctx.send( f"{self.bot.settings['formats']['success']} You have un-subscribed from news pings.") def setup(bot): bot.add_cog(UtilityCog(bot)) ================================================ FILE: docs/STATUS_TYPES.md ================================================ ```yaml Waiting for Response: 0 Awaiting Fixes: 1 Closed: 2 Dev Responded: 3 ``` ================================================ FILE: ext/checks.py ================================================ import discord import json from discord.ext import commands with open("settings.json") as content: settings = json.load(content) class NoMod(commands.CheckFailure): pass class NoSomething(commands.CommandError): def __init__(self, account: discord.User): self.user = account if account.bot: fmt = f"**Invalid bot:** I could not find {account} in my " \ "database." else: fmt = f"**Invalid user:** I could not find {account} in my " \ "database." self.message = fmt super().__init__(fmt) def mod_check(): async def predicate(ctx): db_user = await ctx.bot.db.users.find_one({"_id": str(ctx.author.id)}) if db_user is None or not db_user['rank']['mod']: raise NoMod() return True return commands.check(predicate) ================================================ FILE: ext/context.py ================================================ # Discord Extreme List - Discord's unbiased list. # Copyright (C) 2020-2025 Carolina Mitchell, Advaith Jagathesan, John Burke # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . import discord from discord.ext import commands class EditingContext(commands.Context): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) async def send(self, content=None, *, tts=False, embed=None, file=None, files=None, delete_after=None, nonce=None, allowed_mentions=None): if file or files: return await super().send(content=content, tts=tts, embed=embed, file=file, files=files, delete_after=delete_after, nonce=nonce, allowed_mentions=allowed_mentions) reply = None try: reply = self.bot.cmd_edits[self.message.id] except KeyError: pass if reply: return await reply.edit(content=content, embed=embed, delete_after=delete_after) reference = self.message.reference if reference and isinstance(reference.resolved, discord.Message): msg = await reference.resolved.reply(content=content, tts=tts, embed=embed, file=file, files=files, delete_after=delete_after, nonce=nonce, allowed_mentions=allowed_mentions) else: msg = await super().send(content=content, tts=tts, embed=embed, file=file, files=files, delete_after=delete_after, nonce=nonce, allowed_mentions=allowed_mentions) self.bot.cmd_edits[self.message.id] = msg return msg ================================================ FILE: requirements.txt ================================================ aiohttp==3.7.4 astunparse==1.6.3 async-timeout==3.0.1 attrs==20.3.0 braceexpand==0.1.6 chardet==3.0.4 colorama==0.4.4 colouredlogs==10.0.1 discord.py==1.6.0 dnspython==2.0.0 humanfriendly==4.7 humanize==3.2.0 idna==2.10 import-expression==1.1.4 jishaku==1.20.0.220 motor==2.3.0 multidict==4.7.6 pymongo==3.11.2 pyreadline==2.1 six==1.15.0 snowflake.py==1.0.0 yarl==1.5.1 ================================================ FILE: settings.example.json ================================================ { "token": "", "prefix": ["del,"], "mongo": { "uri": "mongodb://localhost:27017", "db": "del" }, "ownership": { "multiple": true, "owners": [0], "owner": 0 }, "guilds": { "main": "", "staff": "", "bot": "", "messageLog": "" }, "website": { "url": "https://discordextremelist.xyz" }, "roles": { "unapprovedBot": "633141192497823784", "bot": "568587927265869824", "premiumBot": "568970918647300116", "serverOwner": "623052263295942657", "developer": "568572172151291929", "staff": "568568238250917909", "mod": "568568238250917909", "admin": "568568341414019086", "unlisted": "736732871708115024", "fixesBot": "662230379326865429", "botpower": "716174811629486141", "subscribers": "703779239400570880", "botServer": { "listed": "1342399369311162368" } }, "colours": { "awaiting_fixes": "0xf73538", "awaiting_response": "0x1cc1e6", "closed": "0xe40707" }, "channels": { "ticketCategory": "736820335629828159", "ticketLog": "736820647484981268", "messageLog": "736823970334113862" }, "images": { "awaiting_fixes": "https://raw.githubusercontent.com/discordextremelist/bot/master/assets/awaiting_fixes-1.png", "awaiting_response": "https://raw.githubusercontent.com/discordextremelist/bot/master/assets/awaiting_response-2.png", "closed": "https://raw.githubusercontent.com/discordextremelist/bot/master/assets/closed-3.png", "dev_replied": "https://raw.githubusercontent.com/discordextremelist/bot/master/assets/dev_replied-4.png" }, "formats": { "error": "<:error:621988943314812928> |", "warn": "<:warning:599554018406039574> |", "success": "<:check:587490138129563649> |", "noPerms": "<:cross:587490138129432596> |", "ticketStatus": "<:flag:736795389210001497> |", "info": "<:info:645226250889068584> |" }, "emoji": { "flags": { "britian": "<:britian:769505989183012884>", "turkey": "<:turkey:769506407439138846>", "france": "<:france:769506407518568458>", "portugal": "<:portugal:769506407636140052>", "spain": "<:spain:769506407438352424>" }, "check": "<:check:587490138129563649>", "cross": "<:cross:587490138129432596>", "home": "<:home:599501387516215326>", "hammer": "<:hammer:599508413302439961>", "toolbox": "<:toolbox:599508422823641118>", "speech": "<:talking:599519046509133885>", "warning": "<:warning:599554018406039574>", "boot": "<:boot:599553995731763201>", "bell": "<:bell:599554581466316800>", "alarm": "<:alarm:599554591146639380>", "crayon": "<:crayon:599555499377295390>", "brush": "<:brush:599555488539213825>", "serviceBell": "<:servicebell:599556134298189824>", "calendar": "<:calendar:599556100206886924>", "eject": "<:eject:599556110789115925>", "crown": "<:crown:599557812259127297>", "shadows": "<:shadows:599557820723101698>", "places": "<:places:599557829862621204>", "shield": "<:shield:599558630177767424>", "filter": "<:filter:599558621067739136>", "sound": "<:sound:599559909931221014>", "ear": "<:ear:599559784244445186>", "notepad": "<:notepad:599559758189559829>", "bin": "<:bin:600126267999780885>", "cog": "<:cog:667646832805150731>", "infoBook": "<:verificationApp:589349182234558470>", "id": "<:id:669089983986139136>", "robot": "<:robot:669089983990333441>", "entry": "<:entry:669089983507726371>", "game": "<:game:669089983692537857>", "online": "<:online:669089983570903040>", "idle": "<:idle:669089983323439105>", "dnd": "<:dnd:669089984002916352>", "offline": "<:offline:669089983621234688>", "smilie": "<:smilie:669103681639022592>", "label": "<:label:669364669797892127>", "phone": "<:phone:669466706565005312>", "desktop": "<:desktop:669466706447695883>", "coder": "<:coder:669739780824760330>", "ping": "<:ping:668013200918446080>", "minidisc": "<:minidisc:669745576048459779>", "disc": "<:dvd:669745576124088371>", "chart": "<:graph:669755531186929665>", "womanboot": "<:womanboot:670553673390227456>", "zipped": "<:zipped:670786074876051487>", "unlock": "<:unlock:682475650371944454>", "url": "<:globe:695565597173481493>", "clock": "<:clock:726557245869129831>", "timer": "<:timer:726557246171119716>", "assistant": "<:webAssistant:664734569773269003>", "heart": "<:heart:749527451948023820>", "tube": "<:tube:749529449535635516>", "ticket": "<:ticket:769354945056604171>", "high_voltage": "<:high_voltage:769354944930381826>", "info": "<:info:645226250889068584>" } }