Compare commits

..

502 commits

Author SHA1 Message Date
8c323e36a9
docs(pterodactyl): link to the pelican-eggs repository instead of some random fork
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 39s
Actions / Build Documentation (MkDocs) (push) Successful in 32s
Signed-off-by: cswimr <seaswimmerthefsh@gmail.com>
2024-09-25 12:07:53 -04:00
1392a9324a
chore(poetry): update deps
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 34s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 44s
2024-08-28 17:01:58 -04:00
9cba1767e6
fix(repo): update all instances of SeaswimmerTheFsh to cswimr
Some checks failed
Actions / Build Documentation (MkDocs) (push) Failing after 22s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 39s
2024-08-27 14:25:14 -04:00
cbfff6d211
fix(backup): update for red 3.5.13
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 40s
Actions / Build Documentation (MkDocs) (push) Successful in 28s
2024-08-27 14:22:38 -04:00
56d1e14454
feat(repo): updated all cogs (except aurora) to use the help formatting present in the indev version of aurora 2024-08-27 14:22:19 -04:00
571be4e245
fix(pterodactyl): fixed a missing argument in one of the websocket events
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 26s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 37s
2024-08-27 14:05:10 -04:00
6b2793e692
fix(actions): updated container tags
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 28s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 38s
2024-08-27 14:03:15 -04:00
ad0bb7cf00
fix(pterodactyl): fixed join and leave listeners throwing errors
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 31s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 56s
2024-08-26 19:43:57 -04:00
1244d5a941
fix(pterodactyl): don't depend on a website to host images when i can bundle image files in the cog itself
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 30s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 54s
2024-08-26 17:46:42 -04:00
1c0f12660b
chore(pterodactyl): clean up some dirty code
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 30s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 54s
2024-08-26 15:03:37 -04:00
b4a54d214d
misc(poetry): add sqlite-web dev dependency
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 29s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 50s
2024-08-21 14:31:49 -04:00
260438f397
misc(poetry): update to red 3.5.12
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 32s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 45s
2024-08-21 00:17:48 -04:00
5bfb74de47
fix(seautils): fixed a maybe_send_embed call having an invalid kwarg
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 31s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 44s
2024-08-13 02:39:40 -04:00
b7bde42672
Update backup/info.json
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 45s
Actions / Build Documentation (MkDocs) (push) Successful in 34s
2024-08-08 00:36:44 -04:00
0f36badbea
update backup for Red 3.5.11
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 32s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 42s
2024-08-05 14:22:26 -04:00
f04b452396
add __pycache__ to .gitignore
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 32s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 45s
2024-08-02 10:33:49 -04:00
7d4a6b9930
Update antipolls/info.json
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 41s
Actions / Build Documentation (MkDocs) (push) Successful in 29s
2024-07-23 13:54:04 -04:00
f6570dd072
docs(pterodactyl): fixed some incorrect markdown formatting in one of the admonitions
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 43s
Actions / Build Documentation (MkDocs) (push) Successful in 28s
Signed-off-by: Seaswimmer <seaswimmerthefsh@gmail.com>
2024-07-12 13:52:22 -04:00
ff68d6ea19
docs(backup): removed reload from the backup docs
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 26s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 38s
due to some techincal limitations, the `backup` cog does not actually reload cogs it reinstalls. the end user still has to do that, this is because there's no good way for `backup` to confirm if a cog is loaded or not whenever exporting the list of repos/cogs.

