Skip to content

Commit

Permalink
Merge pull request #66 from trag1c/remove-invite-system
Browse files Browse the repository at this point in the history
feat: remove the invite system
  • Loading branch information
mitchellh authored Dec 22, 2024
2 parents f471148 + f20dc17 commit 4cd2b47
Show file tree
Hide file tree
Showing 25 changed files with 11 additions and 1,146 deletions.
9 changes: 1 addition & 8 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
BOT_DATABASE_URL=postgresql+psycopg://user:pass@localhost:5432/ghostty-bot
BOT_GITHUB_ROLE_ID=1245859137473220698
BOT_GUILD_ID=1162081956004114432
BOT_INVITELOG_CHANNEL_ID=1245859287634524358
BOT_MOD_ROLE_ID=1245855561015099402
BOT_MEDIA_CHANNEL_ID=1245859287631622769
BOT_MOD_ROLE_ID=1245855561015099402
BOT_SHOWCASE_CHANNEL_ID=1245859287634524358
BOT_TESTER_ROLE_ID=1245854613434011749
BOT_TOKEN=CdwafxF9MTRvxKKtXpeqKdI4qE.P5PKdC.ke2veU7KdecW5jxgTu-5fgCUssNlPAdNf3tsG7
BOT_VOUCH_CHANNEL_ID=1245859287634524358
GITHUB_ORG=ghostty-org
GITHUB_REPO=ghostty
GITHUB_TESTER_TEAM=beta
GITHUB_TOKEN=gho_WrRihf6P7ksVXolv0WLDe2oTFT8953Vxww8K
SENTRY_DSN=abcd
2 changes: 0 additions & 2 deletions app/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import sentry_sdk

from app.core import bot, config
from app.db import connect as db

if config.SENTRY_DSN is not None:
sentry_sdk.init(
Expand All @@ -20,5 +19,4 @@
)
sleep(60 * 25)

db.attempt_connect()
bot.run(config.BOT_TOKEN)
14 changes: 5 additions & 9 deletions app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@
dotenv.load_dotenv()

BOT_TOKEN = os.environ["BOT_TOKEN"]
GITHUB_TOKEN = os.environ["GITHUB_TOKEN"]

GITHUB_ORG = os.environ["GITHUB_ORG"]
GITHUB_REPO = os.environ["GITHUB_REPO"]
GITHUB_TESTER_TEAM = os.environ["GITHUB_TESTER_TEAM"]
GUILD_ID = int(os.environ["BOT_GUILD_ID"])
MOD_ROLE_ID = int(os.environ["BOT_MOD_ROLE_ID"])
GITHUB_ROLE_ID = int(os.environ["BOT_GITHUB_ROLE_ID"])
TESTER_ROLE_ID = int(os.environ["BOT_TESTER_ROLE_ID"])
GITHUB_TOKEN = os.environ["GITHUB_TOKEN"]

SENTRY_DSN = os.getenv("SENTRY_DSN")

MEDIA_CHANNEL_ID = int(os.environ["BOT_MEDIA_CHANNEL_ID"])
MOD_ROLE_ID = int(os.environ["BOT_MOD_ROLE_ID"])
SHOWCASE_CHANNEL_ID = int(os.environ["BOT_SHOWCASE_CHANNEL_ID"])
VOUCH_CHANNEL_ID = int(os.environ["BOT_VOUCH_CHANNEL_ID"])
INVITELOG_CHANNEL_ID = int(os.environ["BOT_INVITELOG_CHANNEL_ID"])
BOT_DATABASE_URL = os.environ["BOT_DATABASE_URL"]
33 changes: 0 additions & 33 deletions app/core.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import annotations

import datetime as dt
import os
import sys
from pathlib import Path
Expand All @@ -11,18 +10,14 @@
from discord.ext import commands
from sentry_sdk import capture_exception

from app.db.connect import Session
from app.db.utils import fetch_user
from app.features.entity_mentions import ENTITY_REGEX, handle_entities
from app.features.message_filter import check_message_filters
from app.setup import bot, config
from app.utils import is_dm, is_mod, try_dm
from app.view import register_vouch_view


@bot.event
async def on_ready() -> None:
register_vouch_view()
print(f"Bot logged on as {bot.user}!")


Expand All @@ -48,20 +43,6 @@ async def on_message(message: discord.Message) -> None:
if message.author == bot.user:
return

# Special trigger command to request an invite.
# trigger = "I WANT GHOSTTY"
# if message.content.strip().upper() == trigger:
# if message.guild is None:
# await message.channel.send("Tell me you want me in the Ghostty server!")
# return
#
# if message.content.strip() == trigger:
# # TODO
# return
#
# await message.channel.send("Louder. LOUDER!!")
# return

# Simple test
if message.guild is None and message.content == "ping":
await try_dm(message.author, "pong")
Expand All @@ -79,20 +60,6 @@ async def on_message(message: discord.Message) -> None:
await sync(bot, message)


@bot.event
async def on_member_update(before: discord.Member, after: discord.Member) -> None:
if not (new_roles := set(after.roles) - set(before.roles)):
return
if next(iter(new_roles)).id == config.TESTER_ROLE_ID:
user = fetch_user(after, new_user=True)
if user.tester_since is None:
with Session() as session:
user.tester_since = dt.datetime.now(tz=dt.UTC)
user.is_vouch_blacklisted = False
session.add(user)
session.commit()


async def sync(bot: commands.Bot, message: discord.Message) -> None:
"""Syncs all global commands."""
if is_dm(message.author) or not is_mod(message.author):
Expand Down
3 changes: 0 additions & 3 deletions app/db/__init__.py

This file was deleted.

26 changes: 0 additions & 26 deletions app/db/connect.py

This file was deleted.

41 changes: 0 additions & 41 deletions app/db/models.py

This file was deleted.

47 changes: 0 additions & 47 deletions app/db/utils.py

This file was deleted.

4 changes: 2 additions & 2 deletions app/features/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from app.features import beta_waitlist, entity_mentions, invites, mod, vouches
from app.features import entity_mentions, mod

__all__ = ("beta_waitlist", "invites", "entity_mentions", "mod", "vouches")
__all__ = ("entity_mentions", "mod")
65 changes: 0 additions & 65 deletions app/features/beta_waitlist.py

This file was deleted.

5 changes: 1 addition & 4 deletions app/features/entity_mentions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from github.Repository import Repository

from app.setup import config, gh
from app.utils import is_dm, is_tester, try_dm
from app.utils import is_dm, try_dm
from app.view import DeleteMention

REPO_URL = "https://github.com/ghostty-org/ghostty/"
Expand Down Expand Up @@ -45,9 +45,6 @@ async def handle_entities(message: Message) -> None:
)
return

if not is_tester(message.author):
return

repo = gh.get_repo(f"{config.GITHUB_ORG}/{config.GITHUB_REPO}", lazy=True)

entities: list[str] = []
Expand Down
Loading

0 comments on commit 4cd2b47

Please sign in to comment.