Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ jobs:
- name: TruffleHog Secret Scanner
uses: trufflesecurity/trufflehog@main
with:
path: ./
base: ${{ github.event.repository.default_branch }}
head: HEAD
extra_args: --only-verified

sast-scan:
Expand All @@ -50,4 +47,4 @@ jobs:

- name: Run Ruff Code Integrity Check
run: |
ruff check src/
ruff check src/ --select E9,F63,F7,F82
3 changes: 2 additions & 1 deletion src/core/audit.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

import discord
from datetime import datetime


class AuditLogger:
def __init__(self, client, config):
Expand Down
12 changes: 7 additions & 5 deletions src/core/config.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import os
import yaml
from dataclasses import dataclass, field
from typing import List, Dict, Any
from typing import Any

import yaml


@dataclass
class ServerConfig:
guild_id: int = 0
owner_ids: List[int] = field(default_factory=list)
owner_ids: list[int] = field(default_factory=list)
name: str = "OpenWinter"
tagline: str = "Build together. Share freely."

Expand Down Expand Up @@ -49,7 +51,7 @@ class AIConfig:
memory_ttl_seconds: int = 7200

class AppConfig:
def __init__(self, config_dict: Dict[str, Any]):
def __init__(self, config_dict: dict[str, Any]):
srv = config_dict.get("server", {})
self.server = ServerConfig(
guild_id=int(os.getenv("DISCORD_GUILD_ID", srv.get("guild_id", 0))),
Expand All @@ -64,7 +66,7 @@ def __init__(self, config_dict: Dict[str, Any]):
# Radio stations
radio_data = config_dict.get("radio", {})
self.default_station = radio_data.get("default_station", "lofi")
self.stations: Dict[str, RadioStation] = {}
self.stations: dict[str, RadioStation] = {}
for key, st_data in radio_data.get("stations", {}).items():
self.stations[key] = RadioStation(**st_data)

Expand Down
3 changes: 2 additions & 1 deletion src/core/security.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import re
from datetime import datetime, timedelta
from collections import defaultdict
from datetime import datetime, timedelta

import discord

PHISH_REGEX = re.compile(
Expand Down
6 changes: 3 additions & 3 deletions src/modules/ai/engine.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import os
import aiohttp
import discord
from datetime import datetime
from collections import defaultdict
from datetime import datetime

import aiohttp

DEFAULT_SYSTEM_PROMPT = (
"You are SirDeep, the resident open-source AI companion for this developer community. "
Expand Down
1 change: 1 addition & 0 deletions src/modules/ai/view.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import random

import discord

STARTERS = [
Expand Down
8 changes: 5 additions & 3 deletions src/modules/debates/engine.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import os
import json
import os
import random
from datetime import datetime

import discord


class DebateEngine:
def __init__(self, client, config):
self.client = client
Expand Down Expand Up @@ -87,8 +89,8 @@ async def post_debate(self, guild: discord.Guild, target_channel: discord.TextCh
f"> **\"{debate['question']}\"**\n\n"
f"◈ **KEY ARCHITECTURAL TRADE-OFFS:**\n"
+ "\n".join([f"• {p}" for p in debate["points"]]) + "\n\n"
f"◈ **COMMUNITY GUIDELINES:**\n"
f"Jump into the **💬 Discussion Thread** attached below! Post your real-world benchmarks, war stories, and code snippets."
"◈ **COMMUNITY GUIDELINES:**\n"
"Jump into the **💬 Discussion Thread** attached below! Post your real-world benchmarks, war stories, and code snippets."
),
color=0x00D2FF,
timestamp=discord.utils.utcnow()
Expand Down
6 changes: 3 additions & 3 deletions src/modules/leveling/cards.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import io
import os
import sys
import io
from urllib.parse import urlparse

import aiohttp
from PIL import Image, ImageDraw, ImageFont

Expand Down Expand Up @@ -45,8 +46,7 @@ def draw_rounded_rect(draw, bbox, radius, fill, outline=None, width=1):

def clean_tag_text(text: str) -> str:
for prefix in ["💻 ", "🌐 ", "🧠 ", "🎨 ", "📢 ", "🌱 ", "🛠️ ", "⚡ ", "❄️ ", "💎 "]:
if text.startswith(prefix):
text = text[len(prefix):]
text = text.removeprefix(prefix)
return text.strip()

async def render_contributor_card(member, guild, level=1, xp=0, needed_xp=100, rank_pos=1, rep_points=0, specializations=None):
Expand Down
5 changes: 4 additions & 1 deletion src/modules/leveling/engine.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import os
import json
import os
import random
from datetime import datetime

import discord

from .cards import render_contributor_card


class LevelingEngine:
def __init__(self, client, config):
self.client = client
Expand Down
5 changes: 3 additions & 2 deletions src/modules/radio/player.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import asyncio
import os
import sys
import shutil
import asyncio
import sys
from urllib.parse import urlparse

import discord

FFMPEG_OPTIONS = {
Expand Down
1 change: 1 addition & 0 deletions src/modules/radio/view.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import discord


class RadioControlView(discord.ui.View):
def __init__(self, radio_player, config):
super().__init__(timeout=None)
Expand Down
Loading