-
Notifications
You must be signed in to change notification settings - Fork 3
fix some bug of ctf channel join button and show more information in /ctf_menu #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -74,7 +74,9 @@ Then edit the `.env` file with your specific settings. Focus on these key variab | |||||
| |----------|-------------|---------| | ||||||
| | `DISCORD_BOT_TOKEN` | Your Discord bot token | `MTIzNDU2Nzg5...` | | ||||||
| | `CHECK_INTERVAL_MINUTES` | How often to check for new CTFs | `30` (default) | | ||||||
| | `ANNOUNCEMENT_CHANNEL_ID` | Channel name for announcements | `ctf-announcements` | | ||||||
| | `ANNOUNCEMENT_CHANNEL_ID` | Channel id for announcements | `911612541829009418` | | ||||||
| | `CTF_CHANNEL_CATETORY_ID` | Category id for CTF event channel creations | `1454642939559940329` | | ||||||
|
||||||
| | `CTF_CHANNEL_CATETORY_ID` | Category id for CTF event channel creations | `1454642939559940329` | | |
| | `CTF_CHANNEL_CATEGORY_ID` | Category id for CTF event channel creations | `1454642939559940329` | |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -112,10 +112,23 @@ fi | |||||||||||||||||||||
| echo "" | ||||||||||||||||||||||
| echo "Announcement Channel ID:" | ||||||||||||||||||||||
| echo " The Discord channel where CTF announcements will be posted" | ||||||||||||||||||||||
| echo " The channel name that on your server" | ||||||||||||||||||||||
| echo " The channel id that on your server" | ||||||||||||||||||||||
| while true; do | ||||||||||||||||||||||
| read -p " Paste your Discord Channel Name: " ANNOUNCEMENT_CHANNEL_NAME | ||||||||||||||||||||||
| if [ -n "$ANNOUNCEMENT_CHANNEL_NAME" ]; then | ||||||||||||||||||||||
| read -p " Paste your Discord Channel ID: " ANNOUNCEMENT_CHANNEL_ID | ||||||||||||||||||||||
| if [ -n "$ANNOUNCEMENT_CHANNEL_ID" ]; then | ||||||||||||||||||||||
| break | ||||||||||||||||||||||
| else | ||||||||||||||||||||||
| echo " Error: Discord Channel Name cannot be empty. Please try again." | ||||||||||||||||||||||
|
||||||||||||||||||||||
| fi | ||||||||||||||||||||||
| done | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| echo "" | ||||||||||||||||||||||
| echo "CTF Channel Category ID:" | ||||||||||||||||||||||
| echo " The Discord category where CTF channels will be created" | ||||||||||||||||||||||
| echo " The category id that on your server" | ||||||||||||||||||||||
| while true; do | ||||||||||||||||||||||
| read -p " Paste your Discord Category ID: " CTF_CHANNEL_CATETORY_ID | ||||||||||||||||||||||
| if [ -n "$CTF_CHANNEL_CATETORY_ID" ]; then | ||||||||||||||||||||||
|
Comment on lines
+130
to
+131
|
||||||||||||||||||||||
| read -p " Paste your Discord Category ID: " CTF_CHANNEL_CATETORY_ID | |
| if [ -n "$CTF_CHANNEL_CATETORY_ID" ]; then | |
| read -p " Paste your Discord Category ID: " CTF_CHANNEL_CATEGORY_ID | |
| if [ -n "$CTF_CHANNEL_CATEGORY_ID" ]; then |
Copilot
AI
Jan 4, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling error in variable name: "CATETORY" should be "CATEGORY". This should match the corrected spelling in the configuration.
| read -p " Paste your Discord Category ID: " CTF_CHANNEL_CATETORY_ID | |
| if [ -n "$CTF_CHANNEL_CATETORY_ID" ]; then | |
| read -p " Paste your Discord Category ID: " CTF_CHANNEL_CATEGORY_ID | |
| if [ -n "$CTF_CHANNEL_CATEGORY_ID" ]; then | |
| # Backward compatibility: keep old misspelled variable name in sync | |
| CTF_CHANNEL_CATETORY_ID="$CTF_CHANNEL_CATEGORY_ID" |
Copilot
AI
Jan 4, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message still refers to "Discord Channel Name" but the prompt has been changed to request "Discord Category ID". The error message should be updated to match the new prompt context.
| echo " Error: Discord Channel Name cannot be empty. Please try again." | |
| echo " Error: Discord Category ID cannot be empty. Please try again." |
Copilot
AI
Jan 4, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling error in variable name: "CATETORY" should be "CATEGORY". This should match the corrected spelling in the configuration.
Copilot
AI
Jan 4, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling error in variable name: "CATETORY" should be "CATEGORY". This should match the corrected spelling in the configuration.
| CTF_CHANNEL_CATETORY_ID=$CTF_CHANNEL_CATETORY_ID | |
| CTF_CHANNEL_CATEGORY_ID=$CTF_CHANNEL_CATEGORY_ID |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -112,11 +112,11 @@ async def callback(self, interaction: discord.Interaction): | |||||
| channel_name = self.children[0].value | ||||||
|
|
||||||
| # find category | ||||||
| category_name = "Incoming/Running CTF" | ||||||
| category_id = settings.CTF_CHANNEL_CATETORY_ID | ||||||
|
||||||
| category_id = settings.CTF_CHANNEL_CATETORY_ID | |
| category_id = settings.CTF_CHANNEL_CATEGORY_ID |
Copilot
AI
Jan 4, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message incorrectly states the category should have "name=category_name" when the code is now using ID-based lookup with "id=category_id". The error message should be updated to reflect that category lookup is now based on ID, not name.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -7,17 +7,14 @@ class Settings(BaseSettings): | |||||
| # CTFTime tracking configuration | ||||||
| CTFTIME_API_URL:str="https://ctftime.org/api/v1/events/" | ||||||
| TEAM_API_URL:str="https://ctftime.org/api/v1/teams/" | ||||||
| CTFTIME_SEARCH_DAYS:int=+90 | ||||||
| DATABASE_SEARCH_DAYS:int=-90 # known events: finish > now_day+(-90) | ||||||
| ANNOUNCEMENT_CHANNEL_NAME:str | ||||||
| ANNOUNCEMENT_CHANNEL_ID:int | ||||||
| CTF_CHANNEL_CATETORY_ID:int | ||||||
|
||||||
| CTF_CHANNEL_CATETORY_ID:int | |
| CTF_CHANNEL_CATEGORY_ID:int |
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -12,7 +12,7 @@ async def fetch_ctf_events(event_id:Optional[int]=None) -> List[Dict[str, Any]]: | |||
| params = { | ||||
| "limit": 20, | ||||
| "start": int(datetime.now().timestamp()), | ||||
| "finish": int((datetime.now() + timedelta(days=settings.CTFTIME_SEARCH_DAYS)).timestamp()), | ||||
| #"finish": int((datetime.now() + timedelta(days=settings.CTFTIME_SEARCH_DAYS)).timestamp()), | ||||
|
||||
| #"finish": int((datetime.now() + timedelta(days=settings.CTFTIME_SEARCH_DAYS)).timestamp()), |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -9,6 +9,7 @@ | |||||
| from src import crud | ||||||
| from src.utils.ctf_api import fetch_ctf_events | ||||||
| from src.utils.embed_creator import create_event_embed | ||||||
| from src.config import settings | ||||||
|
|
||||||
| logger = logging.getLogger(__name__) | ||||||
|
|
||||||
|
|
@@ -59,11 +60,11 @@ async def join_channel( | |||||
| event_api:Event = events_api[0] | ||||||
|
|
||||||
| # create channel | ||||||
| category_name = "Incoming/Running CTF" | ||||||
| category_id = settings.CTF_CHANNEL_CATETORY_ID | ||||||
|
||||||
| category_id = settings.CTF_CHANNEL_CATETORY_ID | |
| category_id = settings.CTF_CHANNEL_CATEGORY_ID |
Copilot
AI
Jan 4, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message incorrectly states the category should have "name=category_name" when the code is now using ID-based lookup with "id=category_id". The error message should be updated to reflect that category lookup is now based on ID, not name.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling error in variable name: "CATETORY" should be "CATEGORY". This should match the corrected spelling in the configuration.