From 63fa1c03977435a2aa92325f8872e2d222d9e28a Mon Sep 17 00:00:00 2001 From: Krypton Date: Wed, 9 Mar 2022 15:42:05 +0100 Subject: Create discord-messages-with-colors.md --- .../python-guides/discord-messages-with-colors.md | 64 ++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 pydis_site/apps/content/resources/guides/python-guides/discord-messages-with-colors.md (limited to 'pydis_site') diff --git a/pydis_site/apps/content/resources/guides/python-guides/discord-messages-with-colors.md b/pydis_site/apps/content/resources/guides/python-guides/discord-messages-with-colors.md new file mode 100644 index 00000000..60ea8656 --- /dev/null +++ b/pydis_site/apps/content/resources/guides/python-guides/discord-messages-with-colors.md @@ -0,0 +1,64 @@ +--- +title: Discord messages with colors +description: A guide on how to add colors to your codeblocks on Discord +--- + +Discord is now slowly rolling out the ability to send colored messages within code blocks. It uses the ANSI color codes, so if you've tried to print colored text in your terminal or console with Python or other languages then it will be easy for you. + +To be able to send a colored text, you need to use the `ansi` language for your code block and provide a prefix of this format before writing your text: +``` +\u001b[{format};{color}m +``` +*The `\u001b` is the unicode for ESCAPE/ESC, see .* ***If you want to use it yourself without bots, then you need to copy paste the character from the website.*** + +After you've written this, you can type and text you wish, and if you want to reset the color back to normal, then you need to use `\u001b[0m` as prefix. + +Here is the list of values you can use to replace `{format}`: + +* 0: Normal +* 1: **Bold** +* 4: Underline + +Here is the list of values you can use to replace `{color}`: + +*The following values will change the **text** color.* + +* 30: Gray +* 31: Red +* 32: Green +* 33: Yellow +* 34: Blue +* 35: Pink +* 36: Cyan +* 37: White + +*The following values will change the **text background** color.* + +* 40: Some very dark blue +* 41: Orange +* 42: Gray +* 43: Light gray +* 44: Even lighter gray +* 45: Indigo +* 46: Again some gray +* 47: White + +Let's take an example, I want a bold green colored text with the very dark blue background. +I simply use `\u001b[0;40m` (background color) and `\u001b[1;32m` (text color) as prefix. Note that the order is **important**, first you give the background color and then the text color.
+Alternatively you can also directly combine them into a single prefix like the following: `\u001b[1;40;32m` and you can also use multiple values. Something like `\u001b[1;40;4;32m` would underline the text, make it bold, make it green and have a dark blue background. + +Raw message:
+\`\`\`ansi
+\u001b[0;40m\u001b[1;32mThat's some cool formatted text right?
+or
+\u001b[1;40;32mThat's some cool formatted text right?
+\`\`\` + +Result:
+![Background and text color](https://media.discordapp.net/attachments/739937507768270939/930460020603224084/Background-Text-Color.png) + +The way the colors look like on Discord is shown in the image below ^^ + +Note: If the change as not been brought to you yet, or other users, then you can use other code blocks in the meantime to get colored text. See this gist: + +![ANSI Colors](https://media.discordapp.net/attachments/739937507768270939/930825555803263016/ANSI-Colors.png) -- cgit v1.2.3 From 934218e86b8e72ee999e7c086aa0ec7cabf08408 Mon Sep 17 00:00:00 2001 From: Krypton Date: Thu, 10 Mar 2022 10:26:23 +0100 Subject: Update discord-messages-with-colors.md --- .../resources/guides/python-guides/discord-messages-with-colors.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'pydis_site') diff --git a/pydis_site/apps/content/resources/guides/python-guides/discord-messages-with-colors.md b/pydis_site/apps/content/resources/guides/python-guides/discord-messages-with-colors.md index 60ea8656..30f40948 100644 --- a/pydis_site/apps/content/resources/guides/python-guides/discord-messages-with-colors.md +++ b/pydis_site/apps/content/resources/guides/python-guides/discord-messages-with-colors.md @@ -1,5 +1,5 @@ --- -title: Discord messages with colors +title: Discord Messages with Colors description: A guide on how to add colors to your codeblocks on Discord --- @@ -57,8 +57,7 @@ or
Result:
![Background and text color](https://media.discordapp.net/attachments/739937507768270939/930460020603224084/Background-Text-Color.png) -The way the colors look like on Discord is shown in the image below ^^ +The way the colors look like on Discord is shown in the image below: +![ANSI Colors](https://media.discordapp.net/attachments/739937507768270939/930825555803263016/ANSI-Colors.png) Note: If the change as not been brought to you yet, or other users, then you can use other code blocks in the meantime to get colored text. See this gist: - -![ANSI Colors](https://media.discordapp.net/attachments/739937507768270939/930825555803263016/ANSI-Colors.png) -- cgit v1.2.3 From 35081bc351bde2ee338a855d33d719d689930e1f Mon Sep 17 00:00:00 2001 From: Robin5605 Date: Mon, 14 Mar 2022 22:49:58 -0500 Subject: Migrate VPS services pin by Python bot to site --- .../resources/guides/python-guides/vps-services.md | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 pydis_site/apps/content/resources/guides/python-guides/vps-services.md (limited to 'pydis_site') diff --git a/pydis_site/apps/content/resources/guides/python-guides/vps-services.md b/pydis_site/apps/content/resources/guides/python-guides/vps-services.md new file mode 100644 index 00000000..c153e876 --- /dev/null +++ b/pydis_site/apps/content/resources/guides/python-guides/vps-services.md @@ -0,0 +1,25 @@ +--- +title: VPS Services +description: On different VPS services +--- +If you need to run your bot 24/7 (with no downtime), you should consider using a virtual private server (VPS). +This is a list of VPS services that are sufficient for running Discord bots. + +* https://www.scaleway.com/ + * Based in Europe. +* https://www.digitalocean.com/ + * US-based. + * Considered by many to be the gold standard. + * Locations available across the world. +* https://www.ovh.co.uk/ + * France and Canadian locations available. +* https://www.time4vps.eu/ + * Seemingly based in Lithuania. +* https://www.linode.com/ + * Cheap VPS. +* https://www.vultr.com/ + * US-based, DigitalOcean-like. +* https://galaxygate.net/ + * A reliable, affordable, and trusted host. + +There are no reliable free options for VPS hosting. If you would rather not pay for a hosting service, you can consider self-hosting. Any modern hardware should be sufficient for running a bot. An old computer with a few GB of ram could be suitable, or a Raspberry Pi (any model, except perhaps one of the particularly less powerful ones). \ No newline at end of file -- cgit v1.2.3 From 831f56f71d76741276d13e20954f46088e754d18 Mon Sep 17 00:00:00 2001 From: Robin5605 Date: Mon, 14 Mar 2022 23:07:45 -0500 Subject: Fix end of file --- pydis_site/apps/content/resources/guides/python-guides/vps-services.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pydis_site') diff --git a/pydis_site/apps/content/resources/guides/python-guides/vps-services.md b/pydis_site/apps/content/resources/guides/python-guides/vps-services.md index c153e876..02feb8e6 100644 --- a/pydis_site/apps/content/resources/guides/python-guides/vps-services.md +++ b/pydis_site/apps/content/resources/guides/python-guides/vps-services.md @@ -22,4 +22,4 @@ This is a list of VPS services that are sufficient for running Discord bots. * https://galaxygate.net/ * A reliable, affordable, and trusted host. -There are no reliable free options for VPS hosting. If you would rather not pay for a hosting service, you can consider self-hosting. Any modern hardware should be sufficient for running a bot. An old computer with a few GB of ram could be suitable, or a Raspberry Pi (any model, except perhaps one of the particularly less powerful ones). \ No newline at end of file +There are no reliable free options for VPS hosting. If you would rather not pay for a hosting service, you can consider self-hosting. Any modern hardware should be sufficient for running a bot. An old computer with a few GB of ram could be suitable, or a Raspberry Pi (any model, except perhaps one of the particularly less powerful ones). -- cgit v1.2.3 From 30b7b4204b7e4b711960c952cccc15f667e2252f Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Sat, 19 Feb 2022 17:57:18 +0000 Subject: Move FilterList imports down so they're sorted --- pydis_site/apps/api/models/__init__.py | 2 +- pydis_site/apps/api/models/bot/__init__.py | 2 +- pydis_site/apps/api/urls.py | 16 ++++++++-------- pydis_site/apps/api/viewsets/__init__.py | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) (limited to 'pydis_site') diff --git a/pydis_site/apps/api/models/__init__.py b/pydis_site/apps/api/models/__init__.py index 4f616986..e83473c9 100644 --- a/pydis_site/apps/api/models/__init__.py +++ b/pydis_site/apps/api/models/__init__.py @@ -1,9 +1,9 @@ # flake8: noqa from .bot import ( - FilterList, BotSetting, DocumentationLink, DeletedMessage, + FilterList, Infraction, Message, MessageDeletionContext, diff --git a/pydis_site/apps/api/models/bot/__init__.py b/pydis_site/apps/api/models/bot/__init__.py index ec0e701c..64676fdb 100644 --- a/pydis_site/apps/api/models/bot/__init__.py +++ b/pydis_site/apps/api/models/bot/__init__.py @@ -1,8 +1,8 @@ # flake8: noqa -from .filter_list import FilterList from .bot_setting import BotSetting from .deleted_message import DeletedMessage from .documentation_link import DocumentationLink +from .filter_list import FilterList from .infraction import Infraction from .message import Message from .aoc_completionist_block import AocCompletionistBlock diff --git a/pydis_site/apps/api/urls.py b/pydis_site/apps/api/urls.py index 7c55fc92..6b881fac 100644 --- a/pydis_site/apps/api/urls.py +++ b/pydis_site/apps/api/urls.py @@ -21,8 +21,12 @@ from .viewsets import ( # https://www.django-rest-framework.org/api-guide/routers/#defaultrouter bot_router = DefaultRouter(trailing_slash=False) bot_router.register( - 'filter-lists', - FilterListViewSet + "aoc-account-links", + AocAccountLinkViewSet +) +bot_router.register( + "aoc-completionist-blocks", + AocCompletionistBlockViewSet ) bot_router.register( 'bot-settings', @@ -37,12 +41,8 @@ bot_router.register( DocumentationLinkViewSet ) bot_router.register( - "aoc-account-links", - AocAccountLinkViewSet -) -bot_router.register( - "aoc-completionist-blocks", - AocCompletionistBlockViewSet + 'filter-lists', + FilterListViewSet ) bot_router.register( 'infractions', diff --git a/pydis_site/apps/api/viewsets/__init__.py b/pydis_site/apps/api/viewsets/__init__.py index 5fc1d64f..a62a9c01 100644 --- a/pydis_site/apps/api/viewsets/__init__.py +++ b/pydis_site/apps/api/viewsets/__init__.py @@ -1,9 +1,9 @@ # flake8: noqa from .bot import ( - FilterListViewSet, BotSettingViewSet, DeletedMessageViewSet, DocumentationLinkViewSet, + FilterListViewSet, InfractionViewSet, NominationViewSet, OffensiveMessageViewSet, -- cgit v1.2.3 From 0aed5f7913e7ce268ddb56127f84a5386ede5739 Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Sat, 19 Feb 2022 17:59:26 +0000 Subject: Add support for BumpedThreads to be stored in site Following our move to use Redis as just a cache, this PR allows the site to store a list of threads that need to be bumped. The bot will interact with this within the ThreadBumper cog. --- .../apps/api/migrations/0081_bumpedthread.py | 22 ++++++++ pydis_site/apps/api/models/__init__.py | 1 + pydis_site/apps/api/models/bot/__init__.py | 1 + pydis_site/apps/api/models/bot/bumped_thread.py | 22 ++++++++ pydis_site/apps/api/serializers.py | 11 ++++ pydis_site/apps/api/urls.py | 5 ++ pydis_site/apps/api/viewsets/__init__.py | 1 + pydis_site/apps/api/viewsets/bot/__init__.py | 1 + pydis_site/apps/api/viewsets/bot/bumped_thread.py | 65 ++++++++++++++++++++++ 9 files changed, 129 insertions(+) create mode 100644 pydis_site/apps/api/migrations/0081_bumpedthread.py create mode 100644 pydis_site/apps/api/models/bot/bumped_thread.py create mode 100644 pydis_site/apps/api/viewsets/bot/bumped_thread.py (limited to 'pydis_site') diff --git a/pydis_site/apps/api/migrations/0081_bumpedthread.py b/pydis_site/apps/api/migrations/0081_bumpedthread.py new file mode 100644 index 00000000..03e66cc1 --- /dev/null +++ b/pydis_site/apps/api/migrations/0081_bumpedthread.py @@ -0,0 +1,22 @@ +# Generated by Django 3.1.14 on 2022-02-19 16:26 + +import django.core.validators +from django.db import migrations, models +import pydis_site.apps.api.models.mixins + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0080_add_aoc_tables'), + ] + + operations = [ + migrations.CreateModel( + name='BumpedThread', + fields=[ + ('thread_id', models.BigIntegerField(help_text='The thread ID that should be bumped.', primary_key=True, serialize=False, validators=[django.core.validators.MinValueValidator(limit_value=0, message='Thread IDs cannot be negative.')], verbose_name='Thread ID')), + ], + bases=(pydis_site.apps.api.models.mixins.ModelReprMixin, models.Model), + ), + ] diff --git a/pydis_site/apps/api/models/__init__.py b/pydis_site/apps/api/models/__init__.py index e83473c9..a197e988 100644 --- a/pydis_site/apps/api/models/__init__.py +++ b/pydis_site/apps/api/models/__init__.py @@ -1,6 +1,7 @@ # flake8: noqa from .bot import ( BotSetting, + BumpedThread, DocumentationLink, DeletedMessage, FilterList, diff --git a/pydis_site/apps/api/models/bot/__init__.py b/pydis_site/apps/api/models/bot/__init__.py index 64676fdb..013bb85e 100644 --- a/pydis_site/apps/api/models/bot/__init__.py +++ b/pydis_site/apps/api/models/bot/__init__.py @@ -1,5 +1,6 @@ # flake8: noqa from .bot_setting import BotSetting +from .bumped_thread import BumpedThread from .deleted_message import DeletedMessage from .documentation_link import DocumentationLink from .filter_list import FilterList diff --git a/pydis_site/apps/api/models/bot/bumped_thread.py b/pydis_site/apps/api/models/bot/bumped_thread.py new file mode 100644 index 00000000..cdf9a950 --- /dev/null +++ b/pydis_site/apps/api/models/bot/bumped_thread.py @@ -0,0 +1,22 @@ +from django.core.validators import MinValueValidator +from django.db import models + +from pydis_site.apps.api.models.mixins import ModelReprMixin + + +class BumpedThread(ModelReprMixin, models.Model): + """A list of thread IDs to be bumped.""" + + thread_id = models.BigIntegerField( + primary_key=True, + help_text=( + "The thread ID that should be bumped." + ), + validators=( + MinValueValidator( + limit_value=0, + message="Thread IDs cannot be negative." + ), + ), + verbose_name="Thread ID", + ) diff --git a/pydis_site/apps/api/serializers.py b/pydis_site/apps/api/serializers.py index c97f7dba..b9e06081 100644 --- a/pydis_site/apps/api/serializers.py +++ b/pydis_site/apps/api/serializers.py @@ -16,6 +16,7 @@ from .models import ( AocAccountLink, AocCompletionistBlock, BotSetting, + BumpedThread, DeletedMessage, DocumentationLink, FilterList, @@ -41,6 +42,16 @@ class BotSettingSerializer(ModelSerializer): fields = ('name', 'data') +class BumpedThreadSerializer(ModelSerializer): + """A class providing (de-)serialization of `BumpedThread` instances.""" + + class Meta: + """Metadata defined for the Django REST Framework.""" + + model = BumpedThread + fields = ('thread_id',) + + class DeletedMessageSerializer(ModelSerializer): """ A class providing (de-)serialization of `DeletedMessage` instances. diff --git a/pydis_site/apps/api/urls.py b/pydis_site/apps/api/urls.py index 6b881fac..1e564b29 100644 --- a/pydis_site/apps/api/urls.py +++ b/pydis_site/apps/api/urls.py @@ -6,6 +6,7 @@ from .viewsets import ( AocAccountLinkViewSet, AocCompletionistBlockViewSet, BotSettingViewSet, + BumpedThreadViewSet, DeletedMessageViewSet, DocumentationLinkViewSet, FilterListViewSet, @@ -32,6 +33,10 @@ bot_router.register( 'bot-settings', BotSettingViewSet ) +bot_router.register( + 'bumped-threads', + BumpedThreadViewSet +) bot_router.register( 'deleted-messages', DeletedMessageViewSet diff --git a/pydis_site/apps/api/viewsets/__init__.py b/pydis_site/apps/api/viewsets/__init__.py index a62a9c01..ec52416a 100644 --- a/pydis_site/apps/api/viewsets/__init__.py +++ b/pydis_site/apps/api/viewsets/__init__.py @@ -1,6 +1,7 @@ # flake8: noqa from .bot import ( BotSettingViewSet, + BumpedThreadViewSet, DeletedMessageViewSet, DocumentationLinkViewSet, FilterListViewSet, diff --git a/pydis_site/apps/api/viewsets/bot/__init__.py b/pydis_site/apps/api/viewsets/bot/__init__.py index f1d84729..262aa59f 100644 --- a/pydis_site/apps/api/viewsets/bot/__init__.py +++ b/pydis_site/apps/api/viewsets/bot/__init__.py @@ -1,6 +1,7 @@ # flake8: noqa from .filter_list import FilterListViewSet from .bot_setting import BotSettingViewSet +from .bumped_thread import BumpedThreadViewSet from .deleted_message import DeletedMessageViewSet from .documentation_link import DocumentationLinkViewSet from .infraction import InfractionViewSet diff --git a/pydis_site/apps/api/viewsets/bot/bumped_thread.py b/pydis_site/apps/api/viewsets/bot/bumped_thread.py new file mode 100644 index 00000000..6594ac6e --- /dev/null +++ b/pydis_site/apps/api/viewsets/bot/bumped_thread.py @@ -0,0 +1,65 @@ +from rest_framework.mixins import ( + CreateModelMixin, DestroyModelMixin, ListModelMixin, RetrieveModelMixin +) +from rest_framework.viewsets import GenericViewSet + +from pydis_site.apps.api.models.bot import BumpedThread +from pydis_site.apps.api.serializers import BumpedThreadSerializer + + +class BumpedThreadViewSet( + GenericViewSet, CreateModelMixin, DestroyModelMixin, RetrieveModelMixin, ListModelMixin +): + """ + View providing CRUD (Minus the U) operations on threads to be bumped. + + ## Routes + ### GET /bot/bumped-threads + Returns all BumpedThread items in the database. + + #### Response format + >>> [ + ... { + ... 'thread_id': "941705627405811793", + ... }, + ... ... + ... ] + + #### Status codes + - 200: returned on success + - 401: returned if unauthenticated + + ### GET /bot/bumped-threads/ + Returns a specific BumpedThread item from the database. + + #### Response format + >>> { + ... 'thread_id': "941705627405811793", + ... } + + #### Status codes + - 200: returned on success + - 404: returned if a BumpedThread with the given thread_id was not found. + + ### POST /bot/bumped-threads + Adds a single BumpedThread item to the database. + + #### Request body + >>> { + ... 'thread_id': int, + ... } + + #### Status codes + - 201: returned on success + - 400: if one of the given fields is invalid + + ### DELETE /bot/bumped-threads/ + Deletes the BumpedThread item with the given `thread_id`. + + #### Status codes + - 204: returned on success + - 404: if a BumpedThread with the given `thread_id` does not exist + """ + + serializer_class = BumpedThreadSerializer + queryset = BumpedThread.objects.all() -- cgit v1.2.3 From 3e9557056c06a39c077b76d718eb35b99a365711 Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Wed, 16 Mar 2022 21:46:46 +0000 Subject: Only return list of ints when retrieving all BumpedThreads --- pydis_site/apps/api/serializers.py | 17 +++++++++++++++++ pydis_site/apps/api/viewsets/bot/bumped_thread.py | 7 +------ 2 files changed, 18 insertions(+), 6 deletions(-) (limited to 'pydis_site') diff --git a/pydis_site/apps/api/serializers.py b/pydis_site/apps/api/serializers.py index b9e06081..dfdda915 100644 --- a/pydis_site/apps/api/serializers.py +++ b/pydis_site/apps/api/serializers.py @@ -42,12 +42,29 @@ class BotSettingSerializer(ModelSerializer): fields = ('name', 'data') +class ListBumpedThreadSerializer(ListSerializer): + """Custom ListSerializer to override to_representation() when list views are triggered.""" + + def to_representation(self, objects: list[BumpedThread]) -> int: + """ + Used by the `ListModelMixin` to return just the list of bumped thread ids. + + We want to only return the thread_id attribute, hence it is unnecessary + to create a nested dictionary. + + Additionally, this allows bumped thread routes to simply return an + array of thread_id ints instead of objects, saving on bandwidth. + """ + return [obj.thread_id for obj in objects] + + class BumpedThreadSerializer(ModelSerializer): """A class providing (de-)serialization of `BumpedThread` instances.""" class Meta: """Metadata defined for the Django REST Framework.""" + list_serializer_class = ListBumpedThreadSerializer model = BumpedThread fields = ('thread_id',) diff --git a/pydis_site/apps/api/viewsets/bot/bumped_thread.py b/pydis_site/apps/api/viewsets/bot/bumped_thread.py index 6594ac6e..0972379b 100644 --- a/pydis_site/apps/api/viewsets/bot/bumped_thread.py +++ b/pydis_site/apps/api/viewsets/bot/bumped_thread.py @@ -18,12 +18,7 @@ class BumpedThreadViewSet( Returns all BumpedThread items in the database. #### Response format - >>> [ - ... { - ... 'thread_id': "941705627405811793", - ... }, - ... ... - ... ] + >>> list[int] #### Status codes - 200: returned on success -- cgit v1.2.3 From a0180619e77d884aeedb1a89748c0115c8ec8c56 Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Wed, 16 Mar 2022 21:47:57 +0000 Subject: Don't return the BumpedThread object when retrieving single We only need to check for existence, so sending the full object isn't needed. --- pydis_site/apps/api/viewsets/bot/bumped_thread.py | 24 ++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'pydis_site') diff --git a/pydis_site/apps/api/viewsets/bot/bumped_thread.py b/pydis_site/apps/api/viewsets/bot/bumped_thread.py index 0972379b..9d77bb6b 100644 --- a/pydis_site/apps/api/viewsets/bot/bumped_thread.py +++ b/pydis_site/apps/api/viewsets/bot/bumped_thread.py @@ -1,6 +1,8 @@ from rest_framework.mixins import ( - CreateModelMixin, DestroyModelMixin, ListModelMixin, RetrieveModelMixin + CreateModelMixin, DestroyModelMixin, ListModelMixin ) +from rest_framework.request import Request +from rest_framework.response import Response from rest_framework.viewsets import GenericViewSet from pydis_site.apps.api.models.bot import BumpedThread @@ -8,7 +10,7 @@ from pydis_site.apps.api.serializers import BumpedThreadSerializer class BumpedThreadViewSet( - GenericViewSet, CreateModelMixin, DestroyModelMixin, RetrieveModelMixin, ListModelMixin + GenericViewSet, CreateModelMixin, DestroyModelMixin, ListModelMixin ): """ View providing CRUD (Minus the U) operations on threads to be bumped. @@ -25,15 +27,10 @@ class BumpedThreadViewSet( - 401: returned if unauthenticated ### GET /bot/bumped-threads/ - Returns a specific BumpedThread item from the database. - - #### Response format - >>> { - ... 'thread_id': "941705627405811793", - ... } + Returns whether a specific BumpedThread exists in the database. #### Status codes - - 200: returned on success + - 204: returned on success - 404: returned if a BumpedThread with the given thread_id was not found. ### POST /bot/bumped-threads @@ -58,3 +55,12 @@ class BumpedThreadViewSet( serializer_class = BumpedThreadSerializer queryset = BumpedThread.objects.all() + + def retrieve(self, request: Request, *args, **kwargs) -> Response: + """ + DRF method for checking if the given BumpedThread exists. + + Called by the Django Rest Framework in response to the corresponding HTTP request. + """ + self.get_object() + return Response(status=204) -- cgit v1.2.3 From cb52e60a631041a08edb213f41cca8befba4bf7e Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Wed, 16 Mar 2022 23:17:46 +0000 Subject: Add tests for custom BumpedThread impl --- pydis_site/apps/api/tests/test_bumped_threads.py | 63 ++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 pydis_site/apps/api/tests/test_bumped_threads.py (limited to 'pydis_site') diff --git a/pydis_site/apps/api/tests/test_bumped_threads.py b/pydis_site/apps/api/tests/test_bumped_threads.py new file mode 100644 index 00000000..316e3f0b --- /dev/null +++ b/pydis_site/apps/api/tests/test_bumped_threads.py @@ -0,0 +1,63 @@ +from django.urls import reverse + +from .base import AuthenticatedAPITestCase +from ..models import BumpedThread + + +class UnauthedBumpedThreadAPITests(AuthenticatedAPITestCase): + def setUp(self): + super().setUp() + self.client.force_authenticate(user=None) + + def test_detail_lookup_returns_401(self): + url = reverse('api:bot:bumpedthread-detail', args=(1,)) + response = self.client.get(url) + + self.assertEqual(response.status_code, 401) + + def test_list_returns_401(self): + url = reverse('api:bot:bumpedthread-list') + response = self.client.get(url) + + self.assertEqual(response.status_code, 401) + + def test_create_returns_401(self): + url = reverse('api:bot:bumpedthread-list') + response = self.client.post(url, {"thread_id": 3}) + + self.assertEqual(response.status_code, 401) + + def test_delete_returns_401(self): + url = reverse('api:bot:bumpedthread-detail', args=(1,)) + response = self.client.delete(url) + + self.assertEqual(response.status_code, 401) + + +class BumpedThreadAPITests(AuthenticatedAPITestCase): + @classmethod + def setUpTestData(cls): + cls.thread1 = BumpedThread.objects.create( + thread_id=1234, + ) + + def test_returns_bumped_threads_as_flat_list(self): + url = reverse('api:bot:bumpedthread-list') + + response = self.client.get(url) + self.assertEqual(response.status_code, 200) + self.assertEqual(response.json(), [1234]) + + def test_returns_204_for_existing_data(self): + url = reverse('api:bot:bumpedthread-detail', args=(1234,)) + + response = self.client.get(url) + self.assertEqual(response.status_code, 204) + self.assertEqual(response.content, b"") + + def test_returns_404_for_non_existing_data(self): + url = reverse('api:bot:bumpedthread-detail', args=(42,)) + + response = self.client.get(url) + self.assertEqual(response.status_code, 404) + self.assertEqual(response.json(), {"detail": "Not found."}) -- cgit v1.2.3 From 429d98a5349b55e63f93e6192d8b2b35262dc60b Mon Sep 17 00:00:00 2001 From: ChrisJL Date: Fri, 18 Mar 2022 15:11:34 +0000 Subject: fixup: don't use "We" in docstring Co-authored-by: Mark <1515135+MarkKoz@users.noreply.github.com> --- pydis_site/apps/api/serializers.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'pydis_site') diff --git a/pydis_site/apps/api/serializers.py b/pydis_site/apps/api/serializers.py index dfdda915..e53ccffa 100644 --- a/pydis_site/apps/api/serializers.py +++ b/pydis_site/apps/api/serializers.py @@ -49,8 +49,7 @@ class ListBumpedThreadSerializer(ListSerializer): """ Used by the `ListModelMixin` to return just the list of bumped thread ids. - We want to only return the thread_id attribute, hence it is unnecessary - to create a nested dictionary. + Only the thread_id field is useful, hence it is unnecessary to create a nested dictionary. Additionally, this allows bumped thread routes to simply return an array of thread_id ints instead of objects, saving on bandwidth. -- cgit v1.2.3 From 506ac4281dd150eefc4864a00838ac97aa71f14f Mon Sep 17 00:00:00 2001 From: Robin <74519799+Robin5605@users.noreply.github.com> Date: Mon, 21 Mar 2022 14:15:50 -0500 Subject: Add hyperlinks Co-authored-by: Xithrius <15021300+Xithrius@users.noreply.github.com> --- .../content/resources/guides/python-guides/vps-services.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'pydis_site') diff --git a/pydis_site/apps/content/resources/guides/python-guides/vps-services.md b/pydis_site/apps/content/resources/guides/python-guides/vps-services.md index 02feb8e6..07e70e9a 100644 --- a/pydis_site/apps/content/resources/guides/python-guides/vps-services.md +++ b/pydis_site/apps/content/resources/guides/python-guides/vps-services.md @@ -5,21 +5,21 @@ description: On different VPS services If you need to run your bot 24/7 (with no downtime), you should consider using a virtual private server (VPS). This is a list of VPS services that are sufficient for running Discord bots. -* https://www.scaleway.com/ +* [https://www.scaleway.com](https://www.scaleway.com) * Based in Europe. -* https://www.digitalocean.com/ +* [https://www.digitalocean.com](https://www.digitalocean.com) * US-based. * Considered by many to be the gold standard. * Locations available across the world. -* https://www.ovh.co.uk/ +* [https://www.ovh.co.uk](https://www.ovh.co.uk) * France and Canadian locations available. -* https://www.time4vps.eu/ +* [https://www.time4vps.eu](https://www.time4vps.eu) * Seemingly based in Lithuania. -* https://www.linode.com/ +* [https://www.linode.com](https://www.linode.com) * Cheap VPS. -* https://www.vultr.com/ +* [https://www.vultr.com](https://www.vultr.com) * US-based, DigitalOcean-like. -* https://galaxygate.net/ +* [https://galaxygate.net](https://galaxygate.net) * A reliable, affordable, and trusted host. There are no reliable free options for VPS hosting. If you would rather not pay for a hosting service, you can consider self-hosting. Any modern hardware should be sufficient for running a bot. An old computer with a few GB of ram could be suitable, or a Raspberry Pi (any model, except perhaps one of the particularly less powerful ones). -- cgit v1.2.3 From 00a17a53c542b6de263691219c38438393d9f806 Mon Sep 17 00:00:00 2001 From: Robin5605 Date: Tue, 22 Mar 2022 12:33:13 -0500 Subject: Update VPS services content --- .../resources/guides/python-guides/vps-services.md | 53 +++++++++++++--------- 1 file changed, 32 insertions(+), 21 deletions(-) (limited to 'pydis_site') diff --git a/pydis_site/apps/content/resources/guides/python-guides/vps-services.md b/pydis_site/apps/content/resources/guides/python-guides/vps-services.md index 07e70e9a..4dfca732 100644 --- a/pydis_site/apps/content/resources/guides/python-guides/vps-services.md +++ b/pydis_site/apps/content/resources/guides/python-guides/vps-services.md @@ -1,25 +1,36 @@ --- -title: VPS Services -description: On different VPS services + title: VPS Services + description: On different VPS services --- -If you need to run your bot 24/7 (with no downtime), you should consider using a virtual private server (VPS). -This is a list of VPS services that are sufficient for running Discord bots. -* [https://www.scaleway.com](https://www.scaleway.com) - * Based in Europe. -* [https://www.digitalocean.com](https://www.digitalocean.com) - * US-based. - * Considered by many to be the gold standard. - * Locations available across the world. -* [https://www.ovh.co.uk](https://www.ovh.co.uk) - * France and Canadian locations available. -* [https://www.time4vps.eu](https://www.time4vps.eu) - * Seemingly based in Lithuania. -* [https://www.linode.com](https://www.linode.com) - * Cheap VPS. -* [https://www.vultr.com](https://www.vultr.com) - * US-based, DigitalOcean-like. -* [https://galaxygate.net](https://galaxygate.net) - * A reliable, affordable, and trusted host. +If you need to run your bot 24/7 (with no downtime), you should consider using a virtual private server (VPS).This is a list of VPS services that are sufficient for running Discord bots. + +* Europe + * [netcup](https://www.netcup.eu/) + * Germany & Austria data centres. + * Great affiliate program. + * [Yandex Cloud](https://cloud.yandex.ru/) + * Vladimir, Ryazan, and Moscow region data centres. + * [Scaleway](https://www.scaleway.com/) + * France data centre. + * [Time 4 VPS](https://www.time4vps.eu/) + * Lithuania data centre. +* US + * [GalaxyGate](https://galaxygate.net/) + * New York data centre. + * Great affiliate program. +* Global + * [Linode](https://www.linode.com/) + * Global data centre options. + * [Digital Ocean](https://www.digitalocean.com/) + * Global data centre options. + * [OVHcloud](https://www.ovhcloud.com/) + * Global data centre options. + * [Vultr](https://www.vultr.com/) + * Global data centre options. + +--- +Free hosts +There are no reliable free options for VPS hosting. If you would rather not pay for a hosting service, you can consider self-hosting. +Any modern hardware should be sufficient for running a bot. An old computer with a few GB of ram could be suitable, or a Raspberry Pi. -There are no reliable free options for VPS hosting. If you would rather not pay for a hosting service, you can consider self-hosting. Any modern hardware should be sufficient for running a bot. An old computer with a few GB of ram could be suitable, or a Raspberry Pi (any model, except perhaps one of the particularly less powerful ones). -- cgit v1.2.3 From aedf67e6f141288f1f8b00bbd0e46cae1eb16a6c Mon Sep 17 00:00:00 2001 From: Robin5605 Date: Tue, 22 Mar 2022 14:22:27 -0500 Subject: Fix EOF --- pydis_site/apps/content/resources/guides/python-guides/vps-services.md | 1 - 1 file changed, 1 deletion(-) (limited to 'pydis_site') diff --git a/pydis_site/apps/content/resources/guides/python-guides/vps-services.md b/pydis_site/apps/content/resources/guides/python-guides/vps-services.md index 4dfca732..95951134 100644 --- a/pydis_site/apps/content/resources/guides/python-guides/vps-services.md +++ b/pydis_site/apps/content/resources/guides/python-guides/vps-services.md @@ -33,4 +33,3 @@ If you need to run your bot 24/7 (with no downtime), you should consider using a Free hosts There are no reliable free options for VPS hosting. If you would rather not pay for a hosting service, you can consider self-hosting. Any modern hardware should be sufficient for running a bot. An old computer with a few GB of ram could be suitable, or a Raspberry Pi. - -- cgit v1.2.3 From 682613bcf56ea6aefac8b15b56064a16732894a4 Mon Sep 17 00:00:00 2001 From: Robin <74519799+Robin5605@users.noreply.github.com> Date: Tue, 22 Mar 2022 23:51:36 -0500 Subject: Remove starting whitespaces Co-authored-by: Xithrius <15021300+Xithrius@users.noreply.github.com> --- .../apps/content/resources/guides/python-guides/vps-services.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pydis_site') diff --git a/pydis_site/apps/content/resources/guides/python-guides/vps-services.md b/pydis_site/apps/content/resources/guides/python-guides/vps-services.md index 95951134..90306057 100644 --- a/pydis_site/apps/content/resources/guides/python-guides/vps-services.md +++ b/pydis_site/apps/content/resources/guides/python-guides/vps-services.md @@ -1,6 +1,6 @@ --- - title: VPS Services - description: On different VPS services +title: VPS Services +description: On different VPS services --- If you need to run your bot 24/7 (with no downtime), you should consider using a virtual private server (VPS).This is a list of VPS services that are sufficient for running Discord bots. -- cgit v1.2.3 From 806ce3fdf433d05b9d480a3d7ca2332dac951194 Mon Sep 17 00:00:00 2001 From: Krypton Date: Wed, 23 Mar 2022 22:35:32 +0100 Subject: Update discord-messages-with-colors.md --- .../python-guides/discord-messages-with-colors.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'pydis_site') diff --git a/pydis_site/apps/content/resources/guides/python-guides/discord-messages-with-colors.md b/pydis_site/apps/content/resources/guides/python-guides/discord-messages-with-colors.md index 30f40948..c8e50d71 100644 --- a/pydis_site/apps/content/resources/guides/python-guides/discord-messages-with-colors.md +++ b/pydis_site/apps/content/resources/guides/python-guides/discord-messages-with-colors.md @@ -3,13 +3,13 @@ title: Discord Messages with Colors description: A guide on how to add colors to your codeblocks on Discord --- -Discord is now slowly rolling out the ability to send colored messages within code blocks. It uses the ANSI color codes, so if you've tried to print colored text in your terminal or console with Python or other languages then it will be easy for you. +Discord is now slowly rolling out the ability to send colored text within code blocks. This is done using ANSI color codes which is also how you print colored text in your terminal. -To be able to send a colored text, you need to use the `ansi` language for your code block and provide a prefix of this format before writing your text: -``` +To send colored text in a code block you need to first specify the `ansi` language and use the prefixes similar to the one below: +```ansi \u001b[{format};{color}m ``` -*The `\u001b` is the unicode for ESCAPE/ESC, see .* ***If you want to use it yourself without bots, then you need to copy paste the character from the website.*** +*`\u001b` is the unicode escape for ESCAPE/ESC, meant to be used in the source of your bot (see ).* ***If you wish to send colored text without using your bot you need to copy the character from the website.*** After you've written this, you can type and text you wish, and if you want to reset the color back to normal, then you need to use `\u001b[0m` as prefix. @@ -34,13 +34,13 @@ Here is the list of values you can use to replace `{color}`: *The following values will change the **text background** color.* -* 40: Some very dark blue +* 40: Firefly dark blue * 41: Orange -* 42: Gray -* 43: Light gray -* 44: Even lighter gray +* 42: Marble blue +* 43: Greyish turquoise +* 44: Gray * 45: Indigo -* 46: Again some gray +* 46: Light gray * 47: White Let's take an example, I want a bold green colored text with the very dark blue background. @@ -54,7 +54,8 @@ or
\u001b[1;40;32mThat's some cool formatted text right?
\`\`\` -Result:
+Result: + ![Background and text color](https://media.discordapp.net/attachments/739937507768270939/930460020603224084/Background-Text-Color.png) The way the colors look like on Discord is shown in the image below: -- cgit v1.2.3 From 622263827ba2c44739dccb035943c48489f3166e Mon Sep 17 00:00:00 2001 From: Johannes Christ Date: Fri, 25 Mar 2022 10:23:07 +0100 Subject: Fix link to code jam image Closes #704. --- pydis_site/templates/events/sidebar/code-jams/7.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pydis_site') diff --git a/pydis_site/templates/events/sidebar/code-jams/7.html b/pydis_site/templates/events/sidebar/code-jams/7.html index d4615c2a..4aefdbd9 100644 --- a/pydis_site/templates/events/sidebar/code-jams/7.html +++ b/pydis_site/templates/events/sidebar/code-jams/7.html @@ -1,7 +1,7 @@ {% load static %}
- Summer Code Jam 2020 + Summer Code Jam 2020 Django -- cgit v1.2.3 From 08d5e01be09e482f92a96cf00bc007e60dfa2c98 Mon Sep 17 00:00:00 2001 From: Robin <74519799+Robin5605@users.noreply.github.com> Date: Thu, 31 Mar 2022 10:46:33 -0500 Subject: Make "free hosts" a header Co-authored-by: Shom770 <82843611+Shom770@users.noreply.github.com> --- pydis_site/apps/content/resources/guides/python-guides/vps-services.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pydis_site') diff --git a/pydis_site/apps/content/resources/guides/python-guides/vps-services.md b/pydis_site/apps/content/resources/guides/python-guides/vps-services.md index 90306057..b8a6f8fd 100644 --- a/pydis_site/apps/content/resources/guides/python-guides/vps-services.md +++ b/pydis_site/apps/content/resources/guides/python-guides/vps-services.md @@ -30,6 +30,6 @@ If you need to run your bot 24/7 (with no downtime), you should consider using a * Global data centre options. --- -Free hosts +# Free hosts There are no reliable free options for VPS hosting. If you would rather not pay for a hosting service, you can consider self-hosting. Any modern hardware should be sufficient for running a bot. An old computer with a few GB of ram could be suitable, or a Raspberry Pi. -- cgit v1.2.3 From 0cc092741ea35b5810d57d4d768dcb0e021603bd Mon Sep 17 00:00:00 2001 From: Robin5605 Date: Thu, 31 Mar 2022 10:50:38 -0500 Subject: Remove extraneous bullet points in "global" --- .../apps/content/resources/guides/python-guides/vps-services.md | 4 ---- 1 file changed, 4 deletions(-) (limited to 'pydis_site') diff --git a/pydis_site/apps/content/resources/guides/python-guides/vps-services.md b/pydis_site/apps/content/resources/guides/python-guides/vps-services.md index b8a6f8fd..bd4af0a5 100644 --- a/pydis_site/apps/content/resources/guides/python-guides/vps-services.md +++ b/pydis_site/apps/content/resources/guides/python-guides/vps-services.md @@ -21,13 +21,9 @@ If you need to run your bot 24/7 (with no downtime), you should consider using a * Great affiliate program. * Global * [Linode](https://www.linode.com/) - * Global data centre options. * [Digital Ocean](https://www.digitalocean.com/) - * Global data centre options. * [OVHcloud](https://www.ovhcloud.com/) - * Global data centre options. * [Vultr](https://www.vultr.com/) - * Global data centre options. --- # Free hosts -- cgit v1.2.3 From 1e916a0515940caa95f34fc0bc04a040b36c214d Mon Sep 17 00:00:00 2001 From: Robin <74519799+Robin5605@users.noreply.github.com> Date: Thu, 31 Mar 2022 11:52:57 -0500 Subject: Add space Co-authored-by: Hassan Abouelela --- pydis_site/apps/content/resources/guides/python-guides/vps-services.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pydis_site') diff --git a/pydis_site/apps/content/resources/guides/python-guides/vps-services.md b/pydis_site/apps/content/resources/guides/python-guides/vps-services.md index bd4af0a5..0acd3e55 100644 --- a/pydis_site/apps/content/resources/guides/python-guides/vps-services.md +++ b/pydis_site/apps/content/resources/guides/python-guides/vps-services.md @@ -3,7 +3,7 @@ title: VPS Services description: On different VPS services --- -If you need to run your bot 24/7 (with no downtime), you should consider using a virtual private server (VPS).This is a list of VPS services that are sufficient for running Discord bots. +If you need to run your bot 24/7 (with no downtime), you should consider using a virtual private server (VPS). This is a list of VPS services that are sufficient for running Discord bots. * Europe * [netcup](https://www.netcup.eu/) -- cgit v1.2.3 From 1005229e825a5f2449168bcae2b85667c5799265 Mon Sep 17 00:00:00 2001 From: Krypton Date: Fri, 1 Apr 2022 18:15:19 +0200 Subject: Added Discord embed limits guide (#690) Co-authored-by: Krypton Co-authored-by: Krypton Co-authored-by: Xithrius <15021300+Xithrius@users.noreply.github.com> --- .../guides/python-guides/discord-embed-limits.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 pydis_site/apps/content/resources/guides/python-guides/discord-embed-limits.md (limited to 'pydis_site') diff --git a/pydis_site/apps/content/resources/guides/python-guides/discord-embed-limits.md b/pydis_site/apps/content/resources/guides/python-guides/discord-embed-limits.md new file mode 100644 index 00000000..ca97462b --- /dev/null +++ b/pydis_site/apps/content/resources/guides/python-guides/discord-embed-limits.md @@ -0,0 +1,21 @@ +--- +title: Discord Embed Limits +description: A guide that shows the limits of embeds in Discord and how to avoid them. +--- + +If you plan on using embed responses for your bot you should know the limits of the embeds on Discord or you will get `Invalid Form Body` errors: + +- Embed **title** is limited to **256 characters** +- Embed **description** is limited to **4096 characters** +- An embed can contain a maximum of **25 fields** +- A **field name/title** is limited to **256 character** and the **value of the field** is limited to **1024 characters** +- Embed **footer** is limited to **2048 characters** +- Embed **author name** is limited to **256 characters** +- The **total of characters** allowed in an embed is **6000** + +Now if you need to get over this limit (for example for a help command), you would need to use pagination. +There are several ways to do that: + +- A library called **[disputils](https://pypi.org/project/disputils)** +- An experimental library made by the discord.py developer called **[discord-ext-menus](https://github.com/Rapptz/discord-ext-menus)** +- Make your own setup using **[wait_for()](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.Bot.wait_for)** and wait for a reaction to be added -- cgit v1.2.3 From a4eda4a2da65a1a7f903a8c5b1da37c366baee0b Mon Sep 17 00:00:00 2001 From: D0rs4n <41237606+D0rs4n@users.noreply.github.com> Date: Wed, 13 Apr 2022 23:13:02 +0200 Subject: Adjust filtering settings for the AoC link viewset --- pydis_site/apps/api/viewsets/bot/aoc_link.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pydis_site') diff --git a/pydis_site/apps/api/viewsets/bot/aoc_link.py b/pydis_site/apps/api/viewsets/bot/aoc_link.py index 9f22c1a1..c7a96629 100644 --- a/pydis_site/apps/api/viewsets/bot/aoc_link.py +++ b/pydis_site/apps/api/viewsets/bot/aoc_link.py @@ -68,4 +68,4 @@ class AocAccountLinkViewSet( serializer_class = AocAccountLinkSerializer queryset = AocAccountLink.objects.all() filter_backends = (DjangoFilterBackend,) - filter_fields = ("user__id",) + filter_fields = ("user__id", "aoc_username") -- cgit v1.2.3 From fabfbd63dc1055ba28742e7819107fa2b201fb1c Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Thu, 21 Apr 2022 09:27:50 +0100 Subject: Support color string being when converting to hex code Int he latest version of discord.py Embed colours could be sent to site as hex strings, if set using a discord.Color, rather tha an int. Closes #715 Closes SITE-25 --- pydis_site/apps/staff/templatetags/deletedmessage_filters.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'pydis_site') diff --git a/pydis_site/apps/staff/templatetags/deletedmessage_filters.py b/pydis_site/apps/staff/templatetags/deletedmessage_filters.py index 8e14ced6..5026068e 100644 --- a/pydis_site/apps/staff/templatetags/deletedmessage_filters.py +++ b/pydis_site/apps/staff/templatetags/deletedmessage_filters.py @@ -1,4 +1,5 @@ from datetime import datetime +from typing import Union from django import template @@ -6,13 +7,16 @@ register = template.Library() @register.filter -def hex_colour(color: int) -> str: +def hex_colour(colour: Union[str, int]) -> str: """ - Converts an integer representation of a colour to the RGB hex value. + Converts the given representation of a colour to its RGB hex string. As we are using a Discord dark theme analogue, black colours are returned as white instead. """ - colour = f"#{color:0>6X}" + if isinstance(colour, str): + colour = colour if colour.startswith("#") else f"#{colour}" + else: + colour = f"#{colour:0>6X}" return colour if colour != "#000000" else "#FFFFFF" -- cgit v1.2.3 From a97d188f4ff011d733c452bca4f1f38d2b5c34ca Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Thu, 21 Apr 2022 09:43:35 +0100 Subject: Add tests for new embed colour types --- pydis_site/apps/staff/tests/test_logs_view.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'pydis_site') diff --git a/pydis_site/apps/staff/tests/test_logs_view.py b/pydis_site/apps/staff/tests/test_logs_view.py index 45e9ce8f..3e5726cd 100644 --- a/pydis_site/apps/staff/tests/test_logs_view.py +++ b/pydis_site/apps/staff/tests/test_logs_view.py @@ -95,12 +95,22 @@ class TestLogsView(TestCase): "description": "This embed is way too cool to be seen in public channels.", } + cls.embed_three = { + "description": "This embed is way too cool to be seen in public channels.", + "color": "#e74c3c", + } + + cls.embed_four = { + "description": "This embed is way too cool to be seen in public channels.", + "color": "e74c3c", + } + cls.deleted_message_two = DeletedMessage.objects.create( author=cls.author, id=614444836291870750, channel_id=1984, content='Does that mean this thing will halt?', - embeds=[cls.embed_one, cls.embed_two], + embeds=[cls.embed_one, cls.embed_two, cls.embed_three, cls.embed_four], attachments=['https://http.cat/100', 'https://http.cat/402'], deletion_context=cls.deletion_context, ) -- cgit v1.2.3 From ebad433d4fa299085fd3bbba4a349de3088fb5d4 Mon Sep 17 00:00:00 2001 From: mina Date: Thu, 21 Apr 2022 17:51:57 -0400 Subject: Add support for BIG SOLIDUS unicode characters for off topic names We must add support for all B I G S O L I D U S. This is necessary. --- .../apps/api/migrations/0082_otn_allow_big_solidus.py | 19 +++++++++++++++++++ .../apps/api/models/bot/off_topic_channel_name.py | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 pydis_site/apps/api/migrations/0082_otn_allow_big_solidus.py (limited to 'pydis_site') diff --git a/pydis_site/apps/api/migrations/0082_otn_allow_big_solidus.py b/pydis_site/apps/api/migrations/0082_otn_allow_big_solidus.py new file mode 100644 index 00000000..abbb98ec --- /dev/null +++ b/pydis_site/apps/api/migrations/0082_otn_allow_big_solidus.py @@ -0,0 +1,19 @@ +# Generated by Django 3.1.14 on 2022-04-21 23:29 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0081_bumpedthread'), + ] + + operations = [ + migrations.AlterField( + model_name='offtopicchannelname', + name='name', + field=models.CharField(help_text='The actual channel name that will be used on our Discord server.', max_length=96, primary_key=True, serialize=False, validators=[django.core.validators.RegexValidator(regex="^[a-z0-9\\U0001d5a0-\\U0001d5b9-ǃ?’'<>⧹⧸]+$")]), + ), + ] diff --git a/pydis_site/apps/api/models/bot/off_topic_channel_name.py b/pydis_site/apps/api/models/bot/off_topic_channel_name.py index e9fec114..b380efad 100644 --- a/pydis_site/apps/api/models/bot/off_topic_channel_name.py +++ b/pydis_site/apps/api/models/bot/off_topic_channel_name.py @@ -11,7 +11,7 @@ class OffTopicChannelName(ModelReprMixin, models.Model): primary_key=True, max_length=96, validators=( - RegexValidator(regex=r"^[a-z0-9\U0001d5a0-\U0001d5b9-ǃ?’'<>]+$"), + RegexValidator(regex=r"^[a-z0-9\U0001d5a0-\U0001d5b9-ǃ?’'<>⧹⧸]+$"), ), help_text="The actual channel name that will be used on our Discord server." ) -- cgit v1.2.3 From 122bd7adcf289751ffd9320bf92a962823b720f2 Mon Sep 17 00:00:00 2001 From: Hassan Abouelela Date: Sat, 23 Apr 2022 00:06:31 +0400 Subject: Invert Deleted Message Log Order Inverts the order messages are displayed in on the logs page to match the order they would be displayed in on discord (and how they would be read) Signed-off-by: Hassan Abouelela --- pydis_site/templates/staff/logs.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pydis_site') diff --git a/pydis_site/templates/staff/logs.html b/pydis_site/templates/staff/logs.html index 7bd6ba29..bccde9cb 100644 --- a/pydis_site/templates/staff/logs.html +++ b/pydis_site/templates/staff/logs.html @@ -14,7 +14,7 @@
  • Date: {{ deletion_context.creation }}
  • - {% for message in deletion_context.deletedmessage_set.all %} + {% for message in deletion_context.deletedmessage_set.all reversed %}
    Date: Sat, 23 Apr 2022 23:27:36 +0400 Subject: Migrate discord.py custom help command pin to site (#698) --- .../guides/python-guides/discordpy_help_command.md | 66 ++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 pydis_site/apps/content/resources/guides/python-guides/discordpy_help_command.md (limited to 'pydis_site') diff --git a/pydis_site/apps/content/resources/guides/python-guides/discordpy_help_command.md b/pydis_site/apps/content/resources/guides/python-guides/discordpy_help_command.md new file mode 100644 index 00000000..4b475146 --- /dev/null +++ b/pydis_site/apps/content/resources/guides/python-guides/discordpy_help_command.md @@ -0,0 +1,66 @@ +--- +title: Custom Help Command +description: "Overwrite discord.py's help command to implement custom functionality" +--- + +First, a basic walkthrough can be found [here](https://gist.github.com/InterStella0/b78488fb28cadf279dfd3164b9f0cf96) by Stella#2000 on subclassing the HelpCommand. It will provide some foundational knowledge that is required before attempting a more customizable help command. + +## Custom Subclass of Help Command +If the types of classes of the HelpCommand do not fit your needs, you can subclass HelpCommand and use the class mehods to customize the output. Below is a simple demonstration using the following methods that can also be found on the documenation: + +- [filter_commands](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.HelpCommand.filter_commands) + +- [send_group_help](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.HelpCommand.send_bot_help) + +- [send_command_help](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.HelpCommand.send_command_help) + +- [send_group_help](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.HelpCommand.send_group_help) + +- [send_error_message](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.HelpCommand.send_error_message) + +```python +class MyHelp(commands.HelpCommand): + + async def send_bot_help(self, mapping): + """ + This is triggered when !help is invoked. + + This example demonstrates how to list the commands that the member invoking the help command can run. + """ + filtered = await self.filter_commands(self.context.bot.commands, sort=True) # returns a list of command objects + names = [command.name for command in filtered] # iterating through the commands objects getting names + available_commands = "\n".join(names) # joining the list of names by a new line + embed = disnake.Embed(description=available_commands) + await self.context.send(embed=embed) + + async def send_command_help(self, command): + """This is triggered when !help is invoked.""" + await self.context.send("This is the help page for a command") + + async def send_group_help(self, group): + """This is triggered when !help is invoked.""" + await self.context.send("This is the help page for a group command") + + async def send_cog_help(self, cog): + """This is triggered when !help is invoked.""" + await self.context.send("This is the help page for a cog") + + async def send_error_message(self, error): + """If there is an error, send a embed containing the error.""" + channel = self.get_destination() # this defaults to the command context channel + await channel.send(error) + +bot.help_command = MyHelp() +``` + +You can handle when a user does not pass a command name when invoking the help command and make a fancy and customized embed; here a page that describes the bot and shows a list of commands is generally used. However if a command is passed in, you can display detailed information of the command. Below are references from the documentation below that can be utilised: + +- [Get the command object](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.get_command) + +- [Get the command name](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command.name) + +- [Get the command aliases](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command.aliases) + +- [Get the command brief](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command.brief) + +- [Get the command usage](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command.usage) -- cgit v1.2.3 From fc982b4bfad66ae9e5adfdb2ec42e142920dff49 Mon Sep 17 00:00:00 2001 From: minalike Date: Tue, 26 Apr 2022 23:45:37 -0400 Subject: Force line break at arbritrary points for really long words --- pydis_site/static/css/staff/logs.css | 3 +++ 1 file changed, 3 insertions(+) (limited to 'pydis_site') diff --git a/pydis_site/static/css/staff/logs.css b/pydis_site/static/css/staff/logs.css index acf4f1f7..56a12380 100644 --- a/pydis_site/static/css/staff/logs.css +++ b/pydis_site/static/css/staff/logs.css @@ -25,7 +25,10 @@ main.site-content { .discord-message:first-child { border-top: 1px; +} +.discord-message-content { + overflow-wrap: break-word; } .discord-message-header { -- cgit v1.2.3 From fa1dd4058e8606f165df5ff7902d9215eeec4679 Mon Sep 17 00:00:00 2001 From: Krypton Date: Thu, 28 Apr 2022 19:00:06 +0200 Subject: Using static images --- .../python-guides/discord-messages-with-colors.md | 8 ++++---- .../content/discord_colored_messages/ansi-colors.png | Bin 0 -> 33579 bytes .../images/content/discord_colored_messages/result.png | Bin 0 -> 13740 bytes 3 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 pydis_site/static/images/content/discord_colored_messages/ansi-colors.png create mode 100644 pydis_site/static/images/content/discord_colored_messages/result.png (limited to 'pydis_site') diff --git a/pydis_site/apps/content/resources/guides/python-guides/discord-messages-with-colors.md b/pydis_site/apps/content/resources/guides/python-guides/discord-messages-with-colors.md index c8e50d71..6845ce76 100644 --- a/pydis_site/apps/content/resources/guides/python-guides/discord-messages-with-colors.md +++ b/pydis_site/apps/content/resources/guides/python-guides/discord-messages-with-colors.md @@ -48,17 +48,17 @@ I simply use `\u001b[0;40m` (background color) and `\u001b[1;32m` (text color) a Alternatively you can also directly combine them into a single prefix like the following: `\u001b[1;40;32m` and you can also use multiple values. Something like `\u001b[1;40;4;32m` would underline the text, make it bold, make it green and have a dark blue background. Raw message:
    -\`\`\`ansi
    +\`\`\`ansi \u001b[0;40m\u001b[1;32mThat's some cool formatted text right?
    -or
    +or \u001b[1;40;32mThat's some cool formatted text right?
    \`\`\` Result: -![Background and text color](https://media.discordapp.net/attachments/739937507768270939/930460020603224084/Background-Text-Color.png) +![Background and text color result](/static/images/content/discord_colored_messages/result.png) The way the colors look like on Discord is shown in the image below: -![ANSI Colors](https://media.discordapp.net/attachments/739937507768270939/930825555803263016/ANSI-Colors.png) +![ANSI Colors](/static/images/content/discord_colored_messages/ansi-colors.png) Note: If the change as not been brought to you yet, or other users, then you can use other code blocks in the meantime to get colored text. See this gist: diff --git a/pydis_site/static/images/content/discord_colored_messages/ansi-colors.png b/pydis_site/static/images/content/discord_colored_messages/ansi-colors.png new file mode 100644 index 00000000..32af146f Binary files /dev/null and b/pydis_site/static/images/content/discord_colored_messages/ansi-colors.png differ diff --git a/pydis_site/static/images/content/discord_colored_messages/result.png b/pydis_site/static/images/content/discord_colored_messages/result.png new file mode 100644 index 00000000..a666804e Binary files /dev/null and b/pydis_site/static/images/content/discord_colored_messages/result.png differ -- cgit v1.2.3 From e3067dc451a3a5da02a90d61791c1c7c5731cab0 Mon Sep 17 00:00:00 2001 From: Krypton Date: Thu, 28 Apr 2022 19:17:00 +0200 Subject: Removed `
    `'s and used code block for raw message --- .../python-guides/discord-messages-with-colors.md | 15 +++++++++------ .../discord_colored_messages/ansi-colors.png | Bin 33579 -> 43004 bytes 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'pydis_site') diff --git a/pydis_site/apps/content/resources/guides/python-guides/discord-messages-with-colors.md b/pydis_site/apps/content/resources/guides/python-guides/discord-messages-with-colors.md index 6845ce76..9a69973e 100644 --- a/pydis_site/apps/content/resources/guides/python-guides/discord-messages-with-colors.md +++ b/pydis_site/apps/content/resources/guides/python-guides/discord-messages-with-colors.md @@ -44,15 +44,18 @@ Here is the list of values you can use to replace `{color}`: * 47: White Let's take an example, I want a bold green colored text with the very dark blue background. -I simply use `\u001b[0;40m` (background color) and `\u001b[1;32m` (text color) as prefix. Note that the order is **important**, first you give the background color and then the text color.
    +I simply use `\u001b[0;40m` (background color) and `\u001b[1;32m` (text color) as prefix. Note that the order is **important**, first you give the background color and then the text color. + Alternatively you can also directly combine them into a single prefix like the following: `\u001b[1;40;32m` and you can also use multiple values. Something like `\u001b[1;40;4;32m` would underline the text, make it bold, make it green and have a dark blue background. -Raw message:
    -\`\`\`ansi -\u001b[0;40m\u001b[1;32mThat's some cool formatted text right?
    +Raw message: +````nohighlight +```ansi +\u001b[0;40m\u001b[1;32mThat's some cool formatted text right? or -\u001b[1;40;32mThat's some cool formatted text right?
    -\`\`\` +\u001b[1;40;32mThat's some cool formatted text right? +``` +```` Result: diff --git a/pydis_site/static/images/content/discord_colored_messages/ansi-colors.png b/pydis_site/static/images/content/discord_colored_messages/ansi-colors.png index 32af146f..d7176393 100644 Binary files a/pydis_site/static/images/content/discord_colored_messages/ansi-colors.png and b/pydis_site/static/images/content/discord_colored_messages/ansi-colors.png differ -- cgit v1.2.3 From 5202bcda5d79f203a67b59990f0ed3d6c87044b2 Mon Sep 17 00:00:00 2001 From: Krypton Date: Thu, 28 Apr 2022 19:34:41 +0200 Subject: Sentences check --- .../resources/guides/python-guides/discord-messages-with-colors.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pydis_site') diff --git a/pydis_site/apps/content/resources/guides/python-guides/discord-messages-with-colors.md b/pydis_site/apps/content/resources/guides/python-guides/discord-messages-with-colors.md index 9a69973e..f4a747c9 100644 --- a/pydis_site/apps/content/resources/guides/python-guides/discord-messages-with-colors.md +++ b/pydis_site/apps/content/resources/guides/python-guides/discord-messages-with-colors.md @@ -11,7 +11,7 @@ To send colored text in a code block you need to first specify the `ansi` langua ``` *`\u001b` is the unicode escape for ESCAPE/ESC, meant to be used in the source of your bot (see ).* ***If you wish to send colored text without using your bot you need to copy the character from the website.*** -After you've written this, you can type and text you wish, and if you want to reset the color back to normal, then you need to use `\u001b[0m` as prefix. +After you've written this, you can now type the text you wish to color. If you want to reset the color back to normal, then you need to use the `\u001b[0m` prefix again. Here is the list of values you can use to replace `{format}`: -- cgit v1.2.3 From 8f433372ce889b9a61355ca64a23ca11417d920f Mon Sep 17 00:00:00 2001 From: Krypton Date: Thu, 28 Apr 2022 19:37:42 +0200 Subject: Fixed image not at new line --- .../resources/guides/python-guides/discord-messages-with-colors.md | 1 + 1 file changed, 1 insertion(+) (limited to 'pydis_site') diff --git a/pydis_site/apps/content/resources/guides/python-guides/discord-messages-with-colors.md b/pydis_site/apps/content/resources/guides/python-guides/discord-messages-with-colors.md index f4a747c9..e414ff39 100644 --- a/pydis_site/apps/content/resources/guides/python-guides/discord-messages-with-colors.md +++ b/pydis_site/apps/content/resources/guides/python-guides/discord-messages-with-colors.md @@ -62,6 +62,7 @@ Result: ![Background and text color result](/static/images/content/discord_colored_messages/result.png) The way the colors look like on Discord is shown in the image below: + ![ANSI Colors](/static/images/content/discord_colored_messages/ansi-colors.png) Note: If the change as not been brought to you yet, or other users, then you can use other code blocks in the meantime to get colored text. See this gist: -- cgit v1.2.3 From d25d4ed61c6cb4b8ee310e1647ab91fdd8fe83be Mon Sep 17 00:00:00 2001 From: Xithrius <15021300+Xithrius@users.noreply.github.com> Date: Thu, 28 Apr 2022 11:19:05 -0700 Subject: Don't do JSON as a database, kids. (#700) Migrate no-JSON-as-a-database pinned message to site --- .../python-guides/why-not-json-as-database.md | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 pydis_site/apps/content/resources/guides/python-guides/why-not-json-as-database.md (limited to 'pydis_site') diff --git a/pydis_site/apps/content/resources/guides/python-guides/why-not-json-as-database.md b/pydis_site/apps/content/resources/guides/python-guides/why-not-json-as-database.md new file mode 100644 index 00000000..ae34c2b4 --- /dev/null +++ b/pydis_site/apps/content/resources/guides/python-guides/why-not-json-as-database.md @@ -0,0 +1,28 @@ +--- +title: Why JSON is unsuitable as a database +description: The many reasons why you shouldn't use JSON as a database, and instead opt for SQL. +relevant_links: + Tips on Storing Data: https://tutorial.vcokltfre.dev/tips/storage/ +--- + +JSON, quite simply, is not a database. It's not designed to be a data storage format, +rather a wayof transmitting data over a network. It's also often used as a way of doing configuration files for programs. + +There is no redundancy built in to JSON. JSON is just a format, and Python has libraries for it +like json and ujson that let you load and dump it, sometimes to files, but that's all it does, write data to a file. +There is no sort of DBMS (Database Management System), which means no sort of sophistication in how the data is stored, +or built in ways to keep it safe and backed up, there's no built in encryption either - bear in mind +in larger applications encryption may be necessary for GDPR/relevant data protection regulations compliance. + +JSON, unlike relational databases, has no way to store relational data, +which is a very commonly needed way of storing data. +Relational data, as the name may suggest, is data that relates to other data. +For example if you have a table of users and a table of servers, the server table will probably have an owner field, +where you'd reference a user from the users table. (**This is only relevant for relational data**). + +JSON is primarily a KV (key-value) format, for example `{"a": "b"}` where `a` is the key and `b` is the value, +but what if you want to search not by that key but by a sub-key? Well, instead of being able to quickly use `var[key]`, +which in a Python dictionary has a constant return time (for more info look up hash tables), +you now have to iterate through every object in the dictionary and compare to find what you're looking for. +Most relational database systems, like MySQL, MariaDB, and PostgreSQL have ways of indexing secondary fields +apart from the primary key so that you can easily search by multiple attributes. -- cgit v1.2.3 From ad41d8d2a58b73bd4402f945f0ae8fcc7b49bda4 Mon Sep 17 00:00:00 2001 From: Krypton Date: Thu, 28 Apr 2022 22:20:52 +0200 Subject: Using hyperlink for gist link at the bottom --- .../resources/guides/python-guides/discord-messages-with-colors.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pydis_site') diff --git a/pydis_site/apps/content/resources/guides/python-guides/discord-messages-with-colors.md b/pydis_site/apps/content/resources/guides/python-guides/discord-messages-with-colors.md index e414ff39..62ff61f9 100644 --- a/pydis_site/apps/content/resources/guides/python-guides/discord-messages-with-colors.md +++ b/pydis_site/apps/content/resources/guides/python-guides/discord-messages-with-colors.md @@ -65,4 +65,4 @@ The way the colors look like on Discord is shown in the image below: ![ANSI Colors](/static/images/content/discord_colored_messages/ansi-colors.png) -Note: If the change as not been brought to you yet, or other users, then you can use other code blocks in the meantime to get colored text. See this gist: +Note: If the change as not been brought to you yet, or other users, then you can use other code blocks in the meantime to get colored text. See **[this gist](https://gist.github.com/matthewzring/9f7bbfd102003963f9be7dbcf7d40e51)**. -- cgit v1.2.3 From ebdba4488b7def58614dc221215a2430d6df6ecf Mon Sep 17 00:00:00 2001 From: Diabolical5777 <84365102+Diabolical5777@users.noreply.github.com> Date: Wed, 4 May 2022 20:00:15 +0400 Subject: Add recommended hosting service page (#712) * add article discussing free hosting services * add hsoting and VPS services article * Merge branch 'pinned_messages' of https://github.com/Diabolical5777/site into pinned_messages * Delete free_hosting_services.md * Update pydis_site/apps/content/resources/guides/python-guides/vps_services.md Co-authored-by: Bluenix * Update pydis_site/apps/content/resources/guides/python-guides/vps_services.md Co-authored-by: Bluenix * Update pydis_site/apps/content/resources/guides/python-guides/vps_services.md Co-authored-by: Bluenix * add vps and hosting service guide * Update pydis_site/apps/content/resources/guides/python-guides/vps_services.md Co-authored-by: Bluenix * add article on VPS and free hosting services * Update vps_services.md * Update vps_services.md Co-authored-by: Bluenix Co-authored-by: ChrisJL --- .../resources/guides/python-guides/vps_services.md | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 pydis_site/apps/content/resources/guides/python-guides/vps_services.md (limited to 'pydis_site') diff --git a/pydis_site/apps/content/resources/guides/python-guides/vps_services.md b/pydis_site/apps/content/resources/guides/python-guides/vps_services.md new file mode 100644 index 00000000..710fd914 --- /dev/null +++ b/pydis_site/apps/content/resources/guides/python-guides/vps_services.md @@ -0,0 +1,58 @@ +--- +title: VPS and Free Hosting Service for Discord bots +description: This article lists recommended VPS services and covers the disasdvantages of utilising a free hosting service to run a discord bot. +toc: 2 +--- + +## Recommended VPS services + +If you need to run your bot 24/7 (with no downtime), you should consider using a virtual private server (VPS). Here is a list of VPS services that are sufficient for running Discord bots. + +* Europe + * [netcup](https://www.netcup.eu/) + * Germany & Austria data centres. + * Great affiliate program. + * [Yandex Cloud](https://cloud.yandex.ru/) + * Vladimir, Ryazan, and Moscow region data centres. + * [Scaleway](https://www.scaleway.com/) + * France data centre. + * [Time 4 VPS](https://www.time4vps.eu/) + * Lithuania data centre. +* US + * [GalaxyGate](https://galaxygate.net/) + * New York data centre. + * Great affiliate program. +* Global + * [Linode](https://www.linode.com/) + * [Digital Ocean](https://www.digitalocean.com/) + * [OVHcloud](https://www.ovhcloud.com/) + * [Vultr](https://www.vultr.com/) + + +## Why not to use free hosting services for bots? +While these may seem like nice and free services, it has a lot more caveats than you may think. For example, the drawbacks of using common free hosting services to host a discord bot are discussed below. + +### Replit + +- The machines are super underpowered, resulting in your bot lagging a lot as it gets bigger. + +- You need to run a webserver alongside your bot to prevent it from being shut off. This uses extra machine power. + +- Repl.it uses an ephemeral file system. This means any file you saved through your bot will be overwritten when you next launch. + +- They use a shared IP for everything running on the service. +This one is important - if someone is running a user bot on their service and gets banned, everyone on that IP will be banned. Including you. + +### Heroku +- Bots are not what the platform is designed for. Heroku is designed to provide web servers (like Django, Flask, etc). This is why they give you a domain name and open a port on their local emulator. + +- Heroku's environment is heavily containerized, making it significantly underpowered for a standard use case. + +- Heroku's environment is volatile. In order to handle the insane amount of users trying to use it for their own applications, Heroku will dispose your environment every time your application dies unless you pay. + +- Heroku has minimal system dependency control. If any of your Python requirements need C bindings (such as PyNaCl + binding to libsodium, or lxml binding to libxml), they are unlikely to function properly, if at all, in a native + environment. As such, you often need to resort to adding third-party buildpacks to facilitate otherwise normal + CPython extension functionality. (This is the reason why voice doesn't work natively on heroku) + +- Heroku only offers a limited amount of time on their free programme for your applications. If you exceed this limit, which you probably will, they'll shut down your application until your free credit resets. -- cgit v1.2.3 From 1167ed8ad6a7772870ca50f2e657261889624718 Mon Sep 17 00:00:00 2001 From: ChrisJL Date: Sat, 30 Apr 2022 18:31:05 +0100 Subject: Add message ID to delete logs --- pydis_site/templates/staff/logs.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pydis_site') diff --git a/pydis_site/templates/staff/logs.html b/pydis_site/templates/staff/logs.html index bccde9cb..5e2a200b 100644 --- a/pydis_site/templates/staff/logs.html +++ b/pydis_site/templates/staff/logs.html @@ -22,7 +22,7 @@
    -- cgit v1.2.3 From 5f18f0b1aa16be4c2e1b375a0ca0bd4089462dcc Mon Sep 17 00:00:00 2001 From: Daniel Brown Date: Mon, 9 May 2022 11:54:06 -0500 Subject: Add video type to Python Morsels resoure Adding the video type at the request of Trey Hunner. --- pydis_site/apps/resources/resources/python_morsels.yaml | 1 + 1 file changed, 1 insertion(+) (limited to 'pydis_site') diff --git a/pydis_site/apps/resources/resources/python_morsels.yaml b/pydis_site/apps/resources/resources/python_morsels.yaml index bbc8133b..4cdff36b 100644 --- a/pydis_site/apps/resources/resources/python_morsels.yaml +++ b/pydis_site/apps/resources/resources/python_morsels.yaml @@ -17,3 +17,4 @@ tags: - intermediate type: - interactive + - video -- cgit v1.2.3