Skip to content

Commit

Permalink
use new utils
Browse files Browse the repository at this point in the history
  • Loading branch information
pvyParts committed Oct 19, 2024
1 parent 16eca6f commit fefea4b
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions ghosttools/ghost_cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import discord
# AA-Discordbot
from aadiscordbot.app_settings import get_all_servers
from aadiscordbot.cogs.utils.decorators import has_any_perm
from allianceauth.eveonline.models import EveCharacter
from discord import AutocompleteContext, option
Expand Down Expand Up @@ -100,7 +101,7 @@ async def search_characters(ctx: AutocompleteContext):
"""Returns a list of colors that begin with the characters entered so far."""
return list(EveCharacter.objects.filter(character_name__icontains=ctx.value).values_list('character_name', flat=True)[:10])

@commands.slash_command(name='ghost', guild_ids=[int(settings.DISCORD_GUILD_ID)])
@commands.slash_command(name='ghost', guild_ids=get_all_servers())
@option("character", description="Search for a Ghost!", autocomplete=search_characters)
async def slash_ghost(
self,
Expand All @@ -114,12 +115,13 @@ async def slash_ghost(
try:
await ctx.defer()
has_any_perm(ctx.author.id, [
'ghosttools.access_ghost_tools'])
'ghosttools.access_ghost_tools'],
guild=ctx.guild)
return await ctx.respond(embed=self.ghost_embed(character))
except commands.MissingPermissions as e:
return await ctx.respond(e.missing_permissions[0], ephemeral=True)

@commands.slash_command(name='ghosts_processed', guild_ids=[int(settings.DISCORD_GUILD_ID)])
@commands.slash_command(name='ghosts_processed', guild_ids=get_all_servers())
async def slash_ghosts_done(
self,
ctx
Expand All @@ -131,7 +133,8 @@ async def slash_ghosts_done(
try:
await ctx.defer(ephemeral=True)
has_any_perm(ctx.author.id, [
'ghosttools.access_ghost_tools'])
'ghosttools.access_ghost_tools'],
guild=ctx.guild)
await ctx.respond("Ok!", ephemeral=True)
return await ctx.send("All Ghost applications processed!\nPlease log in your ghost and accept the invite!\nIf you were rejected please check the reason before you re-apply!")
except commands.MissingPermissions as e:
Expand Down Expand Up @@ -159,7 +162,7 @@ async def open_ticket(

@commands.slash_command(
name='recruit_me',
guild_ids=[int(settings.DISCORD_GUILD_ID)]+settings.DISCORD_GUILD_IDS
guild_ids=get_all_servers()
)
async def slash_halp(
self,
Expand All @@ -172,7 +175,7 @@ async def slash_halp(

@commands.message_command(
name="Create Recruitment Thread",
guild_ids=[int(settings.DISCORD_GUILD_ID)]+settings.DISCORD_GUILD_IDS
guild_ids=get_all_servers()
)
async def reverse_recruit_msg(
self,
Expand Down

0 comments on commit fefea4b

Please sign in to comment.