Skip to content

Commit

Permalink
Removed astaria references
Browse files Browse the repository at this point in the history
  • Loading branch information
MaticConradi committed Mar 13, 2024
1 parent 6d5a721 commit 8598210
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 53 deletions.
2 changes: 1 addition & 1 deletion build/dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN apt-get update && apt-get install -y git build-essential
COPY ./build/requirements.txt ./
RUN pip install -r ./requirements.txt

RUN git clone https://github.com/alphabotsystem/dependencies.git && cd ./dependencies && git checkout v2.12.0
RUN git clone https://github.com/alphabotsystem/dependencies.git && cd ./dependencies && git checkout v2.12.2
RUN pip install ./dependencies/py/database
RUN rm -r ./dependencies

Expand Down
53 changes: 1 addition & 52 deletions src/discord_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
# -------------------------

ALPHA_GUILD_ID = 414498292655980583
ASTARIA_GUILD_ID = 1110573693664510032

intents = Intents.all()
bot = Client(intents=intents, status=Status.invisible, activity=None)
Expand All @@ -43,8 +42,6 @@
async def on_member_join(member):
if member.guild.id == ALPHA_GUILD_ID:
await update_alpha_guild_roles(only=member.id)
elif member.guild.id == ASTARIA_GUILD_ID:
await update_astaria_guild_roles(only=member.id)

@tasks.loop(minutes=5.0)
async def update_alpha_guild_roles(only=None):
Expand Down Expand Up @@ -99,40 +96,6 @@ async def update_alpha_guild_roles(only=None):
finally:
print(f"Updated Alpha.bot roles in {round(time() - start, 2)} seconds.")

@tasks.loop(minutes=30.0)
async def update_astaria_guild_roles(only=None):
if not environ["PRODUCTION"]: return
start = time()
try:
if not await accountProperties.check_status(): return
accounts = await accountProperties.keys()
if len(accounts.keys()) == 0: return
matches = {value: key for key, value in accounts.items()}

for member in astariaGuild.members:
if only is not None and only != member.id: continue

accountId = matches.get(str(member.id))

if accountId is not None:
properties = await accountProperties.get(accountId)
if properties is None: continue

if cachedAstariaRoles[0] not in member.roles:
try: await member.add_roles(cachedAstariaRoles[0])
except: pass

elif cachedAstariaRoles[0] in member.roles:
try: await member.remove_roles(cachedAstariaRoles[0])
except: pass

except CancelledError: pass
except:
print(format_exc())
if environ["PRODUCTION"]: logging.report_exception()
finally:
print(f"Updated Alpha.bot x Astaria roles in {round(time() - start, 2)} seconds.")

async def handle_bot_license(member, accountId, add=True):
if add:
if cachedAlphaRoles[1] not in member.roles:
Expand Down Expand Up @@ -416,37 +379,29 @@ async def on_message(message):

accountProperties = DatabaseConnector(mode="account")
alphaGuild = None
astariaGuild = None
cachedAlphaRoles = None
cachedAstariaRoles = None

BOTS = [401328409499664394, 739420701211099178]
TEST_CHANNELS = [814143168996048936, 417784977841979402]
lastHeadsup = {}

@bot.event
async def on_ready():
global alphaGuild, astariaGuild, cachedAlphaRoles, cachedAstariaRoles
global alphaGuild, cachedAlphaRoles

alphaGuild = bot.get_guild(ALPHA_GUILD_ID)
astariaGuild = bot.get_guild(ASTARIA_GUILD_ID)
cachedAlphaRoles = [
getFromDiscord(alphaGuild.roles, id=484387309303758848), # Subscriber role
getFromDiscord(alphaGuild.roles, id=1041085930880127098), # Licensing role
getFromDiscord(alphaGuild.roles, id=593768473277104148), # Ichibot role
getFromDiscord(alphaGuild.roles, id=647824289923334155), # Registered role
]
cachedAstariaRoles = [
getFromDiscord(astariaGuild.roles, id=1134363671930355743), # Community owner role
]

await update_system_status()
await update_static_messages()

if not update_alpha_guild_roles.is_running():
update_alpha_guild_roles.start()
if not update_astaria_guild_roles.is_running():
update_astaria_guild_roles.start()
if not update_system_status.is_running():
update_system_status.start()
if not update_nickname_review.is_running():
Expand All @@ -465,12 +420,6 @@ async def update_static_messages():
if guildRulesMessage is not None: await guildRulesMessage.edit(content=None, embed=Embed(title="All members of the official Alpha.bot community must follow all community rules. Failure to do so will result in a warning, kick, or ban, based on our sole discretion.", description="[Community rules](https://www.alpha.bot/community-rules) (last modified on July 1, 2023).", color=0x673AB7), suppress=False)
if termsOfServiceMessage is not None: await termsOfServiceMessage.edit(content=None, embed=Embed(title="By using Alpha.bot branded services you agree to our Terms of Service and Privacy Policy. You can read them on our website.", description="[Terms of Service](https://www.alpha.bot/terms-of-service) (last modified on September 25, 2022)\n[Privacy Policy](https://www.alpha.bot/privacy-policy) (last modified on June 24, 2022).", color=0x673AB7), suppress=False)

astariaRulesAndTosChannel = bot.get_channel(1127148465189834773)
astariaGuildRulesMessage = await astariaRulesAndTosChannel.fetch_message(1127155556797386813)
astariaTermsOfServiceMessage = await astariaRulesAndTosChannel.fetch_message(1127155574883221635)
if astariaGuildRulesMessage is not None: await astariaGuildRulesMessage.edit(content=None, embed=Embed(title="All members of the official Alpha.bot community must follow all community rules. Failure to do so will result in a warning, kick, or ban, based on our sole discretion.", description="[Community rules](https://www.alpha.bot/community-rules) (last modified on July 1, 2023).", color=0x673AB7), suppress=False)
if astariaTermsOfServiceMessage is not None: await astariaTermsOfServiceMessage.edit(content=None, embed=Embed(title="By using Alpha.bot branded services you agree to our Terms of Service and Privacy Policy. You can read them on our website.", description="[Terms of Service](https://www.alpha.bot/terms-of-service) (last modified on September 25, 2022)\n[Privacy Policy](https://www.alpha.bot/privacy-policy) (last modified on June 24, 2022).", color=0x673AB7), suppress=False)

except CancelledError: pass
except:
print(format_exc())
Expand Down

0 comments on commit 8598210

Please sign in to comment.