Signed-off-by: Seaswimmer <seaswimmerthefsh@gmail.com>
2024-07-11 23:30:42 +00:00
825a373a9b
fix(backup): support 3.5.10
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 27s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 41s
2024-07-11 23:20:06 +00:00
d173dd68a5
fix(workflow): nvm
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 28s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 41s
2024-06-11 16:50:15 -04:00
24239425c5
fix(workflows): missing -e argument
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 26s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 40s
2024-06-11 16:48:03 -04:00
e3e96e5b84
fix(workflow): changed meli token
Some checks failed
Actions / Build Documentation (MkDocs) (push) Failing after 25s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 38s
2024-06-11 16:39:04 -04:00
28f814db56
fix(seautils): pylint fix
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 28s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 45s
2024-06-04 12:16:09 -04:00
7354769962
fix(emojiinfo): pylint fix 2024-06-04 12:16:01 -04:00
2ac1dacd19
fix(backup): added another error type caught by backup import, in the case where you didn't reply to a message or upload a file
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 43s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 1m9s
2024-06-03 01:10:00 -04:00
66b933569b
misc(seautils): soup
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 25s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 38s
2024-06-01 15:03:23 -04:00
c06db07f08
misc(seautils): bunch of miscellaneous changes
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 27s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 41s
2024-06-01 15:02:08 -04:00
46f189a297
fix(seautils): pylint fix
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 26s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 37s
2024-05-30 11:02:22 -04:00
545106d496
fix(seautils): fixed a typo in a function name
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 26s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 39s
2024-05-28 22:25:47 -04:00
037a26deb0
misc(seautils): switch to datatracker.ietf.org links for publicly facing urls
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 26s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 39s
2024-05-28 22:20:51 -04:00
f51329524c
fix(seautils): oops lmao
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 26s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 38s
2024-05-28 22:19:09 -04:00
5b23f2f0fb
feat(seautils): add the url of the rfc document being retrieved to the embed
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 26s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 39s
2024-05-28 22:17:20 -04:00
8f492cd937
fix(seautils): hopefully actually fixed the docstring
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 26s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 41s
2024-05-28 22:14:35 -04:00
dfabac55f5
misc(seautils): hopefully fixed [p]rfc's help from overflowing into a second page
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 26s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 39s
2024-05-28 22:13:18 -04:00
4f25e3d0f3
fix(seautils): removed some text from the rfc docstring
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 39s
Actions / Build Documentation (MkDocs) (push) Successful in 26s
2024-05-28 22:11:11 -04:00
7207cd3747
misc(seautils): improved the rfc docstring
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 26s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 38s
2024-05-28 22:09:56 -04:00
069ea800db
feat(seautils): added a detailed docstring to the rfc command
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 28s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 38s
2024-05-28 22:02:42 -04:00
58245c621c
misc(seautils): changed a function name 2024-05-28 21:58:20 -04:00
b9f0dbf98a
fix(seautils): removed big gap at the bottom of rfc embeds
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 25s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 40s
2024-05-28 21:56:43 -04:00
2d895d16c9
fix(seautils): fixed body error
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 27s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 40s
2024-05-28 21:54:48 -04:00
861a03719b
fix(seautils): added a bad solution to a stupid problem
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 27s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 38s
2024-05-28 21:22:30 -04:00
ac5d4df36b
fix(seautils): fixed broken regex
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 26s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 38s
2024-05-28 21:18:49 -04:00
ae8d0d5db4
fix(seautils): added missing ()
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 26s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 40s
2024-05-28 21:17:29 -04:00
0ea80075f6
fix(seautils): fixed a missing argument
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 26s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 41s
2024-05-28 21:16:45 -04:00
8d3f5c1d5f
fix(seautils): fix table of contents in rfc documents
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 27s
Actions / Lint Code (Ruff & Pylint) (push) Has been cancelled
2024-05-28 21:16:10 -04:00
42e209b547
misc(seautils): include the number of the rfc document in the embed
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 26s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 39s
2024-05-28 21:10:28 -04:00
0ed96babdb
fix(seautils): ACTUALLY fixed broken regex
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 26s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 39s
2024-05-28 20:40:48 -04:00
29b6a2141a
fix(seautils): actually actually fixed incorrect regex
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 25s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 40s
2024-05-28 20:39:19 -04:00
c4ef2a7d4b
fix(seautils): fixed some broken regex
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 26s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 39s
2024-05-28 20:38:39 -04:00
99cd13ccf1
feat(seautils): add correct formatting for masked links
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 26s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 39s
2024-05-28 20:35:25 -04:00
28246121a6
feat(seautils): use markdownify to convert rfc html documents to markdown
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 27s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 40s
2024-05-28 20:29:39 -04:00
a641cae640
feat(seautils): add [p]rfc command
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 27s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 40s
2024-05-28 20:20:21 -04:00
2886d5e80d
feat(seautils): use prolog syntax highlighting for dig results
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 25s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 37s
2024-05-28 19:29:26 -04:00
50094b85fc
fix(seautils): fixed the wrong thing lmao
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 26s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 38s
2024-05-28 19:26:07 -04:00
7f46d6accc
fix(seautils): fixed empty answer section
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 26s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 38s
2024-05-28 19:25:01 -04:00
cb6ddabb4d
fix(seautils): prevent duplicates in dig
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 25s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 38s
2024-05-28 19:10:15 -04:00
8608e6a34e
fix(seautils): fixed only the first A response being used
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 26s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 38s
2024-05-28 19:06:11 -04:00
fb468ee63e
fix(seautils): retrieve A, AAAA, and CNAME records by default (& docstring changes)
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 26s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 38s
2024-05-28 18:55:09 -04:00
b27a3ee778
fix(seautils): fall back to the embed description if answer_section is too long
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 26s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 37s
2024-05-28 18:46:32 -04:00
54491cb9c9
fix(seautils): convert port number to a string
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 25s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 36s
2024-05-28 18:44:01 -04:00
29bb64b35c
fix(seautils): query ANY instead of A records
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 25s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 38s
2024-05-28 18:42:42 -04:00
5ffc42480a
fix(seautils): revert breaking dig
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 25s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 39s
2024-05-28 18:40:43 -04:00
7d51814a28
misc(seautils): purposefully breaking dig so i can test nslookup fallback
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 25s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 37s
2024-05-28 18:35:17 -04:00
25fdf7b402
feat(seautils): default to nslookup if dig is not present
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 26s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 38s
2024-05-28 18:31:38 -04:00
091f4fe36d
fix(seautils): fixed maybe_send_message
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 25s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 38s
2024-05-28 18:02:17 -04:00
d444242245
fix(seautils): catch the error that is raised if dig is not installed on the system
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 26s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 38s
2024-05-28 18:01:35 -04:00
7a2ee0a655
misc(seautils): added an error symbol to the failed dns query result message
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 26s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 37s
2024-05-28 17:57:10 -04:00
8b68cb7530
fix(seautils): don't use match and case
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 25s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 38s
2024-05-28 17:54:46 -04:00
028cae9e99
feat(seautils): improve error code handling
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 26s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 38s
2024-05-28 17:53:58 -04:00
aa7e347a95
fix(seautils): fix a keyerror
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 25s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 38s
2024-05-28 17:48:00 -04:00
93f358cfad
fix(seautils): fixed timestamp
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 25s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 37s
2024-05-28 17:46:14 -04:00
8867cc627f
feat(seautils): add an embed to the dig command
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 24s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 37s
2024-05-28 16:33:15 -04:00
e2059eac77
Merge branch 'main' of https://www.coastalcommits.com/Seaswimmer/SeaCogs
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 24s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 36s
2024-05-28 16:23:56 -04:00
e9c062afa9
feat(seautils): added dig command 2024-05-28 16:22:22 -04:00
Sea
ee9b62db5b
misc(repo): add index_name key to info.json
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 28s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 40s
2024-05-23 18:00:56 +00:00
1405dae49e
fix(aurora): add roles to evidenceformat
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 28s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 41s
2024-05-20 20:59:01 -04:00
7ed836a1cd
fix(seautils): pylint fixes
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 28s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 42s
2024-05-19 00:18:48 -04:00
d95c9b3255
fix(emojiinfo): oops lmao
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 26s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 38s
2024-05-17 00:57:30 -04:00
c9a47603a7
fix(emojiinfo): add a debug logging call
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 38s
Actions / Build Documentation (MkDocs) (push) Successful in 25s
2024-05-17 00:48:14 -04:00
d8758cfb1d
misc(emojiinfo): verbosity
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 25s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 41s
2024-05-17 00:46:25 -04:00
3fd91d9776
misc(emojiinfo): default slash command to ephemeral true
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 28s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 44s
2024-05-17 00:44:19 -04:00
d556ee3704
fix(seautils): minor syntax change
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 28s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 40s
2024-05-17 00:20:00 -04:00
7019b9ffe5
fix(seautils): catch an UnboundLocalError
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 27s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 40s
2024-05-17 00:14:33 -04:00
5116598788
feat(seautils): add support for cogs and slash commands
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 28s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 42s
2024-05-17 00:12:40 -04:00
2dcbcb0a59
fix(seautils): use ctx.embed_requested()
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 27s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 40s
2024-05-13 21:14:15 -04:00
059badaa9b
fix(seautils): use length_hint
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 27s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 42s
2024-05-13 21:12:51 -04:00
84d2728d3a
misc(seautils): optimized showcode
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 28s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 40s
2024-05-13 21:11:15 -04:00
bb1aca83dd
feat(seautils): added some more functionality to showcode
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 38s
Actions / Build Documentation (MkDocs) (push) Successful in 40s
2024-05-13 21:09:02 -04:00
59848fe857
misc(seautils): added more aliases to showcode
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 29s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 43s
2024-05-13 20:22:13 -04:00
516c0feecc
fix(seautils): catch the attributeerror
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 27s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 41s
2024-05-13 20:17:00 -04:00
7bd9531b58
feat(seautils): added the cog
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 30s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 44s
2024-05-13 19:26:13 -04:00
09ab8aa69d
docs(emojiinfo): changed a string
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 27s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 42s
2024-05-08 16:11:09 -04:00
fb34593707
docs(emojiinfo): made docs visible on the navigation header
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 28s
Actions / Lint Code (Ruff & Pylint) (push) Has been cancelled
2024-05-08 16:10:34 -04:00
ebdd3e3525
Merge pull request 'Add EmojiInfo cog' (#27) from emoji into main
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 28s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 42s
Reviewed-on: SeaswimmerTheFsh/SeaCogs#27
2024-05-08 20:07:30 +00:00
e1bfa79cb9
fix(emojiinfo): pylint fixes
All checks were successful
Actions / Build Documentation (MkDocs) (pull_request) Successful in 29s
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 44s
2024-05-08 16:06:22 -04:00
e59503829f
fix(emojiinfo): add the PartialEmoji.from_str call to the try and except blocks
Some checks failed
Actions / Build Documentation (MkDocs) (pull_request) Successful in 29s
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 43s
2024-05-08 16:02:56 -04:00
d126f1e6d3
fix(emojiinfo): made the ephemeral argument optional in the slash command 2024-05-08 16:00:36 -04:00
66df7664a5
fix(emojiinfo): awaited a coroutine 2024-05-08 15:59:10 -04:00
ce53908938
fix(emojiinfo): seperated the slash command from the normal command 2024-05-08 15:58:26 -04:00
8f6afe754d
docs(emojiinfo): added documentation 2024-05-08 15:49:19 -04:00
aa6e0d7590
fix(emojiinfo): added descriptions to the application command parameters 2024-05-08 15:48:18 -04:00
d65d04fa7a
fix(emojiinfo): added group to the emojiinfo string 2024-05-08 15:40:58 -04:00
bc9bc53967
fix(emojiinfo): fixed another unboundlocal error 2024-05-08 15:39:51 -04:00
2b5a00f512
fix(emojiinfo): fixed an unboundlocal error 2024-05-08 15:38:51 -04:00
4bf3e85df2
fix(emojiinfo): fixed a syntax error 2024-05-08 15:37:20 -04:00
ce595e50da
fix(emojiinfo): open the emojis.json file before attempting to read from it 2024-05-08 15:36:17 -04:00
9ed16a44f2
feat(emojiinfo): added aliases and groups 2024-05-08 15:34:04 -04:00
59097b676d
fix(emojiinfo): forgot to return early lol 2024-05-08 14:46:28 -04:00
537b2edafa
fix(emojiinfo): catch errors if the emoji is invalid 2024-05-08 14:45:46 -04:00
8ebb383a84
fix(emojiinfo): fixed an issue with markdown 2024-05-08 14:38:39 -04:00
1ed1eb2681
fix(emojiinfo): fixed a syntax error 2024-05-08 14:35:47 -04:00
a02a7ab3d7
fix(emojiinfo): fixed formatting 2024-05-08 14:34:28 -04:00
80dcfea95e
fix(emojiinfo): use aiohttp.ClientSession 2024-05-08 14:30:07 -04:00
7ae8226ca5
fix(emojiinfo): added colorthief to the requirements 2024-05-08 14:26:40 -04:00
b910d8c614
feat(emojiinfo): added most of the cog's functionality 2024-05-08 14:26:03 -04:00
d87c37239d
fix(emojiinfo): fixed error if you input a default discord emoji 2024-05-08 13:58:58 -04:00
c266997a78
fix(emojiinfo): use commands.Cog instead of commands.cog 2024-05-08 13:54:55 -04:00
20c3007306
renamed emoji to emojiinfo 2024-05-08 13:53:21 -04:00
8fdf587bde
fix(emoji): specify a name for the hybrid command 2024-05-08 13:50:46 -04:00
ea1f7a7f8e
fix(emoji): fixed the cog refusing to load 2024-05-08 13:47:33 -04:00
384ce7fc6d
feat(emoji): added the cog 2024-05-08 13:43:33 -04:00
c618f9be72
fix(aurora): updated the aurora importer to have all of the currently implemented moderation types
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 33s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 46s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 31s
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 43s
2024-05-04 12:57:27 -04:00
99c20c6054
feat(repo): Transitioning to issue forms
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 32s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 47s
2024-05-04 10:06:26 -04:00
4370b4ca9a
docs(aurora): updated some commands
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 33s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 46s
2024-05-04 09:51:43 -04:00
f4646a1976
docs(aurora): updated moderation-commands.md with addrole and removerole
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 33s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 47s
2024-05-04 09:46:03 -04:00
76e9c1ec0d
fix(aurora): default timeouts to None instead of 0
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 35s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 49s
2024-05-03 22:25:03 -04:00
bd48b43517
fix(aurora): reduced view timeouts to 60 seconds
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 33s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 46s
2024-05-03 22:21:28 -04:00
d6f33857a3
feat(aurora): added timeouts to configuration views
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Has been cancelled
Actions / Build Documentation (MkDocs) (push) Has been cancelled
2024-05-03 22:20:53 -04:00
6c56ee6181
Merge pull request 'Finish the addrole/removerole commands and surrounding functionality' (#24) from addrole into main
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 32s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 45s
Reviewed-on: SeaswimmerTheFsh/SeaCogs#24
2024-05-04 01:46:12 +00:00
6c859d72a8
fix(aurora): pylint fix
All checks were successful
Actions / Build Documentation (MkDocs) (pull_request) Successful in 34s
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 49s
2024-05-03 21:45:04 -04:00
1d1795c262
fix(aurora): added addrole/removerole support to case_factory
Some checks failed
Actions / Build Documentation (MkDocs) (pull_request) Successful in 31s
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 45s
2024-05-03 21:42:02 -04:00
af108519f9
feat(aurora): imma be real chief i have no idea what i did this commit 2024-05-03 21:35:29 -04:00
a641b11daa
fix(aurora): fixed the incorrect moderation type being passed to message_factory in /removerole 2024-05-03 21:02:16 -04:00
38b0580228
fix(aurora): updated message_factory for addrole support 2024-05-03 21:01:11 -04:00
cd514d0535
fix(aurora): fixed removerole adding roles instead of removing them 2024-05-03 20:56:07 -04:00
908fed37bc
fix(aurora): fixed a TypeError in the expiry handler task 2024-05-03 20:52:29 -04:00
7ef13016d9
fix(aurora): fixed an AttributeError in the expiry handler 2024-05-03 20:51:02 -04:00
877f5e00d3
fix(aurora): adding some more logging to the expiry task 2024-05-03 20:47:19 -04:00
bcef643349
fix(aurora): fixed an incorrectly named column in on_member_join 2024-05-03 20:44:04 -04:00
1a74ce9130
fix(aurora): fixed a broken logging statement 2024-05-03 20:38:07 -04:00
67142c6458
fix(aurora): added more verbose debug logging to the expiry task 2024-05-03 20:37:01 -04:00
dc8138bd89
fix(aurora): added warning logging to the expiry task 2024-05-03 20:32:02 -04:00
f9e807957f
fix(aurora): why was I trying to raise an exception???? 2024-05-03 20:28:26 -04:00
8e59b5a4bd
fix(aurora): added a missing ; to an sql statement 2024-05-03 20:25:42 -04:00
6966ea1613
fix(aurora): added a missing ) in an sql query 2024-05-03 20:24:16 -04:00
752a41855a
fix(aurora): actually fixed the string concatenation bug 2024-05-03 20:21:30 -04:00
0642d5eb42
fix(aurora): fixed a bug in addrole and removerole with string concatenation 2024-05-03 20:18:29 -04:00
ebf739b563
feat(aurora): added a listener to readd roles to a user on guild join 2024-05-03 20:10:26 -04:00
f6b827c64f
feat(aurora): added expiry handling for addrole and removerole 2024-05-03 20:09:48 -04:00
b8a4d247f8
fix(aurora): fixed a bug in /case with exports to codeblocks being improperly formatted 2024-05-03 20:09:23 -04:00
a7fcbc4dab
feat(aurora): implemented removerole command 2024-05-03 20:08:57 -04:00
1a23a2778a
misc(pterodactyl): added a missing typehint
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 39s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 54s
2024-05-03 19:42:32 -04:00
acb737f0a6
fix(aurora): fixed a broken button in the guild config menu
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 39s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 56s
2024-04-26 16:14:30 -04:00
ce7e39d385
fix(backup): updated to red 3.5.9
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 34s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 48s
2024-04-24 17:13:49 -04:00
d0474a3707
fix(antipolls): doesn't need to be marked as hidden anymore
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 35s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 53s
2024-04-16 12:39:57 -04:00
d17a7e645f
fix(antipolls): pylint fixes
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 36s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 52s
2024-04-16 12:38:00 -04:00
aaf9ac1b4e
fix(antipolls): prevent cog loading if the Message Content intent is disabled
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 36s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 53s
2024-04-16 12:13:15 -04:00
dbe6fc2390
fix(antipolls): improved verbose logging for the cog_disabled_in_guild check
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 34s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 52s
2024-04-16 11:14:11 -04:00
b67b692201
fix(antipolls): fixed an allowedmentions error
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 34s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 49s
2024-04-16 11:08:15 -04:00
15715dff3c
fix(antipolls): fixed the humanize_list typeerror (for real this time)
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 38s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 55s
2024-04-16 11:05:37 -04:00
73b0e73ff0
fix(antipolls): fixed typeerror in the configuration commands
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 38s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 53s
2024-04-16 11:02:31 -04:00
d9c123d441
fix(antipolls): more fixes to antipoll's config commands
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 39s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 55s
2024-04-16 11:00:05 -04:00
4f38fc1f7d
fix(antipolls): use append instead of extend
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 37s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 54s
2024-04-16 10:56:10 -04:00
602d759e67
fix(antipolls): awaited a coroutine
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 38s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 55s
2024-04-16 10:49:20 -04:00
3da2d74a48
fix(antipolls): added more verbose logging to a listener
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 39s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 58s
2024-04-16 10:47:45 -04:00
4344d26096
feat(AntiPolls): added the cog
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 39s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 54s
2024-04-16 10:44:05 -04:00
285257eed5
fix(pterodactyl): added an f string
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 36s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 54s
2024-04-15 17:45:43 -04:00
2b7f320d2a
fix(repo): some minor poetry changes
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 30s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 41s
2024-04-10 10:01:44 -04:00
df970717c2
feat(aurora): added sorting based on role position for the addrole and immune role configuration embeds
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 38s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 53s
2024-04-08 11:57:28 -04:00
97b54b507b
fix(aurora): fixed an issue with adding multiple immune roles/addrole roles at once
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 39s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 55s
2024-04-08 11:46:22 -04:00
06e011f670
fix(pterodactyl): don't run update_topic or the websocket tasks before red is ready
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 39s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 54s
2024-04-08 06:24:53 -04:00
0955282325
fix(aurora): do not run handle_expiry before Red is ready 2024-04-08 06:24:34 -04:00
19fc6adaad
fix(bible): pylint fix
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 36s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 51s
2024-04-08 06:03:52 -04:00
7ca836759f
feat(backup): red 3.5.8 support
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 39s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 54s
2024-04-08 06:01:50 -04:00
833d6954cc
misc(repo): changed all logger names
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 42s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 57s
2024-04-08 05:55:35 -04:00
b9e06d6288
misc(bible): messing with icon sizes even more
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 34s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 49s
2024-04-06 06:33:52 -04:00
f28a8aad0e
misc(bible): messing with icon size more
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 36s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 50s
2024-04-06 06:32:45 -04:00
a9c2f18b5d
misc(bible): messing with icon sizes some more
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 37s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 54s
2024-04-06 06:31:04 -04:00
f0bc915da8
misc(bible): messing with icon sizes
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 37s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 52s
2024-04-06 06:29:49 -04:00
46b7123fdd
misc(bible): cropped the api.bible logo
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 38s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 52s
2024-04-06 06:28:05 -04:00
04c3b0e83c
fix(bible): use the correct attachment name
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 39s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 52s
2024-04-06 06:20:14 -04:00
33ce8a147c
fix(bible): fixed another typeerror
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 52s
Actions / Build Documentation (MkDocs) (push) Successful in 34s
2024-04-06 06:18:16 -04:00
01b249fbb3
fix(bible): fixed a typeerror
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 38s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 52s
2024-04-06 06:16:41 -04:00
f572a0d535
feat(bible): added the api.bible icon to embeds
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 42s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 54s
2024-04-06 06:15:00 -04:00
9f7244cd65
feat(Aurora): added a respect_hierarchy configuration option and relevant configuration button to [p]aurora set guild, along with functionality that uses this configuration value
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 33s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 43s
2024-04-05 10:43:58 -04:00
a4f2d21fa1
fix(aurora): fixed a minor issue in utilities.utils.get_bool_emoji 2024-04-05 10:42:13 -04:00
ba25078f3f
feat(pterodactyl): added custom formatting for the cog-level help embed
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 36s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 44s
2024-03-29 07:18:55 -04:00
3066848853
feat(nerdify): added documentation link to cog-level help embed 2024-03-29 07:18:22 -04:00
0ed7ab6727
feat(bible): added documentation link to cog-level help embed 2024-03-29 07:18:17 -04:00
f713780d49
feat(backup): added documentation link to cog-level help embed 2024-03-29 07:17:51 -04:00
5adaca755d
feat(aurora): added documentation link to cog-level help embed 2024-03-29 07:17:39 -04:00
09d7f634f2
fix(backup): changed version requirements
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 32s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 45s
2024-03-29 03:35:35 -04:00
069621eee8
fix(docs): disabled social plugin so the documentation builds
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 35s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 47s
2024-03-29 03:33:02 -04:00
76da85365c
docs(backup): updated docs with a disclaimer about version compatibility
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Successful in 43s
Actions / Build Documentation (MkDocs) (push) Failing after 25s
2024-03-29 03:31:00 -04:00
1edb08a127
feat(backup): updated to Red 3.5.6+ 2024-03-29 03:29:35 -04:00
43464db6a7
fix(pterodactyl): replace newlines with whitespace to prevent formatting errors
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 33s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 40s
2024-03-26 03:04:06 -04:00
50d1d7900b
fix(pterodactyl): fixed [pterodactyl players] command
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 23s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 28s
2024-03-23 15:02:46 +00:00
6ec79c9f92
fix(pterodactyl): pylint fix
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 24s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 27s
2024-03-23 14:59:20 +00:00
9f6e960a25
fix(pterodactyl): fixed a broken msg.edit() call in [p]pterodactyl set regex blacklist add]
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 32s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 39s
2024-03-22 21:53:19 +00:00
46b534ebf8
fix(pterodactyl): fixed a string
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 25s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 30s
2024-03-21 15:28:51 -04:00
74f58162de
feat(pterodactyl): allow disabling console commands from being sent through discord
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 2s
Actions / Build Documentation (MkDocs) (push) Successful in 28s
2024-03-21 15:27:29 -04:00
39808f1766
fix(pterodactyl): fixed player fetching api error
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 27s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 32s
2024-03-15 19:26:15 -04:00
014025f547
feat(pterodactyl): added a players command
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 27s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 31s
2024-03-15 16:22:10 -04:00
9b0a11a7bc
fix(pterodactyl): fixed some chat formatting
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 24s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 29s
2024-03-14 16:49:49 -04:00
6ab593390c
fix(pterodactyl): fixed set view formatting
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 24s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 29s
2024-03-14 16:48:54 -04:00
7c16ec8df8
feat(pterodactyl): added the topic config values to -ptero set view
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 24s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 28s
2024-03-14 16:48:08 -04:00
cbd9f28f38
fix(pterodactyl): fixed incorrect configuration value
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 24s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 28s
2024-03-14 16:39:15 -04:00
c546fa597b
fix(pterodactyl): actually start the topic loop
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 24s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 28s
2024-03-14 16:38:23 -04:00
7b859e07e9
docs(pterodactyl): added documentation for the topic subcommand
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 25s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 30s
2024-03-14 16:34:54 -04:00
5f4cb88ea8
fix(pterodactyl): fixed incorrect placeholder name and fixed broken get_topic method 2024-03-14 16:34:41 -04:00
4135cd4f98
feat(pterodactyl): added support for changing channel topics 2024-03-14 16:26:31 -04:00
d6bccf20e9
fix(pterodactyl): fixed a few double pings
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 23s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 27s
2024-03-13 01:48:17 -04:00
7a75266b01
fix(pterodactyl): fixed incorrect action_ing string for stopping the server
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 26s
Actions / Build Documentation (MkDocs) (push) Successful in 23s
2024-03-11 22:19:31 -04:00
25b26322d2
fix(pterodactyl): allow killing the server while it's starting or stopping
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 38s
Actions / Build Documentation (MkDocs) (push) Successful in 16s
2024-03-11 14:20:30 -04:00
SeaswimmerTheFsh
40b846123f
fix(pterodactyl): don't call config 28 qunintillion times for no reason in the websocket message handler 2024-03-09 23:26:27 -05:00
4c603eea46
misc(aurora): version bump
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 26s
Actions / Build Documentation (MkDocs) (push) Successful in 19s
2024-03-08 15:39:37 -05:00
92e8ee2dc2
fix(aurora): removed humanize from factory.py
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 21s
Actions / Build Documentation (MkDocs) (push) Successful in 18s
2024-03-08 15:01:24 -05:00
99dddf2fa7
fix(aurora): remove humanize
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 23s
Actions / Build Documentation (MkDocs) (push) Successful in 17s
2024-03-08 14:56:50 -05:00
ba7a5f9208
fix(aurora): fixed an out of range value error if you ban someone for 30000000 years
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 29s
Actions / Build Documentation (MkDocs) (push) Successful in 21s
2024-03-08 14:30:57 -05:00
ddb9f30d6f
fix(aurora): added returns to the errors in the timedelta and relativedelta commands 2024-03-08 14:27:50 -05:00
3b5932bac9
fix(aurora): fixed broken help formatting
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 22s
Actions / Build Documentation (MkDocs) (push) Successful in 19s
2024-03-08 14:21:26 -05:00
f4efcb8ea5
feat(aurora): migrated to Red's builtin timedelta/relativedelta parsing
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 26s
Actions / Build Documentation (MkDocs) (push) Successful in 20s
2024-03-08 14:19:48 -05:00
6035aea5c6
misc(repo): bumped ruff version
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 19s
Actions / Build Documentation (MkDocs) (push) Successful in 16s
2024-03-07 21:33:26 -05:00
03c14a0311
fix(workflow): update for new docker image 2024-03-07 21:33:12 -05:00
56522e51ad
fix(pterodactyl): pylint fixes
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 42s
Actions / Build Documentation (MkDocs) (push) Successful in 42s
2024-03-07 21:14:12 -05:00
9eff010b35
fix(pterodactyl): reduced websocket logging level again
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 25s
Actions / Build Documentation (MkDocs) (push) Successful in 32s
2024-03-07 16:52:38 -05:00
c0195f44f6
fix(pterodactyl): fixed websocket logging (only sends debug logs if the global logging level is set to verbose or trace)
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 24s
Actions / Build Documentation (MkDocs) (push) Successful in 28s
2024-03-07 16:48:40 -05:00
fdb785ffd7
feat(backup): allow for retrieving backup exports from bot messages if you reply to them
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 23s
Actions / Build Documentation (MkDocs) (push) Successful in 28s
2024-03-07 13:47:40 -05:00
178a92559c
feat(repo): added help formatters for version numbers to cogs that have them and migrated to using red's inbuilt loggers instead of logging.getLogger
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 31s
Actions / Build Documentation (MkDocs) (push) Successful in 26s
2024-03-07 03:38:34 -05:00
ae31a61436
fix(pterodactyl): log websocket messages to VERBOSE (log level 5) and not DEBUG
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 18s
Actions / Build Documentation (MkDocs) (push) Successful in 23s
2024-03-07 02:52:44 -05:00
9e826d6ba5
misc(pterodactyl): testing something
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 26s
Actions / Build Documentation (MkDocs) (push) Successful in 25s
2024-03-07 02:39:49 -05:00
b5362ff153
fix(pterodactyl): update PterodactylClient initialization to use my own logger instead of setting debug to true
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 20s
Actions / Build Documentation (MkDocs) (push) Successful in 25s
2024-03-07 02:33:14 -05:00
2e5fa81eac
fix(pterodactyl): use custom fork of pydactyl library to fix https://github.com/iamkubi/pydactyl/issues/82
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 30s
Actions / Build Documentation (MkDocs) (push) Successful in 30s
2024-03-07 02:19:22 -05:00
c65fdd698c
fix(pterodactyl): pylint fixes 2024-03-07 02:19:00 -05:00
497f6a0a1a
fix(repo): changed all loggers to red.seacogs.<cog_name> instead of red.sea.<cog_name>
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 49s
Actions / Build Documentation (MkDocs) (push) Successful in 43s
2024-03-07 01:32:27 -05:00
f059145681
fix(pterodactyl): missed one!
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 23s
Actions / Build Documentation (MkDocs) (push) Successful in 27s
2024-03-07 01:04:27 -05:00
41a8d575d4
fix(pterodactyl): fixed InteractionResponded error when using a power slash command
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 22s
Actions / Build Documentation (MkDocs) (push) Successful in 24s
2024-03-07 01:03:36 -05:00
dd62b7d7ce
fix(pterodactyl): whoops!
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 22s
Actions / Build Documentation (MkDocs) (push) Successful in 26s
2024-03-07 00:59:14 -05:00
bbb54f0f55
feat(pterodactyl): fixed slash commands
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 21s
Actions / Build Documentation (MkDocs) (push) Successful in 25s
2024-03-07 00:56:50 -05:00
f033f6a483
fix(pterodactyl): maybe fixed hybrid config commands, if this doesn't work, I'll move configuration commands to a separate command
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 23s
Actions / Build Documentation (MkDocs) (push) Successful in 26s
2024-03-07 00:21:51 -05:00
1bb7e22b95
fix(pterodactyl): fixed another issue with hybrid commands
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 21s
Actions / Build Documentation (MkDocs) (push) Successful in 23s
2024-03-07 00:14:52 -05:00
f707b70097
fix(pterodactyl): fixed broken slash commands
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 21s
Actions / Build Documentation (MkDocs) (push) Successful in 24s
2024-03-07 00:13:43 -05:00
64ab2fbf82
feat(pterodactyl): added a pterodactyl command command to execute commands on the server and made pterodactyl command and pterodactyl power into hybrid commands
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 24s
Actions / Build Documentation (MkDocs) (push) Successful in 30s
2024-03-07 00:00:15 -05:00
9d64c15a87
misc(pterodactyl): added another ⚠️
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 20s
Actions / Build Documentation (MkDocs) (push) Successful in 22s
2024-03-05 02:28:10 -05:00
8c58e1746e
feat(pterodactyl): added ptero power kill command
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 18s
Actions / Build Documentation (MkDocs) (push) Successful in 22s
2024-03-05 02:25:58 -05:00
52be531807
fix(pterodactyl): type hints 2024-03-05 02:24:20 -05:00
80cb729e72
fix(pterodactyl): make sure views get removed properly
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 21s
Actions / Build Documentation (MkDocs) (push) Successful in 22s
2024-03-05 02:19:59 -05:00
df92bc34cc
fix(pterodactyl): fixed some bugs
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 19s
Actions / Build Documentation (MkDocs) (push) Successful in 22s
2024-03-05 02:18:11 -05:00
b2f27f9490
feat(pterodactyl): added confirmation prompts to the power commands
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 19s
Actions / Build Documentation (MkDocs) (push) Successful in 24s
2024-03-05 02:16:32 -05:00
093a6b9077
fix(backup): reduced python version constraint
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 19s
Actions / Build Documentation (MkDocs) (push) Successful in 23s
2024-03-05 02:13:56 -05:00
8639615c49
docs(): updated urls to www.coastalcommits.com from coastalcommits.com
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 24s
Actions / Build Documentation (MkDocs) (push) Successful in 26s
2024-03-04 23:54:56 -05:00
dec154fb4c
fix(backup): changed version constraints again
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 18s
Actions / Build Documentation (MkDocs) (push) Successful in 23s
there have been no changes to downloader that break this since 3.5.0's release. however, 3.5.6 will be breaking most likely
2024-03-04 23:43:14 -05:00
aaba9ebd59
fix(backup): reduced minimum bot version to 3.5.2
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 20s
Actions / Build Documentation (MkDocs) (push) Successful in 22s
2024-03-04 23:37:22 -05:00
75adf692c1
docs(pterodactyl): updated an outdated default value in the docs
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 19s
Actions / Build Documentation (MkDocs) (push) Successful in 23s
2024-03-04 23:16:09 -05:00
85d5316f43
fix(pterodactyl): forgot two!
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 19s
Actions / Build Documentation (MkDocs) (push) Successful in 23s
2024-03-04 23:13:37 -05:00
13dba790b7
fix(pterodactyl): removed leftover debug statement 2024-03-04 23:13:25 -05:00
d01985eea6
fix(pterodactyl): removed a bunch of useless/redundant logging statements
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 19s
Actions / Build Documentation (MkDocs) (push) Successful in 23s
2024-03-04 23:12:32 -05:00
0baad46298
misc(pterodactyl): temporarily adding a debug statement to test something
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 20s
Actions / Build Documentation (MkDocs) (push) Successful in 24s
2024-03-04 23:06:51 -05:00
3d3c5f708e
docs(pterodactyl): added new placeholder to chat command docs
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 19s
Actions / Build Documentation (MkDocs) (push) Successful in 26s
2024-03-04 23:04:36 -05:00
34c34e745a
feat(pterodactyl): added a discord invite placeholder
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 22s
Actions / Build Documentation (MkDocs) (push) Successful in 25s
updated default chat command as well, and also a configuration value and related command
2024-03-04 22:59:43 -05:00
87dfc03812
fix(pterodactyl): don't ping users, roles, or @everyone/@here in console messages + ping only users in chat messages
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 20s
Actions / Build Documentation (MkDocs) (push) Successful in 25s
2024-03-04 19:53:12 -05:00
eecf1fb70f
docs(pterodactyl): added a guide on installing Red on Pterodactyl
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 21s
Actions / Build Documentation (MkDocs) (push) Successful in 25s
2024-03-04 15:26:25 -05:00
9b153a4799
fix(pterodactyl): whoops I forgot two
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 19s
Actions / Build Documentation (MkDocs) (push) Successful in 24s
2024-03-03 02:01:33 -05:00
0496454030
fix(pterodactyl): only json.loads() once in the websocket handling code
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 22s
Actions / Build Documentation (MkDocs) (push) Has been cancelled
2024-03-03 02:01:01 -05:00
e2389cec08
fix(pterodactyl): don't log console messages while server is offline (why even?)
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 19s
Actions / Build Documentation (MkDocs) (push) Successful in 23s
2024-03-02 20:10:16 -05:00
58e88f2dd6
fix(pterodactyl): use re.search instead of re.match (thanks zephyrkul)
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 22s
Actions / Build Documentation (MkDocs) (push) Has been cancelled
2024-03-02 20:09:39 -05:00
9106675276
fix(pterodactyl): wooo more debug statements
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 20s
Actions / Build Documentation (MkDocs) (push) Successful in 25s
2024-03-02 19:53:09 -05:00
72d8ff4782
fix(pterodactyl): 🥺
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 21s
Actions / Build Documentation (MkDocs) (push) Successful in 26s
2024-03-02 19:50:48 -05:00
9e92d82817
fix(pterodactyl): fixed trying to match against dictionary keys instead of their values
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 20s
Actions / Build Documentation (MkDocs) (push) Successful in 29s
2024-03-02 19:43:28 -05:00
1ad721f380
fix(pterodactyl): use add_field so formatting doesn't look off
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 19s
Actions / Build Documentation (MkDocs) (push) Successful in 21s
2024-03-02 19:35:42 -05:00
088bf6b8dc
fix(pterodactyl): use .items() to unpack dictionary values
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 18s
Actions / Build Documentation (MkDocs) (push) Successful in 22s
2024-03-02 19:34:30 -05:00
bf3f0f9782
fix(pterodactyl): actually show the blacklisted regex in ptero set view
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 19s
Actions / Build Documentation (MkDocs) (push) Successful in 21s
2024-03-02 19:32:45 -05:00
e6231bf1a7
fix(pterodactyl): fixed TypeError (again)
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 20s
Actions / Build Documentation (MkDocs) (push) Successful in 21s
2024-03-02 19:31:26 -05:00
4020ab7847
fix(pterodactyl): fixed TypeError
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 20s
Actions / Build Documentation (MkDocs) (push) Successful in 28s
2024-03-02 19:30:15 -05:00
f6ebbae583
feat(pterodactyl): added a regex blacklist command
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 19s
Actions / Build Documentation (MkDocs) (push) Successful in 24s
2024-03-02 19:27:36 -05:00
5c2bfea238
misc(pterodactyl): added a comment explaining why pterodactylclient is being used with debug mode enabled
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 21s
Actions / Build Documentation (MkDocs) (push) Successful in 24s
2024-03-02 19:08:36 -05:00
a52a991ae6
fix(pterodactyl): remove " characters from tellraw message strings
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 23s
Actions / Build Documentation (MkDocs) (push) Successful in 25s
2024-03-02 16:41:36 -05:00
6e2776b63a
misc(pterodactyl): removed unused config keys
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 25s
Actions / Build Documentation (MkDocs) (push) Successful in 33s
2024-03-02 15:46:04 -05:00
4c7526b157
fix(pterodactyl): changed achivement embed colors
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 27s
Actions / Build Documentation (MkDocs) (push) Successful in 31s
2024-03-02 15:42:29 -05:00
6cdab8363a
misc(pterodactyl): made achievement text bold
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 20s
Actions / Build Documentation (MkDocs) (push) Successful in 23s
2024-03-02 15:38:06 -05:00
464483b4c9
fix(pterodactyl): regex consistency
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 18s
Actions / Build Documentation (MkDocs) (push) Successful in 25s
2024-03-02 15:30:47 -05:00
3d7337c42c
fix(pterodactyl): don't detect messages from the server/rcon as chat messages
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 18s
Actions / Build Documentation (MkDocs) (push) Successful in 24s
2024-03-02 15:29:59 -05:00
8ccb174913
fix(pterodactyl): fixed incorrect websocket handling
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 19s
Actions / Build Documentation (MkDocs) (push) Successful in 24s
2024-03-02 15:27:34 -05:00
3e18894bb5
fix(pterodactyl): only check if a message is a chat message if it isn't a server message
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 19s
Actions / Build Documentation (MkDocs) (push) Successful in 22s
2024-03-02 15:20:33 -05:00
1263f59cee
fix(pterodactyl): detect messages sent through /say
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 20s
Actions / Build Documentation (MkDocs) (push) Successful in 23s
2024-03-02 15:18:32 -05:00
385c94c97e
fix(pterodactyl): fixed broken chat command default
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 20s
Actions / Build Documentation (MkDocs) (push) Successful in 24s
2024-03-02 15:12:59 -05:00
a7a42be4ed
fix(pterodactyl): don't allow pings through the websocket chat
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 21s
Actions / Build Documentation (MkDocs) (push) Successful in 25s
2024-03-02 15:11:40 -05:00
1f51cb2a27
fix(pterodactyl): changed a regex pattern default 2024-03-02 15:11:26 -05:00
eb5fdfa84e
docs(pterodactyl): added regex examples page 2024-03-02 15:11:14 -05:00
030291113b
docs(pterodactyl): don't make the user give the subuser permissions it doesn't need
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 21s
Actions / Build Documentation (MkDocs) (push) Successful in 26s
2024-03-02 13:21:12 -05:00
7e4d4b348a
fix(pterodactyl): match the correct group in check_if_server_message
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 19s
Actions / Build Documentation (MkDocs) (push) Successful in 24s
2024-03-02 12:41:54 -05:00
4c234502f7
fix(pterodactyl): fixed broken regex
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 20s
Actions / Build Documentation (MkDocs) (push) Successful in 23s
2024-03-02 12:40:25 -05:00
26e5bd9129
fix(pterodactyl): check if server message is from Server or Rcon before sending to chat channel
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 21s
Actions / Build Documentation (MkDocs) (push) Successful in 24s
2024-03-02 12:36:38 -05:00
8fdf9eb239
docs(pterodactyl): added a section on installing the cog and explaining what the project is
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 22s
Actions / Build Documentation (MkDocs) (push) Successful in 26s
2024-03-02 12:29:10 -05:00
3a52efeac0
Merge pull request 'Add Pterodactyl cog' (#19) from pterodactyl into main
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 18s
Actions / Build Documentation (MkDocs) (push) Successful in 25s
Reviewed-on: SeaswimmerTheFsh/SeaCogs#19
2024-03-02 05:07:42 +00:00
882b0386f2
fix(pterodactyl): pylint fixes
All checks were successful
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 21s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 24s
2024-03-01 23:43:46 -05:00
45797361a6
docs(pterodactyl): flushed out the docs more
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 24s
2024-03-01 23:35:12 -05:00
12862ccea7
fix(pterodactyl): docstring change
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 23s
2024-03-01 23:04:33 -05:00
0b0afa53d6
fix(pterodactyl): docstring change
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 23s
2024-03-01 23:03:43 -05:00
9e8bcb952a
fix(pterodactyl): made configuration command arguments required
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-03-01 23:01:11 -05:00
0882a498b6
fix(pterodactyl): forgot to move something in the config view command
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 20s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 22s
2024-03-01 22:57:00 -05:00
d1966fb05f
fix(pterodactyl): cleaned up the pterodactyl config view command
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 27s
2024-03-01 22:55:07 -05:00
987a29afff
feat(pterodactyl): added [p]pterodactyl config view command
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 22s
2024-03-01 22:53:08 -05:00
f93223fd36
fix(pterodactyl): use an escaped * for ip masking so markdown isn't triggered
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 23s
2024-03-01 22:39:58 -05:00
306148ea69
feat(pterodactyl): added masking of IP addresses in the console output
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 21s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 24s
2024-03-01 22:38:49 -05:00
fb177ff8ad
fix(pterodactyl): fixed broken placeholder replacement
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-03-01 22:25:21 -05:00
e9523d5f70
fix(pterodactyl): fixed server messages sometimes not logging
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 20s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 23s
2024-03-01 22:24:02 -05:00
6a02381e89
feat(pterodactyl): add power commands
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 21s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 25s
2024-03-01 22:20:50 -05:00
b75bacb811
docs(pterodactyl): restarting is not a server power status type
All checks were successful
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 23s
2024-03-01 15:45:54 -05:00
88c77b4aa5
fix(pterodactyl): fixed error if base_url ends in /
All checks were successful
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 24s
2024-03-01 15:44:26 -05:00
af29b950c2
docs(pterodactyl): consistency
All checks were successful
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 20s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 22s
2024-03-01 15:30:46 -05:00
95bf863f7e
fix(pterodactyl): alphabetized a dict and the docs
All checks were successful
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 22s
2024-03-01 15:28:14 -05:00
dab56bed94
feat(pterodactyl): added more placeholders and updated documentation to match
All checks were successful
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 22s
2024-03-01 15:27:13 -05:00
4979e44b7c
feat(pterodactyl): updated how placeholders are parsed in get_chat_command(), updated documentation to match
All checks were successful
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 23s
2024-03-01 15:21:44 -05:00
1bc1c7a90e
fix(pterodactyl): fixed retry functionality - no longer blocks the bot
All checks were successful
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 21s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 23s
2024-03-01 15:11:57 -05:00
a166168507
fix(pterodactyl): maybe?
All checks were successful
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 22s
2024-03-01 15:02:42 -05:00
8b50c0376d
fix(pterodactyl): asyncio sleep instead of blocking
All checks were successful
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 20s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 22s
2024-03-01 14:59:20 -05:00
a0b1773185
fix(pterodactyl): added another info logging statement
All checks were successful
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 22s
2024-03-01 14:57:21 -05:00
b6819192b0
fix(pterodactyl): use time.sleep instead
All checks were successful
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 20s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 26s
2024-03-01 14:56:44 -05:00
b775439967
fix(pterodactyl): cleanup
All checks were successful
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 20s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 24s
2024-03-01 14:52:14 -05:00
f2d54ce23b
feat(pterodactyl): added a retry counter and sleep cooldown to the error_callback
All checks were successful
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 21s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 25s
2024-03-01 14:42:45 -05:00
b7f5ae644a
fix(pterodactyl): check if websocket_credentials is None 2024-03-01 14:18:44 -05:00
684f2559e2
fix(pterodactyl): pylint fixes
All checks were successful
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-03-01 14:11:11 -05:00
a1a33ebfca
docs(pterodactyl): flushed out setup page
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 24s
2024-03-01 14:08:57 -05:00
8b1e42716b
fix(pterodactyl): use a custom logger for the websocket instead of websockets.client
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 21s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 25s
2024-03-01 14:04:10 -05:00
837bf4aa34
fix(pterodactyl): changed a bunch of logger messages to be info and not debug
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 20s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 27s
2024-03-01 13:16:22 -05:00
1bbabd495f
fix(pterodactyl): added logging for if the WebSocket task is cancelled
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 20s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 22s
2024-03-01 13:14:55 -05:00
8cbad26e1d
fix(pterodactyl): removed some debugging stuff
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 21s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 23s
2024-03-01 13:13:30 -05:00
6f4f13e623
fix(pterodactyl): adding some debugging code
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 21s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 26s
2024-03-01 13:08:10 -05:00
b18b99075e
misc(pterodactyl): added a space to fix an embed
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 26s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 34s
2024-03-01 01:21:10 -05:00
3795d7d13a
fix(pterodactyl): updated info.json
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 17s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-03-01 01:19:51 -05:00
dd6184ccd0
fix(pterodactyl): remove useless config key
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-03-01 01:17:48 -05:00
afc5868e9e
feat(pterodactyl): use red's api key storage system for api key storage and not a config key
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 24s
2024-03-01 01:17:31 -05:00
7e03696e10
feat(pterodactyl): added achievements
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 20s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-03-01 00:46:51 -05:00
8954df4c1d
fix(pterodactyl): fixed a docstring
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 20s
2024-03-01 00:30:38 -05:00
f2c56e0382
fix(pterodactyl): restrict [p]pterodactyl config to bot owners
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-03-01 00:29:08 -05:00
bd7aa54efe
fix(pterodactyl): fixed an issue with colors in generate_join_leave_embed
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-03-01 00:25:39 -05:00
f91cd82d1b
fix(pterodactyl): added config key I forgot to register
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-03-01 00:23:59 -05:00
2fbd8cde9e
feat(pterodactyl): added user join/leave
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 20s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 22s
2024-03-01 00:23:00 -05:00
7a39c9a75d
feat(pterodactyl): added startup and shutdown messages
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-03-01 00:05:06 -05:00
d39f0ba104
feat(pterodactyl): server status will persist through reloads
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 22s
2024-03-01 00:02:42 -05:00
a4f68d55eb
fix(pterodactyl): register config on cog class initialization
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 20s
2024-02-29 23:55:51 -05:00
8387064ab4
fix(pterodactyl): maybe fixed config issue
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 20s
2024-02-29 23:54:35 -05:00
9e63b4e798
fix(pterodactyl): oops lol
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-02-29 23:52:48 -05:00
0d21a52ce3
feat(pterodactyl): added support for bridging messages sent by the server
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-02-29 23:50:54 -05:00
457f1da7f4
fix(pterodactyl): pylint "fix"
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 22s
2024-02-29 23:44:28 -05:00
c0289a86fc
fix(pterodactyl): pylint fixes
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-02-29 23:42:12 -05:00
7f8d70ccae
fix(pterodactyl): fixed circular import
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-02-29 23:33:00 -05:00
2bf8629e4c
fix(pterodactyl): updated typehints
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-02-29 23:31:30 -05:00
e1c98aa78f
cleanup(pterodactyl): split out a bunch of stuff into separate files
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 23s
2024-02-29 23:26:24 -05:00
417f297193
misc(pterodactyl): renamed tellraw to chat_command
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 20s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 23s
2024-02-29 22:41:06 -05:00
37cdca09ec
fix(pterodactyl): pylint fixes
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 24s
2024-02-29 22:15:44 -05:00
84b0201662
docs(pterodactyl): added docs pages 2024-02-29 22:11:37 -05:00
839ead56eb
fix(pterodactyl): remove looping functionality from websocket.connect on line 62 as it's irrelevant now and was broken regardless 2024-02-29 22:07:22 -05:00
9e15730af9
fix(pterodactyl): cancel the task upon error 2024-02-29 22:06:59 -05:00
de5d0194c8
fix(pterodactyl): don't send chat messages to minecraft containing bot commands
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 24s
2024-02-29 21:51:18 -05:00
ef7f574306
fix(pterodactyl): testing a fix to tellraw
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-02-29 21:46:47 -05:00
07835e7b13
fix(pterodactyl): fixed TypeError
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 20s
2024-02-29 21:41:00 -05:00
cccc941e26
fix(pterodactyl): restart the websocket task if it fails
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 22s
2024-02-29 21:38:54 -05:00
0aa17e8807
fix(pterodactyl): fixed exceptions in the websocket task being suppressed
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 22s
2024-02-29 21:35:09 -05:00
366bafcd27
fix(pterodactyl): don't trim content
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 20s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 23s
2024-02-29 21:18:42 -05:00
d5600e8cf7
fix(pterodactyl): fixed chat messages breaking and removed debug logging
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 22s
2024-02-29 21:15:46 -05:00
97213a5025
fix(pterodactyl): maybe?
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 20s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 23s
2024-02-29 21:14:10 -05:00
2e4b664760
fix(pterodactyl): maybe?
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-02-29 21:11:16 -05:00
925e402819
fix(pterodactyl): try to match regex early for debugging
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 22s
2024-02-29 21:08:50 -05:00
502ffbee84
fix(pterodactyl): adding some debug logging
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 22s
2024-02-29 21:07:28 -05:00
f87f4ee37f
fix(pterodactyl): don't try to send messages from bots to the server (for real this time)
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 20s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 22s
2024-02-29 21:00:35 -05:00
50dd5c64b4
fix(pterodactyl): added error messages for if the websocket connection is closed
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-02-29 20:59:47 -05:00
579855af02
fix(pterodactyl): reverted previous commit
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 22s
2024-02-29 20:45:31 -05:00
2fb201a9cb
fix(pterodactyl): happy now?
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-02-29 20:44:46 -05:00
236cb1d815
fix(pterodactyl): adding debug strings to check_if_chat_message
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 22s
2024-02-29 20:43:11 -05:00
f588caf25f
fix(pterodactyl): fixed broken tellraw string
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 22s
2024-02-29 20:40:03 -05:00
4108bb22bb
fix(pterodactyl): moved chatchannel into the chat command group
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 22s
2024-02-29 20:31:29 -05:00
76aa99c3f9
feat(pterodactyl): configuration update + a bunch of other stuff
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 23s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 25s
2024-02-29 20:28:26 -05:00
f792ad58a0
fix(pterodactyl): use display_name and not name
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-02-29 19:01:17 -05:00
5a4dc4866c
feat(pterodactyl): added role coloring for discord roles
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 20s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 23s
2024-02-29 19:00:07 -05:00
d3cc445802
feat(pterodactyl): testing allowing custom colors in tellraw
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 22s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 27s
2024-02-29 18:53:47 -05:00
4174bc4be7
fix(pterodactyl): don't accept messages from bots
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 23s
2024-02-29 18:53:17 -05:00
d00b70758a
fix(pterodactyl): hopefully fixed tellraw error
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 20s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 25s
2024-02-29 18:50:22 -05:00
b0a110e4f8
fix(pterodactyl): added more debug logging
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 21s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 23s
2024-02-29 18:39:01 -05:00
9023ea160b
feat(pterodactyl): added console channel logging for chat messages
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-02-29 17:27:36 -05:00
0e638ca9e3
fix(pterodactyl): fixing tellraw command
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-02-29 17:24:08 -05:00
5dc55b52e7
fix(pterodactyl): testing fix to sending chat messages to minecraft
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 22s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-02-29 17:22:41 -05:00
4f95955a04
fix(pterodactyl): fixed broken formatting
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 22s
2024-02-29 17:19:26 -05:00
510f8c788e
feat(pterodactyl): added sending messages from discord to the server
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 20s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 22s
2024-02-29 17:18:03 -05:00
a791c27fc3
fix(pterodactyl): fixed broken debug statement
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 24s
2024-02-29 17:14:06 -05:00
07e2497aac
fix(pterodactyl): fixed incorrect dictionary key causing an error
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-02-29 17:01:00 -05:00
e12ded9d42
fix(pterodactyl): add more verbose debug logging
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 22s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 22s
2024-02-29 16:58:19 -05:00
ee6e900e7d
fix(pterodactyl): fixed incorrect config name
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-02-29 16:55:45 -05:00
f42c536f7c
fix(pterodactyl): awaited a coroutine
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 25s
2024-02-29 16:53:09 -05:00
7e728087c4
fix(pterodactyl): adding debug logging so i can figure out what's failing in the chat system
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 17s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 23s
2024-02-29 16:52:10 -05:00
9a698fbac6
feat(pterodactyl): added one-way chat messages (minecraft --> discord)
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 22s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 24s
2024-02-29 16:47:20 -05:00
dab7343ca6
fix(pterodactyl): use running, not started
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-02-28 13:44:13 -05:00
239f7cf613
fix(pterodactyl): fixed current_status
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-02-28 13:41:51 -05:00
39ae8b5ea0
fix(pterodactyl): do not log during startup/shutdown to avoid the console channel getting flooded and ratelimited
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-02-28 13:39:40 -05:00
142336e233
feat(pterodactyl): handle server status changes
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 23s
2024-02-28 13:32:31 -05:00
f6f0a31763
fix(pterodactyl): don't log console command executions
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-02-28 13:22:46 -05:00
ec2cd09f8e
fix(pterodactyl): removed ansi escape codes
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 20s
2024-02-28 13:21:39 -05:00
c740cdc6dc
feat(pterodactyl): fixed some issues and added logging for what user executed a command through the console
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-02-28 13:18:15 -05:00
a8f60b1aec
fix(pterodactyl): do not ratelimit yourself
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 20s
2024-02-28 13:08:24 -05:00
d297a2181d
fix(pterodactyl): i'm dumb
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-02-28 13:07:31 -05:00
60f94c4499
fix(pterodactyl): testing a ""solution"" to the websocket closing problem
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 17s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-02-28 13:05:04 -05:00
ccbce180dd
fix(pterodactyl): hopefully fixed the websocket closing on console output event
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 20s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-02-28 13:03:31 -05:00
2017cbb226
cleanup(pterodactyl): making some changes to establish_websocket_connection
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 22s
2024-02-28 13:00:11 -05:00
caa03a63e6
fix(pterodactyl): set origin header through websockets.connect and not through extra_headers 2024-02-28 12:54:34 -05:00
b7635f06f5
fix(pterodactyl): added a character limit to the channel.send call in the websocket method
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 20s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-02-28 12:50:16 -05:00
ff93fd8527
fix(pterodactyl): awaited a coroutine
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-02-28 12:47:15 -05:00
3d8f479347
fix(pterodactyl): cog ->Cog
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 17s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 20s
2024-02-28 12:44:54 -05:00
0961985168
feat(pterodactyl): added configuration command for setting the console channel
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 17s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 22s
2024-02-28 12:44:12 -05:00
cebc2223d9
feat(pterodactyl): added console channel support
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 21s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 24s
2024-02-28 12:43:26 -05:00
d9f5d14f40
fix(pterodactyl): origin, not Origin
All checks were successful
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 22s
2024-02-28 12:03:16 -05:00
7b83513d63
cleanup(pterodactyl): removed debug loggers
All checks were successful
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-02-28 11:59:49 -05:00
48634ac903
fix(pterodactyl): enabled debug mode on the pterodactylclient
All checks were successful
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 19s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 21s
2024-02-28 11:57:39 -05:00
2312cce011
fix(pterodactyl): added temporary debugging logs
All checks were successful
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 20s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 20s
2024-02-28 11:55:48 -05:00
09d48082e5 Revert "fix(pterodactyl): awaited a coroutine"
All checks were successful
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 20s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 22s
This reverts commit 08cd13d7c7.
2024-02-28 11:54:16 -05:00
08cd13d7c7
fix(pterodactyl): awaited a coroutine
All checks were successful
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 20s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 26s
2024-02-28 11:52:35 -05:00
d391aeeb7b
fix(pterodactyl): handle disconnecting from the websocket
All checks were successful
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 21s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 25s
2024-02-28 11:46:00 -05:00
e6ca4071f3
fix(pterodactyl): fixed broken poetry.lock file
All checks were successful
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 23s
2024-02-28 11:31:47 -05:00
6738ab17ca Merge branch 'main' into pterodactyl
All checks were successful
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 25s
2024-02-28 11:30:16 -05:00
fbb31dc0d4
fix(workflow): do not cancel pylint if ruff fails
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 16s
Actions / Build Documentation (MkDocs) (push) Successful in 12s
2024-02-28 11:30:04 -05:00
8a22d5ce23
fix(pterodactyl): pylint fixes
All checks were successful
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 21s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 24s
2024-02-28 11:08:16 -05:00
f485df856c
Merge remote-tracking branch 'origin/main' into pterodactyl
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 24s
2024-02-28 11:06:32 -05:00
95a947b019
fix(aurora): fixed a dangerous-default-value pylint warning in database.mysql_log()
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 17s
Actions / Build Documentation (MkDocs) (push) Successful in 12s
2024-02-28 11:01:33 -05:00
84543fbd73
fix(aurora): more pylint fixes
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 18s
Actions / Build Documentation (MkDocs) (push) Successful in 13s
2024-02-28 10:58:57 -05:00
92b031c54e
fix(backup): pylint fix 2024-02-28 10:56:46 -05:00
bd3a08fe97
fix(aurora): pylint fixes 2024-02-28 10:56:13 -05:00
98396c17e2
feat(workflow): readd pylint linting
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 17s
Actions / Build Documentation (MkDocs) (push) Successful in 13s
2024-02-28 10:52:22 -05:00
be27d882f2
fix(pterodactyl): don't await something that isn't a coroutine
All checks were successful
Actions / Lint Code (Ruff) (pull_request) Successful in 10s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 24s
2024-02-28 10:46:42 -05:00
d092f78502
feat(pterodactyl): added more debug logging to the configuration commands
All checks were successful
Actions / Lint Code (Ruff) (pull_request) Successful in 7s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 23s
2024-02-28 08:56:47 -05:00
d92831f3db
misc(pterodactyl): added a debug logging statement to the first line of establish_websocket_connection
All checks were successful
Actions / Lint Code (Ruff) (pull_request) Successful in 8s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 23s
2024-02-28 08:49:02 -05:00
2d4e372784
fix(pterodactyl): fixed the cog load process being blocked by the establish_websocket_connection method
All checks were successful
Actions / Lint Code (Ruff) (pull_request) Successful in 7s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 24s
2024-02-28 08:47:24 -05:00
5e3ab08d6d
fix(pterodactyl): fixed a broken debug logging statement
All checks were successful
Actions / Lint Code (Ruff) (pull_request) Successful in 7s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 25s
2024-02-28 08:37:02 -05:00
f377dc9250
fix(pterodactyl): added websockets as a dependency in info.json 2024-02-28 08:36:47 -05:00
680f92572c
fix(pterodactyl): fixed debug logging causing an error in establish_websocket_connection
All checks were successful
Actions / Lint Code (Ruff) (pull_request) Successful in 6s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 24s
2024-02-28 08:20:35 -05:00
ea84044e73
fix(pterodactyl): fix failing to connect to the websocket due to a 403 error
All checks were successful
Actions / Lint Code (Ruff) (pull_request) Successful in 6s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 22s
2024-02-28 08:14:40 -05:00
53adeb4b80
feat(pterodactyl): added configuration commands
All checks were successful
Actions / Lint Code (Ruff) (pull_request) Successful in 7s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 24s
2024-02-28 08:11:23 -05:00
9d4d8b8267
misc(pterodactyl): moved configuration calls into establish_websocket_connection 2024-02-28 08:11:15 -05:00
6e6559d80c
feat(pterodactyl): added more verbose debug logging to establish_websocket_connection 2024-02-28 08:10:46 -05:00
dcf0165a8a
misc(pterodactyl): removed credentials from default configs
All checks were successful
Actions / Lint Code (Ruff) (pull_request) Successful in 6s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 24s
api key has been invalidated
2024-02-27 23:18:17 -05:00
6158d05960
feat(pterodactyl): introduced the cog
All checks were successful
Actions / Lint Code (Ruff) (pull_request) Successful in 9s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 24s
2024-02-27 23:02:03 -05:00
57c7bce6cd
fix(workflow): use the correct containers
All checks were successful
Actions / Lint Code (Ruff) (push) Successful in 5s
Actions / Build Documentation (MkDocs) (push) Successful in 12s
Actions / Lint Code (Ruff) (pull_request) Successful in 7s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 13s
2024-02-14 14:04:19 -05:00
5d1f8818eb
misc(docs): removed method reference from nerdify.md
All checks were successful
Actions / Lint Code (Ruff) (push) Successful in 9s
Actions / Build Documentation (MkDocs) (push) Successful in 29s
2024-02-14 13:20:20 -05:00
858a1bae8a
fix(repo): ruff fixes / removing pylint exceptions
All checks were successful
Actions / Lint Code (Ruff) (push) Successful in 6s
Actions / Build Documentation (MkDocs) (push) Successful in 25s
2024-02-14 11:04:26 -05:00
e34d621e6d
test(ruff): enabled E, C, disabled C901 2024-02-14 10:59:10 -05:00
dd9e221e2d
misc(repo): adding some more stuff to the ruff configs
Some checks failed
Actions / Lint Code (Ruff) (push) Failing after 6s
Actions / Build Documentation (MkDocs) (push) Successful in 24s
2024-02-14 10:51:10 -05:00
5aff4afad1
misc(repo): setting up ruff
All checks were successful
Actions / Lint Code (Ruff) (push) Successful in 5s
Actions / Build Documentation (MkDocs) (push) Successful in 24s
2024-02-14 10:43:21 -05:00
9c293750cb
fix(aurora): ruff fixes
All checks were successful
Actions / Lint Code (Ruff) (push) Successful in 5s
Actions / Build Documentation (MkDocs) (push) Successful in 24s
2024-02-14 10:39:26 -05:00
516e4539e8
fix(repo): fixed pyproject file having incorrect deps
Some checks failed
Actions / Lint Code (Ruff) (push) Failing after 6s
Actions / Build Documentation (MkDocs) (push) Successful in 26s
2024-02-14 10:37:54 -05:00
eafd02bb53
feat(workflow): switch to ruff for code linting
Some checks failed
Actions / Lint Code (Ruff) (push) Failing after 5s
Actions / Build Documentation (MkDocs) (push) Successful in 14s
2024-02-14 10:35:57 -05:00
1aa12e88ac
fix(aurora): fixed unknown user in history command
All checks were successful
Actions / Lint Code (Pylint) (push) Successful in 16s
Actions / Build Documentation (MkDocs) (push) Successful in 11s
2024-02-13 18:28:06 -05:00
69482c9f45
fix(aurora): fixed a NoneType error in utils.fetch_user_dict()
All checks were successful
Actions / Lint Code (Pylint) (push) Successful in 17s
Actions / Build Documentation (MkDocs) (push) Successful in 13s
2024-02-13 18:25:32 -05:00
35ad7a77a7
fix(aurora): require ids to be ints in some utlis functions
All checks were successful
Actions / Lint Code (Pylint) (push) Successful in 51s
Actions / Build Documentation (MkDocs) (push) Successful in 14s
2024-02-13 23:19:41 +00:00
f7d2f1a564
misc(aurora): less restrictive type requirements for some utils functions 2024-02-13 23:18:44 +00:00
db7c06b044
misc(aurora): adding typechecks to return values in utils 2024-02-13 23:02:13 +00:00
afb961799d
misc(docs): changed header colors
All checks were successful
Actions / Lint Code (Pylint) (push) Successful in 19s
Actions / Build Documentation (MkDocs) (push) Successful in 14s
2024-02-10 23:47:36 +00:00
3506274a2a
fix(aurora): actually fixed pylint error
All checks were successful
Actions / Lint Code (Pylint) (push) Successful in 17s
Actions / Build Documentation (MkDocs) (push) Successful in 11s
2024-02-03 13:44:08 -05:00
09ce2c7d73
fix(aurora): pylint fix
Some checks failed
Actions / Lint Code (Pylint) (push) Failing after 16s
Actions / Build Documentation (MkDocs) (push) Successful in 13s
2024-02-03 13:41:57 -05:00
21d5266bb6
fix(bible): actual pylint fix
Some checks failed
Actions / Lint Code (Pylint) (push) Failing after 16s
Actions / Build Documentation (MkDocs) (push) Successful in 12s
2024-02-03 13:37:55 -05:00
660b2ddb10
fix(bible): actual pylint fix
Some checks failed
Actions / Lint Code (Pylint) (push) Failing after 16s
Actions / Build Documentation (MkDocs) (push) Successful in 13s
2024-02-03 13:01:51 -05:00
e57e0d53ce
fix(bible): pylint fix
Some checks failed
Actions / Lint Code (Pylint) (push) Failing after 21s
Actions / Build Documentation (MkDocs) (push) Successful in 14s
2024-02-03 12:55:13 -05:00
c7fb47ad2f
feat(bible): added version description to footer
Some checks failed
Actions / Lint Code (Pylint) (push) Failing after 17s
Actions / Build Documentation (MkDocs) (push) Successful in 13s
2024-02-02 13:10:13 -05:00
f615e9f61d
feat(bible): added description and descriptionLocal to the version model 2024-02-02 13:09:46 -05:00
ad2cf39e3e
fix(bible): fixed repr formatting for the Version model 2024-02-02 13:07:56 -05:00
0ccad57476
fix(aurora): pylint fix
All checks were successful
Actions / Lint Code (Pylint) (push) Successful in 22s
Actions / Build Documentation (MkDocs) (push) Successful in 12s
2024-02-02 12:55:34 -05:00
067ded28f3
fix(bible): pylint fixes 2024-02-02 12:55:19 -05:00
cf5e146f88
feat(bible): added language to output of bible passage and bible random
Some checks failed
Actions / Lint Code (Pylint) (push) Failing after 16s
Actions / Build Documentation (MkDocs) (push) Successful in 12s
2024-02-02 12:44:48 -05:00
3dce020a65
fix(bible): fixed keyerror in get_version 2024-02-02 12:44:22 -05:00
3813d3de02
feat(bible): added bible translation to the output of bible random and bible passage
Some checks failed
Actions / Lint Code (Pylint) (push) Failing after 16s
Actions / Build Documentation (MkDocs) (push) Successful in 13s
2024-02-02 12:43:09 -05:00
6be92f05db
fix(aurora): fixed /history not showing roles correctly
Some checks failed
Actions / Lint Code (Pylint) (push) Failing after 16s
Actions / Build Documentation (MkDocs) (push) Successful in 12s
2024-02-02 12:16:41 -05:00
ba5b128afc
fix(aurora): figuring out why I can't get a role from an id
Some checks failed
Actions / Lint Code (Pylint) (push) Failing after 17s
Actions / Build Documentation (MkDocs) (push) Successful in 13s
2024-02-02 12:09:45 -05:00
7d2b71667a
fix(aurora): fixing user dm messages in addrole
Some checks failed
Actions / Lint Code (Pylint) (push) Failing after 17s
Actions / Build Documentation (MkDocs) (push) Successful in 12s
2024-02-02 12:05:05 -05:00
21dabccb48
fix(aurora): fixed mysql_log in addrole (again)
All checks were successful
Actions / Lint Code (Pylint) (push) Successful in 16s
Actions / Build Documentation (MkDocs) (push) Successful in 13s
2024-02-02 11:54:01 -05:00
c1d2e6d28a
fix(aurora): fixed mysql_log in addrole
All checks were successful
Actions / Lint Code (Pylint) (push) Successful in 16s
Actions / Build Documentation (MkDocs) (push) Successful in 12s
2024-02-02 11:53:08 -05:00
5b18b6612a
fix(aurora): defer before sending the user a message
All checks were successful
Actions / Lint Code (Pylint) (push) Successful in 17s
Actions / Build Documentation (MkDocs) (push) Successful in 12s
2024-02-02 11:51:44 -05:00
4d321006c8
fix(aurora): defer the interaction so it doesn't expire
All checks were successful
Actions / Lint Code (Pylint) (push) Successful in 30s
Actions / Build Documentation (MkDocs) (push) Successful in 13s
2024-02-02 11:47:51 -05:00
d1afd62114
fix(aurora): fixed hanging
All checks were successful
Actions / Lint Code (Pylint) (push) Successful in 17s
Actions / Build Documentation (MkDocs) (push) Successful in 13s
2024-02-02 11:43:27 -05:00
efe16cefac
fix(aurora): cleaning up code more
All checks were successful
Actions / Lint Code (Pylint) (push) Successful in 17s
Actions / Build Documentation (MkDocs) (push) Successful in 13s
2024-02-02 11:41:44 -05:00
4ca9760284
fix(aurora): cleaned up addrole
All checks were successful
Actions / Lint Code (Pylint) (push) Successful in 16s
Actions / Build Documentation (MkDocs) (push) Successful in 13s
2024-02-02 11:36:46 -05:00
c9c2e1f955
fix(aurora): oops i set reason instead of role
All checks were successful
Actions / Lint Code (Pylint) (push) Successful in 17s
Actions / Build Documentation (MkDocs) (push) Successful in 12s
2024-02-02 11:33:17 -05:00
a83a63dd6a
fix(aurora): addrole should take a role argument
All checks were successful
Actions / Lint Code (Pylint) (push) Successful in 18s
Actions / Build Documentation (MkDocs) (push) Successful in 12s
2024-02-02 11:32:20 -05:00
018eb5ed28
misc(aurora): version bump
All checks were successful
Actions / Lint Code (Pylint) (push) Successful in 15s
Actions / Build Documentation (MkDocs) (push) Successful in 12s
2024-02-02 11:30:20 -05:00
6d8e139b19
fix(bible): pylint fixes
All checks were successful
Actions / Lint Code (Pylint) (push) Successful in 17s
Actions / Build Documentation (MkDocs) (push) Successful in 13s
2024-02-02 11:27:32 -05:00
eb9d744a3f
fix(backup): pylint fixes 2024-02-02 11:27:28 -05:00
fa3b353704
misc(repository): black reformat
Some checks failed
Actions / Lint Code (Pylint) (push) Failing after 18s
Actions / Build Documentation (MkDocs) (push) Successful in 13s
2024-02-02 11:22:08 -05:00
519e3056ab
feat(aurora): added addrole command 2024-02-02 11:21:56 -05:00
323b4808cb
fix(bible): oops lol
Some checks failed
Actions / Lint Code (Pylint) (push) Failing after 16s
Actions / Build Documentation (MkDocs) (push) Successful in 12s
2024-02-02 02:10:42 -05:00
fda80d4e41
fix(bible): added inexplicableerror and handling for it
Some checks failed
Actions / Lint Code (Pylint) (push) Failing after 15s
Actions / Build Documentation (MkDocs) (push) Successful in 12s
2024-02-02 02:10:06 -05:00
09302403b8
fix(backup): convert author.id to a string before hashing
Some checks failed
Actions / Lint Code (Pylint) (push) Failing after 15s
Actions / Build Documentation (MkDocs) (push) Successful in 11s
2024-02-02 02:07:21 -05:00
21e256c4fb
fix(bible): update info.json to disclose data given through FUMS
Some checks failed
Actions / Lint Code (Pylint) (push) Failing after 15s
Actions / Build Documentation (MkDocs) (push) Successful in 11s
2024-02-02 02:05:47 -05:00
2c14be64ea
fix(bible): hash user ids when sending through FUMS 2024-02-02 02:05:24 -05:00
d1c0ed2e14
misc(bible): removing some annoying debugging code
Some checks failed
Actions / Lint Code (Pylint) (push) Failing after 16s
Actions / Build Documentation (MkDocs) (push) Successful in 12s
2024-02-02 02:00:54 -05:00
e6b72e80ee
misc(bible): fixing up some fums stuff 2024-02-02 02:00:18 -05:00
b86707a6b4
fix(bible): fixing up fums on _get_passage
All checks were successful
Actions / Lint Code (Pylint) (push) Successful in 15s
Actions / Build Documentation (MkDocs) (push) Successful in 12s
2024-02-02 01:55:17 -05:00
08b3553c2c
fix(bible): do not use fums on routes that don't support it (part 3)
All checks were successful
Actions / Lint Code (Pylint) (push) Successful in 15s
Actions / Build Documentation (MkDocs) (push) Successful in 16s
2024-02-02 01:51:47 -05:00
09e91da62f
fix(bible): do not use fums on routes that don't support it (part 2)
All checks were successful
Actions / Lint Code (Pylint) (push) Successful in 15s
Actions / Build Documentation (MkDocs) (push) Successful in 12s
2024-02-02 01:50:31 -05:00
83edd36d6b
fix(bible): don't use fums on an api route that doesn't support it
Some checks failed
Actions / Lint Code (Pylint) (push) Failing after 15s
Actions / Build Documentation (MkDocs) (push) Successful in 12s
2024-02-02 01:48:58 -05:00
7597dcf5f7
fix(bible): adding some troubleshooting code
All checks were successful
Actions / Lint Code (Pylint) (push) Successful in 16s
Actions / Build Documentation (MkDocs) (push) Successful in 11s
2024-02-02 01:47:17 -05:00
acc883af20
fix(bible): fixing some things
All checks were successful
Actions / Lint Code (Pylint) (push) Successful in 15s
Actions / Build Documentation (MkDocs) (push) Successful in 11s
2024-02-02 01:45:51 -05:00
e71fc9f154
fix(bible): do you want strings??
Some checks failed
Actions / Lint Code (Pylint) (push) Failing after 15s
Actions / Build Documentation (MkDocs) (push) Successful in 12s
2024-02-02 01:38:47 -05:00
0980c7cbf2
fix(bible): fixed api requests not being structured to return fums data
Some checks failed
Actions / Lint Code (Pylint) (push) Failing after 16s
Actions / Build Documentation (MkDocs) (push) Successful in 12s
2024-02-02 01:37:38 -05:00
d24d8f9603
feat(bible): implemented API.bible's FUMS system
Some checks failed
Actions / Lint Code (Pylint) (push) Failing after 18s
Actions / Build Documentation (MkDocs) (push) Successful in 13s
2024-02-02 01:35:43 -05:00
83 changed files with 11374 additions and 36202 deletions

View file

@ -80,9 +80,23 @@ Manage the immunity whitelist.
- Usage: `[p]aurora timedelta <duration>`
- Aliases: `tdc, td, and timedeltaconvert`
This command converts a duration to a [`timedelta`](https://docs.python.org/3/library/datetime.html#datetime.timedelta) Python object.
This command converts a duration to a [`timedelta`](https://docs.python.org/3/library/datetime.html#datetime.timedelta) Python object.You cannot convert years or months as they are not fixed units. Use `[p]aurora relativedelta` for that.
**Example usage**
`[p]timedelta 1 day 15hr 82 minutes 52s`
`[p]aurora timedelta 1 day 15hr 82 minutes 52s`
**Output**
`1 day, 16:22:52`
### aurora relativedelta
- Usage: `[p]aurora relativedelta <duration>`
- Aliases: `rdc, rd, and relativedeltaconvert`
This command converts a duration to a [`relativedelta`](https://dateutil.readthedocs.io/en/stable/relativedelta.html) Python object.
**Example usage**
`[p]aurora relativedelta 3 years 1 day 15hr 82 minutes 52s`
**Output**
`relativedelta(years=+3, days=+1, hours=+15, minutes=+82, seconds=+52)`

View file

@ -10,7 +10,7 @@ Aurora is a fully-featured moderation system. It is heavily inspired by Galactic
## Installation
```bash
[p]repo add seacogs https://coastalcommits.com/SeaswimmerTheFsh/SeaCogs
[p]repo add seacogs https://www.coastalcommits.com/cswimr/SeaCogs
[p]cog install seacogs aurora
[p]cog load aurora
```

View file

@ -23,19 +23,27 @@ Add a note to a user.
Warn a user.
## blacklist
## addrole
/// admonition | This command is unfinished, and doesn't currently work.
type: warning
///
- Usage: `/blacklist <target> <role> <reason> [silent]`
- `target:` (Required) Who are you blacklisting?
- `role:` (Required) What blacklist type are you applying to the target?
- `reason:` (Required) Why are you blacklisting this user?
- Usage: `/addrole <target> <role> <reason> [duration] [silent]`
- `target:` (Required) Who are you adding a role to?
- `role:` (Required) What role are you adding to the target?
- `reason:` (Required) Why are you adding a role to this user?
- `duration:` (Optional) How long are you adding this role for?
- `silent:` (Optional) Should the user be messaged?
Add a blacklist role to a user.
Add a role to a user.
## removerole
- Usage: `/removerole <target> <role> <reason> [duration] [silent]`
- `target:` (Required) Who are you removing a role from?
- `role:` (Required) What role are you removing from the target?
- `reason:` (Required) Why are you removing a role from this user?
- `duration:` (Optional) How long are you removing this role for?
- `silent:` (Optional) Should the user be messaged?
Remove a role from a user.
## mute

View file

@ -1,15 +1,23 @@
# Backup
Backup allows you to export a JSON list of all of your installed repositories and cogs, then reimport them and automatically reinstall/reload the cogs.
Backup allows you to export a JSON list of all of your installed repositories and cogs, then reimport them and automatically reinstall the cogs.
## Installation
```bash
[p]repo add seacogs https://coastalcommits.com/SeaswimmerTheFsh/SeaCogs
[p]repo add seacogs https://www.coastalcommits.com/cswimr/SeaCogs
[p]cog install seacogs backup
[p]cog load backup
```
## Version Compatibility
As of commit [1edb08a](https://www.coastalcommits.com/cswimr/SeaCogs/commit/1edb08a1271f12098ca0bed11a735f7162cedd14), the Backup cog no longer supports Red versions older than 3.5.6. If you want to use the cog on an earlier version (3.5.0 - 3.5.5), install the cog pinned to this commit: `43464db6a7c51bc69282b1ae3dc507a4aae851de`.
```bash
[p]cog installversion sea-cogs 43464db6a7c51bc69282b1ae3dc507a4aae851de backup
```
## Commands
### backup export

View file

@ -6,7 +6,7 @@ This cog does require an api key to work.
## Installation
```bash
[p]repo add seacogs https://coastalcommits.com/SeaswimmerTheFsh/SeaCogs
[p]repo add seacogs https://www.coastalcommits.com/cswimr/SeaCogs
[p]cog install seacogs bible
[p]cog load bible
```

19
.docs/emojiinfo.md Normal file
View file

@ -0,0 +1,19 @@
# EmojiInfo
EmojiInfo allows you to retrieve information about an emoji.
## Installation
```bash
[p]repo add seacogs https://www.coastalcommits.com/cswimr/SeaCogs
[p]cog install seacogs emojiinfo
[p]cog load emojiinfo
```
## Commands
### emoji
- Usage: `[p]emoji <emoji> [ephemeral]`
Retrieve information about the provided emoji. If `ephemeral` is provided and the command is used as a slash command, the response will be sent as an ephemeral message.

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

View file

@ -5,7 +5,7 @@ Nerdify allows you to nerdify other people's text.
## Installation
```bash
[p]repo add seacogs https://coastalcommits.com/SeaswimmerTheFsh/SeaCogs
[p]repo add seacogs https://www.coastalcommits.com/cswimr/SeaCogs
[p]cog install seacogs nerdify
[p]cog load nerdify
```
@ -19,9 +19,3 @@ Nerdify allows you to nerdify other people's text.
Nerdify the replied to message, previous message, or your own text.
If `[text]` is not provided, the bot will try to nerdify either the previous message or the replied to message, if the invocation message is a reply.
## Method Reference
::: nerdify.nerdify.Nerdify.nerdify_text
::: nerdify.nerdify.Nerdify.type_message

View file

@ -0,0 +1,199 @@
# Configuration
This page will go over all of the configuration options for the Pterodactyl cog.
All of the commands below can be accessed through `[p]pterodactyl config`.
## `api`
This option determines which [PlayerDB](https://playerdb.co/) endpoint the cog will use to retrieve player avatars.
This is only used for webhook avatars in the chat integration system. You should probably leave this as default.
Default value: `minecraft`
## `chat`
### `channel`
This option determines what channel chat messages will be sent to. If this is unset, the chat integration won't work.
**Make sure the bot has permissions to speak in this channel!**
Default value: `None`
### `command`
This option determines what command will be sent to the server whenever a message is sent in the configured chat channel. The JSON format Minecraft uses for this is very janky sometimes, if you need help with changing the command, you can join my [Discord server](https://discord.gg/eMUMe77Yb8).
Available placeholders:
- `.$C` - replaced with hex color of the author's top colored role
- `.$D` - replaced with the author's discriminator (will usually be 0, you shouldn't use this)
- `.$I` - replaced with the author's ID
- `.$M` - replaced with message content
- `.$N` - replaced with author's display name (or guild nickname, if set)
- `.$U` - replaced with the author's username (NOT display name, you should usually use `.$N`)
- `.$V` - replaced with the configured invite link
Default value:
```json
tellraw @a ["",{"text":".$N ","color":".$C","insertion":"<@.$I>","hoverEvent":{"action":"show_text","contents":"Shift click to mention this user inside Discord"}},{"text":"(DISCORD):","color":"blue","clickEvent":{"action":"open_url","value":".$V"},"hoverEvent":{"action":"show_text","contents":"Click to join the Discord Server"}},{"text":" .$M","color":"white"}]
```
## `console`
### `channel`
/// admonition | Only give access to the console channel to people you trust!
type: danger
If a user account has access to the console channel, they can execute ***any*** command on your server, including some power actions.
They will also be able to see potentially sensitive information, such as player IPs, if [IP Masking](configuration.md#ip) is disabled.
///
This option determines what channel console logs will be sent to. If this is unset, the console integration won't work.
**Make sure the bot has permissions to speak in this channel!**
Server status changes, Discord --> Minecraft chat messages, and command executions will all be logged here.
/// admonition
type: info
Please note that, in order to avoid Discord ratelimits, logs will not be posted when the server status is one of the following:
- `starting`
- `stopping`
This is to prevent the console channel from flooding and getting backed up by Discord's message ratelimits.
///
Default value: `None`
### `commands`
/// admonition | This has no effect on the `[p]pterodactyl command` text command, or the matching slash command.
type: danger
If you want to disable the ability to execute commands on the server through Discord, use the following commands:
`[p]pterodactyl config console commands False` - this command
`[p]command disable pterodactyl command` - disables the text command that lets you execute commands on the server
`[p]slash disable pterodactyl` - due to how slash commands are laid out, this is the only way to disable the ability to execute commands on the server
`[p]slash sync` - apply above slash command change
///
This option determines if commands sent to the console channel will be sent to the Pterodactyl console.
Default value: `False`
## `invite`
This option determines what url the chat command will substitute in for the Discord invite placeholder.
Default value: `None`
## `ip`
This option determines whether or not IP's will be redacted when posted in chat or to the console channel.
Default value: `True`
## `messages`
### `join`
This option determines what the description in embeds will be when a user joins the server. Has no effect if embeds aren't used.
Default value: `Welcome to the server! 👋`
### `leave`
This option determines what the description in embeds will be when a user leaves the server. Has no effect if embeds aren't used.
Default value: `Goodbye! 👋`
### `shutdown`
This option determines what the bot will send in the chat channel when the server stops.
Default value: `Server stopped!`
### `startup`
This option determines what the bot will send in the chat channel when the server is started.
Default value: `Server started!`
## `regex`
If you're not running on recent versions of Paper, which this cog was developed against, or you're otherwise changing for format of chat messages, you'll need to add custom regex through the `[p]pterodactyl config regex` command. Same thing applies if any other type of message isn't being detected. I recomend using ChatGPT or something similar for this, or if you need help, you can join my [Discord server](https://discord.gg/eMUMe77Yb8).
See [Regex Examples](regex.md) for default values.
### `blacklist`
This group of commands allows you to add regex patterns that will be ignored by the console logger. The intended use for this is if you're getting ratelimited by messages that flood the console after the server sets its status to `running` but before it actually finishes starting.
### `achievement`
This regex pattern is used to detect advacnements/challenges. The default should work for most Minecraft servers.
### `chat`
This regex pattern is used to detect chat messages. You will probably have to change this if you're using any plugins or mods that use custom chat formatting, like EssentialsX Chat or Styled Chat.
### `join`
This regex pattern is used to detect whenever a user joins the server. You shouldn't usually need to change this.
### `leave`
This regex pattern is used to detect whenever a user leaves the server. You shouldn't usually need to change this.
### `server`
This regex pattern is used to detect whenever a server message is sent. You will have to change this if you aren't running on Paper, most likely.
## `serverid`
This option determines which server's websocket to connect to. See [Getting Started](getting-started.md#getting-server-information) for more information on this.
Default value: `None`
## `topic`
### `host`
This option determines the hostname of your server that will be used to retrieve server information.
### `port`
This option determines the port of your server that will be used to retrieve server information.
Default value: `25565`
### `text`
This option determines what the channel topic will be set to.
Available placeholders:
- `.$H` - replaced with the server's hostname
- `.$O` - replaced with the server's port
Available with a Minecraft server:
- `.$I` - replaced with the server's ip address
- `.$M` - replaced with maximum player count
- `.$P` - replaced with current online player count
- `.$V` - replaced with the server's current version
- `.$D` - replaced with the server's description / message of the day
Default value:
```
Server IP: .$H\nServer Players: .$P/.$M
```
## `url`
This option determines what panel the cog will send requests to. See [Getting Started](getting-started.md#getting-server-information) for more information on this.
Default value: `None`
## `view`
Lists all of the configuration options offered by the cog.

View file

@ -0,0 +1,104 @@
# Getting Started
This page will go over the steps required to get started with the Pterodactyl cog.
/// admonition | Screenshots may be visually distinct
type: info
For the purpose of this guide, I'll be using [Bloom Host's](https://bloom.host/) [Pterodactyl fork](https://mc.bloom.host/).
The steps should be basically identical for other panels, but screenshots will look visually different.
If in doubt, contact your host's support.
///
## Installing the cog
This project is a [cog](https://discordpy.readthedocs.io/en/stable/ext/commands/cogs.html) made for use with *specifically* instances of [Red-DiscordBot](https://github.com/Cog-Creators/Red-DiscordBot).
See the [Red documentation](https://docs.discord.red/en/stable/install_guides/index.html) for information on how to run an instance of Red. Once you've got it running, come back here.
/// admonition | `[p]` is your bot's prefix
type: tip
///
Now, load the Downloader cog:
```
[p]load downloader
```
The Downloader cog allows you to add Git repositories to your bot in order to download cogs from them.
Now, use Downloader to add my repository to your bot:
```
[p]repo add sea-cogs https://www.coastalcommits.com/cswimr/SeaCogs
```
Now, install the Pterodactyl cog:
```
[p]cog install sea-cogs pterodactyl
[p]load pterodactyl
```
## Creating a sub-user
This is **optional**, but highly recommended, for security reasons.
Navigate to your `Users` page, and click the `New User` button.
Type in an email address, and scroll down to the `Control` header.
Click the checkmark on that header to select all of the permissions contained under the header.
Now, scroll back up to the top of the prompt and press `Invite User`.
![image](../img/pterodactyl/setup/1.png)
![image](../img/pterodactyl/setup/2.png)
Now, you'll need to check the email you just entered into the subusers page, and create an account. I won't cover this, as it'll change depending on what host you're using.
## Getting an API Key
**Log out of your primary account, and switch to the sub-user you just created.**
Navigate to your sub-user account's `API Credentials` page.
![image](../img/pterodactyl/setup/3.png)
Create a new API key.
![image](../img/pterodactyl/setup/4.png)
You don't have to specify an allowed IP if you don't want to, but I recommend it. If you chose to, you'll need to retrieve your bot's IP address. You can do this through SSH or through a cog like [AAA3A's IP cog](https://github.com/AAA3A-AAA3A/AAA3A-cogs).
![image](../img/pterodactyl/setup/5.png)
Now, use the `[p]set api` command on your bot to add the API key.
The format is as follows:
```
# Service: pterodactyl
# Keys and Tokens: api_key ptlc_...
```
![image](../img/pterodactyl/setup/6.png)
## Getting server information
There's some other information that the Pterodactyl cog needs to function.
First, get the base url for your panel. This does not include any extra information, like server ids, or whatnot. In my case, I'm using `https://mc.bloom.host/`.
![image](../img/pterodactyl/setup/7.png)
Use the `[p]pterodactyl config url` command to set the URL the cog will use.
In my case, I'd use `-pterodactyl config url https://mc.bloom.host/`.
![image](../img/pterodactyl/setup/8.png)
Now, we need to get the id of your server. Navigate to the `Settings` page in your panel.
![image](../img/pterodactyl/setup/9.png)
Use the `[p]pterodactyl config serverid` command to add the server id to the bot.
In my case, I'd use `-pterodactyl config serverid ad712016-df3d-47a5-b1df-6b71baf50340`.
![image](../img/pterodactyl/setup/10.png)
Once you've done all of this, you should see a connection message in the bot's logs. Now, we need to configure some other things.
See the [Configuration](configuration.md) page for more information.

View file

@ -0,0 +1,16 @@
# Pterodactyl
/// admonition | This project is in active development
type: warning
These docs are not complete yet, and there is a lot still to do.
///
Pterodactyl allows for connecting to a Pterodactyl server through websockets. It is intended primarily for use with Minecraft servers, as it allows for version & server platform-agnostic Discord integration, including console logging and two-way chat bridging.
## Installation
```bash
[p]repo add seacogs https://www.coastalcommits.com/cswimr/SeaCogs
[p]cog install seacogs pterodactyl
[p]cog load aurora
```

View file

@ -0,0 +1,74 @@
# Installing Red
This guide will explain how to create an instance of [Red-DiscordBot]() (referred to as 'Red') on a Pterodactyl panel.
Running the bot on Pterodactyl is not required to use the Pterodactyl cog. If you already have a working instance of Red, you should look at [Getting Started](getting-started.md).
/// admonition | Caveats
type: warning
There are a few caveats to running an instance of Red on Pterodactyl.
- You will not receive any support from the Red developers.
- The built-in Audio cog will not work.
- Depending on your host, you might have to request a [`tmpfs` size increase](https://github.com/pelican-eggs/eggs/tree/master/bots/discord/redbot#additional-requirements).
If these are unacceptable to you, you should [install Red normally](https://docs.discord.red/en/stable/install_guides/index.html).
///
/// admonition | Requirements
type: info
- A Discord bot token (see [Creating a bot account](https://docs.discord.red/en/stable/bot_application_guide.html))
- A panel host with the [Red-DiscordBot Pterodactyl egg](https://github.com/ign-gg/Pterodactyl-Eggs/tree/master/bots/discord/redbot)
- A panel with support for server splitting, like [Bloom.host](https://bloom.host/)'s DuckPanel.
///
## Creating a Server Split
1. Navigate to your host's server split option.
2. Select `Discord Bots` in the `Server Category` dropdown
3. Select `Red` in the `Server Type` dropdown
4. Allocate 1gb of RAM to Red. You can get away with less, but for the purposes of this guide we'll be using 1gb.
5. Allocate 5gb of storage space to Red.
6. Click the `Split Server` button. The installation process will take a few minutes, once it's done, continue to the next section.
![server-split-img](../img/pterodactyl/installing-red/1.png)
## Configuring Startup Variables
1. Navigate to the `Startup` page of your new server split.
2. Enter in your bot token.
3. If you want to change the default prefix that the bot will respond to, do so here.
4. If you want to change the owner of the bot, you can do so here. This defaults to the owner of the application the bot user is from.
![server-startup-img](../img/pterodactyl/installing-red/2.png)
## Inviting the Bot
1. Navigate to the `Console` page of your server split.
2. Click the `Start` button.
3. Click the Invite URL in your console, once the bot starts.
![console-img](../img/pterodactyl/installing-red/3.png)
## Initial Setup
Red is quite a large bot, so I'll focus on the specifics of getting the bot working with my Pterodactyl cog specifically.
/// admonition | `[p]` is your bot's prefix
type: tip
///
1. Load the `Downloader` cog.
```bash
[p]load downloader
```
2. Add my repository to the bot
```bash
[p]repo add sea-cogs https://www.coastalcommits.com/cswimr/SeaCogs
```
3. Install and load the Pterodactyl cog
```bash
[p]cog install sea-cogs pterodactyl
[p]load pterodactyl
```
4. Follow the instructions given in [Getting Started](getting-started.md)

View file

@ -0,0 +1,65 @@
# Regex Examples
## 1.20.4 - Paper (Default)
### Achievements
```re
^\[\d{2}:\d{2}:\d{2} INFO\]: (.*) has (made the advancement|completed the challenge) \[(.*)\]$
```
### Chat
```re
^\[\d{2}:\d{2}:\d{2}\sINFO\]: (?!\[(?:Server|Rcon)\])(?:<|\[)(\w+)(?:>|\]) (.*)
```
### Join
```re
^\[\d{2}:\d{2}:\d{2} INFO\]: ([^<\n]+) joined the game$
```
### Leave
```re
^\[\d{2}:\d{2}:\d{2} INFO\]: ([^<\n]+) left the game$
```
### Server
```re
^\[\d{2}:\d{2}:\d{2} INFO\]:(?: \[Not Secure\])? \[(?:Server|Rcon)\] (.*)
```
## 1.20.1 - Forge
### Achievements
```re
^\[\d{2}:\d{2}:\d{2}\] \[Server thread\/INFO\] \[minecraft\/MinecraftServer\]: (.*) has (made the advancement|completed the challenge) \[(.*)\]$
```
### Chat
```re
^\[\d{2}:\d{2}:\d{2}\] \[Server thread\/INFO\] \[minecraft\/MinecraftServer\]: (?!\[(?:Server|Rcon)\])(?:<|\[)(\w+)(?:>|\]) (.*)
```
### Join
```re
^\[\d{2}:\d{2}:\d{2}\] \[Server thread\/INFO\] \[minecraft\/MinecraftServer\]: ([^<\n]+) joined the game$
```
### Leave
```re
^\[\d{2}:\d{2}:\d{2}\] \[Server thread\/INFO\] \[minecraft\/MinecraftServer\]: ([^<\n]+) left the game$
```
### Server
```re
^\[\d{2}:\d{2}:\d{2}\] \[Server thread\/INFO\] \[minecraft\/MinecraftServer\]: \[(?:Server|Rcon)\] (.*)
```

View file

@ -1,23 +0,0 @@
---
name: Bug Report
about: Got an issue with a cog from SeaCogs? Use this.
title: "[BUG]"
labels: bug
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
What caused the error?
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Additional context**
Add any other context about the problem here.

View file

@ -0,0 +1,55 @@
name: Bug Report
about: File a bug report
title: "[Cog Name] "
labels: [bug]
ref: master
body:
- type: markdown
attributes:
value: |
Thank you for taking the time to fill out this bug report!
- type: checkboxes
id: confirmation
attributes:
label: Please confirm that;
options:
- label: I have checked that this bug does not already have an opened/closed [issue](https://www.coastalcommits.com/cswimr/SeaCogs/issues) or [pull request](https://www.coastalcommits.com/cswimr/SeaCogs/pulls) associated with it.
required: true
- label: I have checked that I am on the latest version of [Red-DiscordBot](https://github.com/CogCreators/Red-DiscordBot), and SeaCogs.
required: true
- type: input
id: hosting
attributes:
label: Hosting
description: How is your bot hosted?
placeholder: Local, Docker, etc.
validations:
required: true
- type: textarea
id: what-happened
attributes:
label: What happened?
description: Also, what did you expect to happen?
placeholder: A bug happened!
validations:
required: true
- type: textarea
id: reproduction
attributes:
label: Reproduction steps
description: Please provide detailed steps to reproduce the bug.
placeholder: |
1. Do this
2. Do that
3. Do this other thing
4. Bug happens!
validations:
required: false
- type: textarea
id: logs
attributes:
label: Relevant traceback or logs
description: Please copy and paste any relevant tracebacks or log output. This will be automatically formatted into code, so no need for backticks.
render: py
validations:
required: false

View file

@ -0,0 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: Other Concerns?
url: https://discord.gg/eMUMe77Yb8
about: Ask in our Discord server!

View file

@ -1,26 +0,0 @@
---
name: Suggestion
about: Trying to suggest something for SeaCogs? Use this.
title: "[SUGGESTION]"
labels: enhancement
assignees: ''
---
**What cog is your feature request for?**
A cog in this repository.
**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.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Additional context**
Add any other context about the problem here.

View file

@ -0,0 +1,55 @@
name: Suggestion
about: Trying to suggest something for SeaCogs? Use this.
title: "[Cog Name] "
labels: enhancement
ref: master
body:
- type: markdown
attributes:
value: |
Thank you for taking the time to suggest an enhancement!
- type: input
id: cog
attributes:
label: What cog is your feature request for?
description: Specify the cog within the repository.
placeholder: E.g., ModerationCog
validations:
required: true
- type: textarea
id: problem-description
attributes:
label: Is your feature request related to a problem? Please describe.
placeholder: A clear and concise description of what the problem is.
validations:
required: true
- type: textarea
id: solution-description
attributes:
label: Describe the solution you'd like
placeholder: A clear and concise description of what you want to happen.
validations:
required: true
- type: textarea
id: alternatives
attributes:
label: Describe alternatives you've considered
placeholder: A clear and concise description of any alternative solutions or features you've considered.
validations:
required: false
- type: textarea
id: screenshots
attributes:
label: Screenshots
description: If applicable, add screenshots to help explain your problem.
placeholder: Paste image links here.
validations:
required: false
- type: textarea
id: additional-context
attributes:
label: Additional context
description: Add any other context about the problem here.
placeholder: Any extra information you think might be useful.
validations:
required: false

View file

@ -0,0 +1,6 @@
# Describe what your pull request does and which issue you're targeting
<!-- Create a new issue, if it doesn't exist yet -->
- [ ] By submitting this pull request, I permit cswimr to license my work under
the [Mozilla Public License Version 2.0](https://www.coastalcommits.com/cswimr/SeaCogs/src/branch/main/LICENSE).

View file

@ -17,4 +17,6 @@
import-outside-toplevel,
import-self,
relative-beyond-top-level,
duplicate-code
too-many-instance-attributes,
duplicate-code,
too-many-nested-blocks

View file

@ -6,9 +6,9 @@ on:
pull_request:
jobs:
Lint Code (Pylint):
Lint Code (Ruff & Pylint):
runs-on: docker
container: coastalcommits.com/seaswimmerthefsh/actionscontainers-seacogs:latest
container: www.coastalcommits.com/cswimr/actions:seacogs
steps:
- name: Checkout
uses: actions/checkout@v3
@ -16,12 +16,16 @@ jobs:
- name: Install dependencies
run: poetry install --with dev --no-root
- name: Analysing code with Ruff
run: ./.venv/bin/ruff check $(git ls-files '*.py')
continue-on-error: true
- name: Analysing code with Pylint
run: pylint --rcfile .forgejo/workflows/config/.pylintrc $(git ls-files '*.py')
run: ./.venv/bin/pylint --rcfile=.forgejo/workflows/config/.pylintrc $(git ls-files '*.py')
Build Documentation (MkDocs):
runs-on: docker
container: coastalcommits.com/seaswimmerthefsh/actionscontainers-seacogs:latest
container: www.coastalcommits.com/cswimr/actions:seacogs
steps:
- name: Checkout
uses: actions/checkout@v3
@ -38,7 +42,7 @@ jobs:
run: |
export SITE_URL="https://$CI_ACTION_REF_NAME_SLUG.seacogs.coastalcommits.com"
export EDIT_URI="src/branch/$CI_ACTION_REF_NAME/.docs"
mkdocs build -v
./.venv/bin/mkdocs build -v
- name: Deploy documentation
run: |
@ -54,7 +58,7 @@ jobs:
npx -p "@getmeli/cli" meli upload ./site \
--url "https://pages.coastalcommits.com" \
--site "${{ vars.MELI_SITE_ID }}" \
--token "${{ secrets.MELI_SITE_SECRET }}" \
--token "${{ secrets.MELI_SECRET }}" \
--release "$CI_ACTION_REF_NAME_SLUG/${{ env.GITHUB_SHA }}" \
--branch "$CI_ACTION_REF_NAME_SLUG"

2
.gitignore vendored
View file

@ -1,3 +1,5 @@
.cache
.vscode
site
.venv
__pycache__

View file

@ -11,7 +11,7 @@ My assorted cogs for Red-DiscordBot.
To get started with a development environment, first clone this repository.
```sh
git clone https://coastalcommits.com/SeaswimmerTheFsh/SeaCogs.git
git clone https://coastalcommits.com/cswimr/SeaCogs.git
```
Then, install Poetry.

5
antipolls/__init__.py Normal file
View file

@ -0,0 +1,5 @@
from .antipolls import AntiPolls
async def setup(bot):
await bot.add_cog(AntiPolls(bot))

181
antipolls/antipolls.py Normal file
View file

@ -0,0 +1,181 @@
# _____ _
# / ____| (_)
# | (___ ___ __ _ _____ ___ _ __ ___ _ __ ___ ___ _ __
# \___ \ / _ \/ _` / __\ \ /\ / / | '_ ` _ \| '_ ` _ \ / _ \ '__|
# ____) | __/ (_| \__ \\ V V /| | | | | | | | | | | | __/ |
# |_____/ \___|\__,_|___/ \_/\_/ |_|_| |_| |_|_| |_| |_|\___|_|
import discord
from red_commons.logging import getLogger
from redbot.core import commands
from redbot.core.bot import Config, Red
from redbot.core.utils.chat_formatting import bold, humanize_list
class AntiPolls(commands.Cog):
"""AntiPolls deletes messages that contain polls, with a configurable per-guild role and channel whitelist and support for default Discord permissions (Manage Messages)."""
__author__ = ["[cswimr](https://www.coastalcommits.com/cswimr)"]
__git__ = "https://www.coastalcommits.com/cswimr/SeaCogs"
__version__ = "1.0.1"
__documentation__ = "https://seacogs.coastalcommits.com/antipolls/"
def __init__(self, bot: Red):
super().__init__()
self.bot = bot
self.logger = getLogger("red.SeaCogs.AntiPolls")
self.config = Config.get_conf(self, identifier=23517395243, force_registration=True)
self.config.register_guild(
role_whitelist=[],
channel_whitelist=[],
manage_messages=True,
)
if not self.bot.intents.message_content:
self.logger.error("Message Content intent is not enabled, cog will not load.")
raise RuntimeError("This cog requires the Message Content intent to function. To prevent potentially destructive behavior, the cog will not load without the intent enabled.")
def format_help_for_context(self, ctx: commands.Context) -> str:
pre_processed = super().format_help_for_context(ctx) or ""
n = "\n" if "\n\n" not in pre_processed else ""
text = [
f"{pre_processed}{n}",
f"{bold('Cog Version:')} [{self.__version__}]({self.__git__})",
f"{bold('Author:')} {humanize_list(self.__author__)}",
f"{bold('Documentation:')} {self.__documentation__}",
]
return "\n".join(text)
async def red_delete_data_for_user(self, **kwargs): # pylint: disable=unused-argument
"""Nothing to delete."""
return
@commands.Cog.listener('on_message')
async def polls_listener(self, message: discord.Message) -> None:
if message.guild is None:
return self.logger.verbose("Message in direct messages ignored")
if message.author.bot:
return self.logger.verbose("Message from bot ignored")
if await self.bot.cog_disabled_in_guild(self, message.guild):
return self.logger.verbose("Message ignored, cog is disabled in guild %s", message.guild.id)
guild_config = await self.config.guild(message.guild).all()
if guild_config['manage_messages'] is True and message.author.guild_permissions.manage_messages:
return self.logger.verbose("Message from user with Manage Messages permission ignored")
if message.channel.id in guild_config['channel_whitelist']:
return self.logger.verbose("Message in whitelisted channel %s ignored", message.channel.id)
if any(role.id in guild_config['role_whitelist'] for role in message.author.roles):
return self.logger.verbose("Message from whitelisted role %s ignored", message.author.roles)
if not message.content and not message.embeds and not message.attachments and not message.stickers:
self.logger.trace("Message %s is a poll, attempting to delete", message.id)
try:
await message.delete()
except discord.HTTPException as e:
return self.logger.error("Failed to delete message: %s", e)
return self.logger.trace("Deleted poll message %s", message.id)
self.logger.verbose("Message %s is not a poll, ignoring", message.id)
@commands.group(name="antipolls", aliases=["ap"])
@commands.guild_only()
@commands.admin_or_permissions(manage_guild=True)
async def antipolls(self, ctx: commands.Context) -> None:
"""Manage AntiPolls settings."""
@antipolls.group(name="roles")
async def antipolls_roles(self, ctx: commands.Context) -> None:
"""Manage role whitelist."""
@antipolls_roles.command(name="add")
async def antipolls_roles_add(self, ctx: commands.Context, *roles: discord.Role) -> None:
"""Add roles to the whitelist."""
async with self.config.guild(ctx.guild).role_whitelist() as role_whitelist:
role_whitelist: list
failed: list[discord.Role] = []
for role in roles:
if role.id in role_whitelist:
failed.append(role)
continue
role_whitelist.append(role.id)
await ctx.tick()
if failed:
await ctx.send(f"The following roles were already in the whitelist: {humanize_list([role.mention for role in failed])}", delete_after=10)
@antipolls_roles.command(name="remove")
async def antipolls_roles_remove(self, ctx: commands.Context, *roles: discord.Role) -> None:
"""Remove roles from the whitelist."""
async with self.config.guild(ctx.guild).role_whitelist() as role_whitelist:
role_whitelist: list
failed: list[discord.Role] = []
for role in roles:
if role.id not in role_whitelist:
failed.append(role)
continue
role_whitelist.remove(role.id)
await ctx.tick()
if failed:
await ctx.send(f"The following roles were not in the whitelist: {humanize_list([role.mention for role in failed])}", delete_after=10)
@antipolls_roles.command(name="list")
async def antipolls_roles_list(self, ctx: commands.Context) -> None:
"""List roles in the whitelist."""
role_whitelist = await self.config.guild(ctx.guild).role_whitelist()
if not role_whitelist:
return await ctx.send("No roles in the whitelist.")
roles = [ctx.guild.get_role(role) for role in role_whitelist]
await ctx.send(humanize_list([role.mention for role in roles]))
@antipolls.group(name="channels")
async def antipolls_channels(self, ctx: commands.Context) -> None:
"""Manage channel whitelist."""
@antipolls_channels.command(name="add")
async def antipolls_channels_add(self, ctx: commands.Context, *channels: discord.TextChannel) -> None:
"""Add channels to the whitelist."""
async with self.config.guild(ctx.guild).channel_whitelist() as channel_whitelist:
channel_whitelist: list
failed: list[discord.TextChannel] = []
for channel in channels:
if channel.id in channel_whitelist:
failed.append(channel)
continue
channel_whitelist.append(channel.id)
await ctx.tick()
if failed:
await ctx.send(f"The following channels were already in the whitelist: {humanize_list([channel.mention for channel in failed])}", delete_after=10)
@antipolls_channels.command(name="remove")
async def antipolls_channels_remove(self, ctx: commands.Context, *channels: discord.TextChannel) -> None:
"""Remove channels from the whitelist."""
async with self.config.guild(ctx.guild).channel_whitelist() as channel_whitelist:
channel_whitelist: list
failed: list[discord.TextChannel] = []
for channel in channels:
if channel.id not in channel_whitelist:
failed.append(channel)
continue
channel_whitelist.remove(channel.id)
await ctx.tick()
if failed:
await ctx.send(f"The following channels were not in the whitelist: {humanize_list([channel.mention for channel in failed])}", delete_after=10)
@antipolls_channels.command(name="list")
async def antipolls_channels_list(self, ctx: commands.Context) -> None:
"""List channels in the whitelist."""
channel_whitelist = await self.config.guild(ctx.guild).channel_whitelist()
if not channel_whitelist:
return await ctx.send("No channels in the whitelist.")
channels = [ctx.guild.get_channel(channel) for channel in channel_whitelist]
await ctx.send(humanize_list([channel.mention for channel in channels]))
@antipolls.command(name="managemessages")
async def antipolls_managemessages(self, ctx: commands.Context, enabled: bool) -> None:
"""Toggle Manage Messages permission check."""
await self.config.guild(ctx.guild).manage_messages.set(enabled)
await ctx.tick()

17
antipolls/info.json Normal file
View file

@ -0,0 +1,17 @@
{
"author" : ["cswimr"],
"install_msg" : "Thank you for installing AntiPolls!\nYou can find the source code of this cog [here](https://coastalcommits.com/cswimr/SeaCogs).",
"name" : "AntiPolls",
"short" : "AntiPolls deletes messages that contain polls.",
"description" : "AntiPolls deletes messages that contain polls, with a configurable per-guild role and channel whitelist and support for default Discord permissions (Manage Messages).",
"end_user_data_statement" : "This cog does not store any user data.",
"hidden": true,
"disabled": false,
"min_bot_version": "3.5.0",
"min_python_version": [3, 10, 0],
"tags": [
"automod",
"automoderation",
"polls"
]
}

File diff suppressed because it is too large Load diff

BIN
aurora/data/arrow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

View file

@ -1,3 +1,4 @@
# pylint: disable=duplicate-code
import json
from datetime import timedelta
from typing import Dict
@ -18,7 +19,7 @@ class ImportAuroraView(ui.View):
@ui.button(label="Yes", style=ButtonStyle.success)
async def import_button_y(
self, interaction: Interaction, button: ui.Button
): # pylint: disable=unused-argument
): # pylint: disable=unused-argument
await self.message.delete()
await interaction.response.send_message(
"Deleting original table...", ephemeral=True
@ -40,9 +41,9 @@ class ImportAuroraView(ui.View):
await interaction.edit_original_response(content="Importing moderations...")
file = await self.ctx.message.attachments[0].read()
data: [dict] = sorted(json.loads(file), key=lambda x: x["moderation_id"])
data: list[dict] = sorted(json.loads(file), key=lambda x: x["moderation_id"])
user_mod_types = ["NOTE", "WARN", "MUTE", "UNMUTE", "KICK", "BAN", "UNBAN"]
user_mod_types = ["NOTE", "WARN", "ADDROLE", "REMOVEROLE", "MUTE", "UNMUTE", "KICK", "TEMPBAN", "BAN", "UNBAN"]
channel_mod_types = ["SLOWMODE", "LOCKDOWN"]
@ -57,6 +58,8 @@ class ImportAuroraView(ui.View):
case["target_type"] = "USER"
elif case["moderation_type"] in channel_mod_types:
case["target_type"] = "CHANNEL"
else:
case["target_type"] = "USER"
if "role_id" not in case or not case["role_id"]:
case["role_id"] = 0
@ -68,10 +71,8 @@ class ImportAuroraView(ui.View):
metadata = {}
else:
metadata: Dict[str, any] = json.loads(case["metadata"])
if not metadata.get('imported_from'):
metadata.update({
'imported_from': 'Aurora'
})
if not metadata.get("imported_from"):
metadata.update({"imported_from": "Aurora"})
if case["duration"] != "NULL":
hours, minutes, seconds = map(int, case["duration"].split(":"))
@ -101,13 +102,15 @@ class ImportAuroraView(ui.View):
await interaction.edit_original_response(content="Import complete.")
if failed_cases:
await interaction.edit_original_response(
content="Import complete.\n" + warning("Failed to import the following cases:\n") + box(failed_cases)
content="Import complete.\n"
+ warning("Failed to import the following cases:\n")
+ box(failed_cases)
)
@ui.button(label="No", style=ButtonStyle.danger)
async def import_button_n(
self, interaction: Interaction, button: ui.Button
): # pylint: disable=unused-argument
): # pylint: disable=unused-argument
await self.message.edit(content="Import cancelled.", view=None)
await self.message.delete(10)
await self.ctx.message.delete(10)

View file

@ -1,3 +1,4 @@
# pylint: disable=duplicate-code
import json
from datetime import timedelta
@ -15,9 +16,13 @@ class ImportGalacticBotView(ui.View):
self.message: Message = message
@ui.button(label="Yes", style=ButtonStyle.success)
async def import_button_y(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
async def import_button_y(
self, interaction: Interaction, button: ui.Button
): # pylint: disable=unused-argument
await self.message.delete()
await interaction.response.send_message("Deleting original table...", ephemeral=True)
await interaction.response.send_message(
"Deleting original table...", ephemeral=True
)
database = connect()
cursor = database.cursor()
@ -35,94 +40,94 @@ class ImportGalacticBotView(ui.View):
await interaction.edit_original_response(content="Importing moderations...")
accepted_types = [
'NOTE',
'WARN',
'MUTE',
'UNMUTE',
'KICK',
'SOFTBAN',
'BAN',
'UNBAN',
'SLOWMODE',
'LOCKDOWN'
"NOTE",
"WARN",
"MUTE",
"UNMUTE",
"KICK",
"SOFTBAN",
"BAN",
"UNBAN",
"SLOWMODE",
"LOCKDOWN",
]
file = await self.ctx.message.attachments[0].read()
data = sorted(json.loads(file), key=lambda x: x['case'])
data = sorted(json.loads(file), key=lambda x: x["case"])
failed_cases = []
for case in data:
if case['type'] not in accepted_types:
if case["type"] not in accepted_types:
continue
timestamp = round(case['timestamp'] / 1000)
timestamp = round(case["timestamp"] / 1000)
try:
if case['duration'] is not None and float(case['duration']) != 0:
duration = timedelta(seconds=round(float(case['duration']) / 1000))
if case["duration"] is not None and float(case["duration"]) != 0:
duration = timedelta(seconds=round(float(case["duration"]) / 1000))
else:
duration = 'NULL'
duration = "NULL"
except OverflowError:
failed_cases.append(case['case'])
failed_cases.append(case["case"])
continue
metadata = {
'imported_from': 'GalacticBot'
}
metadata = {"imported_from": "GalacticBot"}
if case['type'] == 'SLOWMODE':
metadata['seconds'] = case['data']['seconds']
if case["type"] == "SLOWMODE":
metadata["seconds"] = case["data"]["seconds"]
if case['resolved']:
if case["resolved"]:
resolved = 1
resolved_by = None
resolved_reason = None
resolved_timestamp = None
if case['changes']:
for change in case['changes']:
if change['type'] == 'RESOLVE':
resolved_by = change['staff']
resolved_reason = change['reason']
resolved_timestamp = round(change['timestamp'] / 1000)
if case["changes"]:
for change in case["changes"]:
if change["type"] == "RESOLVE":
resolved_by = change["staff"]
resolved_reason = change["reason"]
resolved_timestamp = round(change["timestamp"] / 1000)
break
if resolved_by is None:
resolved_by = '?'
resolved_by = "?"
if resolved_reason is None:
resolved_reason = 'Could not get resolve reason during moderation import.'
resolved_reason = (
"Could not get resolve reason during moderation import."
)
if resolved_timestamp is None:
resolved_timestamp = timestamp
changes = [
{
'type': "ORIGINAL",
'reason': case['reason'],
'user_id': case['executor'],
'timestamp': timestamp
"type": "ORIGINAL",
"reason": case["reason"],
"user_id": case["executor"],
"timestamp": timestamp,
},
{
'type': "RESOLVE",
'reason': resolved_reason,
'user_id': resolved_by,
'timestamp': resolved_timestamp
}
"type": "RESOLVE",
"reason": resolved_reason,
"user_id": resolved_by,
"timestamp": resolved_timestamp,
},
]
else:
resolved = 0
resolved_by = 'NULL'
resolved_reason = 'NULL'
resolved_by = "NULL"
resolved_reason = "NULL"
changes = []
if case['reason'] and case['reason'] != "N/A":
reason = case['reason']
if case["reason"] and case["reason"] != "N/A":
reason = case["reason"]
else:
reason = "NULL"
await mysql_log(
self.ctx.guild.id,
case['executor'],
case['type'],
case['targetType'],
case['target'],
case["executor"],
case["type"],
case["targetType"],
case["target"],
0,
duration,
reason,
@ -132,15 +137,21 @@ class ImportGalacticBotView(ui.View):
resolved_reason=resolved_reason,
changes=changes,
metadata=metadata,
database=database
database=database,
)
await interaction.edit_original_response(content="Import complete.")
if failed_cases:
await interaction.edit_original_response(content="Import complete.\n" + warning("Failed to import the following cases:\n") + box(failed_cases))
await interaction.edit_original_response(
content="Import complete.\n"
+ warning("Failed to import the following cases:\n")
+ box(failed_cases)
)
@ui.button(label="No", style=ButtonStyle.danger)
async def import_button_n(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
async def import_button_n(
self, interaction: Interaction, button: ui.Button
): # pylint: disable=unused-argument
await self.message.edit(content="Import cancelled.", view=None)
await self.message.delete(10)
await self.ctx.message.delete(10)

View file

@ -1,11 +1,10 @@
{
"author" : ["SeaswimmerTheFsh (seasw.)"],
"install_msg" : "Thank you for installing Aurora!\nMost of this cog's functionality requires enabling slash commands.\nYou can find the source code of this cog [here](https://coastalcommits.com/SeaswimmerTheFsh/SeaCogs).",
"author" : ["cswimr"],
"install_msg" : "Thank you for installing Aurora!\nMost of this cog's functionality requires enabling slash commands.\nYou can find the source code of this cog [here](https://coastalcommits.com/cswimr/SeaCogs).",
"name" : "Aurora",
"short" : "A full replacement for Red's core Mod cogs.",
"description" : "Aurora is a fully-featured moderation system. It is heavily inspired by GalacticBot, and is designed to be a more user-friendly alternative to Red's core Mod cogs. This cog stores all of its data in an SQLite database.",
"end_user_data_statement" : "This cog stores the following information:\n- User IDs of accounts who moderate users or are moderated\n- Guild IDs of guilds with the cog enabled\n- Timestamps of moderations\n- Other information relating to moderations",
"requirements": ["humanize", "pytimeparse2"],
"hidden": false,
"disabled": false,
"min_bot_version": "3.5.0",

View file

@ -1,14 +1,20 @@
from discord import ButtonStyle, ui, Interaction
from discord import ButtonStyle, Interaction, Message, ui
from redbot.core import commands
from redbot.core.utils.chat_formatting import error
from aurora.utilities.factory import addrole_embed
from aurora.utilities.config import config
from aurora.utilities.factory import addrole_embed
class Addrole(ui.View):
def __init__(self, ctx: commands.Context):
def __init__(self, ctx: commands.Context, message: Message, timeout: int = None):
super().__init__()
self.ctx = ctx
self.message = message
self.timeout = timeout
async def on_timeout(self):
await self.message.edit(view=None)
@ui.select(cls=ui.RoleSelect, placeholder="Select a role", min_values=0, max_values=25)
async def addrole_select(self, interaction: Interaction, select: ui.RoleSelect):
@ -16,12 +22,13 @@ class Addrole(ui.View):
await interaction.response.send_message(error("You must have the manage guild permission to add roles to the addrole whitelist."), ephemeral=True)
return
await interaction.response.defer()
addrole_whitelist: list = await config.guild(self.ctx.guild).addrole_whitelist()
if select.values[0].id in addrole_whitelist:
addrole_whitelist.remove(select.values[0].id)
else:
addrole_whitelist.append(select.values[0].id)
await config.guild(self.ctx.guild).addrole_whitelist.set(addrole_whitelist)
async with config.guild(self.ctx.guild).addrole_whitelist() as addrole_whitelist:
addrole_whitelist: list # type hint
for value in select.values:
if value.id in addrole_whitelist:
addrole_whitelist.remove(value.id)
else:
addrole_whitelist.append(value.id)
await interaction.message.edit(embed=await addrole_embed(self.ctx))
@ui.button(label="Clear", style=ButtonStyle.red, row=1)

View file

@ -1,14 +1,20 @@
from discord import ui, ButtonStyle, Interaction
from discord import ButtonStyle, Interaction, Message, ui
from redbot.core import commands
from aurora.utilities.config import config
from aurora.utilities.factory import guild_embed
from aurora.utilities.utils import create_pagesize_options
from aurora.utilities.config import config
class Guild(ui.View):
def __init__(self, ctx: commands.Context):
def __init__(self, ctx: commands.Context, message: Message, timeout: int = None):
super().__init__()
self.ctx = ctx
self.message = message
self.timeout = timeout
async def on_timeout(self):
await self.message.edit(view=None)
@ui.button(label="Show Moderator", style=ButtonStyle.green, row=0)
async def show_moderator(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
@ -16,7 +22,7 @@ class Guild(ui.View):
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
return
await interaction.response.defer()
current_setting = await config.guild(interaction.guild).show_moderator
current_setting = await config.guild(interaction.guild).show_moderator()
await config.guild(interaction.guild).show_moderator.set(not current_setting)
await interaction.message.edit(embed=await guild_embed(self.ctx))
@ -30,6 +36,16 @@ class Guild(ui.View):
await config.guild(interaction.guild).use_discord_permissions.set(not current_setting)
await interaction.message.edit(embed=await guild_embed(self.ctx))
@ui.button(label="Respect Hierarchy", style=ButtonStyle.green, row=0)
async def respect_heirarchy(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
return
await interaction.response.defer()
current_setting = await config.guild(interaction.guild).respect_hierarchy()
await config.guild(interaction.guild).respect_hierarchy.set(not current_setting)
await interaction.message.edit(embed=await guild_embed(self.ctx))
@ui.button(label="Ignore Modlog", style=ButtonStyle.green, row=0)
async def ignore_modlog(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:

View file

@ -1,14 +1,20 @@
from discord import ButtonStyle, ui, Interaction
from discord import ButtonStyle, Interaction, Message, ui
from redbot.core import commands
from redbot.core.utils.chat_formatting import error
from aurora.utilities.factory import immune_embed
from aurora.utilities.config import config
from aurora.utilities.factory import immune_embed
class Immune(ui.View):
def __init__(self, ctx: commands.Context):
def __init__(self, ctx: commands.Context, message: Message, timeout: int = None):
super().__init__()
self.ctx = ctx
self.message = message
self.timeout = timeout
async def on_timeout(self):
await self.message.edit(view=None)
@ui.select(cls=ui.RoleSelect, placeholder="Select a role", min_values=0, max_values=25)
async def immune_select(self, interaction: Interaction, select: ui.RoleSelect):
@ -16,13 +22,13 @@ class Immune(ui.View):
await interaction.response.send_message(error("You must have the manage guild permission to add immune roles."), ephemeral=True)
return
await interaction.response.defer()
immune_roles: list = await config.guild(self.ctx.guild).immune_roles()
for role in select.values:
if role.id in immune_roles:
immune_roles.remove(role.id)
else:
immune_roles.append(role.id)
await config.guild(self.ctx.guild).immune_roles.set(immune_roles)
async with config.guild(self.ctx.guild).immune_roles() as immune_roles:
immune_roles: list # type hint
for value in select.values:
if value.id in immune_roles:
immune_roles.remove(value.id)
else:
immune_roles.append(value.id)
await interaction.message.edit(embed=await immune_embed(self.ctx))
@ui.button(label="Clear", style=ButtonStyle.red, row=1)

View file

@ -1,14 +1,20 @@
from discord import ui, ButtonStyle, Interaction
from discord import ButtonStyle, Interaction, Message, ui
from redbot.core import commands
from aurora.utilities.config import config
from aurora.utilities.factory import overrides_embed
from aurora.utilities.utils import create_pagesize_options
from aurora.utilities.config import config
class Overrides(ui.View):
def __init__(self, ctx: commands.Context):
def __init__(self, ctx: commands.Context, message: Message, timeout: int = None):
super().__init__()
self.ctx = ctx
self.message = message
self.timeout = timeout
async def on_timeout(self):
await self.message.edit(view=None)
@ui.button(label="Auto Evidence Format", style=ButtonStyle.green, row=0)
async def auto_evidenceformat(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument

View file

@ -2,26 +2,28 @@ from redbot.core import Config
config: Config = Config.get_conf(None, identifier=481923957134912, cog_name="Aurora")
def register_config(config_obj: Config):
config_obj.register_guild(
show_moderator = True,
use_discord_permissions = True,
ignore_modlog = True,
ignore_other_bots = True,
dm_users = True,
log_channel = " ",
immune_roles = [],
history_ephemeral = False,
history_inline = False,
history_pagesize = 5,
history_inline_pagesize = 6,
auto_evidenceformat = False,
addrole_whitelist = []
show_moderator=True,
use_discord_permissions=True,
respect_hierarchy=True,
ignore_modlog=True,
ignore_other_bots=True,
dm_users=True,
log_channel=" ",
immune_roles=[],
history_ephemeral=False,
history_inline=False,
history_pagesize=5,
history_inline_pagesize=6,
auto_evidenceformat=False,
addrole_whitelist=[],
)
config_obj.register_user(
history_ephemeral = None,
history_inline = None,
history_pagesize = None,
history_inline_pagesize = None,
auto_evidenceformat = None
history_ephemeral=None,
history_inline=None,
history_pagesize=None,
history_inline_pagesize=None,
auto_evidenceformat=None,
)

View file

@ -1,21 +1,23 @@
# pylint: disable=cyclic-import
import json
import time
import sqlite3
import time
from datetime import datetime, timedelta
from discord import Guild
from redbot.core import data_manager
from .logger import logger
from .utils import generate_dict, get_next_case_number, convert_timedelta_to_str
from .utils import (convert_timedelta_to_str, generate_dict,
get_next_case_number)
def connect() -> sqlite3.Connection:
"""Connects to the SQLite database, and returns a connection object."""
try:
connection = sqlite3.connect(database=data_manager.cog_data_path(raw_name='Aurora') / 'aurora.db')
connection = sqlite3.connect(
database=data_manager.cog_data_path(raw_name="Aurora") / "aurora.db"
)
return connection
except sqlite3.OperationalError as e:
@ -85,8 +87,8 @@ async def create_guild_table(guild: Guild):
"NULL",
"NULL",
0,
json.dumps([]), # pylint: disable=dangerous-default-value
json.dumps({}), # pylint: disable=dangerous-default-value
json.dumps([]),
json.dumps({}),
)
cursor.execute(insert_query, insert_values)
@ -102,7 +104,6 @@ async def create_guild_table(guild: Guild):
database.close()
# pylint: disable=dangerous-default-value
async def mysql_log(
guild_id: str,
author_id: str,
@ -118,8 +119,8 @@ async def mysql_log(
resolved_by: str = None,
resolved_reason: str = None,
expired: bool = None,
changes: list = [],
metadata: dict = {},
changes: list = None,
metadata: dict = None,
) -> int:
if not timestamp:
timestamp = int(time.time())
@ -169,8 +170,8 @@ async def mysql_log(
resolved_by,
resolved_reason,
expired,
json.dumps(changes),
json.dumps(metadata),
json.dumps(changes if changes else []),
json.dumps(metadata if metadata else {}),
)
cursor.execute(sql, val)

View file

@ -1,18 +1,25 @@
# pylint: disable=cyclic-import
from typing import Union
from datetime import datetime, timedelta
from typing import Union
import humanize
from discord import Color, Embed, Guild, Interaction, InteractionMessage, User, Member
from discord import Color, Embed, Guild, Interaction, InteractionMessage, Member, Role, User
from redbot.core import commands
from redbot.core.utils.chat_formatting import box, bold, error, warning
from redbot.core.utils.chat_formatting import bold, box, error, humanize_timedelta, warning
from aurora.utilities.config import config
from aurora.utilities.utils import fetch_channel_dict, fetch_user_dict, get_next_case_number, get_bool_emoji, get_pagesize_str
from aurora.utilities.utils import fetch_channel_dict, fetch_user_dict, get_bool_emoji, get_next_case_number, get_pagesize_str
async def message_factory(color: Color, guild: Guild, reason: str, moderation_type: str, moderator: Union[Member, User] = None, duration: timedelta = None, response: InteractionMessage = None) -> Embed:
async def message_factory(
color: Color,
guild: Guild,
reason: str,
moderation_type: str,
moderator: Union[Member, User] = None,
duration: timedelta = None,
response: InteractionMessage = None,
role: Role = None,
) -> Embed:
"""This function creates a message from set parameters, meant for contacting the moderated user.
Args:
@ -23,42 +30,72 @@ async def message_factory(color: Color, guild: Guild, reason: str, moderation_ty
moderator (Union[Member, User], optional): The moderator who performed the moderation. Defaults to None.
duration (timedelta, optional): The duration of the moderation. Defaults to None.
response (InteractionMessage, optional): The response message. Defaults to None.
role (Role, optional): The role that was added or removed. Defaults to None.
Returns:
embed: The message embed.
"""
if response is not None and not moderation_type in ["kicked", "banned", "tempbanned", "unbanned"]:
if response is not None and moderation_type not in [
"kicked",
"banned",
"tempbanned",
"unbanned",
]:
guild_name = f"[{guild.name}]({response.jump_url})"
else:
guild_name = guild.name
title = moderation_type
if moderation_type in ["tempbanned", "muted"] and duration:
embed_duration = f" for {humanize.precisedelta(duration)}"
embed_duration = f" for {humanize_timedelta(timedelta=duration)}"
else:
embed_duration = ""
if moderation_type == "note":
embed_desc = "received a"
elif moderation_type == "addrole":
embed_desc = f"received the {role.name} role"
title = "Role Added"
moderation_type = ""
elif moderation_type == "removerole":
embed_desc = f"lost the {role.name} role"
title = "Role Removed"
moderation_type = ""
else:
embed_desc = "been"
embed = Embed(title=str.title(moderation_type), description=f"You have {embed_desc} {moderation_type}{embed_duration} in {guild_name}.", color=color, timestamp=datetime.now())
embed = Embed(
title=str.title(title),
description=f"You have {embed_desc} {moderation_type}{embed_duration} in {guild_name}.",
color=color,
timestamp=datetime.now(),
)
if await config.guild(guild).show_moderator() and moderator is not None:
embed.add_field(name='Moderator', value=f"`{moderator.name} ({moderator.id})`", inline=False)
embed.add_field(
name="Moderator", value=f"`{moderator.name} ({moderator.id})`", inline=False
)
embed.add_field(name='Reason', value=f"`{reason}`", inline=False)
embed.add_field(name="Reason", value=f"`{reason}`", inline=False)
if guild.icon.url is not None:
embed.set_author(name=guild.name, icon_url=guild.icon.url)
else:
embed.set_author(name=guild.name)
embed.set_footer(text=f"Case #{await get_next_case_number(guild.id):,}", icon_url="https://cdn.discordapp.com/attachments/1070822161389994054/1159469476773904414/arrow-right-circle-icon-512x512-2p1e2aaw.png?ex=65312319&is=651eae19&hm=3cebdd28e805c13a79ec48ef87c32ca532ffa6b9ede2e48d0cf8e5e81f3a6818&")
embed.set_footer(
text=f"Case #{await get_next_case_number(guild.id):,}",
icon_url="attachment://arrow.png",
)
return embed
async def log_factory(interaction: Interaction, case_dict: dict, resolved: bool = False) -> Embed:
async def log_factory(
interaction: Interaction, case_dict: dict, resolved: bool = False
) -> Embed:
"""This function creates a log embed from set parameters, meant for moderation logging.
Args:
@ -67,57 +104,115 @@ async def log_factory(interaction: Interaction, case_dict: dict, resolved: bool
resolved (bool, optional): Whether the case is resolved or not. Defaults to False.
"""
if resolved:
if case_dict['target_type'] == 'USER':
target_user = await fetch_user_dict(interaction, case_dict['target_id'])
target_name = f"`{target_user['name']}`" if target_user['discriminator'] == "0" else f"`{target_user['name']}#{target_user['discriminator']}`"
elif case_dict['target_type'] == 'CHANNEL':
target_user = await fetch_channel_dict(interaction, case_dict['target_id'])
if target_user['mention']:
if case_dict["target_type"] == "USER":
target_user = await fetch_user_dict(interaction.client, case_dict["target_id"])
target_name = (
f"`{target_user['name']}`"
if target_user["discriminator"] == "0"
else f"`{target_user['name']}#{target_user['discriminator']}`"
)
elif case_dict["target_type"] == "CHANNEL":
target_user = await fetch_channel_dict(interaction.guild, case_dict["target_id"])
if target_user["mention"]:
target_name = f"{target_user['mention']}"
else:
target_name = f"`{target_user['name']}`"
moderator_user = await fetch_user_dict(interaction, case_dict['moderator_id'])
moderator_name = f"`{moderator_user['name']}`" if moderator_user['discriminator'] == "0" else f"`{moderator_user['name']}#{moderator_user['discriminator']}`"
moderator_user = await fetch_user_dict(interaction.client, case_dict["moderator_id"])
moderator_name = (
f"`{moderator_user['name']}`"
if moderator_user["discriminator"] == "0"
else f"`{moderator_user['name']}#{moderator_user['discriminator']}`"
)
embed = Embed(title=f"📕 Case #{case_dict['moderation_id']:,} Resolved", color=await interaction.client.get_embed_color(interaction.channel))
embed = Embed(
title=f"📕 Case #{case_dict['moderation_id']:,} Resolved",
color=await interaction.client.get_embed_color(interaction.channel),
)
embed.description = f"**Type:** {str.title(case_dict['moderation_type'])}\n**Target:** {target_name} ({target_user['id']})\n**Moderator:** {moderator_name} ({moderator_user['id']})\n**Timestamp:** <t:{case_dict['timestamp']}> | <t:{case_dict['timestamp']}:R>"
if case_dict['duration'] != 'NULL':
td = timedelta(**{unit: int(val) for unit, val in zip(["hours", "minutes", "seconds"], case_dict["duration"].split(":"))})
duration_embed = f"{humanize.precisedelta(td)} | <t:{case_dict['end_timestamp']}:R>" if case_dict["expired"] == '0' else str(humanize.precisedelta(td))
embed.description = embed.description + f"\n**Duration:** {duration_embed}\n**Expired:** {bool(case_dict['expired'])}"
if case_dict["duration"] != "NULL":
td = timedelta(
**{
unit: int(val)
for unit, val in zip(
["hours", "minutes", "seconds"],
case_dict["duration"].split(":"),
)
}
)
duration_embed = (
f"{humanize_timedelta(timedelta=td)} | <t:{case_dict['end_timestamp']}:R>"
if case_dict["expired"] == "0"
else str(humanize_timedelta(timedelta=td))
)
embed.description = (
embed.description
+ f"\n**Duration:** {duration_embed}\n**Expired:** {bool(case_dict['expired'])}"
)
embed.add_field(name='Reason', value=box(case_dict['reason']), inline=False)
embed.add_field(name="Reason", value=box(case_dict["reason"]), inline=False)
resolved_user = await fetch_user_dict(interaction, case_dict['resolved_by'])
resolved_name = resolved_user['name'] if resolved_user['discriminator'] == "0" else f"{resolved_user['name']}#{resolved_user['discriminator']}"
embed.add_field(name='Resolve Reason', value=f"Resolved by `{resolved_name}` ({resolved_user['id']}) for:\n" + box(case_dict['resolve_reason']), inline=False)
resolved_user = await fetch_user_dict(interaction.client, case_dict["resolved_by"])
resolved_name = (
resolved_user["name"]
if resolved_user["discriminator"] == "0"
else f"{resolved_user['name']}#{resolved_user['discriminator']}"
)
embed.add_field(
name="Resolve Reason",
value=f"Resolved by `{resolved_name}` ({resolved_user['id']}) for:\n"
+ box(case_dict["resolve_reason"]),
inline=False,
)
else:
if case_dict['target_type'] == 'USER':
target_user = await fetch_user_dict(interaction, case_dict['target_id'])
target_name = f"`{target_user['name']}`" if target_user['discriminator'] == "0" else f"`{target_user['name']}#{target_user['discriminator']}`"
elif case_dict['target_type'] == 'CHANNEL':
target_user = await fetch_channel_dict(interaction, case_dict['target_id'])
if target_user['mention']:
target_name = target_user['mention']
if case_dict["target_type"] == "USER":
target_user = await fetch_user_dict(interaction.client, case_dict["target_id"])
target_name = (
f"`{target_user['name']}`"
if target_user["discriminator"] == "0"
else f"`{target_user['name']}#{target_user['discriminator']}`"
)
elif case_dict["target_type"] == "CHANNEL":
target_user = await fetch_channel_dict(interaction.guild, case_dict["target_id"])
if target_user["mention"]:
target_name = target_user["mention"]
else:
target_name = f"`{target_user['name']}`"
moderator_user = await fetch_user_dict(interaction, case_dict['moderator_id'])
moderator_name = f"`{moderator_user['name']}`" if moderator_user['discriminator'] == "0" else f"`{moderator_user['name']}#{moderator_user['discriminator']}`"
moderator_user = await fetch_user_dict(interaction.client, case_dict["moderator_id"])
moderator_name = (
f"`{moderator_user['name']}`"
if moderator_user["discriminator"] == "0"
else f"`{moderator_user['name']}#{moderator_user['discriminator']}`"
)
embed = Embed(title=f"📕 Case #{case_dict['moderation_id']:,}", color=await interaction.client.get_embed_color(interaction.channel))
embed = Embed(
title=f"📕 Case #{case_dict['moderation_id']:,}",
color=await interaction.client.get_embed_color(interaction.channel),
)
embed.description = f"**Type:** {str.title(case_dict['moderation_type'])}\n**Target:** {target_name} ({target_user['id']})\n**Moderator:** {moderator_name} ({moderator_user['id']})\n**Timestamp:** <t:{case_dict['timestamp']}> | <t:{case_dict['timestamp']}:R>"
if case_dict['duration'] != 'NULL':
td = timedelta(**{unit: int(val) for unit, val in zip(["hours", "minutes", "seconds"], case_dict["duration"].split(":"))})
embed.description = embed.description + f"\n**Duration:** {humanize.precisedelta(td)} | <t:{case_dict['end_timestamp']}:R>"
if case_dict["duration"] != "NULL":
td = timedelta(
**{
unit: int(val)
for unit, val in zip(
["hours", "minutes", "seconds"],
case_dict["duration"].split(":"),
)
}
)
embed.description = (
embed.description
+ f"\n**Duration:** {humanize_timedelta(timedelta=td)} | <t:{case_dict['end_timestamp']}:R>"
)
embed.add_field(name='Reason', value=box(case_dict['reason']), inline=False)
embed.add_field(name="Reason", value=box(case_dict["reason"]), inline=False)
return embed
async def case_factory(interaction: Interaction, case_dict: dict) -> Embed:
"""This function creates a case embed from set parameters.
@ -125,42 +220,82 @@ async def case_factory(interaction: Interaction, case_dict: dict) -> Embed:
interaction (Interaction): The interaction object.
case_dict (dict): The case dictionary.
"""
if case_dict['target_type'] == 'USER':
target_user = await fetch_user_dict(interaction, case_dict['target_id'])
target_name = f"`{target_user['name']}`" if target_user['discriminator'] == "0" else f"`{target_user['name']}#{target_user['discriminator']}`"
elif case_dict['target_type'] == 'CHANNEL':
target_user = await fetch_channel_dict(interaction, case_dict['target_id'])
if target_user['mention']:
if case_dict["target_type"] == "USER":
target_user = await fetch_user_dict(interaction.client, case_dict["target_id"])
target_name = (
f"`{target_user['name']}`"
if target_user["discriminator"] == "0"
else f"`{target_user['name']}#{target_user['discriminator']}`"
)
elif case_dict["target_type"] == "CHANNEL":
target_user = await fetch_channel_dict(interaction.guild, case_dict["target_id"])
if target_user["mention"]:
target_name = f"{target_user['mention']}"
else:
target_name = f"`{target_user['name']}`"
moderator_user = await fetch_user_dict(interaction, case_dict['moderator_id'])
moderator_name = f"`{moderator_user['name']}`" if moderator_user['discriminator'] == "0" else f"`{moderator_user['name']}#{moderator_user['discriminator']}`"
moderator_user = await fetch_user_dict(interaction.client, case_dict["moderator_id"])
moderator_name = (
f"`{moderator_user['name']}`"
if moderator_user["discriminator"] == "0"
else f"`{moderator_user['name']}#{moderator_user['discriminator']}`"
)
embed = Embed(title=f"📕 Case #{case_dict['moderation_id']:,}", color=await interaction.client.get_embed_color(interaction.channel))
embed = Embed(
title=f"📕 Case #{case_dict['moderation_id']:,}",
color=await interaction.client.get_embed_color(interaction.channel),
)
embed.description = f"**Type:** {str.title(case_dict['moderation_type'])}\n**Target:** {target_name} ({target_user['id']})\n**Moderator:** {moderator_name} ({moderator_user['id']})\n**Resolved:** {bool(case_dict['resolved'])}\n**Timestamp:** <t:{case_dict['timestamp']}> | <t:{case_dict['timestamp']}:R>"
if case_dict['duration'] != 'NULL':
td = timedelta(**{unit: int(val) for unit, val in zip(["hours", "minutes", "seconds"], case_dict["duration"].split(":"))})
duration_embed = f"{humanize.precisedelta(td)} | <t:{case_dict['end_timestamp']}:R>" if bool(case_dict['expired']) is False else str(humanize.precisedelta(td))
if case_dict["duration"] != "NULL":
td = timedelta(
**{
unit: int(val)
for unit, val in zip(
["hours", "minutes", "seconds"], case_dict["duration"].split(":")
)
}
)
duration_embed = (
f"{humanize_timedelta(timedelta=td)} | <t:{case_dict['end_timestamp']}:R>"
if bool(case_dict["expired"]) is False
else str(humanize_timedelta(timedelta=td))
)
embed.description += f"\n**Duration:** {duration_embed}\n**Expired:** {bool(case_dict['expired'])}"
embed.description += f"\n**Changes:** {len(case_dict['changes']) - 1}" if case_dict['changes'] else "\n**Changes:** 0"
embed.description += (
f"\n**Changes:** {len(case_dict['changes']) - 1}"
if case_dict["changes"]
else "\n**Changes:** 0"
)
if case_dict['metadata']:
if case_dict['metadata']['imported_from']:
embed.description += f"\n**Imported From:** {case_dict['metadata']['imported_from']}"
if case_dict["role_id"]:
embed.description += f"\n**Role:** <@&{case_dict['role_id']}>"
embed.add_field(name='Reason', value=box(case_dict['reason']), inline=False)
if case_dict["metadata"]:
if case_dict["metadata"]["imported_from"]:
embed.description += (
f"\n**Imported From:** {case_dict['metadata']['imported_from']}"
)
if case_dict['resolved'] == 1:
resolved_user = await fetch_user_dict(interaction, case_dict['resolved_by'])
resolved_name = f"`{resolved_user['name']}`" if resolved_user['discriminator'] == "0" else f"`{resolved_user['name']}#{resolved_user['discriminator']}`"
embed.add_field(name='Resolve Reason', value=f"Resolved by {resolved_name} ({resolved_user['id']}) for:\n{box(case_dict['resolve_reason'])}", inline=False)
embed.add_field(name="Reason", value=box(case_dict["reason"]), inline=False)
if case_dict["resolved"] == 1:
resolved_user = await fetch_user_dict(interaction.client, case_dict["resolved_by"])
resolved_name = (
f"`{resolved_user['name']}`"
if resolved_user["discriminator"] == "0"
else f"`{resolved_user['name']}#{resolved_user['discriminator']}`"
)
embed.add_field(
name="Resolve Reason",
value=f"Resolved by {resolved_name} ({resolved_user['id']}) for:\n{box(case_dict['resolve_reason'])}",
inline=False,
)
return embed
async def changes_factory(interaction: Interaction, case_dict: dict) -> Embed:
"""This function creates a changes embed from set parameters.
@ -168,34 +303,56 @@ async def changes_factory(interaction: Interaction, case_dict: dict) -> Embed:
interaction (Interaction): The interaction object.
case_dict (dict): The case dictionary.
"""
embed = Embed(title=f"📕 Case #{case_dict['moderation_id']:,} Changes", color=await interaction.client.get_embed_color(interaction.channel))
embed = Embed(
title=f"📕 Case #{case_dict['moderation_id']:,} Changes",
color=await interaction.client.get_embed_color(interaction.channel),
)
memory_dict = {}
if case_dict['changes']:
for change in case_dict['changes']:
if change['user_id'] not in memory_dict:
memory_dict[str(change['user_id'])] = await fetch_user_dict(interaction, change['user_id'])
if case_dict["changes"]:
for change in case_dict["changes"]:
if change["user_id"] not in memory_dict:
memory_dict[str(change["user_id"])] = await fetch_user_dict(
interaction.client, change["user_id"]
)
user = memory_dict[str(change['user_id'])]
name = user['name'] if user['discriminator'] == "0" else f"{user['name']}#{user['discriminator']}"
user = memory_dict[str(change["user_id"])]
name = (
user["name"]
if user["discriminator"] == "0"
else f"{user['name']}#{user['discriminator']}"
)
timestamp = f"<t:{change['timestamp']}> | <t:{change['timestamp']}:R>"
if change['type'] == 'ORIGINAL':
embed.add_field(name='Original', value=f"**User:** `{name}` ({user['id']})\n**Reason:** {change['reason']}\n**Timestamp:** {timestamp}", inline=False)
if change["type"] == "ORIGINAL":
embed.add_field(
name="Original",
value=f"**User:** `{name}` ({user['id']})\n**Reason:** {change['reason']}\n**Timestamp:** {timestamp}",
inline=False,
)
elif change['type'] == 'EDIT':
embed.add_field(name='Edit', value=f"**User:** `{name}` ({user['id']})\n**Reason:** {change['reason']}\n**Timestamp:** {timestamp}", inline=False)
elif change["type"] == "EDIT":
embed.add_field(
name="Edit",
value=f"**User:** `{name}` ({user['id']})\n**Reason:** {change['reason']}\n**Timestamp:** {timestamp}",
inline=False,
)
elif change['type'] == 'RESOLVE':
embed.add_field(name='Resolve', value=f"**User:** `{name}` ({user['id']})\n**Reason:** {change['reason']}\n**Timestamp:** {timestamp}", inline=False)
elif change["type"] == "RESOLVE":
embed.add_field(
name="Resolve",
value=f"**User:** `{name}` ({user['id']})\n**Reason:** {change['reason']}\n**Timestamp:** {timestamp}",
inline=False,
)
else:
embed.description = "*No changes have been made to this case.* 🙁"
return embed
async def evidenceformat_factory(interaction: Interaction, case_dict: dict) -> str:
"""This function creates a codeblock in evidence format from set parameters.
@ -203,42 +360,53 @@ async def evidenceformat_factory(interaction: Interaction, case_dict: dict) -> s
interaction (Interaction): The interaction object.
case_dict (dict): The case dictionary.
"""
if case_dict['target_type'] == 'USER':
target_user = await fetch_user_dict(interaction, case_dict['target_id'])
target_name = target_user['name'] if target_user['discriminator'] == "0" else f"{target_user['name']}#{target_user['discriminator']}"
if case_dict["target_type"] == "USER":
target_user = await fetch_user_dict(interaction.client, case_dict["target_id"])
target_name = (
target_user["name"]
if target_user["discriminator"] == "0"
else f"{target_user['name']}#{target_user['discriminator']}"
)
elif case_dict['target_type'] == 'CHANNEL':
target_user = await fetch_channel_dict(interaction, case_dict['target_id'])
target_name = target_user['name']
elif case_dict["target_type"] == "CHANNEL":
target_user = await fetch_channel_dict(interaction.guild, case_dict["target_id"])
target_name = target_user["name"]
moderator_user = await fetch_user_dict(interaction, case_dict['moderator_id'])
moderator_name = moderator_user['name'] if moderator_user['discriminator'] == "0" else f"{moderator_user['name']}#{moderator_user['discriminator']}"
moderator_user = await fetch_user_dict(interaction.client, case_dict["moderator_id"])
moderator_name = (
moderator_user["name"]
if moderator_user["discriminator"] == "0"
else f"{moderator_user['name']}#{moderator_user['discriminator']}"
)
content = f"Case: {case_dict['moderation_id']:,} ({str.title(case_dict['moderation_type'])})\nTarget: {target_name} ({target_user['id']})\nModerator: {moderator_name} ({moderator_user['id']})"
if case_dict['duration'] != 'NULL':
hours, minutes, seconds = map(int, case_dict['duration'].split(':'))
if case_dict["role_id"] != "0":
role = interaction.guild.get_role(int(case_dict["role_id"]))
content += "\nRole: " + (role.name if role is not None else case_dict["role_id"])
if case_dict["duration"] != "NULL":
hours, minutes, seconds = map(int, case_dict["duration"].split(":"))
td = timedelta(hours=hours, minutes=minutes, seconds=seconds)
content += f"\nDuration: {humanize.precisedelta(td)}"
content += f"\nDuration: {humanize_timedelta(timedelta=td)}"
content += f"\nReason: {case_dict['reason']}"
return box(content, 'prolog')
return box(content, "prolog")
########################################################################################################################
### Configuration Embeds #
########################################################################################################################
async def _config(ctx: commands.Context) -> Embed:
"""Generates the core embed for configuration menus to use."""
e = Embed(
title="Aurora Configuration Menu",
color=await ctx.embed_color()
)
e = Embed(title="Aurora Configuration Menu", color=await ctx.embed_color())
e.set_thumbnail(url=ctx.bot.user.display_avatar.url)
return e
async def overrides_embed(ctx: commands.Context) -> Embed:
"""Generates a configuration menu embed for a user's overrides."""
@ -247,32 +415,44 @@ async def overrides_embed(ctx: commands.Context) -> Embed:
"inline": await config.user(ctx.author).history_inline(),
"inline_pagesize": await config.user(ctx.author).history_inline_pagesize(),
"pagesize": await config.user(ctx.author).history_pagesize(),
"auto_evidenceformat": await config.user(ctx.author).auto_evidenceformat()
"auto_evidenceformat": await config.user(ctx.author).auto_evidenceformat(),
}
override_str = [
'- ' + bold("Auto Evidence Format: ") + get_bool_emoji(override_settings['auto_evidenceformat']),
'- ' + bold("Ephemeral: ") + get_bool_emoji(override_settings['ephemeral']),
'- ' + bold("History Inline: ") + get_bool_emoji(override_settings['inline']),
'- ' + bold("History Inline Pagesize: ") + get_pagesize_str(override_settings['inline_pagesize']),
'- ' + bold("History Pagesize: ") + get_pagesize_str(override_settings['pagesize']),
"- "
+ bold("Auto Evidence Format: ")
+ get_bool_emoji(override_settings["auto_evidenceformat"]),
"- " + bold("Ephemeral: ") + get_bool_emoji(override_settings["ephemeral"]),
"- " + bold("History Inline: ") + get_bool_emoji(override_settings["inline"]),
"- "
+ bold("History Inline Pagesize: ")
+ get_pagesize_str(override_settings["inline_pagesize"]),
"- "
+ bold("History Pagesize: ")
+ get_pagesize_str(override_settings["pagesize"]),
]
override_str = '\n'.join(override_str)
override_str = "\n".join(override_str)
e = await _config(ctx)
e.title += ": User Overrides"
e.description = """
e.description = (
"""
Use the buttons below to manage your user overrides.
These settings will override the relevant guild settings.\n
""" + override_str
"""
+ override_str
)
return e
async def guild_embed(ctx: commands.Context) -> Embed:
"""Generates a configuration menu field value for a guild's settings."""
guild_settings = {
"show_moderator": await config.guild(ctx.guild).show_moderator(),
"use_discord_permissions": await config.guild(ctx.guild).use_discord_permissions(),
"use_discord_permissions": await config.guild(
ctx.guild
).use_discord_permissions(),
"ignore_modlog": await config.guild(ctx.guild).ignore_modlog(),
"ignore_other_bots": await config.guild(ctx.guild).ignore_other_bots(),
"dm_users": await config.guild(ctx.guild).dm_users(),
@ -280,54 +460,101 @@ async def guild_embed(ctx: commands.Context) -> Embed:
"history_ephemeral": await config.guild(ctx.guild).history_ephemeral(),
"history_inline": await config.guild(ctx.guild).history_inline(),
"history_pagesize": await config.guild(ctx.guild).history_pagesize(),
"history_inline_pagesize": await config.guild(ctx.guild).history_inline_pagesize(),
"history_inline_pagesize": await config.guild(
ctx.guild
).history_inline_pagesize(),
"auto_evidenceformat": await config.guild(ctx.guild).auto_evidenceformat(),
"respect_hierarchy": await config.guild(ctx.guild).respect_hierarchy(),
}
channel = ctx.guild.get_channel(guild_settings['log_channel'])
channel = ctx.guild.get_channel(guild_settings["log_channel"])
if channel is None:
channel = warning("Not Set")
else:
channel = channel.mention
guild_str = [
'- '+ bold("Show Moderator: ") + get_bool_emoji(guild_settings['show_moderator']),
'- '+ bold("Use Discord Permissions: ") + get_bool_emoji(guild_settings['use_discord_permissions']),
'- '+ bold("Ignore Modlog: ") + get_bool_emoji(guild_settings['ignore_modlog']),
'- '+ bold("Ignore Other Bots: ") + get_bool_emoji(guild_settings['ignore_other_bots']),
'- '+ bold("DM Users: ") + get_bool_emoji(guild_settings['dm_users']),
'- '+ bold("Auto Evidence Format: ") + get_bool_emoji(guild_settings['auto_evidenceformat']),
'- '+ bold("Ephemeral: ") + get_bool_emoji(guild_settings['history_ephemeral']),
'- '+ bold("History Inline: ") + get_bool_emoji(guild_settings['history_inline']),
'- '+ bold("History Pagesize: ") + get_pagesize_str(guild_settings['history_pagesize']),
'- '+ bold("History Inline Pagesize: ") + get_pagesize_str(guild_settings['history_inline_pagesize']),
'- '+ bold("Log Channel: ") + channel
"- "
+ bold("Show Moderator: ")
+ get_bool_emoji(guild_settings["show_moderator"]),
"- "
+ bold("Use Discord Permissions: ")
+ get_bool_emoji(guild_settings["use_discord_permissions"]),
"- "
+ bold("Respect Hierarchy: ")
+ get_bool_emoji(guild_settings["respect_hierarchy"]),
"- "
+ bold("Ignore Modlog: ")
+ get_bool_emoji(guild_settings["ignore_modlog"]),
"- "
+ bold("Ignore Other Bots: ")
+ get_bool_emoji(guild_settings["ignore_other_bots"]),
"- " + bold("DM Users: ") + get_bool_emoji(guild_settings["dm_users"]),
"- "
+ bold("Auto Evidence Format: ")
+ get_bool_emoji(guild_settings["auto_evidenceformat"]),
"- "
+ bold("Ephemeral: ")
+ get_bool_emoji(guild_settings["history_ephemeral"]),
"- "
+ bold("History Inline: ")
+ get_bool_emoji(guild_settings["history_inline"]),
"- "
+ bold("History Pagesize: ")
+ get_pagesize_str(guild_settings["history_pagesize"]),
"- "
+ bold("History Inline Pagesize: ")
+ get_pagesize_str(guild_settings["history_inline_pagesize"]),
"- " + bold("Log Channel: ") + channel,
]
guild_str = '\n'.join(guild_str)
guild_str = "\n".join(guild_str)
e = await _config(ctx)
e.title += ": Server Configuration"
e.description = """
e.description = (
"""
Use the buttons below to manage Aurora's server configuration.\n
""" + guild_str
"""
+ guild_str
)
return e
async def addrole_embed(ctx: commands.Context) -> Embed:
"""Generates a configuration menu field value for a guild's addrole whitelist."""
whitelist = await config.guild(ctx.guild).addrole_whitelist()
if whitelist:
whitelist = [ctx.guild.get_role(role).mention or error(f"`{role}` (Not Found)") for role in whitelist]
whitelist = '\n'.join(whitelist)
roles = []
async with config.guild(ctx.guild).addrole_whitelist() as whitelist:
for role in whitelist:
evalulated_role = ctx.guild.get_role(role) or error(f"`{role}` (Not Found)")
if isinstance(evalulated_role, Role):
roles.append({
"id": evalulated_role.id,
"mention": evalulated_role.mention,
"position": evalulated_role.position
})
else:
roles.append({
"id": role,
"mention": error(f"`{role}` (Not Found)"),
"position": 0
})
if roles:
roles = sorted(roles, key=lambda x: x["position"], reverse=True)
roles = [role["mention"] for role in roles]
whitelist_str = "\n".join(roles)
else:
whitelist = warning("No roles are on the addrole whitelist!")
whitelist_str = warning("No roles are on the addrole whitelist!")
e = await _config(ctx)
e.title += ": Addrole Whitelist"
e.description = "Use the select menu below to manage this guild's addrole whitelist."
e.description = (
"Use the select menu below to manage this guild's addrole whitelist."
)
if len(whitelist) > 4000 and len(whitelist) < 5000:
lines = whitelist.split('\n')
if len(whitelist_str) > 4000 and len(whitelist_str) < 5000:
lines = whitelist_str.split("\n")
chunks = []
chunk = ""
for line in lines:
@ -335,23 +562,41 @@ async def addrole_embed(ctx: commands.Context) -> Embed:
chunks.append(chunk)
chunk = line
else:
chunk += '\n' + line if chunk else line
chunk += "\n" + line if chunk else line
chunks.append(chunk)
for chunk in chunks:
e.add_field(name="", value=chunk)
else:
e.description += '\n\n' + whitelist
e.description += "\n\n" + whitelist_str
return e
async def immune_embed(ctx: commands.Context) -> Embed:
"""Generates a configuration menu field value for a guild's immune roles."""
immune_roles = await config.guild(ctx.guild).immune_roles()
if immune_roles:
immune_str = [ctx.guild.get_role(role).mention or error(f"`{role}` (Not Found)") for role in immune_roles]
immune_str = '\n'.join(immune_str)
async def immune_embed(ctx: commands.Context) -> Embed:
"""Generates a configuration menu embed for a guild's immune roles."""
roles = []
async with config.guild(ctx.guild).immune_roles() as immune_roles:
for role in immune_roles:
evalulated_role = ctx.guild.get_role(role) or error(f"`{role}` (Not Found)")
if isinstance(evalulated_role, Role):
roles.append({
"id": evalulated_role.id,
"mention": evalulated_role.mention,
"position": evalulated_role.position
})
else:
roles.append({
"id": role,
"mention": error(f"`{role}` (Not Found)"),
"position": 0
})
if roles:
roles = sorted(roles, key=lambda x: x["position"], reverse=True)
roles = [role["mention"] for role in roles]
immune_str = "\n".join(roles)
else:
immune_str = warning("No roles are set as immune roles!")
@ -360,7 +605,7 @@ async def immune_embed(ctx: commands.Context) -> Embed:
e.description = "Use the select menu below to manage this guild's immune roles."
if len(immune_str) > 4000 and len(immune_str) < 5000:
lines = immune_str.split('\n')
lines = immune_str.split("\n")
chunks = []
chunk = ""
for line in lines:
@ -368,12 +613,12 @@ async def immune_embed(ctx: commands.Context) -> Embed:
chunks.append(chunk)
chunk = line
else:
chunk += '\n' + line if chunk else line
chunk += "\n" + line if chunk else line
chunks.append(chunk)
for chunk in chunks:
e.add_field(name="", value=chunk)
else:
e.description += '\n\n' + immune_str
e.description += "\n\n" + immune_str
return e

View file

@ -1,3 +1,3 @@
import logging
from red_commons.logging import getLogger
logger = logging.getLogger("red.sea.aurora")
logger = getLogger("red.SeaCogs.Aurora")

View file

@ -1,12 +1,13 @@
# pylint: disable=cyclic-import
import json
from datetime import datetime
from datetime import timedelta as td
from typing import Union
from typing import Optional, Union
from discord import Guild, Interaction, Member, User, SelectOption
from dateutil.relativedelta import relativedelta as rd
from discord import File, Guild, Interaction, Member, SelectOption, User
from discord.errors import Forbidden, NotFound
from redbot.core import commands
from redbot.core import commands, data_manager
from redbot.core.utils.chat_formatting import error
from .config import config
@ -17,7 +18,7 @@ def check_permissions(
permissions: list,
ctx: Union[commands.Context, Interaction] = None,
guild: Guild = None,
):
) -> Union[bool, str]:
"""Checks if a user has a specific permission (or a list of permissions) in a channel."""
if ctx:
member = ctx.guild.get_member(user.id)
@ -33,7 +34,7 @@ def check_permissions(
for permission in permissions:
if (
not getattr(resolved_permissions, permission, False)
and not resolved_permissions.administrator is True
and resolved_permissions.administrator is not True
):
return permission
@ -42,11 +43,13 @@ def check_permissions(
async def check_moddable(
target: Union[User, Member], interaction: Interaction, permissions: list
):
) -> bool:
"""Checks if a moderator can moderate a target."""
if check_permissions(interaction.client.user, permissions, guild=interaction.guild):
await interaction.response.send_message(
error(f"I do not have the `{permissions}` permission, required for this action."),
error(
f"I do not have the `{permissions}` permission, required for this action."
),
ephemeral=True,
)
return False
@ -54,7 +57,9 @@ async def check_moddable(
if await config.guild(interaction.guild).use_discord_permissions() is True:
if check_permissions(interaction.user, permissions, guild=interaction.guild):
await interaction.response.send_message(
error(f"You do not have the `{permissions}` permission, required for this action."),
error(
f"You do not have the `{permissions}` permission, required for this action."
),
ephemeral=True,
)
return False
@ -72,9 +77,11 @@ async def check_moddable(
return False
if isinstance(target, Member):
if interaction.user.top_role <= target.top_role:
if interaction.user.top_role <= target.top_role and await config.guild(interaction.guild).respect_hierarchy() is True:
await interaction.response.send_message(
content=error("You cannot moderate members with a higher role than you!"),
content=error(
"You cannot moderate members with a higher role than you!"
),
ephemeral=True,
)
return False
@ -84,7 +91,9 @@ async def check_moddable(
<= target.top_role
):
await interaction.response.send_message(
content=error("You cannot moderate members with a role higher than the bot!"),
content=error(
"You cannot moderate members with a role higher than the bot!"
),
ephemeral=True,
)
return False
@ -102,7 +111,7 @@ async def check_moddable(
return True
async def get_next_case_number(guild_id: str, cursor = None) -> int:
async def get_next_case_number(guild_id: str, cursor=None) -> int:
"""This function returns the next case number from the MySQL table for a specific guild."""
from .database import connect
@ -116,8 +125,8 @@ async def get_next_case_number(guild_id: str, cursor = None) -> int:
return (result[0] + 1) if result else 1
def generate_dict(result):
case: dict = {
def generate_dict(result) -> dict:
case = {
"moderation_id": result[0],
"timestamp": result[1],
"moderation_type": result[2],
@ -133,21 +142,21 @@ def generate_dict(result):
"resolve_reason": result[12],
"expired": result[13],
"changes": json.loads(result[14]),
"metadata": json.loads(result[15])
"metadata": json.loads(result[15]),
}
return case
async def fetch_user_dict(interaction: Interaction, user_id: str):
async def fetch_user_dict(client: commands.Bot, user_id: str) -> dict:
"""This function returns a dictionary containing either user information or a standard deleted user template."""
if user_id == "?":
user_dict = {"id": "?", "name": "Unknown User", "discriminator": "0"}
else:
try:
user = interaction.client.get_user(user_id)
user = client.get_user(int(user_id))
if user is None:
user = await interaction.client.fetch_user(user_id)
user = await client.fetch_user(int(user_id))
user_dict = {
"id": user.id,
@ -162,17 +171,22 @@ async def fetch_user_dict(interaction: Interaction, user_id: str):
"discriminator": "0",
}
return user_dict
async def fetch_channel_dict(interaction: Interaction, channel_id: str):
async def fetch_channel_dict(guild: Guild, channel_id: int) -> dict:
"""This function returns a dictionary containing either channel information or a standard deleted channel template."""
try:
channel = interaction.guild.get_channel(channel_id)
channel = guild.get_channel(int(channel_id))
if not channel:
channel = await interaction.guild.fetch_channel(channel_id)
channel = await guild.fetch_channel(channel_id)
channel_dict = {"id": channel.id, "name": channel.name, "mention": channel.mention}
channel_dict = {
"id": channel.id,
"name": channel.name,
"mention": channel.mention,
}
except NotFound:
channel_dict = {"id": channel_id, "name": "Deleted Channel", "mention": None}
@ -180,9 +194,9 @@ async def fetch_channel_dict(interaction: Interaction, channel_id: str):
return channel_dict
async def fetch_role_dict(interaction: Interaction, role_id: str):
async def fetch_role_dict(guild: Guild, role_id: int) -> dict:
"""This function returns a dictionary containing either role information or a standard deleted role template."""
role = interaction.guild.get_role(role_id)
role = guild.get_role(int(role_id))
if not role:
role_dict = {"id": role_id, "name": "Deleted Role"}
@ -191,7 +205,7 @@ async def fetch_role_dict(interaction: Interaction, role_id: str):
return role_dict
async def log(interaction: Interaction, moderation_id: int, resolved: bool = False):
async def log(interaction: Interaction, moderation_id: int, resolved: bool = False) -> None:
"""This function sends a message to the guild's configured logging channel when an infraction takes place."""
from .database import fetch_case
from .factory import log_factory
@ -202,25 +216,31 @@ async def log(interaction: Interaction, moderation_id: int, resolved: bool = Fal
case = await fetch_case(moderation_id, interaction.guild.id)
if case:
embed = await log_factory(interaction=interaction, case_dict=case, resolved=resolved)
embed = await log_factory(
interaction=interaction, case_dict=case, resolved=resolved
)
try:
await logging_channel.send(embed=embed)
except Forbidden:
return
async def send_evidenceformat(interaction: Interaction, case_dict: dict):
async def send_evidenceformat(interaction: Interaction, case_dict: dict) -> None:
"""This function sends an ephemeral message to the moderator who took the moderation action, with a pre-made codeblock for use in the mod-evidence channel."""
from .factory import evidenceformat_factory
send_evidence_bool = (await config.user(interaction.user).auto_evidenceformat()
send_evidence_bool = (
await config.user(interaction.user).auto_evidenceformat()
or await config.guild(interaction.guild).auto_evidenceformat()
or False)
or False
)
if send_evidence_bool is False:
return
content = await evidenceformat_factory(interaction=interaction, case_dict=case_dict)
await interaction.followup.send(content=content, ephemeral=True)
def convert_timedelta_to_str(timedelta: td) -> str:
"""This function converts a timedelta object to a string."""
total_seconds = int(timedelta.total_seconds())
@ -229,7 +249,8 @@ def convert_timedelta_to_str(timedelta: td) -> str:
seconds = total_seconds % 60
return f"{hours}:{minutes}:{seconds}"
def get_bool_emoji(value: bool) -> str:
def get_bool_emoji(value: Optional[bool]) -> str:
"""Returns a unicode emoji based on a boolean value."""
if value is True:
return "\N{WHITE HEAVY CHECK MARK}"
@ -237,12 +258,14 @@ def get_bool_emoji(value: bool) -> str:
return "\N{NO ENTRY SIGN}"
return "\N{BLACK QUESTION MARK ORNAMENT}\N{VARIATION SELECTOR-16}"
def get_pagesize_str(value: Union[int, None]) -> str:
"""Returns a string based on a pagesize value."""
if value is None:
return "\N{BLACK QUESTION MARK ORNAMENT}\N{VARIATION SELECTOR-16}"
return str(value) + " cases per page"
def create_pagesize_options() -> list[SelectOption]:
"""Returns a list of SelectOptions for pagesize configuration."""
options = []
@ -262,3 +285,14 @@ def create_pagesize_options() -> list[SelectOption]:
)
)
return options
def timedelta_from_relativedelta(relativedelta: rd) -> td:
"""Converts a relativedelta object to a timedelta object."""
now = datetime.now()
then = now - relativedelta
return now - then
def get_footer_image(coginstance: commands.Cog) -> File:
"""Returns the footer image for the embeds."""
image_path = data_manager.bundled_data_path(coginstance) / "arrow.png"
return File(image_path, filename="arrow.png", description="arrow")

View file

@ -6,42 +6,61 @@
# |_____/ \___|\__,_|___/ \_/\_/ |_|_| |_| |_|_| |_| |_|\___|_|
import contextlib
import logging
import json
import re
from redbot.core import commands
from redbot.core.bot import Red
from red_commons.logging import getLogger
from redbot.cogs.downloader import errors
from redbot.cogs.downloader.converters import InstalledCog
from redbot.core.utils.chat_formatting import error, text_to_file
from redbot.core import commands
from redbot.core.bot import Red
from redbot.core.utils.chat_formatting import bold, error, humanize_list, text_to_file
# pylint: disable=protected-access
class Backup(commands.Cog):
"""A utility to make reinstalling repositories and cogs after migrating the bot far easier."""
__author__ = "SeaswimmerTheFsh"
__version__ = "1.0.0"
__author__ = ["[cswimr](https://www.coastalcommits.com/cswimr)"]
__git__ = "https://www.coastalcommits.com/cswimr/SeaCogs"
__version__ = "1.1.1"
__documentation__ = "https://seacogs.coastalcommits.com/backup/"
def __init__(self, bot: Red):
super().__init__()
self.bot = bot
self.logger = logging.getLogger("red.sea.backup")
self.logger = getLogger("red.SeaCogs.Backup")
def format_help_for_context(self, ctx: commands.Context) -> str:
pre_processed = super().format_help_for_context(ctx) or ""
n = "\n" if "\n\n" not in pre_processed else ""
text = [
f"{pre_processed}{n}",
f"{bold('Cog Version:')} [{self.__version__}]({self.__git__})",
f"{bold('Author:')} {humanize_list(self.__author__)}",
f"{bold('Documentation:')} {self.__documentation__}",
]
return "\n".join(text)
@commands.group(autohelp=True)
@commands.is_owner()
async def backup(self, ctx: commands.Context):
"""Backup your installed cogs."""
@backup.command(name='export')
@backup.command(name="export")
@commands.is_owner()
async def backup_export(self, ctx: commands.Context):
"""Export your installed repositories and cogs to a file."""
downloader = ctx.bot.get_cog("Downloader")
if downloader is None:
await ctx.send(error(f"You do not have the `Downloader` cog loaded. Please run `{ctx.prefix}load downloader` and try again."))
await ctx.send(
error(
f"You do not have the `Downloader` cog loaded. Please run `{ctx.prefix}load downloader` and try again."
)
)
return
all_repos = list(downloader._repo_manager.repos) # pylint: disable=protected-access
all_repos = list(downloader._repo_manager.repos)
export_data = []
@ -50,7 +69,7 @@ class Backup(commands.Cog):
"name": repo.name,
"url": repo.url,
"branch": repo.branch,
"cogs": []
"cogs": [],
}
cogs = await downloader.installed_cogs()
@ -59,31 +78,40 @@ class Backup(commands.Cog):
if cog.repo_name == repo.name:
cog_dict = {
"name": cog.name,
# "loaded": cog.name in ctx.bot.extensions.keys(),
# this functionality was planned but never implemented due to Red limitations
# and the possibility of restoration functionality being added to Core
# "loaded": cog.name in ctx.bot.extensions.keys(),
# this functionality was planned but never implemented due to Red limitations
# and the possibility of restoration functionality being added to Core
"pinned": cog.pinned,
"commit": cog.commit
"commit": cog.commit,
}
repo_dict["cogs"].append(cog_dict)
export_data.append(repo_dict)
await ctx.send(file=text_to_file(json.dumps(export_data, indent=4), 'backup.json'))
await ctx.send(
file=text_to_file(json.dumps(export_data, indent=4), "backup.json")
)
@backup.command(name='import')
@backup.command(name="import")
@commands.is_owner()
async def backup_import(self, ctx: commands.Context):
"""Import your installed repositories and cogs from an export file."""
try:
export = json.loads(await ctx.message.attachments[0].read())
except (json.JSONDecodeError, IndexError):
await ctx.send(error("Please provide a valid JSON export file."))
return
try:
export = json.loads(await ctx.message.reference.resolved.attachments[0].read())
except (json.JSONDecodeError, IndexError, AttributeError):
await ctx.send(error("Please provide a valid JSON export file."))
return
downloader = ctx.bot.get_cog("Downloader")
if downloader is None:
await ctx.send(error(f"You do not have the `Downloader` cog loaded. Please run `{ctx.prefix}load downloader` and try again."))
await ctx.send(
error(
f"You do not have the `Downloader` cog loaded. Please run `{ctx.prefix}load downloader` and try again."
)
)
return
repo_s = []
@ -96,45 +124,57 @@ class Backup(commands.Cog):
async with ctx.typing():
for repo in export:
# Most of this code is from the Downloader cog.
name = repo['name']
branch = repo['branch']
url = repo['url']
cogs = repo['cogs']
name = repo["name"]
branch = repo["branch"]
url = repo["url"]
cogs = repo["cogs"]
if 'PyLav/Red-Cogs' in url:
if "PyLav/Red-Cogs" in url:
repo_e.append("PyLav cogs are not supported.")
continue
if name.startswith('.') or name.endswith('.'):
repo_e.append(f"Invalid repository name: {name}\nRepository names cannot start or end with a dot.")
if name.startswith(".") or name.endswith("."):
repo_e.append(
f"Invalid repository name: {name}\nRepository names cannot start or end with a dot."
)
continue
if re.match(r"^[a-zA-Z0-9_\-\.]+$", name) is None:
repo_e.append(f"Invalid repository name: {name}\nRepository names may only contain letters, numbers, underscores, hyphens, and dots.")
repo_e.append(
f"Invalid repository name: {name}\nRepository names may only contain letters, numbers, underscores, hyphens, and dots."
)
continue
try:
repository = await downloader._repo_manager.add_repo(url, name, branch) # pylint: disable=protected-access
repo_s.append(f"Added repository {name} from {url} on branch {branch}.")
self.logger.debug("Added repository %s from %s on branch %s", name, url, branch)
repository = await downloader._repo_manager.add_repo(
url, name, branch
)
repo_s.append(
f"Added repository {name} from {url} on branch {branch}."
)
self.logger.debug(
"Added repository %s from %s on branch %s", name, url, branch
)
except errors.ExistingGitRepo:
repo_e.append(f"Repository {name} already exists.")
repository = downloader._repo_manager.get_repo(name) # pylint: disable=protected-access
repository = downloader._repo_manager.get_repo(
name
)
self.logger.debug("Repository %s already exists", name)
# This is commented out because errors.AuthenticationError is not yet implemented in Red 3.5.5's Downloader cog.
# Rather, it is only in the development version and will be added in version 3.5.6 (or whatever the next version is).
# except errors.AuthenticationError as err:
# repo_e.append(f"Authentication error while adding repository {name}. See logs for more information.")
# self.logger.exception(
# "Something went wrong whilst cloning %s (to revision %s)",
# url,
# branch,
# exc_info=err,
# )
# continue
except errors.AuthenticationError as err:
repo_e.append(f"Authentication error while adding repository {name}. See logs for more information.")
self.logger.exception(
"Something went wrong whilst cloning %s (to revision %s)",
url,
branch,
exc_info=err,
)
continue
except errors.CloningError as err:
repo_e.append(f"Cloning error while adding repository {name}. See logs for more information.")
repo_e.append(
f"Cloning error while adding repository {name}. See logs for more information."
)
self.logger.exception(
"Something went wrong whilst cloning %s (to revision %s)",
url,
@ -144,21 +184,23 @@ class Backup(commands.Cog):
continue
except OSError:
repo_e.append(f"OS error while adding repository {name}. See logs for more information.")
repo_e.append(
f"OS error while adding repository {name}. See logs for more information."
)
self.logger.exception(
"Something went wrong trying to add repo %s under name %s",
url,
name
name,
)
continue
cog_modules = []
for cog in cogs:
# If you're forking this cog, make sure to change these strings!
if cog['name'] == "backup" and 'SeaswimmerTheFsh/SeaCogs' in url:
if cog["name"] == "backup" and "cswimr/SeaCogs" in url:
continue
try:
cog_module = await InstalledCog.convert(ctx, cog['name'])
cog_module = await InstalledCog.convert(ctx, cog["name"])
except commands.BadArgument:
uninstall_e.append(f"Failed to uninstall {cog['name']}")
continue
@ -170,42 +212,67 @@ class Backup(commands.Cog):
with contextlib.suppress(commands.ExtensionNotLoaded):
await ctx.bot.unload_extension(cog)
await ctx.bot.remove_loaded_package(cog)
await downloader._delete_cog(poss_installed_path) # pylint: disable=protected-access
await downloader._delete_cog(
poss_installed_path
)
uninstall_s.append(f"Uninstalled {cog}")
self.logger.debug("Uninstalled %s", cog)
else:
uninstall_e.append(f"Failed to uninstall {cog}")
self.logger.warning("Failed to uninstall %s", cog)
await downloader._remove_from_installed(cog_modules) # pylint: disable=protected-access
await downloader._remove_from_installed(
cog_modules
)
for cog in cogs:
cog_name = cog['name']
cog_pinned = cog['pinned']
cog_name = cog["name"]
cog_pinned = cog["pinned"]
if cog_pinned:
commit = cog['commit']
commit = cog["commit"]
else:
commit = None
# If you're forking this cog, make sure to change these strings!
if cog_name == 'backup' and 'SeaswimmerTheFsh/SeaCogs' in url:
if cog_name == "backup" and "cswimr/SeaCogs" in url:
continue
async with repository.checkout(commit, exit_to_rev=repository.branch):
cogs_c, message = await downloader._filter_incorrect_cogs_by_names(repository, [cog_name]) # pylint: disable=protected-access
async with repository.checkout(
commit, exit_to_rev=repository.branch
):
cogs_c, message = (
await downloader._filter_incorrect_cogs_by_names(
repository, [cog_name]
)
)
if not cogs_c:
install_e.append(message)
self.logger.error(message)
continue
failed_reqs = await downloader._install_requirements(cogs_c) # pylint: disable=protected-access
failed_reqs = await downloader._install_requirements(
cogs_c
)
if failed_reqs:
install_e.append(f"Failed to install {cog_name} due to missing requirements: {failed_reqs}")
self.logger.error("Failed to install %s due to missing requirements: %s", cog_name, failed_reqs)
install_e.append(
f"Failed to install {cog_name} due to missing requirements: {failed_reqs}"
)
self.logger.error(
"Failed to install %s due to missing requirements: %s",
cog_name,
failed_reqs,
)
continue
installed_cogs, failed_cogs = await downloader._install_cogs(cogs_c) # pylint: disable=protected-access
installed_cogs, failed_cogs = await downloader._install_cogs(
cogs_c
)
if repository.available_libraries:
installed_libs, failed_libs = await repository.install_libraries(target_dir=downloader.SHAREDLIB_PATH, req_target_dir=downloader.LIB_PATH)
installed_libs, failed_libs = (
await repository.install_libraries(
target_dir=downloader.SHAREDLIB_PATH,
req_target_dir=downloader.LIB_PATH,
)
)
else:
installed_libs = None
failed_libs = None
@ -214,21 +281,41 @@ class Backup(commands.Cog):
for cog in installed_cogs:
cog.pinned = True
await downloader._save_to_installed(installed_cogs + installed_libs if installed_libs else installed_cogs) # pylint: disable=protected-access
await downloader._save_to_installed(
installed_cogs + installed_libs
if installed_libs
else installed_cogs
)
if installed_cogs:
installed_cog_name = installed_cogs[0].name
install_s.append(f"Installed {installed_cog_name}")
self.logger.debug("Installed %s", installed_cog_name)
if installed_libs:
for lib in installed_libs:
install_s.append(f"Installed {lib.name} required for {cog_name}")
self.logger.debug("Installed %s required for %s", lib.name, cog_name)
install_s.append(
f"Installed {lib.name} required for {cog_name}"
)
self.logger.debug(
"Installed %s required for %s", lib.name, cog_name
)
if failed_cogs:
failed_cog_name = failed_cogs[0].name
install_e.append(f"Failed to install {failed_cog_name}")
self.logger.error("Failed to install %s", failed_cog_name)
if failed_libs:
for lib in failed_libs:
install_e.append(f"Failed to install {lib.name} required for {cog_name}")
self.logger.error("Failed to install %s required for %s", lib.name, cog_name)
await ctx.send("Import complete!", file=text_to_file(f"Repositories:\n{repo_s}\n\nRepository Errors:\n{repo_e}\n\nUninstalled Cogs:\n{uninstall_s}\n\nUninstalled Cogs Errors:\n{uninstall_e}\n\nInstalled Cogs:\n{install_s}\n\nInstalled Cogs Errors:\n{install_e}", 'backup.log'))
install_e.append(
f"Failed to install {lib.name} required for {cog_name}"
)
self.logger.error(
"Failed to install %s required for %s",
lib.name,
cog_name,
)
await ctx.send(
"Import complete!",
file=text_to_file(
f"Repositories:\n{repo_s}\n\nRepository Errors:\n{repo_e}\n\nUninstalled Cogs:\n{uninstall_s}\n\nUninstalled Cogs Errors:\n{uninstall_e}\n\nInstalled Cogs:\n{install_s}\n\nInstalled Cogs Errors:\n{install_e}",
"backup.log",
),
)

View file

@ -1,15 +1,15 @@
{
"author" : ["SeaswimmerTheFsh (seasw.)"],
"install_msg" : "Thank you for installing Backup!\nYou can find the source code of this cog [here](https://coastalcommits.com/SeaswimmerTheFsh/SeaCogs).",
"author" : ["cswimr"],
"install_msg" : "Thank you for installing Backup!\nYou can find the source code of this cog [here](https://coastalcommits.com/cswimr/SeaCogs).",
"name" : "Backup",
"short" : "A utility to make reinstalling repositories and cogs after migrating the bot far easier.",
"description" : "A utility to make reinstalling repositories and cogs after migrating the bot far easier.",
"end_user_data_statement" : "This cog does not store end user data.",
"hidden": false,
"disabled": false,
"min_bot_version": "3.5.5",
"max_bot_version": "3.5.5",
"min_python_version": [3, 10, 0],
"min_bot_version": "3.5.6",
"max_bot_version": "3.5.13",
"min_python_version": [3, 9, 0],
"tags": [
"utility",
"backup",

View file

@ -1,244 +0,0 @@
# All of this code was stolen from the 'free_python_bible_api' repository on GitHub.
# https://github.com/MatthiasELISEE/free_python_bible_api/blob/master/free_bible_api.py
import re
from collections import OrderedDict
import xmltodict
bible = "!failed"
def set_bible(file_name):
global bible
try:
with open(file_name) as fd:
bible = xmltodict.parse(fd.read())
bible = bible["osis"]["osisText"]["div"]
except KeyError:
raise Exception("Your xml OSIS bible is not correctly formatted.")
# only works for french and english without accents
def osisID_from_reference(reference):
reference = reference.replace(" ", "").lower()
parts = re.search("(\d?[a-z]+)(\d+)[:,.](\d+)", reference)
book = parts.group(1)
osis_chapter = parts.group(2)
osis_verse = parts.group(3)
# Esther not at the right place, but is just before Ezra
# James not at the right place, but is just after Luke
if "gen" in book:
osis_book = "Gen"
elif "exo" in book:
osis_book = "Exod"
elif "lev" in book:
osis_book = "Lev"
elif "deut" in book:
osis_book = "Num"
elif "jos" in book:
osis_book = "Josh"
elif "jug" in book or "judg" in book:
osis_book = "Judg"
elif "ruth" in book:
osis_book = "Ruth"
elif "1s" in book:
osis_book = "1Sam"
elif "2s" in book:
osis_book = "2Sam"
elif "1k" in book or "1r" in book:
osis_book = "1Kgs"
elif "2k" in book or "2r" in book:
osis_book = "2Kgs"
elif "1ch" in book:
osis_book = "1Chr"
elif "2ch" in book:
osis_book = "2Chr"
elif book.startswith("est"):
osis_book = "Esth"
elif book.startswith("e"):
osis_book = "Ezra"
elif book.startswith("n"):
osis_book = "Neh"
elif "job" in book:
osis_book = "Job"
elif book.startswith("ps"):
osis_book = "Ps"
elif book.startswith("pr"):
osis_book = "Prov"
elif "ecc" in book:
osis_book = "Eccl"
elif "song" in book or "cant" in book:
osis_book = "Song"
elif "isa" in book or "esa" in book:
osis_book = "Isa"
elif "jer" in book:
osis_book = "Jer"
elif "lam" in book:
osis_book = "Lam"
elif "eze" in book:
osis_book = "Ezek"
elif "dan" in book:
osis_book = "Dan"
elif book.startswith("ho") or book.startswith("os"):
osis_book = "Hos"
elif book.startswith("jo"):
osis_book = "Joel"
elif book.startswith("am"):
osis_book = "Amos"
elif book.startswith("ob"):
osis_book = "Obad"
elif book.startswith("mi"):
osis_book = "Mic"
elif "nah" in book:
osis_book = "Nah"
elif "hab" in book:
osis_book = "Hab"
elif "ph" in book and not book.startswith("ph"):
osis_book = "Zeph"
elif book.startswith("agg") or book.startswith("hag"):
osis_book = "Hag"
elif book.startswith("z"):
osis_book = "Zech"
elif book.startswith("ma"):
osis_book = "Mal"
elif book.startswith("mt") or book.startswith("mat"):
osis_book = "Matt"
elif book.startswith("ma"):
osis_book = "Mark"
elif book.startswith("lu"):
osis_book = "Luke"
elif book.startswith("ja"):
osis_book = "Jas"
elif book.startswith("j"):
osis_book = "John"
elif book.startswith("a"):
osis_book = "Acts"
elif book.startswith("ro") or book.startswith("rm"):
osis_book = "Rom"
elif book.startswith("1c"):
osis_book = "1Cor"
elif book.startswith("2c"):
osis_book = "2Cor"
elif book.startswith("g"):
osis_book = "Gal"
elif book.startswith("e"):
osis_book = "Eph"
elif "pp" in book:
osis_book = "Phil"
elif book.startswith("c"):
osis_book = "Col"
elif book.startswith("1th"):
osis_book = "1Thess"
elif book.startswith("2th"):
osis_book = "2Thess"
elif "1t" in book:
osis_book = "1Tim"
elif "2t" in book:
osis_book = "2Tim"
elif book.startswith("t"):
osis_book = "Titus"
elif book.startswith("p"):
osis_book = "Phlm"
elif book.startswith("h"):
osis_book = "Heb"
elif book.startswith("1p"):
osis_book = "1Pet"
elif book.startswith("2p"):
osis_book = "2Pet"
elif book.startswith("1"):
osis_book = "1John"
elif book.startswith("2"):
osis_book = "2John"
elif book.startswith("3"):
osis_book = "3John"
elif book.startswith("j"):
osis_book = "Jude"
elif book.startswith("r"):
osis_book = "Rev"
return osis_book + "." + osis_chapter + "." + osis_verse
def text_from_osisID(osisID):
global bible
if bible == "!failed":
raise IOError(
"You forgot to set the bible using the set_bible function. Sorry."
)
book_trigger = False
chapter_trigger = False
verse_trigger = False
returned = ""
for book in bible:
if book["@osisID"] == osisID:
book_trigger = True
# Workaround for 1-chapter books
if type(book["chapter"]) == OrderedDict:
chapters = [book["chapter"]]
else:
chapters = book["chapter"]
for chapter in chapters:
# Workaround to solve the problem of the preceding workaround
if type(chapter) != OrderedDict:
chapter = chapter[0]
if chapter["@osisID"] == osisID:
chapter_trigger = True
# But there's no 1-verse chapter lmbo
for verse in chapter["verse"]:
if verse["@osisID"] == osisID:
verse_trigger = True
if verse_trigger or chapter_trigger or book_trigger:
returned += verse["#text"] + "\n"
verse_trigger = False
chapter_trigger = False
book_trigger = False
if returned == "":
return "!failed"
return returned
def text_from_reference(reference):
return reference + " : " + text_from_osisID(osisID_from_reference(reference))
def text_from_references(reference):
reference_list = reference.split(";")
osisID_list = [osisID_from_reference(r) for r in reference_list]
splitted_references = []
for r in reference_list:
rs = r.split("-")
if len(rs) < 2:
continue
elif len(rs) > 2:
raise IOError("There are too much '-'")
else:
end = int(float(rs[1]))
osisID_start = osisID_from_reference(rs[0])
osisID = osisID_start.split(".")
start = int(float(osisID[2]))
del osisID[2]
for i in range(start, end + 1):
splitted_references.append(
"".join([osisID[0]] + [" "] + [osisID[1]] + [":"] + [str(i)])
)
reference_list.remove(r)
reference_list = splitted_references + reference_list
return "".join(text_from_reference(str(s)) for s in reference_list)
# using it with node https://ourcodeworld.com/articles/read/286/how-to-execute-a-python-script-and-retrieve-output-data-and-errors-in-node-js

File diff suppressed because it is too large Load diff

View file

@ -5,30 +5,68 @@
# ____) | __/ (_| \__ \\ V V /| | | | | | | | | | | | __/ |
# |_____/ \___|\__,_|___/ \_/\_/ |_|_| |_| |_|_| |_| |_|\___|_|
import json
import logging
import random
from io import BytesIO
import aiohttp
from discord import Embed
from redbot.core import commands
import numpy as np
from discord import Colour, Embed, File
from PIL import Image
from red_commons.logging import getLogger
from redbot.core import Config, commands, data_manager
from redbot.core.bot import Red
from redbot.core.utils.chat_formatting import error
from redbot.core.utils.chat_formatting import bold, error, humanize_list
import bible.errors
from bible.models import Version
class Bible(commands.Cog):
"""Retrieve Bible verses from the API.bible API."""
__author__ = "SeaswimmerTheFsh"
__version__ = "1.0.0"
__author__ = ["[cswimr](https://www.coastalcommits.com/cswimr)"]
__git__ = "https://www.coastalcommits.com/cswimr/SeaCogs"
__version__ = "1.1.1"
__documentation__ = "https://seacogs.coastalcommits.com/pterodactyl/"
def __init__(self, bot: Red):
super().__init__()
self.bot = bot
self.session = aiohttp.ClientSession()
self.logger = logging.getLogger("red.sea.bible")
self.config = Config.get_conf(
self, identifier=481923957134912, force_registration=True
)
self.logger = getLogger("red.SeaCogs.Bible")
self.config.register_global(bible="de4e12af7f28f599-02")
self.config.register_user(bible=None)
def format_help_for_context(self, ctx: commands.Context) -> str:
pre_processed = super().format_help_for_context(ctx) or ""
n = "\n" if "\n\n" not in pre_processed else ""
text = [
f"{pre_processed}{n}",
f"{bold('Cog Version:')} [{self.__version__}]({self.__git__})",
f"{bold('Author:')} {humanize_list(self.__author__)}",
f"{bold('Documentation:')} {self.__documentation__}",
]
return "\n".join(text)
def get_icon(self, color: Colour) -> File:
"""Get the docs.api.bible favicon with a given color."""
image_path = data_manager.bundled_data_path(self) / "api.bible-logo.png"
image = Image.open(image_path)
image = image.convert("RGBA")
data = np.array(image)
red, green, blue, alpha = data.T # pylint: disable=unused-variable
white_areas = (red == 255) & (blue == 255) & (green == 255)
data[..., :-1][white_areas.T] = color.to_rgb()
image = Image.fromarray(data)
with BytesIO() as image_binary:
image.save(image_binary, "PNG")
image_binary.seek(0)
return File(image_binary, filename="icon.png", description="API.Bible Icon")
async def translate_book_name(self, bible_id: str, book_name: str) -> str:
"""Translate a book name to a book ID."""
@ -42,13 +80,46 @@ class Bible(commands.Cog):
return book["id"]
raise ValueError(error(f"Book {book_name} not found."))
async def get_version(self, bible_id: str) -> Version:
"""Retrieve the version of the Bible being used."""
url = f"https://api.scripture.api.bible/v1/bibles/{bible_id}"
headers = await self.bot.get_shared_api_tokens("api.bible")
async with self.session.get(url, headers=headers) as response:
data = await response.json()
self.logger.debug(
"get_version executed with a response code of: %s",
response.status,
)
if response.status == 401:
raise bible.errors.Unauthorized()
if response.status == 403:
raise bible.errors.BibleAccessError()
if response.status == 503:
raise bible.errors.ServiceUnavailable()
return Version(
bible_id,
data["data"]["abbreviation"],
data["data"]["language"]["name"],
data["data"]["abbreviationLocal"],
data["data"]["language"]["nameLocal"],
data["data"]["description"],
data["data"]["descriptionLocal"],
data["data"]["copyright"],
)
async def _get_passage(
self, bible_id: str, passage_id: str, include_verse_numbers: bool
self,
ctx: commands.Context,
bible_id: str,
passage_id: str,
include_verse_numbers: bool,
) -> dict:
"""Get a Bible passage from the API.bible API."""
url = f"https://api.scripture.api.bible/v1/bibles/{bible_id}/passages/{passage_id}"
headers = await self.bot.get_shared_api_tokens("api.bible")
params = {
"fums-version": "3",
"content-type": "text",
"include-notes": "false",
"include-titles": "false",
@ -61,10 +132,11 @@ class Bible(commands.Cog):
async with self.session.get(url, headers=headers, params=params) as response:
data = await response.json()
self.logger.debug(
"_get_passage executed with a response code of: %s\n%s",
"_get_passage executed with a response code of: %s",
response.status,
json.dumps(data),
)
if response.status == 400:
raise bible.errors.InexplicableError()
if response.status == 401:
raise bible.errors.Unauthorized()
if response.status == 403:
@ -73,7 +145,25 @@ class Bible(commands.Cog):
raise bible.errors.NotFound()
if response.status == 503:
raise bible.errors.ServiceUnavailable()
return data["data"]
fums_url = "https://fums.api.bible/f3"
fums_params = {
"t": data["meta"]["fumsToken"],
"dId": self.bot.user.id,
"sId": ctx.message.created_at.timestamp(),
"uId": hash(str(ctx.author.id)),
}
async with self.session.get(fums_url, params=fums_params) as response:
self.logger.debug(
"_get_passage FUMS executed with a response code of: %s\nDevice ID: %s\nSession ID: %s\nUser ID: %s (%s)",
response.status,
self.bot.user.id,
ctx.message.created_at.timestamp(),
hash(str(ctx.author.id)),
ctx.author.id,
)
return data["data"]
async def _get_books(self, bible_id: str) -> dict:
"""Get the books of the Bible from the API.bible API."""
@ -83,9 +173,8 @@ class Bible(commands.Cog):
async with self.session.get(url, headers=headers) as response:
data = await response.json()
self.logger.debug(
"_get_books executed with a response code of: %s\n%s",
"_get_books executed with a response code of: %s",
response.status,
json.dumps(data),
)
if response.status == 401:
raise bible.errors.Unauthorized()
@ -103,9 +192,8 @@ class Bible(commands.Cog):
async with self.session.get(url, headers=headers) as response:
data = await response.json()
self.logger.debug(
"_get_chapters executed with a response code of: %s\n%s",
"_get_chapters executed with a response code of: %s",
response.status,
json.dumps(data),
)
if response.status == 401:
raise bible.errors.Unauthorized()
@ -123,9 +211,8 @@ class Bible(commands.Cog):
async with self.session.get(url, headers=headers) as response:
data = await response.json()
self.logger.debug(
"_get_verses executed with a response code of: %s\n%s",
"_get_verses executed with a response code of: %s",
response.status,
json.dumps(data),
)
if response.status == 401:
raise bible.errors.Unauthorized()
@ -155,20 +242,22 @@ class Bible(commands.Cog):
return
try:
version = await self.get_version(bible_id)
if len(passage.split("-")) == 2:
from_verse, to_verse = passage.replace(":", ".").split("-")
if "." not in to_verse:
to_verse = f"{from_verse.split('.')[0]}.{to_verse}"
passage = await self._get_passage(
bible_id, f"{book_id}.{from_verse}-{book_id}.{to_verse}", True
ctx, bible_id, f"{book_id}.{from_verse}-{book_id}.{to_verse}", True
)
else:
passage = await self._get_passage(
bible_id, f"{book_id}.{passage.replace(':', '.')}", False
ctx, bible_id, f"{book_id}.{passage.replace(':', '.')}", False
)
except (
bible.errors.BibleAccessError,
bible.errors.NotFound,
bible.errors.InexplicableError,
bible.errors.ServiceUnavailable,
bible.errors.Unauthorized,
) as e:
@ -180,13 +269,17 @@ class Bible(commands.Cog):
return
if await ctx.embed_requested():
icon = self.get_icon(await ctx.embed_color())
embed = Embed(
title=f"{passage['reference']}",
description=passage["content"].replace("", ""),
color=await self.bot.get_embed_color(ctx.channel),
color=await ctx.embed_color(),
)
embed.set_footer(text=f"{ctx.prefix}bible passage - Powered by API.Bible")
await ctx.send(embed=embed)
embed.set_footer(
text=f"{ctx.prefix}bible passage - Powered by API.Bible - {version.abbreviationLocal} ({version.languageLocal}, {version.descriptionLocal})",
icon_url="attachment://icon.png"
)
await ctx.send(embed=embed, file=icon)
else:
await ctx.send(f"## {passage['reference']}\n{passage['content']}")
@ -196,6 +289,7 @@ class Bible(commands.Cog):
bible_id = await self.config.bible()
try:
version = await self.get_version(bible_id)
books = await self._get_books(bible_id)
book = random.choice(books)
@ -205,10 +299,11 @@ class Bible(commands.Cog):
verses = await self._get_verses(bible_id, book["id"], chapter["number"])
verse = random.choice(verses)["id"]
passage = await self._get_passage(bible_id, verse, False)
passage = await self._get_passage(ctx, bible_id, verse, False)
except (
bible.errors.BibleAccessError,
bible.errors.NotFound,
bible.errors.InexplicableError,
bible.errors.ServiceUnavailable,
bible.errors.Unauthorized,
) as e:
@ -216,12 +311,16 @@ class Bible(commands.Cog):
return
if await ctx.embed_requested():
icon = self.get_icon(await ctx.embed_color())
embed = Embed(
title=f"{passage['reference']}",
description=passage["content"].replace("", ""),
color=await self.bot.get_embed_color(ctx.channel),
color=await ctx.embed_color(),
)
embed.set_footer(text=f"{ctx.prefix}bible random - Powered by API.Bible")
await ctx.send(embed=embed)
embed.set_footer(
text=f"{ctx.prefix}bible random - Powered by API.Bible - {version.abbreviationLocal} ({version.languageLocal}, {version.descriptionLocal})",
icon_url="attachment://icon.png"
)
await ctx.send(embed=embed, file=icon)
else:
await ctx.send(f"## {passage['reference']}\n{passage['content']}")

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View file

@ -39,3 +39,14 @@ class ServiceUnavailable(Exception):
):
super().__init__(message)
self.message = message
class InexplicableError(Exception):
def __init__(
self,
message: str = error(
"An inexplicable 'Bad Request' error occurred. This error happens occassionally with the API.Bible service. Please try again. If the error persists, please report this to the bot owner."
),
):
super().__init__(message)
self.message = message

View file

@ -1,17 +1,18 @@
{
"author" : ["SeaswimmerTheFsh (seasw.)"],
"install_msg" : "Thank you for installing Bible!\nYou can find the source code of this cog [here](https://coastalcommits.com/SeaswimmerTheFsh/SeaCogs).",
"author" : ["cswimr"],
"install_msg" : "Thank you for installing Bible!\nThis cog requires setting an API key for API.Bible. Please read the [documentation](https://seacogs.coastalcommits.com/bible/#setup) for more information.\nYou can find the source code of this cog [here](https://coastalcommits.com/cswimr/SeaCogs).",
"name" : "Bible",
"short" : "Retrieve Bible verses.",
"description" : "Retrieve Bible verses from the World English Bible.",
"end_user_data_statement" : "This cog does not store end user data.",
"short" : "Retrieve Bible verses from API.Bible.",
"description" : "Retrieve Bible verses from the API.Bible API. This cog requires an API.Bible api key.",
"end_user_data_statement" : "This cog does not store end user data, however it does send the following data to the API.Bible API:\n- The bot user's ID\n- The timestamp of the invoking message\n- The hashed user id of the invoking user",
"hidden": false,
"disabled": false,
"min_bot_version": "3.5.0",
"min_python_version": [3, 10, 0],
"requirements": ["xmltodict"]
"requirements": ["numpy", "pillow"],
"tags": [
"fun",
"utility"
"utility",
"api"
]
}

26
bible/models.py Normal file
View file

@ -0,0 +1,26 @@
class Version:
def __init__(
self,
bible_id,
abbreviation,
language,
abbreviationLocal,
languageLocal,
description,
descriptionLocal,
version_copyright,
):
self.bible_id = bible_id
self.abbreviation = abbreviation
self.language = language
self.abbreviationLocal = abbreviationLocal
self.languageLocal = languageLocal
self.description = description
self.descriptionLocal = descriptionLocal
self.copyright = version_copyright
def __str__(self):
return self.abbreviationLocal
def __repr__(self):
return f'bible.models.Version("{self.bible_id}", "{self.abbreviation}", "{self.language}", "{self.abbreviationLocal}", "{self.languageLocal}", "{self.description}", "{self.descriptionLocal}", "{self.copyright}")'

5
emojiinfo/__init__.py Normal file
View file

@ -0,0 +1,5 @@
from .emojiinfo import EmojiInfo
async def setup(bot):
await bot.add_cog(EmojiInfo(bot))

5309
emojiinfo/data/emojis.json Normal file

File diff suppressed because it is too large Load diff

130
emojiinfo/emojiinfo.py Normal file
View file

@ -0,0 +1,130 @@
import io
import aiohttp
import discord
from colorthief import ColorThief
from red_commons.logging import RedTraceLogger, getLogger
from redbot.core import app_commands, commands
from redbot.core.bot import Red
from redbot.core.utils.chat_formatting import bold, humanize_list
from .model import PartialEmoji
class EmojiInfo(commands.Cog):
"""Retrieve information about emojis."""
__author__ = ["[cswimr](https://www.coastalcommits.com/cswimr)"]
__git__ = "https://www.coastalcommits.com/cswimr/SeaCogs"
__version__ = "1.0.1"
__documentation__ = "https://seacogs.coastalcommits.com/emojiinfo/"
def __init__(self, bot: Red) -> None:
super().__init__()
self.bot: Red = bot
self.logger: RedTraceLogger = getLogger(name="red.SeaCogs.Emoji")
def format_help_for_context(self, ctx: commands.Context) -> str:
pre_processed = super().format_help_for_context(ctx) or ""
n = "\n" if "\n\n" not in pre_processed else ""
text = [
f"{pre_processed}{n}",
f"{bold('Cog Version:')} [{self.__version__}]({self.__git__})",
f"{bold('Author:')} {humanize_list(self.__author__)}",
f"{bold('Documentation:')} {self.__documentation__}",
]
return "\n".join(text)
async def fetch_twemoji(self, unicode_emoji) -> str:
base_url = "https://cdn.jsdelivr.net/gh/jdecked/twemoji@latest/assets/72x72/"
emoji_codepoint = "-".join([hex(ord(char))[2:] for char in unicode_emoji])
segments = emoji_codepoint.split("-")
valid_segments = [seg for seg in segments if len(seg) >= 4]
emoji_url = f"{base_url}{valid_segments[0]}.png"
return emoji_url
async def fetch_primary_color(self, emoji_url: str) -> discord.Color | None:
async with aiohttp.ClientSession() as session:
async with session.get(emoji_url) as response:
if response.status != 200:
return None
image = await response.read()
dominant_color = ColorThief(io.BytesIO(image)).get_color(quality=1)
color = discord.Color.from_rgb(*dominant_color)
return color
async def get_emoji_info(self, emoji: PartialEmoji) -> tuple[str, str]:
if emoji.is_unicode_emoji():
try:
emoji_url = await self.fetch_twemoji(unicode_emoji=emoji.name)
except IndexError as e:
raise e
else:
emoji_url = emoji.url
if emoji.id is not None:
emoji_id = f"{bold('ID:')} `{emoji.id}`\n"
markdown = f"`<{'a' if emoji.animated else ''}:{emoji.name}:{emoji.id}>`"
name = f"{bold('Name:')} {emoji.name}\n"
aliases = ""
group = ""
else:
emoji_id = ""
markdown = f"`{emoji}`"
name = f"{bold('Name:')} {emoji.aliases.pop(0)}\n"
aliases = f"{bold('Aliases:')} {', '.join(emoji.aliases)}\n" if emoji.aliases else ""
group = f"{bold('Group:')} {emoji.group}\n"
return (
f"{name}"
f"{emoji_id}"
f"{bold('Native:')} {emoji.is_unicode_emoji()}\n"
f"{group}"
f"{aliases}"
f"{bold('Animated:')} {emoji.animated}\n"
f"{bold('Markdown:')} {markdown}\n"
f"{bold('URL:')} [Click Here]({emoji_url})"
), emoji_url
@app_commands.command(name="emoji")
@app_commands.describe(
emoji="What emoji would you like to get information on?",
ephemeral="Would you like the response to be hidden?"
)
async def emoji_slash(self, interaction: discord.Interaction, emoji: str, ephemeral: bool = True) -> None:
"""Retrieve information about an emoji."""
await interaction.response.defer(ephemeral=ephemeral)
try:
emoji: PartialEmoji = PartialEmoji.from_str(self, value=emoji)
string, emoji_url, = await self.get_emoji_info(emoji)
self.logger.verbose(f"Emoji:\n{string}")
except (IndexError, UnboundLocalError):
return await interaction.followup.send("Please provide a valid emoji!")
if await self.bot.embed_requested(channel=interaction.channel):
embed = embed = discord.Embed(title="Emoji Information", description=string, color = await self.fetch_primary_color(emoji_url) or await self.bot.get_embed_color(interaction.channel))
embed.set_thumbnail(url=emoji_url)
await interaction.followup.send(embed=embed)
else:
await interaction.followup.send(content=string)
@commands.command(name="emoji")
async def emoji(self, ctx: commands.Context, *, emoji: str) -> None:
"""Retrieve information about an emoji."""
try:
emoji: PartialEmoji = PartialEmoji.from_str(self, value=emoji)
string, emoji_url, = await self.get_emoji_info(emoji)
self.logger.verbose(f"Emoji:\n{string}")
except (IndexError, UnboundLocalError):
return await ctx.send("Please provide a valid emoji!")
if await ctx.embed_requested():
embed = embed = discord.Embed(title="Emoji Information", description=string, color = await self.fetch_primary_color(emoji_url) or await ctx.embed_color)
embed.set_thumbnail(url=emoji_url)
await ctx.send(embed=embed)
else:
await ctx.send(content=string)

16
emojiinfo/info.json Normal file
View file

@ -0,0 +1,16 @@
{
"author" : ["cswimr"],
"install_msg" : "Thank you for installing Emoji!",
"name" : "Emoji",
"short" : "Retrieve information about emojis.",
"description" : "Retrieve information about emojis.",
"end_user_data_statement" : "This cog does not store end user data.",
"hidden": false,
"disabled": false,
"min_bot_version": "3.5.0",
"min_python_version": [3, 10, 0],
"requirements": ["colorthief"],
"tags": [
"utility"
]
}

91
emojiinfo/model.py Normal file
View file

@ -0,0 +1,91 @@
import json
import discord
from redbot.core import commands, data_manager
class PartialEmoji(discord.PartialEmoji):
"""Represents a "partial" emoji. Subclasses `discord.PartialEmoji`
.. container:: operations
.. describe:: x == y
Checks if two emoji are the same.
.. describe:: x != y
Checks if two emoji are not the same.
.. describe:: hash(x)
Return the emoji's hash.
.. describe:: str(x)
Returns the emoji rendered for discord.
Attributes
-----------
name: Optional[:class:`str`]
The custom emoji name, if applicable, or the unicode codepoint
of the non-custom emoji. This can be ``None`` if the emoji
got deleted (e.g. removing a reaction with a deleted emoji).
animated: :class:`bool`
Whether the emoji is animated or not.
id: Optional[:class:`int`]
The ID of the custom emoji, if applicable.
group: Optional[:class:`str`]
The group name of the emoji if it is a native emoji.
"""
def __init__(self, *, name: str, animated: bool = False, id: int | None = None, group: str | None = None, aliases: list | None = None) -> None: # pylint: disable=redefined-builtin
super().__init__(name=name, animated=animated, id=id)
self.group = group
self.aliases = aliases
@classmethod
def from_str(cls, coginstance: commands.Cog, value: str) -> "PartialEmoji":
"""Converts a Discord string representation of an emoji to a :class:`PartialEmoji`.
The formats accepted are:
- ``a:name:id``
- ``<a:name:id>``
- ``name:id``
- ``<:name:id>``
If the format does not match then it is assumed to be a unicode emoji.
.. versionadded:: 2.0
Parameters
------------
value: :class:`str`
The string representation of an emoji.
Returns
--------
:class:`PartialEmoji`
The partial emoji from this string.
"""
match = cls._CUSTOM_EMOJI_RE.match(value)
if match is not None:
groups = match.groupdict()
animated = bool(groups['animated'])
emoji_id = int(groups['id'])
name = groups['name']
return cls(name=name, animated=animated, id=emoji_id)
path: data_manager.Path = data_manager.bundled_data_path(coginstance) / "emojis.json"
with open(path, "r", encoding="UTF-8") as file:
emojis: dict = json.load(file)
emoji_aliases = []
emoji_group = None
for dict_name, group in emojis.items():
for k, v in group.items():
if v == value:
emoji_group = dict_name
if k not in emoji_aliases:
emoji_aliases.append(k)
return cls(name=value, animated=False, id=None, group=emoji_group, aliases=emoji_aliases)

View file

@ -1,9 +1,9 @@
{
"author": [
"SeaswimmerTheFsh (seasw.)"
"cswimr"
],
"install_msg": "Thanks for installing my repo!\n\nIf you have any issues with any of the cogs, please create an issue [here](https://coastalcommits.com/SeaswimmerTheFsh/SeaCogs/issues) or join my [Discord Server](https://discord.gg/eMUMe77Yb8 ).",
"name": "SeaCogs",
"short": "Various cogs for Red, by SeaswimmerTheFsh (seasw.)",
"description": "Various cogs for Red, by SeaswimmerTheFsh (seasw.)"
"install_msg": "Thanks for installing my repo!\n\nIf you have any issues with any of the cogs, please create an issue [here](https://coastalcommits.com/cswimr/SeaCogs/issues) or join my [Discord Server](https://discord.gg/eMUMe77Yb8 ).",
"index_name": "sea-cogs",
"short": "Various cogs for Red, by cswimr",
"description": "Various cogs for Red, by cswimr"
}

View file

@ -1,12 +1,12 @@
site_name: SeaCogs Documentation
site_url: !ENV [SITE_URL, 'https://seacogs.coastalcommits.com']
repo_name: CoastalCommits
repo_url: https://coastalcommits.com/SeaswimmerTheFsh/SeaCogs
repo_url: https://coastalcommits.com/cswimr/SeaCogs
edit_uri: !ENV [EDIT_URI, 'src/branch/main/.docs']
copyright: Copyright &copy; 2023-2024, SeaswimmerTheFsh
copyright: Copyright &copy; 2023-2024, cswimr
docs_dir: .docs
site_author: SeaswimmerTheFsh
site_author: cswimr
site_description: Documentation for my Red-DiscordBot Cogs.
nav:
@ -18,7 +18,14 @@ nav:
- Configuration: aurora/configuration.md
- Bible: bible.md
- Backup: backup.md
- EmojiInfo: emojiinfo.md
- Nerdify: nerdify.md
- Pterodactyl:
- pterodactyl/index.md
- Installing Red: pterodactyl/installing-red.md
- Getting Started: pterodactyl/getting-started.md
- Configuration: pterodactyl/configuration.md
- Regex Examples: pterodactyl/regex.md
plugins:
- git-authors
@ -67,7 +74,7 @@ theme:
palette:
- media: '(prefers-color-scheme: light)'
scheme: default
primary: cyan
primary: white
accent: light blue
toggle:
icon: material/toggle-switch
@ -75,7 +82,7 @@ theme:
- media: '(prefers-color-scheme: dark)'
scheme: slate
primary: cyan
primary: black
accent: light blue
toggle:
icon: material/toggle-switch-off-outline
@ -105,3 +112,6 @@ watch:
- ./backup
- ./bible
- ./nerdify
- ./pterodactyl
- ./emojiinfo
- ./antipolls

View file

@ -1,6 +1,6 @@
{
"author" : ["SeaswimmerTheFsh (seasw.)"],
"install_msg" : "Thank you for installing Nerdify!\nYou can find the source code of this cog [here](https://coastalcommits.com/SeaswimmerTheFsh/SeaCogs). Based off of PhasecoreX's [UwU](<https://github.com/PhasecoreX/PCXCogs/tree/master/uwu>) cog.",
"author" : ["cswimr"],
"install_msg" : "Thank you for installing Nerdify!\nYou can find the source code of this cog [here](https://coastalcommits.com/cswimr/SeaCogs). Based off of PhasecoreX's [UwU](<https://github.com/PhasecoreX/PCXCogs/tree/master/uwu>) cog.",
"name" : "Nerdify",
"short" : "Nerdify your text!",
"description" : "Nerdify your text!",

View file

@ -12,19 +12,36 @@ from typing import Any, Optional, Union
import discord
from redbot.core import commands
from redbot.core.utils import chat_formatting, common_filters
from redbot.core.utils.chat_formatting import bold, humanize_list
class Nerdify(commands.Cog):
"""Nerdify your text."""
__author__ = "SeaswimmerTheFsh"
__version__ = "1.3.2"
__author__ = ["[cswimr](https://www.coastalcommits.com/cswimr)"]
__git__ = "https://www.coastalcommits.com/cswimr/SeaCogs"
__version__ = "1.3.5"
__documentation__ = "https://seacogs.coastalcommits.com/nerdify/"
def __init__(self, bot):
self.bot = bot
def format_help_for_context(self, ctx: commands.Context) -> str:
pre_processed = super().format_help_for_context(ctx) or ""
n = "\n" if "\n\n" not in pre_processed else ""
text = [
f"{pre_processed}{n}",
f"{bold('Cog Version:')} [{self.__version__}]({self.__git__})",
f"{bold('Author:')} {humanize_list(self.__author__)}",
f"{bold('Documentation:')} {self.__documentation__}",
]
return "\n".join(text)
@commands.command(aliases=["nerd"])
async def nerdify(self, ctx: commands.Context, *, text: Optional[str] = None) -> None:
async def nerdify(
self, ctx: commands.Context, *, text: Optional[str] = None
) -> None:
"""Nerdify the replied to message, previous message, or your own text."""
if not text:
if hasattr(ctx.message, "reference") and ctx.message.reference:
@ -57,7 +74,7 @@ class Nerdify(commands.Cog):
Returns:
The converted text."""
return f"\"{text}\" 🤓"
return f'"{text}" 🤓'
async def type_message(
self, destination: discord.abc.Messageable, content: str, **kwargs: Any

3097
poetry.lock generated

File diff suppressed because it is too large Load diff

5
pterodactyl/__init__.py Normal file
View file

@ -0,0 +1,5 @@
from .pterodactyl import Pterodactyl
async def setup(bot):
await bot.add_cog(Pterodactyl(bot))

30
pterodactyl/config.py Normal file
View file

@ -0,0 +1,30 @@
from redbot.core import Config
config: Config = Config.get_conf(None, identifier=457581387213637448123567, cog_name="Pterodactyl", force_registration=True)
def register_config(config_obj: Config) -> None:
config_obj.register_global(
base_url=None,
server_id=None,
console_channel=None,
console_commands_enabled=False,
current_status='',
chat_regex=r"^\[\d{2}:\d{2}:\d{2}\sINFO\]: (?!\[(?:Server|Rcon)\])(?:<|\[)(\w+)(?:>|\]) (.*)",
server_regex=r"^\[\d{2}:\d{2}:\d{2} INFO\]:(?: \[Not Secure\])? \[(?:Server|Rcon)\] (.*)",
join_regex=r"^\[\d{2}:\d{2}:\d{2} INFO\]: ([^<\n]+) joined the game$",
leave_regex=r"^\[\d{2}:\d{2}:\d{2} INFO\]: ([^<\n]+) left the game$",
achievement_regex=r"^\[\d{2}:\d{2}:\d{2} INFO\]: (.*) has (made the advancement|completed the challenge) \[(.*)\]$",
chat_command='tellraw @a ["",{"text":".$N ","color":".$C","insertion":"<@.$I>","hoverEvent":{"action":"show_text","contents":"Shift click to mention this user inside Discord"}},{"text":"(DISCORD):","color":"blue","clickEvent":{"action":"open_url","value":".$V"},"hoverEvent":{"action":"show_text","contents":"Click to join the Discord Server"}},{"text":" .$M","color":"white"}]', # noqa: E501
topic='Server IP: .$H\nServer Players: .$P/.$M',
topic_hostname=None,
topic_port=25565,
api_endpoint="minecraft",
chat_channel=None,
startup_msg='Server started!',
shutdown_msg='Server stopped!',
join_msg='Welcome to the server! 👋',
leave_msg='Goodbye! 👋',
mask_ip=True,
invite=None,
regex_blacklist={},
)

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

19
pterodactyl/info.json Normal file
View file

@ -0,0 +1,19 @@
{
"author" : ["cswimr"],
"install_msg" : "Thank you for installing Pterodactyl!\nYou can find the source code of this cog [here](https://coastalcommits.com/cswimr/SeaCogs).\nDocumentation can be found [here](https://seacogs.coastalcommits.com/pterodactyl ).",
"name" : "Pterodactyl",
"short" : "Interface with Pterodactyl through websockets.",
"description" : "Interface with Pterodactyl through websockets.",
"end_user_data_statement" : "This cog does not store end user data.",
"hidden": false,
"disabled": false,
"min_bot_version": "3.5.0",
"min_python_version": [3, 8, 0],
"requirements": ["git+https://github.com/cswimr/pydactyl", "websockets"],
"tags": [
"pterodactyl",
"minecraft",
"server",
"management"
]
}

9
pterodactyl/logger.py Normal file
View file

@ -0,0 +1,9 @@
from red_commons import logging
from red_commons.logging import getLogger
logger = getLogger('red.SeaCogs.Pterodactyl')
websocket_logger = getLogger('red.SeaCogs.Pterodactyl.websocket')
if logger.level >= logging.VERBOSE:
websocket_logger.setLevel(logging.logging.INFO)
elif logger.level < logging.VERBOSE:
websocket_logger.setLevel(logging.logging.DEBUG)

View file

@ -0,0 +1,10 @@
import aiohttp
async def get_status(host: str, port: int = 25565) -> tuple[bool, dict]:
async with aiohttp.ClientSession() as session:
async with session.get(f'https://api.mcsrvstat.us/2/{host}:{port}') as response:
response = await response.json()
if response['online']:
return (True, response)
return (False, response)

616
pterodactyl/pterodactyl.py Normal file
View file

@ -0,0 +1,616 @@
import asyncio
import json
from typing import Mapping, Optional, Tuple, Union
import discord
import websockets
from discord.ext import tasks
from pydactyl import PterodactylClient
from redbot.core import app_commands, commands
from redbot.core.app_commands import Choice
from redbot.core.bot import Red
from redbot.core.utils.chat_formatting import bold, box, error, humanize_list
from redbot.core.utils.views import ConfirmView
from pterodactyl import mcsrvstatus
from pterodactyl.config import config, register_config
from pterodactyl.logger import logger
class Pterodactyl(commands.Cog):
"""Pterodactyl allows you to manage your Pterodactyl Panel from Discord."""
__author__ = ["[cswimr](https://www.coastalcommits.com/cswimr)"]
__git__ = "https://www.coastalcommits.com/cswimr/SeaCogs"
__version__ = "2.0.4"
__documentation__ = "https://seacogs.coastalcommits.com/pterodactyl/"
def __init__(self, bot: Red):
self.bot = bot
self.client: Optional[PterodactylClient] = None
self.task: Optional[asyncio.Task] = None
self.websocket: Optional[websockets.WebSocketClientProtocol] = None
self.retry_counter: int = 0
register_config(config)
self.task = self.get_task()
self.update_topic.start()
def format_help_for_context(self, ctx: commands.Context) -> str:
pre_processed = super().format_help_for_context(ctx) or ""
n = "\n" if "\n\n" not in pre_processed else ""
text = [
f"{pre_processed}{n}",
f"{bold('Cog Version:')} [{self.__version__}]({self.__git__})",
f"{bold('Author:')} {humanize_list(self.__author__)}",
f"{bold('Documentation:')} {self.__documentation__}",
]
return "\n".join(text)
async def cog_load(self) -> None:
pterodactyl_keys = await self.bot.get_shared_api_tokens("pterodactyl")
api_key = pterodactyl_keys.get("api_key")
if api_key is None:
self.task.cancel()
raise ValueError("Pterodactyl API key not set. Please set it using `[p]set api`.")
base_url = await config.base_url()
if base_url is None:
self.task.cancel()
raise ValueError("Pterodactyl base URL not set. Please set it using `[p]pterodactyl config url`.")
server_id = await config.server_id()
if server_id is None:
self.task.cancel()
raise ValueError("Pterodactyl server ID not set. Please set it using `[p]pterodactyl config serverid`.")
self.client = PterodactylClient(base_url, api_key).client
async def cog_unload(self) -> None:
self.update_topic.cancel()
self.task.cancel()
self.retry_counter = 0
await self.client._session.close() # pylint: disable=protected-access
def get_task(self) -> asyncio.Task:
from pterodactyl.websocket import establish_websocket_connection
task = self.bot.loop.create_task(establish_websocket_connection(self), name="Pterodactyl Websocket Connection")
task.add_done_callback(self.error_callback)
return task
def error_callback(self, fut) -> None: #NOTE - Thanks flame442 and zephyrkul for helping me figure this out
try:
fut.result()
except asyncio.CancelledError:
logger.info("WebSocket task has been cancelled.")
except Exception as e: # pylint: disable=broad-exception-caught
logger.error("WebSocket task has failed: %s", e, exc_info=e)
self.task.cancel()
if self.retry_counter < 5:
self.retry_counter += 1
logger.info("Retrying in %s seconds...", 5 * self.retry_counter)
self.task = self.bot.loop.call_later(5 * self.retry_counter, self.get_task)
else:
logger.info("Retry limit reached. Stopping task.")
@tasks.loop(minutes=6)
async def update_topic(self):
await self.bot.wait_until_red_ready()
topic = await self.get_topic()
console = self.bot.get_channel(await config.console_channel())
chat = self.bot.get_channel(await config.chat_channel())
if console:
await console.edit(topic=topic)
if chat:
await chat.edit(topic=topic)
@commands.Cog.listener()
async def on_message_without_command(self, message: discord.Message) -> None:
if message.channel.id == await config.console_channel() and message.author.bot is False:
if await config.console_commands_enabled() is False:
await message.channel.send("Console commands are disabled.")
logger.debug("Received console command from %s, but console commands are disabled: %s", message.author.id, message.content)
return
logger.debug("Received console command from %s: %s", message.author.id, message.content)
await message.channel.send(f"Received console command from {message.author.id}: {message.content[:1900]}", allowed_mentions=discord.AllowedMentions.none())
try:
await self.websocket.send(json.dumps({"event": "send command", "args": [message.content]}))
except websockets.exceptions.ConnectionClosed as e:
logger.error("WebSocket connection closed: %s", e)
self.task.cancel()
self.retry_counter = 0
self.task = self.get_task()
if message.channel.id == await config.chat_channel() and message.author.bot is False:
logger.debug("Received chat message from %s: %s", message.author.id, message.content)
channel = self.bot.get_channel(await config.console_channel())
if channel:
await channel.send(f"Received chat message from {message.author.id}: {message.content[:1900]}", allowed_mentions=discord.AllowedMentions.none())
msg = json.dumps({"event": "send command", "args": [await self.get_chat_command(message)]})
logger.debug("Sending chat message to server:\n%s", msg)
try:
await self.websocket.send(msg)
except websockets.exceptions.ConnectionClosed as e:
logger.error("WebSocket connection closed: %s", e)
self.task.cancel()
self.retry_counter = 0
self.task = self.get_task()
async def get_topic(self) -> str:
topic: str = await config.topic()
placeholders = {
"H": await config.topic_hostname() or "unset",
"O": str(await config.topic_port()),
}
if await config.api_endpoint() == "minecraft":
status, response = await mcsrvstatus.get_status(await config.topic_hostname(), await config.topic_port())
if status:
placeholders.update({
"I": response['ip'],
"M": str(response['players']['max']),
"P": str(response['players']['online']),
"V": response['version'],
"D": response['motd']['clean'][0] if response['motd']['clean'] else "unset",
})
else:
placeholders.update({
"I": response['ip'],
"M": "0",
"P": "0",
"V": "Server Offline",
"D": "Server Offline",
})
for key, value in placeholders.items():
topic = topic.replace('.$' + key, value)
return topic
async def get_chat_command(self, message: discord.Message) -> str:
command: str = await config.chat_command()
placeholders = {
"C": str(message.author.color),
"D": message.author.discriminator,
"I": str(message.author.id),
"M": message.content.replace('"','').replace("\n", " "),
"N": message.author.display_name,
"U": message.author.name,
"V": await config.invite() or "use [p]pterodactyl config invite to change me",
}
for key, value in placeholders.items():
command = command.replace('.$' + key, value)
return command
async def get_player_list(self) -> Optional[Tuple[str, list]]:
if await config.api_endpoint() == "minecraft":
status, response = await mcsrvstatus.get_status(await config.topic_hostname(), await config.topic_port())
if status and 'list' in response['players']:
output_str = '\n'.join(response['players']['list'])
return output_str, response['players']['list']
return None
async def get_player_list_embed(self, ctx: Union[commands.Context, discord.Interaction]) -> Optional[discord.Embed]:
player_list = await self.get_player_list()
if player_list:
embed = discord.Embed(color=await self.bot.get_embed_color(ctx.channel), title="Players Online")
embed.description = player_list[0]
return embed
return None
async def power(self, ctx: Union[discord.Interaction, commands.Context], action: str, action_ing: str, warning: str = '') -> None:
if isinstance(ctx, discord.Interaction):
ctx = await self.bot.get_context(ctx)
current_status = await config.current_status()
if current_status == action_ing:
return await ctx.send(f"Server is already {action_ing}.", ephemeral=True)
if current_status in ["starting", "stopping"] and action != "kill":
return await ctx.send("Another power action is already in progress.", ephemeral=True)
view = ConfirmView(ctx.author, disable_buttons=True)
message = await ctx.send(f"{warning}Are you sure you want to {action} the server?", view=view)
await view.wait()
if view.result is True:
await message.edit(content=f"Sending websocket command to {action} server...", view=None)
await self.websocket.send(json.dumps({"event": "set state", "args": [action]}))
await message.edit(content=f"Server {action_ing}", view=None)
else:
await message.edit(content="Cancelled.", view=None)
async def send_command(self, ctx: Union[discord.Interaction, commands.Context], command: str):
channel = self.bot.get_channel(await config.console_channel())
if isinstance(ctx, discord.Interaction):
ctx = await self.bot.get_context(ctx)
if channel:
await channel.send(f"Received console command from {ctx.author.id}: {command[:1900]}", allowed_mentions=discord.AllowedMentions.none())
try:
await self.websocket.send(json.dumps({"event": "send command", "args": [command]}))
await ctx.send(f"Command sent to server. {box(command, 'json')}")
except websockets.exceptions.ConnectionClosed as e:
logger.error("WebSocket connection closed: %s", e)
await ctx.send(error("WebSocket connection closed."))
self.task.cancel()
self.retry_counter = 0
self.task = self.get_task()
@commands.Cog.listener()
async def on_red_api_tokens_update(self, service_name: str, api_tokens: Mapping[str,str]): # pylint: disable=unused-argument
if service_name == "pterodactyl":
logger.info("Configuration value set: api_key\nRestarting task...")
self.task.cancel()
self.retry_counter = 0
self.task = self.get_task()
slash_pterodactyl = app_commands.Group(name="pterodactyl", description="Pterodactyl allows you to manage your Pterodactyl Panel from Discord.")
@slash_pterodactyl.command(name = "command", description = "Send a command to the server console.")
async def slash_pterodactyl_command(self, interaction: discord.Interaction, command: str) -> None:
"""Send a command to the server console.
Parameters:
-----------
command: str
The command to send to the server."""
return await self.send_command(interaction, command)
@slash_pterodactyl.command(name = "players", description = "Retrieve a list of players on the server.")
async def slash_pterodactyl_players(self, interaction: discord.Interaction) -> None:
"""Retrieve a list of players on the server."""
e = await self.get_player_list_embed(interaction)
if e:
await interaction.response.send_message(embed=e, ephemeral=True)
else:
await interaction.response.send_message("No players online.", ephemeral=True)
@slash_pterodactyl.command(name = "power", description = "Send power actions to the server.")
@app_commands.choices(action=[
Choice(name="Start", value="start"),
Choice(name="Stop", value="stop"),
Choice(name="Restart", value="restart"),
Choice(name="⚠️ Kill ⚠️", value="kill")
])
async def slash_pterodactyl_power(self, interaction: discord.Interaction, action: app_commands.Choice[str]) -> None:
"""Send power actions to the server.
Parameters:
-----------
action: app_commands.Choice[str]
The action to perform on the server."""
if action.value == "kill":
return await self.power(interaction, action.value, "stopping... (forcefully killed)", warning="**⚠️ Forcefully killing the server process can corrupt data in some cases. ⚠️**\n")
if action.value == "stop":
return await self.power(interaction, action.value, "stopping...")
return await self.power(interaction, action.value, f"{action.value}ing...")
@commands.group(autohelp = True, name = "pterodactyl", aliases = ["ptero"])
async def pterodactyl(self, ctx: commands.Context) -> None:
"""Pterodactyl allows you to manage your Pterodactyl Panel from Discord."""
@pterodactyl.command(name = "players", aliases=["list", "online", "playerlist", "who"])
async def pterodactyl_players(self, ctx: commands.Context) -> None:
"""Retrieve a list of players on the server."""
e = await self.get_player_list_embed(ctx)
if e:
await ctx.send(embed=e)
else:
await ctx.send("No players online.")
@pterodactyl.command(name = "command", aliases = ["cmd", "execute", "exec"])
@commands.admin()
async def pterodactyl_command(self, ctx: commands.Context, *, command: str) -> None:
"""Send a command to the server console."""
return await self.send_command(ctx, command)
@pterodactyl.group(autohelp = True, name = "power")
@commands.admin()
async def pterodactyl_power(self, ctx: commands.Context) -> None:
"""Send power actions to the server."""
@pterodactyl_power.command(name = "start")
async def pterodactyl_power_start(self, ctx: commands.Context) -> Optional[discord.Message]:
"""Start the server."""
return await self.power(ctx, "start", "starting...")
@pterodactyl_power.command(name = "stop")
async def pterodactyl_power_stop(self, ctx: commands.Context) -> Optional[discord.Message]:
"""Stop the server."""
return await self.power(ctx, "stop", "stopping...")
@pterodactyl_power.command(name = "restart")
async def pterodactyl_power_restart(self, ctx: commands.Context) -> Optional[discord.Message]:
"""Restart the server."""
return await self.power(ctx, "restart", "restarting...")
@pterodactyl_power.command(name = "kill")
async def pterodactyl_power_kill(self, ctx: commands.Context) -> Optional[discord.Message]:
"""Kill the server."""
return await self.power(ctx, "kill", "stopping... (forcefully killed)", warning="**⚠️ Forcefully killing the server process can corrupt data in some cases. ⚠️**\n")
@pterodactyl.group(autohelp = True, name = "config", aliases = ["settings", "set"])
@commands.is_owner()
async def pterodactyl_config(self, ctx: commands.Context) -> None:
"""Configure Pterodactyl settings."""
@pterodactyl_config.command(name = "url")
async def pterodactyl_config_base_url(self, ctx: commands.Context, *, base_url: str) -> None:
"""Set the base URL of your Pterodactyl Panel.
Please include the protocol (http/https).
Example: `https://panel.example.com`"""
await config.base_url.set(base_url)
await ctx.send(f"Base URL set to {base_url}")
logger.info("Configuration value set: base_url = %s\nRestarting task...", base_url)
self.task.cancel()
self.retry_counter = 0
self.task = self.get_task()
@pterodactyl_config.command(name = "serverid")
async def pterodactyl_config_server_id(self, ctx: commands.Context, *, server_id: str) -> None:
"""Set the ID of your server."""
await config.server_id.set(server_id)
await ctx.send(f"Server ID set to {server_id}")
logger.info("Configuration value set: server_id = %s\nRestarting task...", server_id)
self.task.cancel()
self.retry_counter = 0
self.task = self.get_task()
@pterodactyl_config.group(name = "console")
async def pterodactyl_config_console(self, ctx: commands.Context):
"""Configure console settings."""
@pterodactyl_config_console.command(name = "channel")
async def pterodactyl_config_console_channel(self, ctx: commands.Context, channel: discord.TextChannel) -> None:
"""Set the channel to send console output to."""
await config.console_channel.set(channel.id)
await ctx.send(f"Console channel set to {channel.mention}")
@pterodactyl_config_console.command(name = "commands")
async def pterodactyl_config_console_commands(self, ctx: commands.Context, enabled: bool) -> None:
"""Enable or disable console commands."""
await config.console_commands_enabled.set(enabled)
await ctx.send(f"Console commands set to {enabled}")
@pterodactyl_config.command(name = "invite")
async def pterodactyl_config_invite(self, ctx: commands.Context, invite: str) -> None:
"""Set the invite link for your server."""
await config.invite.set(invite)
await ctx.send(f"Invite link set to {invite}")
@pterodactyl_config.group(name = "topic")
async def pterodactyl_config_topic(self, ctx: commands.Context):
"""Set the topic for the console and chat channels."""
@pterodactyl_config_topic.command(name = "host", aliases = ["hostname", "ip"])
async def pterodactyl_config_topic_host(self, ctx: commands.Context, host: str) -> None:
"""Set the hostname or IP address of your server."""
await config.topic_hostname.set(host)
await ctx.send(f"Hostname/IP set to `{host}`")
@pterodactyl_config_topic.command(name = "port")
async def pterodactyl_config_topic_port(self, ctx: commands.Context, port: int) -> None:
"""Set the port of your server."""
await config.topic_port.set(port)
await ctx.send(f"Port set to `{port}`")
@pterodactyl_config_topic.command(name = "text")
async def pterodactyl_config_topic_text(self, ctx: commands.Context, *, text: str) -> None:
"""Set the text for the console and chat channels.
Available placeholders:
- `.$H` (hostname)
- `.$O` (port)
Available for Minecraft servers:
- `.$I` (ip)
- `.$M` (max players)
- `.$P` (players online)
- `.$V` (version)
- `.$D` (description / Message of the Day)"""
await config.topic.set(text)
await ctx.send(f"Topic set to:\n{box(text, 'yaml')}")
@pterodactyl_config.group(name = "chat")
async def pterodactyl_config_chat(self, ctx: commands.Context):
"""Configure chat settings."""
@pterodactyl_config_chat.command(name = "channel")
async def pterodactyl_config_chat_channel(self, ctx: commands.Context, channel: discord.TextChannel) -> None:
"""Set the channel to send chat output to."""
await config.chat_channel.set(channel.id)
await ctx.send(f"Chat channel set to {channel.mention}")
@pterodactyl_config_chat.command(name = "command")
async def pterodactyl_config_chat_command(self, ctx: commands.Context, *, command: str) -> None:
"""Set the command that will be used to send messages from Discord.
Required placeholders: `.$U` (username), `.$M` (message), `.$C` (color)
See [documentation](https://seacogs.coastalcommits.com/pterodactyl/setup/#changing-the-tellraw-command) for more information."""
await config.chat_command.set(command)
await ctx.send(f"Chat command set to:\n{box(command, 'json')}")
@pterodactyl_config.group(name = "regex")
async def pterodactyl_config_regex(self, ctx: commands.Context) -> None:
"""Set regex patterns."""
@pterodactyl_config_regex.command(name = "chat")
async def pterodactyl_config_regex_chat(self, ctx: commands.Context, *, regex: str) -> None:
"""Set the regex pattern to match chat messages on the server.
See [documentation](https://seacogs.coastalcommits.com/pterodactyl/setup/#my-chat-messages-arent-detected) for more information."""
await config.chat_regex.set(regex)
await ctx.send(f"Chat regex set to:\n{box(regex, 'regex')}")
@pterodactyl_config_regex.command(name = "server")
async def pterodactyl_config_regex_server(self, ctx: commands.Context, *, regex: str) -> None:
"""Set the regex pattern to match server messages on the server.
See [documentation](https://seacogs.coastalcommits.com/pterodactyl/setup/#my-chat-messages-arent-detected) for more information."""
await config.server_regex.set(regex)
await ctx.send(f"Server regex set to:\n{box(regex, 'regex')}")
@pterodactyl_config_regex.command(name = "join")
async def pterodactyl_config_regex_join(self, ctx: commands.Context, *, regex: str) -> None:
"""Set the regex pattern to match join messages on the server.
See [documentation](https://seacogs.coastalcommits.com/pterodactyl/setup/#my-chat-messages-arent-detected) for more information."""
await config.join_regex.set(regex)
await ctx.send(f"Join regex set to:\n{box(regex, 'regex')}")
@pterodactyl_config_regex.command(name = "leave")
async def pterodactyl_config_regex_leave(self, ctx: commands.Context, *, regex: str) -> None:
"""Set the regex pattern to match leave messages on the server.
See [documentation](https://seacogs.coastalcommits.com/pterodactyl/setup/#my-chat-messages-arent-detected) for more information."""
await config.leave_regex.set(regex)
await ctx.send(f"Leave regex set to:\n{box(regex, 'regex')}")
@pterodactyl_config_regex.command(name = "achievement")
async def pterodactyl_config_regex_achievement(self, ctx: commands.Context, *, regex: str) -> None:
"""Set the regex pattern to match achievement messages on the server.
See [documentation](https://seacogs.coastalcommits.com/pterodactyl/setup/#my-chat-messages-arent-detected) for more information."""
await config.achievement_regex.set(regex)
await ctx.send(f"Achievement regex set to:\n{box(regex, 'regex')}")
@pterodactyl_config.group(name = "messages", aliases = ['msg', 'msgs', 'message'])
async def pterodactyl_config_messages(self, ctx: commands.Context):
"""Configure message settings."""
@pterodactyl_config_messages.command(name = "startup")
async def pterodactyl_config_messages_startup(self, ctx: commands.Context, *, message: str) -> None:
"""Set the message that will be sent when the server starts."""
await config.startup_msg.set(message)
await ctx.send(f"Startup message set to: {message}")
@pterodactyl_config_messages.command(name = "shutdown")
async def pterodactyl_config_messages_shutdown(self, ctx: commands.Context, *, message: str) -> None:
"""Set the message that will be sent when the server stops."""
await config.shutdown_msg.set(message)
await ctx.send(f"Shutdown message set to: {message}")
@pterodactyl_config_messages.command(name = "join")
async def pterodactyl_config_messages_join(self, ctx: commands.Context, *, message: str) -> None:
"""Set the message that will be sent when a user joins the server. This is only shown in embeds."""
await config.join_msg.set(message)
await ctx.send(f"Join message set to: {message}")
@pterodactyl_config_messages.command(name = "leave")
async def pterodactyl_config_messages_leave(self, ctx: commands.Context, *, message: str) -> None:
"""Set the message that will be sent when a user leaves the server. This is only shown in embeds."""
await config.leave_msg.set(message)
await ctx.send(f"Leave message set to: {message}")
@pterodactyl_config.command(name = "ip")
async def pterodactyl_config_mask_ip(self, ctx: commands.Context, mask: bool) -> None:
"""Mask the IP addresses of users in console messages."""
await config.mask_ip.set(mask)
await ctx.send(f"IP masking set to {mask}")
@pterodactyl_config.command(name = "api")
async def pterodactyl_config_api(self, ctx: commands.Context, endpoint: str) -> None:
"""Set the API endpoint for retrieving user avatars.
This is only used for retrieving user avatars for webhook messages.
See [PlayerDB](https://playerdb.co/) for valid endpoints. Usually, you should leave this as default."""
await config.api_endpoint.set(endpoint)
await ctx.send(f"API endpoint set to {endpoint}")
@pterodactyl_config_regex.group(name = "blacklist", aliases = ['block', 'blocklist'],)
async def pterodactyl_config_regex_blacklist(self, ctx: commands.Context):
"""Blacklist regex patterns."""
@pterodactyl_config_regex_blacklist.command(name = "add")
async def pterodactyl_config_regex_blacklist_add(self, ctx: commands.Context, name: str, *, regex: str) -> None:
"""Add a regex pattern to the blacklist."""
async with config.regex_blacklist() as blacklist:
blacklist: dict
if name not in blacklist:
blacklist.update({name: regex})
await ctx.send(f"Added `{name}` to the regex blacklist.\n{box(regex, 're')}")
else:
view = ConfirmView(ctx.author, disable_buttons=True)
msg = await ctx.send(f"Name `{name}` already exists in the blacklist. Would you like to update it? Current value:\n{box(blacklist[name], 're')}", view=view)
await view.wait()
if view.result is True:
blacklist.update({name: regex})
await msg.edit(content=f"Updated `{name}` in the regex blacklist.\n{box(regex, 're')}")
else:
await msg.edit(content="Cancelled.")
@pterodactyl_config_regex_blacklist.command(name = "remove")
async def pterodactyl_config_regex_blacklist_remove(self, ctx: commands.Context, name: str) -> None:
"""Remove a regex pattern from the blacklist."""
async with config.regex_blacklist() as blacklist:
blacklist: dict
if name in blacklist:
view = ConfirmView(ctx.author, disable_buttons=True)
msg = await ctx.send(f"Are you sure you want to remove `{name}` from the regex blacklist?\n{box(blacklist[name], 're')}", view=view)
await view.wait()
if view.result is True:
del blacklist[name]
await msg.edit(content=f"Removed `{name}` from the regex blacklist.")
else:
await msg.edit(content="Cancelled.")
else:
await ctx.send(f"Name `{name}` does not exist in the blacklist.")
@pterodactyl_config.command(name = 'view', aliases = ['show'])
async def pterodactyl_config_view(self, ctx: commands.Context) -> None:
"""View the current configuration."""
base_url = await config.base_url()
server_id = await config.server_id()
console_channel = await config.console_channel()
console_commands_enabled = await config.console_commands_enabled()
chat_channel = await config.chat_channel()
chat_command = await config.chat_command()
chat_regex = await config.chat_regex()
server_regex = await config.server_regex()
join_regex = await config.join_regex()
leave_regex = await config.leave_regex()
achievement_regex = await config.achievement_regex()
startup_msg = await config.startup_msg()
shutdown_msg = await config.shutdown_msg()
join_msg = await config.join_msg()
leave_msg = await config.leave_msg()
mask_ip = await config.mask_ip()
api_endpoint = await config.api_endpoint()
invite = await config.invite()
regex_blacklist: dict = await config.regex_blacklist()
topic_text = await config.topic()
topic_hostname = await config.topic_hostname()
topic_port = await config.topic_port()
embed = discord.Embed(color = await ctx.embed_color(), title="Pterodactyl Configuration")
embed.description = f"""**Base URL:** {base_url}
**Server ID:** `{server_id}`
**Console Channel:** <#{console_channel}>
**Console Commands:** {self.get_bool_str(console_commands_enabled)}
**Chat Channel:** <#{chat_channel}>
**Startup Message:** {startup_msg}
**Shutdown Message:** {shutdown_msg}
**Join Message:** {join_msg}
**Leave Message:** {leave_msg}
**Mask IP:** {self.get_bool_str(mask_ip)}
**API Endpoint:** `{api_endpoint}`
**Invite:** {invite}
**Topic Hostname:** `{topic_hostname}`
**Topic Port:** `{topic_port}`
**Topic Text:** {box(topic_text, 'yaml')}
**Chat Command:** {box(chat_command, 'json')}
**Chat Regex:** {box(chat_regex, 're')}
**Server Regex:** {box(server_regex, 're')}
**Join Regex:** {box(join_regex, 're')}
**Leave Regex:** {box(leave_regex, 're')}
**Achievement Regex:** {box(achievement_regex, 're')}"""
await ctx.send(embed=embed)
if not len(regex_blacklist) == 0:
regex_blacklist_embed = discord.Embed(color = await ctx.embed_color(), title="Regex Blacklist")
for name, regex in regex_blacklist.items():
regex_blacklist_embed.add_field(name=name, value=box(regex, 're'), inline=False)
await ctx.send(embed=regex_blacklist_embed)
def get_bool_str(self, inp: bool) -> str:
"""Return a string representation of a boolean."""
return "Enabled" if inp else "Disabled"

267
pterodactyl/websocket.py Normal file
View file

@ -0,0 +1,267 @@
# pylint: disable=cyclic-import
import json
import re
from pathlib import Path
from typing import Optional, Tuple, Union
import aiohttp
import discord
import websockets
from pydactyl import PterodactylClient
from redbot.core.data_manager import bundled_data_path
from redbot.core.utils.chat_formatting import bold, pagify
from pterodactyl.config import config
from pterodactyl.logger import logger, websocket_logger
from pterodactyl.pterodactyl import Pterodactyl
async def establish_websocket_connection(coginstance: Pterodactyl) -> None:
await coginstance.bot.wait_until_red_ready()
base_url = await config.base_url()
base_url = base_url[:-1] if base_url.endswith('/') else base_url
logger.info("Establishing WebSocket connection")
websocket_credentials = await retrieve_websocket_credentials(coginstance)
async with websockets.connect(websocket_credentials['data']['socket'], origin=base_url, ping_timeout=60, logger=websocket_logger) as websocket:
logger.info("WebSocket connection established")
auth_message = json.dumps({"event": "auth", "args": [websocket_credentials['data']['token']]})
await websocket.send(auth_message)
logger.info("Authentication message sent")
coginstance.websocket = websocket
while True: # pylint: disable=too-many-nested-blocks
message = json.loads(await websocket.recv())
if message['event'] in ('token expiring', 'token expired'):
logger.info("Received token expiring/expired event. Refreshing token.")
websocket_credentials = await retrieve_websocket_credentials(coginstance)
auth_message = json.dumps({"event": "auth", "args": [websocket_credentials['data']['token']]})
await websocket.send(auth_message)
logger.info("Authentication message sent")
if message['event'] == 'auth success':
logger.info("WebSocket authentication successful")
if message['event'] == 'console output' and await config.console_channel() is not None:
regex_blacklist: dict = await config.regex_blacklist()
matches = [re.search(regex, message['args'][0]) for regex in regex_blacklist.values()]
if await config.current_status() in ('running', '') and not any(matches):
content = remove_ansi_escape_codes(message['args'][0])
if await config.mask_ip() is True:
content = mask_ip(content)
console_channel = coginstance.bot.get_channel(await config.console_channel())
chat_channel = coginstance.bot.get_channel(await config.chat_channel())
if console_channel is not None:
if content.startswith('['):
pagified_content = pagify(content, delims=[" ", "\n"])
for page in pagified_content:
await console_channel.send(content=page, allowed_mentions=discord.AllowedMentions.none())
server_message = await check_if_server_message(content)
if server_message:
if chat_channel is not None:
await chat_channel.send(server_message if len(server_message) < 2000 else server_message[:1997] + '...', allowed_mentions=discord.AllowedMentions.none())
chat_message = await check_if_chat_message(content)
if chat_message:
info = await get_info(chat_message['username'])
if info is not None:
await send_chat_discord(coginstance, chat_message['username'], chat_message['message'], info['data']['player']['avatar'])
else:
await send_chat_discord(coginstance, chat_message['username'], chat_message['message'], 'https://seafsh.cc/u/j3AzqQ.png')
join_message = await check_if_join_message(content)
if join_message:
if chat_channel is not None:
if coginstance.bot.embed_requested(chat_channel):
embed, img = await generate_join_leave_embed(coginstance=coginstance, username=join_message,join=True)
if img:
with open(img, 'rb') as file:
await chat_channel.send(embed=embed, file=file)
else:
await chat_channel.send(embed=embed)
else:
await chat_channel.send(f"{join_message} joined the game", allowed_mentions=discord.AllowedMentions.none())
leave_message = await check_if_leave_message(content)
if leave_message:
if chat_channel is not None:
if coginstance.bot.embed_requested(chat_channel):
embed, img = await generate_join_leave_embed(coginstance=coginstance, username=leave_message,join=False)
if img:
with open(img, 'rb') as file:
await chat_channel.send(embed=embed, file=file)
else:
await chat_channel.send(embed=embed)
else:
await chat_channel.send(f"{leave_message} left the game", allowed_mentions=discord.AllowedMentions.none())
achievement_message = await check_if_achievement_message(content)
if achievement_message:
if chat_channel is not None:
if coginstance.bot.embed_requested(chat_channel):
await chat_channel.send(embed=await generate_achievement_embed(coginstance, achievement_message['username'], achievement_message['achievement'], achievement_message['challenge']))
else:
await chat_channel.send(f"{achievement_message['username']} has {'completed the challenge' if achievement_message['challenge'] else 'made the advancement'} {achievement_message['achievement']}")
if message['event'] == 'status':
old_status = await config.current_status()
current_status = message['args'][0]
if old_status != current_status:
await config.current_status.set(current_status)
if await config.console_channel() is not None:
console = coginstance.bot.get_channel(await config.console_channel())
if console is not None:
await console.send(f"Server status changed! `{current_status}`")
if await config.chat_channel() is not None:
if current_status == 'running' and await config.startup_msg() is not None:
chat = coginstance.bot.get_channel(await config.chat_channel())
if chat is not None:
await chat.send(await config.startup_msg())
if current_status == 'stopping' and await config.shutdown_msg() is not None:
chat = coginstance.bot.get_channel(await config.chat_channel())
if chat is not None:
await chat.send(await config.shutdown_msg())
async def retrieve_websocket_credentials(coginstance: Pterodactyl) -> Optional[dict]:
pterodactyl_keys = await coginstance.bot.get_shared_api_tokens("pterodactyl")
api_key = pterodactyl_keys.get("api_key")
if api_key is None:
coginstance.task.cancel()
raise ValueError("Pterodactyl API key not set. Please set it using `[p]set api`.")
base_url = await config.base_url()
if base_url is None:
coginstance.task.cancel()
raise ValueError("Pterodactyl base URL not set. Please set it using `[p]pterodactyl config url`.")
server_id = await config.server_id()
if server_id is None:
coginstance.task.cancel()
raise ValueError("Pterodactyl server ID not set. Please set it using `[p]pterodactyl config serverid`.")
client = PterodactylClient(base_url, api_key).client
coginstance.client = client
websocket_credentials = client.servers.get_websocket(server_id)
logger.debug("""Websocket connection details retrieved:
Socket: %s
Token: %s...""",
websocket_credentials['data']['socket'],
websocket_credentials['data']['token'][:20]
)
return websocket_credentials
#NOTE - The token is truncated to prevent it from being logged in its entirety, for security reasons
def remove_ansi_escape_codes(text: str) -> str:
ansi_escape = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])')
#NOTE - https://chat.openai.com/share/d92f9acf-d776-4fd6-a53f-b14ac15dd540
return ansi_escape.sub('', text)
async def check_if_server_message(text: str) -> Union[bool, str]:
regex = await config.server_regex()
match: Optional[re.Match[str]] = re.match(regex, text)
if match:
logger.trace("Message is a server message")
return match.group(1)
return False
async def check_if_chat_message(text: str) -> Union[bool, dict]:
regex = await config.chat_regex()
match: Optional[re.Match[str]] = re.match(regex, text)
if match:
groups = {"username": match.group(1), "message": match.group(2)}
logger.trace("Message is a chat message\n%s", json.dumps(groups))
return groups
return False
async def check_if_join_message(text: str) -> Union[bool, str]:
regex = await config.join_regex()
match: Optional[re.Match[str]] = re.match(regex, text)
if match:
logger.trace("Message is a join message")
return match.group(1)
return False
async def check_if_leave_message(text: str) -> Union[bool, str]:
regex = await config.leave_regex()
match: Optional[re.Match[str]] = re.match(regex, text)
if match:
logger.trace("Message is a leave message")
return match.group(1)
return False
async def check_if_achievement_message(text: str) -> Union[bool, dict]:
regex = await config.achievement_regex()
match: Optional[re.Match[str]] = re.match(regex, text)
if match:
groups = {"username": match.group(1), "achievement": match.group(3)}
if match.group(2) == "completed the challenge":
groups["challenge"] = True
else:
groups["challenge"] = False
logger.trace("Message is an achievement message")
return groups
return False
async def get_info(username: str) -> Optional[dict]:
logger.verbose("Retrieving player info for %s", username)
endpoint = await config.api_endpoint()
async with aiohttp.ClientSession() as session:
async with session.get(f"https://playerdb.co/api/player/{endpoint}/{username}") as response:
if response.status == 200:
logger.verbose("Player info retrieved for %s", username)
return await response.json()
logger.warning("Failed to retrieve player info for %s: %s", username, response.status)
return None
async def send_chat_discord(coginstance: Pterodactyl, username: str, message: str, avatar_url: str) -> None:
logger.trace("Sending chat message to Discord")
channel = coginstance.bot.get_channel(await config.chat_channel())
if channel is not None:
webhooks = await channel.webhooks()
webhook = discord.utils.get(webhooks, name="Pterodactyl Chat")
if webhook is None:
webhook = await channel.create_webhook(name="Pterodactyl Chat")
await webhook.send(content=message, username=username, avatar_url=avatar_url, allowed_mentions=discord.AllowedMentions(everyone=False, roles=False, users=True))
logger.trace("Chat message sent to Discord")
else:
logger.warning("Chat channel not set. Skipping sending chat message to Discord")
async def generate_join_leave_embed(coginstance: Pterodactyl, username: str, join: bool) -> Tuple[discord.Embed, Optional[Union[str, Path]]]:
embed = discord.Embed()
embed.color = discord.Color.green() if join else discord.Color.red()
embed.description = await config.join_msg() if join else await config.leave_msg()
info = await get_info(username)
if info:
img = None
embed.set_author(name=username, icon_url=info['data']['player']['avatar'])
else:
img = bundled_data_path(coginstance) / "unknown.png"
embed.set_author(name=username, icon_url='attachment://unknown.png')
embed.timestamp = discord.utils.utcnow()
return embed, img
async def generate_achievement_embed(coginstance: Pterodactyl, username: str, achievement: str, challenge: bool) -> Tuple[discord.Embed, Optional[Union[str, Path]]]:
embed = discord.Embed()
embed.color = discord.Color.from_str('#a800a7') if challenge else discord.Color.from_str('#54fb54')
embed.description = f"{bold(username)} has {'completed the challenge' if challenge else 'made the advancement'} {bold(achievement)}"
info = await get_info(username)
if info:
img = None
embed.set_author(name=username, icon_url=info['data']['player']['avatar'])
else:
img = bundled_data_path(coginstance) / "unknown.png"
embed.set_author(name=username, icon_url='attachment://unknown.png')
embed.timestamp = discord.utils.utcnow()
return embed, img
def mask_ip(string: str) -> str:
def check(match: re.Match[str]):
ip = match.group(0)
masked_ip = '.'.join(r'\*' * len(octet) for octet in ip.split('.'))
return masked_ip
return re.sub(r'\b(?:\d{1,3}\.){3}\d{1,3}\b', check, string)

View file

@ -2,22 +2,29 @@
name = "seacogs"
version = "0.1.0"
description = "My assorted cogs for Red-DiscordBot."
authors = ["SeaswimmerTheFsh"]
authors = ["cswimr"]
license = "MPL 2"
readme = "README.md"
package-mode = false
[tool.poetry.dependencies]
python = ">=3.9,<3.12"
python = ">=3.11,<3.12"
Red-DiscordBot = "^3.5.5"
pytimeparse2 = "^1.7.1"
humanize = "^4.8.0"
xmltodict = "^0.13.0"
py-dactyl = "^2.0.4"
websockets = "^12.0"
pillow = "^10.3.0"
numpy = "^1.26.4"
colorthief = "^0.2.1"
beautifulsoup4 = "^4.12.3"
markdownify = "^0.12.1"
[tool.poetry.group.dev]
optional = true
[tool.poetry.group.dev.dependencies]
pylint = "^2.17.5"
ruff = "^0.3.1"
pylint = "^3.1.0"
sqlite-web = "^0.6.4"
[tool.poetry.group.docs]
optional = true
@ -33,3 +40,82 @@ mkdocs-redirects = "^1.2.1"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.ruff]
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
]
# Same as Black.
line-length = 320
indent-width = 4
# Assume Python 3.11
target-version = "py311"
[tool.ruff.lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
# McCabe complexity (`C901`) by default.
select = ["F", "W", "E", "C901"]
ignore = ["C901"]
# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
[tool.ruff.format]
# Like Black, use double quotes for strings.
quote-style = "double"
# Like Black, indent with spaces, rather than tabs.
indent-style = "space"
# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false
# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"
# Enable auto-formatting of code examples in docstrings. Markdown,
# reStructuredText code/literal blocks and doctests are all supported.
#
# This is currently disabled by default, but it is planned for this
# to be opt-out in the future.
docstring-code-format = false
# Set the line length limit used when formatting code snippets in
# docstrings.
#
# This only has an effect when the `docstring-code-format` setting is
# enabled.
docstring-code-line-length = "dynamic"

5
seautils/__init__.py Normal file
View file

@ -0,0 +1,5 @@
from .seautils import SeaUtils
async def setup(bot):
await bot.add_cog(SeaUtils(bot))

13
seautils/info.json Normal file
View file

@ -0,0 +1,13 @@
{
"author" : ["cswimr"],
"install_msg" : "Thank you for installing SeaUtils!\nYou can find the source code of this cog [here](https://coastalcommits.com/cswimr/SeaCogs).",
"name" : "SeaUtils",
"short" : "A collection of useful utilities.",
"description" : "A collection of useful utilities.",
"end_user_data_statement" : "This cog does not store end user data.",
"hidden": true,
"disabled": false,
"min_bot_version": "3.5.0",
"min_python_version": [3, 8, 0],
"requirements": ["beautifulsoup4", "markdownify"]
}

254
seautils/seautils.py Normal file
View file

@ -0,0 +1,254 @@
# _____ _
# / ____| (_)
# | (___ ___ __ _ _____ ___ _ __ ___ _ __ ___ ___ _ __
# \___ \ / _ \/ _` / __\ \ /\ / / | '_ ` _ \| '_ ` _ \ / _ \ '__|
# ____) | __/ (_| \__ \\ V V /| | | | | | | | | | | | __/ |
# |_____/ \___|\__,_|___/ \_/\_/ |_|_| |_| |_|_| |_| |_|\___|_|
import asyncio
import inspect
import operator
import re
from asyncio.subprocess import Process
from functools import partial, partialmethod
from typing import Any
import aiohttp
import yaml
from bs4 import BeautifulSoup
from discord import Color, Embed, app_commands
from discord.utils import CachedSlotProperty, cached_property
from markdownify import MarkdownConverter
from redbot.core import commands
from redbot.core.bot import Red
from redbot.core.dev_commands import cleanup_code
from redbot.core.utils import chat_formatting as cf
from redbot.core.utils.views import SimpleMenu
def md(soup: BeautifulSoup, **options) -> Any | str:
return MarkdownConverter(**options).convert_soup(soup=soup)
def format_rfc_text(text: str, number: int) -> str:
one: str = re.sub(r"\(\.\/rfc(\d+)", r"(https://www.rfc-editor.org/rfc/rfc\1.html", text)
two: str = re.sub(r"\((#(?:section|page)-\d+(?:.\d+)?)\)", f"(https://www.rfc-editor.org/rfc/rfc{number}.html\1)", one)
three: str = re.sub(r"\n{3,}", "\n\n", two)
return three
class SeaUtils(commands.Cog):
"""A collection of random utilities."""
__author__ = ["[cswimr](https://www.coastalcommits.com/cswimr)"]
__git__ = "https://www.coastalcommits.com/cswimr/SeaCogs"
__version__ = "1.0.1"
__documentation__ = "https://seacogs.coastalcommits.com/seautils/"
def __init__(self, bot: Red) -> None:
self.bot = bot
def format_help_for_context(self, ctx: commands.Context) -> str:
pre_processed = super().format_help_for_context(ctx) or ""
n = "\n" if "\n\n" not in pre_processed else ""
text = [
f"{pre_processed}{n}",
f"{cf.bold('Cog Version:')} [{self.__version__}]({self.__git__})",
f"{cf.bold('Author:')} {cf.humanize_list(self.__author__)}",
f"{cf.bold('Documentation:')} {self.__documentation__}",
]
return "\n".join(text)
def format_src(self, obj: Any) -> str:
"""A large portion of this code is repurposed from Zephyrkul's RTFS cog.
https://github.com/Zephyrkul/FluffyCogs/blob/master/rtfs/rtfs.py"""
obj = inspect.unwrap(func=obj)
src: Any = getattr(obj, "__func__", obj)
if isinstance(obj, (commands.Command, app_commands.Command)):
src = obj.callback
elif isinstance(obj, (partial, partialmethod)):
src = obj.func
elif isinstance(obj, property):
src = obj.fget
elif isinstance(obj, (cached_property, CachedSlotProperty)):
src = obj.function
return inspect.getsource(object=src)
@commands.command(aliases=["source", "src", "code", "showsource"])
@commands.is_owner()
async def showcode(self, ctx: commands.Context, *, object: str) -> None: # pylint: disable=redefined-builtin
"""Show the code for a particular object."""
try:
if object.startswith("/") and (obj := ctx.bot.tree.get_command(object[1:])):
text = self.format_src(obj)
elif obj := ctx.bot.get_cog(object):
text = self.format_src(type(obj))
elif obj := ctx.bot.get_command(object):
text = self.format_src(obj)
else:
raise AttributeError
temp_content = cf.pagify(
text=cleanup_code(text),
escape_mass_mentions=True,
page_length = 1977
)
content = []
max_i = operator.length_hint(temp_content)
i = 1
for page in temp_content:
content.append(f"**Page {i}/{max_i}**\n{cf.box(page, lang='py')}")
i += 1
await SimpleMenu(pages=content, disable_after_timeout=True, timeout=180).start(ctx)
except (OSError, AttributeError, UnboundLocalError):
if ctx.embed_requested():
embed = Embed(title="Object not found!", color=await ctx.embed_color())
await ctx.send(embed=embed, reference=ctx.message.to_reference(fail_if_not_exists=False))
else:
await ctx.send(content="Object not found!", reference=ctx.message.to_reference(fail_if_not_exists=False))
@commands.command(name='dig', aliases=['dnslookup', 'nslookup'])
@commands.is_owner()
async def dig(self, ctx: commands.Context, name: str, record_type: str | None = None, server: str | None = None, port: int = 53) -> None:
"""Retrieve DNS information for a domain.
Uses `dig` to perform a DNS query. Will fall back to `nslookup` if `dig` is not installed on the system.
`nslookup` does not provide as much information as `dig`, so only the `name` parameter will be used if `nslookup` is used.
Will return the A, AAAA, and CNAME records for a domain by default. You can specify a different record type with the `type` parameter."""
command_opts: list[str | int] = ['dig']
query_types: list[str] = [record_type] if record_type else ['A', 'AAAA', 'CNAME']
if server:
command_opts.extend(['@', server])
for query_type in query_types:
command_opts.extend([name, query_type])
command_opts.extend(['-p', str(port), '+yaml'])
try:
process: Process = await asyncio.create_subprocess_exec(*command_opts, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)
stdout, stderr = await process.communicate()
if stderr:
await ctx.maybe_send_embed(message="An error was encountered!\n" + cf.box(text=stderr.decode()))
else:
data = yaml.safe_load(stdout.decode())
message_data: dict = data[0]['message']
response_data: dict = message_data['response_message_data']
if ctx.embed_requested():
embed = Embed(
title="DNS Query Result",
color=await ctx.embed_color(),
timestamp=message_data['response_time']
)
embed.add_field(name="Response Address", value=message_data['response_address'], inline=True)
embed.add_field(name="Response Port", value=message_data['response_port'], inline=True)
embed.add_field(name="Query Address", value=message_data['query_address'], inline=True)
embed.add_field(name="Query Port", value=message_data['query_port'], inline=True)
embed.add_field(name="Status", value=response_data['status'], inline=True)
embed.add_field(name="Flags", value=response_data['flags'], inline=True)
if response_data.get('status') != 'NOERROR':
embed.colour = Color.red()
embed.description = cf.error("Dig query did not return `NOERROR` status.")
questions = []
answers = []
authorities = []
for m in data:
response = m['message']['response_message_data']
if 'QUESTION_SECTION' in response:
for question in response['QUESTION_SECTION']:
if question not in questions:
questions.append(question)
if 'ANSWER_SECTION' in response:
for answer in response['ANSWER_SECTION']:
if answer not in answers:
answers.append(answer)
if 'AUTHORITY_SECTION' in response:
for authority in response['AUTHORITY_SECTION']:
if authority not in authorities:
authorities.append(authority)
if questions:
question_section = "\n".join(questions)
embed.add_field(name="Question Section", value=f"{cf.box(text=question_section, lang='prolog')}", inline=False)
if answers:
answer_section = "\n".join(answers)
if len(answer_section) > 1024:
embed.description = cf.warning("Answer section is too long to fit within embed field, falling back to description.") + cf.box(answer_section)
else:
embed.add_field(name="Answer Section", value=f"{cf.box(text=answer_section, lang='prolog')}", inline=False)
if authorities:
authority_section = "\n".join(authorities)
embed.add_field(name="Authority Section", value=f"{cf.box(text=authority_section, lang='prolog')}", inline=False)
await ctx.send(embed=embed)
else:
await ctx.send(content=cf.box(text=stdout, lang='yaml'))
except (FileNotFoundError):
try:
ns_process = await asyncio.create_subprocess_exec('nslookup', name, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)
ns_stdout, ns_stderr = await ns_process.communicate()
if ns_stderr:
await ctx.maybe_send_embed(message="An error was encountered!\n" + cf.box(text=ns_stderr.decode()))
else:
warning = cf.warning("`dig` is not installed! Defaulting to `nslookup`.\nThis command provides more information when `dig` is installed on the system.\n")
if await ctx.embed_requested():
embed = Embed(
title="DNS Query Result",
color=await ctx.embed_color(),
timestamp=ctx.message.created_at
)
embed.description = warning + cf.box(text=ns_stdout.decode())
await ctx.send(embed=embed)
else:
await ctx.send(content = warning + cf.box(text=ns_stdout.decode()))
except (FileNotFoundError):
await ctx.maybe_send_embed(message=cf.error("Neither `dig` nor `nslookup` are installed on the system. Unable to resolve DNS query."))
@commands.command()
async def rfc(self, ctx: commands.Context, number: int) -> None:
"""Retrieve the text of an RFC document.
This command uses the [RFC Editor website](https://www.rfc-editor.org/) to fetch the text of an RFC document.
A [Request for Comments (RFC)](https://en.wikipedia.org/wiki/Request_for_Comments) is a publication in a series from the principal technical development and standards-setting bodies for the [Internet](https://en.wikipedia.org/wiki/Internet), most prominently the [Internet Engineering Task Force](https://en.wikipedia.org/wiki/Internet_Engineering_Task_Force). An RFC is authored by individuals or groups of engineers and [computer scientists](https://en.wikipedia.org/wiki/Computer_scientist) in the form of a [memorandum](https://en.wikipedia.org/wiki/Memorandum) describing methods, behaviors, research, or innovations applicable to the working of the Internet and Internet-connected systems. It is submitted either for [peer review](https://en.wikipedia.org/wiki/Peer_review) or to convey new concepts, information, or, occasionally, engineering humor.""" # noqa: E501
url = f"https://www.rfc-editor.org/rfc/rfc{number}.html"
datatracker_url = f"https://datatracker.ietf.org/doc/rfc{number}"
async with aiohttp.ClientSession() as session:
async with session.get(url=url) as response:
if response.status == 200:
html = await response.text()
soup = BeautifulSoup(html, 'html.parser')
pre_tags = soup.find_all('pre')
content: list[Embed | str] = []
for pre_tag in pre_tags:
text = format_rfc_text(md(pre_tag), number)
if len(text) > 4096:
pagified_text = cf.pagify(text, delims=["\n\n"], page_length=4096)
for page in pagified_text:
if await ctx.embed_requested():
embed = Embed(
title=f"RFC Document {number}",
url=datatracker_url,
description=page,
color=await ctx.embed_color()
)
content.append(embed)
else:
content.append(page)
else:
if await ctx.embed_requested():
embed = Embed(
title=f"RFC Document {number}",
url=datatracker_url,
description=text,
color=await ctx.embed_color()
)
content.append(embed)
else:
content.append(text)
if await ctx.embed_requested():
for embed in content:
embed.set_footer(text=f"Page {content.index(embed) + 1}/{len(content)}")
await SimpleMenu(pages=content, disable_after_timeout=True, timeout=300).start(ctx)
else:
await ctx.maybe_send_embed(message=cf.error(f"An error occurred while fetching RFC {number}. Status code: {response.status}."))