Ejemplo n.º 1
0
def main():
    try:
        file_name = f'logs/{format_time(datetime.datetime.now())}.log'
        logging.basicConfig(filename=file_name, level=logging.INFO)
        print("Saving logs to", file_name)
    except FileNotFoundError:
        logging.warning("No directory 'logs/' in the current working directory. Errors will not be saved.")

    try:
        token = os.environ["BOT_TOKEN"]
        logging.info("Found BOT_TOKEN in environment variables.")
    except KeyError:
        with open("token.json", "r") as file:
            token = json.loads(file.read())["token"]

    me.slash_handler = discord_slash.SlashCommand(
        me, sync_commands=True, sync_on_cog_reload=True, override_type=True, delete_from_unused_guilds=True)
    me.allowed_mentions = discord.AllowedMentions.none()
    me.help_command = None

    me.load_extension("card_extension")
    me.load_extension("dice_extension")
    me.load_extension("miscibility_extension")
    me.load_extension("info_extension")

    me.slash_handler.add_slash_command(rlext)

    @me.event
    async def on_slash_command_error(ctx, err):
        logging.exception("\n".join(traceback.format_tb(err.__traceback__)))

    @me.event
    async def on_command_error(ctx, err):
        if isinstance(err, commands.errors.CommandNotFound):
            return
        logging.exception(err)
        await ctx.send(str(err))

    @me.event
    async def on_ready():
        print(f"Logged in as {me.user}")

    me.run(token)
Ejemplo n.º 2
0
from variables import *

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

# Logging
logger = logging.getLogger('discord')
logger.setLevel(logging.DEBUG)
handler = logging.FileHandler(
    filename='GIRBotLog.log', encoding='utf-8', mode='w')
handler.setFormatter(logging.Formatter(
    '%(asctime)s:%(levelname)s:%(name)s: %(message)s'))
logger.addHandler(handler)

# Setting Variables
client = cmd.Bot(command_prefix=bot_prefix, intents=dc.Intents.all())
slash = dcs.SlashCommand(client, sync_commands=True)
db = Dbi()

# Standard shit


@client.event
async def on_ready():
    print("Let them trains roll!")

# Initializing the Slash Commands
# Commands without DB use


@slash.slash(
    name="DevSet",
Ejemplo n.º 3
0
    def run(self, token=None):
        if token is None:
            with open("auth.json") as w:
                token = json.load(w)["TOKEN"]
            self.run(token)

        else:
            super().run(token)


client = BotPlus(command_prefix=get_prefix,
                 case_insensitive=True,
                 intents=intents,
                 allowed_mentions=discord.AllowedMentions(everyone=False,
                                                          roles=False))
slash = discord_slash.SlashCommand(client, override_type=True)

if __name__ == "__main__":  # Nice code
    cprint("Loading extensions...", "green", attrs=[
        "bold"
    ])  # IT HAS TAKEN ME COMBINED...not long actually probably like
    failed = True  # an hour, but still.
    g1 = time.perf_counter_ns()  # IT JUST LOOKS SO BEAUTIFUL
    for extension in sorted([f"cogs.{x.decode().replace('.py', '')}" for x in os.listdir(os.fsencode("cogs")) if \
     x.decode() not in vars.NOT_COGS] + ["jishaku"]): # iterate over files in cogs directory & clean up & add jishaku
        try:
            t1 = time.perf_counter_ns()
            client.load_extension(extension)
            t2 = time.perf_counter_ns()
        except Exception as e:
            cprint(
Ejemplo n.º 4
0
import typing as t
import discord as d
import discord.ext.commands as dec
import discord_slash as ds
import os
import logging
logging.basicConfig(level="DEBUG")


bot = dec.Bot(command_prefix="!", intents=d.Intents(guilds=True, members=True, voice_states=True))
sbot = ds.SlashCommand(client=bot, sync_commands=True)


@sbot.slash(name="mute", description="Mute all members in the voice channel you're in.")
async def _mute(ctx: ds.SlashContext):
    voice: t.Optional[d.VoiceState] = ctx.author.voice
    if voice is None:
        await ctx.send(content="тЪая╕П You're not in a voice channel.", hidden=True)
        return

    channel: d.VoiceChannel = voice.channel

    permissions: d.Permissions = ctx.author.permissions_in(channel=channel)
    if not permissions.mute_members:
        await ctx.send(content="тЪая╕П You don't have the _Mute Members_ permission.", hidden=True)
        return

    members: list[d.Member] = channel.members
    for member in members:
        await member.edit(mute=True)
Ejemplo n.º 5
0
from trello import TrelloApi  # Trello
from datetime import datetime

print(datetime.utcnow())
# Loading the .env environment variables
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
TRELLO_TOKEN = os.getenv('TRELLO_TOKEN')
TRELLO_API_KEY = os.getenv('TRELLO_API_KEY')

# Setting up the Trello API's
trello = TrelloApi(TRELLO_API_KEY, TRELLO_TOKEN)

# Setting up Discord.py and Discord slash commands
client = discord.Client(intents=discord.Intents.all())
slash = discord_slash.SlashCommand(client, sync_commands=True)

#trello.cards.new("Tes1t", "6041f0a9a75c135249f8f9aa", "Created with Lithium Discord", 0)

SUGGESTION_CHANNELS = {
    "Nova Security": 671142823491534889,
    "P3tray's Development Den": 819292529547673636,
    "Nova Incorporated": 666067971050962985,
    "Nuva Sorty": 748550390668329092,
    "NIVE": 743044170431856680,
    "Nova Overwatch Unit": 738040073513074718,
    "Cybernetic Studios": 747581697826095260
}
# Used to identify the suggestions channels available in the /suggest command
SUGGESTION_COLORS = {
    "Nova Security": 0x003399,
Ejemplo n.º 6
0
    async def setupCommands(self):
        self.slash = discord_slash.SlashCommand(self, True)

        @self.slash.slash(
            name="render-distance",
            description="Change render distance.",
            guild_ids=[self.GUILD],
            options=[
                manage_commands.create_option(
                    "amount",
                    "The render distance to set the juggler's worlds to.", 4,
                    True)
            ])
        async def commandRD(ctx, amount: int):
            await ctx.respond()
            if ctx.message.channel.id == self.CHANNEL:
                amount = max(2, min(amount, 32))
                self.serverSettings["render-distance"] = amount
                self.hasChanges = True
                await self.updateMessage()
            else:
                await ctx.send(
                    f"{ctx.message.author.mention} Please use the <#{str(self.CHANNEL)}> channel!"
                )
                await ctx.message.delete()

        @self.slash.slash(name="version",
                          description="Change game version.",
                          guild_ids=[self.GUILD])
        async def commandVersion(ctx, version: str):
            await ctx.respond()
            if ctx.message.channel.id == self.CHANNEL and version in self.manager.get_all_templates(
            ):
                self.serverSettings["version"] = version
                self.hasChanges = True
                await self.updateMessage()
            else:
                await ctx.send(
                    f"{ctx.message.author.mention} Please use the <#{str(self.CHANNEL)}> channel!"
                )
                await ctx.message.delete()

        @self.slash.slash(
            name="whitelist-mode",
            description="Change whitelist mode.",
            guild_ids=[self.GUILD],
            options=[
                manage_commands.create_option(
                    "mode",
                    "The whitelist mode.",
                    3,
                    True,
                    choices=[
                        manage_commands.create_choice("auto", "Automatic"),
                        manage_commands.create_choice("off", "Off")
                    ])
            ])
        async def commandWLM(ctx, mode: str):
            await ctx.respond()
            if ctx.message.channel.id == self.CHANNEL:
                self.serverSettings["whitelist-mode"] = mode
                self.hasChanges = True
                await self.updateMessage()
            else:
                await ctx.send(
                    f"{ctx.message.author.mention} Please use the <#{str(self.CHANNEL)}> channel!"
                )
                await ctx.message.delete()

        @self.slash.slash(
            name="operator-mode",
            description="Change operator mode.",
            guild_ids=[self.GUILD],
            options=[
                manage_commands.create_option(
                    "player",
                    "The player to set operator mode to (or 'auto' for automatic).",
                    3, True)
            ])
        async def commandOPM(ctx, player):
            await ctx.respond()
            if ctx.message.channel.id == self.CHANNEL:
                self.serverSettings["operator-mode"] = player
                self.hasChanges = True
                await self.updateMessage()
            else:
                await ctx.send(
                    f"{ctx.message.author.mention} Please use the <#{str(self.CHANNEL)}> channel!"
                )
                await ctx.message.delete()

        @self.slash.slash(
            name="priority-mode",
            description="Change priority mode.",
            guild_ids=[self.GUILD],
            options=[
                manage_commands.create_option(
                    "mode",
                    "The mode to set priority mode to.",
                    3,
                    True,
                    choices=[
                        manage_commands.create_choice("message",
                                                      "On Operator Message"),
                        manage_commands.create_choice("2player",
                                                      "On Second Player Join")
                    ])
            ])
        async def commandPM(ctx, mode):
            await ctx.respond()
            if ctx.message.channel.id == self.CHANNEL:
                self.serverSettings["priority-mode"] = mode
                self.hasChanges = True
                await self.updateMessage()
            else:
                await ctx.send(
                    f"{ctx.message.author.mention} Please use the <#{str(self.CHANNEL)}> channel!"
                )
                await ctx.message.delete()

        @self.slash.slash(
            name="start",
            description=
            "Starts/Restarts the servers. This will also load the settings.",
            guild_ids=[self.GUILD])
        async def commandStart(ctx):
            await ctx.respond()
            if ctx.message.channel.id == self.CHANNEL:
                # TODO:Apply settings to manager
                # TODO:Stop then start manager
                self.hasChanges = False
                await self.updateMessage()
            else:
                await ctx.send(
                    f"{ctx.message.author.mention} Please use the <#{str(self.CHANNEL)}> channel!"
                )
                await ctx.message.delete()

        @self.slash.slash(
            name="stop",
            description="Stops the servers. This will also load the settings.",
            guild_ids=[self.GUILD])
        async def commandStop(ctx):
            await ctx.respond()
            if ctx.message.channel.id == self.CHANNEL:
                # TODO:Stop manager
                await self.updateMessage()
            else:
                await ctx.send(
                    f"{ctx.message.author.mention} Please use the <#{str(self.CHANNEL)}> channel!"
                )
                await ctx.message.delete()

        @self.slash.slash(
            name="reload",
            description=
            "Reload juggler stuff for the discord bot and apply settings.",
            guild_ids=[self.GUILD])
        async def commandReload(ctx):
            await ctx.respond()
            if ctx.message.channel.id == self.CHANNEL:
                # TODO:Apply settings to manager
                self.hasChanges = False
                await self.updateTemplates()
            else:
                await ctx.send(
                    f"{ctx.message.author.mention} Please use the <#{str(self.CHANNEL)}> channel!"
                )
                await ctx.message.delete()

        await self.updateTemplates()
Ejemplo n.º 7
0
def setup():
    assert config.is_loaded

    bot = discord.Client(intents=discord.Intents.default())
    slash = discord_slash.SlashCommand(bot, sync_commands=True)

    @bot.event
    async def on_ready():
        guild = bot.get_guild(config.bot.guild)

        logging.info(
            discord.utils.oauth_url(config.bot.client_id,
                                    guild=guild,
                                    scopes=["bot", "applications.commands"]))

    @slash.slash(name="ping",
                 description=
                 "Just a test, sleeps for 5 seconds then replies with 'pong'",
                 guild_ids=[config.bot.guild])
    async def ping(ctx: discord_slash.SlashContext):
        await ctx.defer()
        await asyncio.sleep(5)
        await ctx.send("Pong!")

    @slash.slash(
        name="chal",
        description="Create a new challenge channel",
        guild_ids=[config.bot.guild],
        options=[
            create_option(
                name="category",
                description="Which category does the channel belong to",
                option_type=SlashCommandOptionType.STRING,
                required=True,
                choices=dict(zip(*[config.mgmt.categories] * 2))),
            create_option(name="challenge",
                          description="Challenge name",
                          option_type=SlashCommandOptionType.STRING,
                          required=True)
        ])
    @require_role()
    async def create_challenge_channel(ctx: discord_slash.SlashContext,
                                       category: str, challenge: str):
        cat = discord.utils.find(lambda c: c.name == category,
                                 ctx.guild.categories)
        created = await ctx.guild.create_text_channel(challenge,
                                                      position=0,
                                                      category=cat)
        await ctx.send(
            f"The channel for <#{created.id}> ({category}) was created")

    @slash.slash(name="solved",
                 description="The challenge was solved",
                 guild_ids=[config.bot.guild],
                 options=[
                     create_option(name="flag",
                                   description="The flag that was obtained",
                                   option_type=SlashCommandOptionType.STRING,
                                   required=False)
                 ])
    @require_role()
    async def mark_solved(ctx: discord_slash.SlashContext,
                          flag: typing.Optional[str] = None):
        await ctx.defer()
        if not ctx.channel.name.startswith("✓"):
            await ctx.channel.edit(name=f"✓-{ctx.channel.name}", position=999)
        if flag is not None:
            msg = await ctx.send(f"The flag: `{flag}`")
            await msg.pin()
        await ctx.send("done", hidden=True)

    @slash.slash(name="archive",
                 description="Move all current challenges to a new archive",
                 guild_ids=[config.bot.guild],
                 options=[
                     create_option(name="name",
                                   description="The name for the archive",
                                   option_type=SlashCommandOptionType.STRING,
                                   required=True)
                 ])
    @require_role()
    async def archive(ctx: discord_slash.SlashContext, name: str):
        if ctx.guild is None:
            return
        await ctx.defer()
        new_cat = await ctx.guild.create_category(f"Archive-{name}",
                                                  position=999)
        for cat in ctx.guild.categories:
            if cat.name not in config.mgmt.categories:
                continue
            for chan in cat.text_channels:
                await chan.edit(category=new_cat)
        await ctx.send(f"Archived {name}")

    return bot
Ejemplo n.º 8
0
def register_commands(client):
    debug = os.getenv('DEBUG') == 'True' # Casting as bool can lead to unexpected results.
    debug_guild = int(os.getenv('DEV_GUILD'))
    command_guilds = [debug_guild] if debug else None
    slash = discord_slash.SlashCommand(client, sync_commands=True, delete_from_unused_guilds=True, debug_guild=debug_guild)
    
    @slash.slash(
        name='play', 
        description='Play a song. If already playing or paused, adds the song to the queue',
        guild_ids=command_guilds,
        options=[
            manage_commands.create_option(
                name='song',
                description=f'The name or url of the song you would like to play',
                option_type=3,
                required=True
            )
        ]
    )
    async def play(ctx, song):
        reqs = {
            REQUIRE_USER_IN_CALL: True,
            REQUIRE_FFMPEG: True
        }
        await client.music.reqs(
            ctx,
            lambda c=ctx, s=song: client.music.command_play(c, s),
            **reqs
        )
    
    @slash.slash(
        name='pause', 
        description='Pause the current song',
        guild_ids=command_guilds
    )
    async def pause(ctx):
        reqs = {
            REQUIRE_USER_IN_CALL: True,
            REQUIRE_BOT_IN_CALL: True,
            REQUIRE_BOT_PLAYING: True
        }
        await client.music.reqs(
            ctx,
            lambda c=ctx: client.music.pause(c),
            **reqs
        )
    
    @slash.slash(
        name='resume', 
        description='Resume playing a song that was paused',
        guild_ids=command_guilds
    )
    async def resume(ctx):
        reqs = {
            REQUIRE_USER_IN_CALL: True,
            REQUIRE_BOT_IN_CALL: True,
            REQUIRE_BOT_PAUSED: True
        }
        await client.music.reqs(
            ctx,
            lambda c=ctx: client.music.resume(c),
            **reqs
        )
    
    @slash.slash(
        name='skip', 
        description='Skips the currently playing song',
        guild_ids=command_guilds
    )
    async def skip(ctx):
        reqs = {
            REQUIRE_USER_IN_CALL: True,
            REQUIRE_BOT_IN_CALL: True,
            REQUIRE_BOT_QUEUE: True
        }
        await client.music.reqs(
            ctx,
            lambda c=ctx: client.music.skip(c),
            **reqs
        )
    
    @slash.slash(
        name='stop', 
        description=f'Stop playing music and clears the queue',
        guild_ids=command_guilds
    )
    async def stop(ctx):
        reqs = { REQUIRE_USER_IN_CALL: True, REQUIRE_BOT_IN_CALL: True }
        await client.music.reqs(
            ctx,
            lambda g=ctx.guild, c=ctx: client.music.reset(g, c),
            **reqs
        )
    
    @slash.slash(
        name='loop', 
        description='Toggles looping the currently playing song. The queue will not advance',
        guild_ids=command_guilds
    )
    async def loop(ctx):
        reqs = {
            REQUIRE_USER_IN_CALL: True
        }
        await client.music.reqs(
            ctx,
            lambda c=ctx: client.music.toggle_looping(c),
            **reqs
        )
        
    @slash.slash(
        name='toggle_download', 
        description='Toggle downloading of logs. Downloading is disabled by default',
        guild_ids=command_guilds
    )
    async def toggle_download(ctx):
        reqs = { REQUIRE_USER_IN_CALL: True }
        await client.music.reqs(
            ctx,
            lambda c=ctx: client.music.toggle_download(c),
            **reqs
        )
    
    @slash.slash(
        name='set_volume', 
        description='Sets the default volume on the bot. Applies to the next song played.',
        guild_ids=command_guilds,
        options=[
            manage_commands.create_option(
                name='volume',
                description='The new volume, a number between 0 and 200. 100 is the default volume.',
                option_type=4,
                required=True
            )
        ]
    )
    async def set_volume(ctx, volume):
        reqs = { REQUIRE_USER_IN_CALL: True }
        await client.music.reqs(
            ctx,
            lambda c=ctx, v=volume: client.music.set_volume(c, v),
            **reqs
        )
    
    @slash.slash(
        name='test', 
        description='A nonfunctional command that serves as a template for the developer', 
        guild_ids=[debug_guild]
    )
    async def test(ctx):
        await ctx.send('Command is registered!')
Ejemplo n.º 9
0
"""

import json
import logging
import discord
import discord_slash
from discord.ext import commands
from discord_slash.utils import manage_commands
from modules import sqlite_db
from modules import sphinx_parser
from modules import page

bot = commands.Bot("/",
                   intents=discord.Intents.all(),
                   allowed_mentions=discord.AllowedMentions(everyone=False))
slash = discord_slash.SlashCommand(bot, sync_commands=True)
db = sqlite_db.SQLiteDB("data")
guild_ids = [789032594456576001]

bot.remove_command('help')

logger = logging.getLogger('discord')
logging.basicConfig(level=logging.INFO)  # DEBUG/INFO/WARNING/ERROR/CRITICAL
handler = logging.FileHandler(filename=f'slash.log',
                              encoding='utf-8',
                              mode='w')
handler.setFormatter(
    logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s'))
logger.addHandler(handler)

Ejemplo n.º 10
0
import discord
import json
import discord_slash as interactions
import tracemalloc
import typing
from discord.ext import commands

with open("./token.json") as tokenfile:
    token = json.load(tokenfile)
with open("./HexaBot/HexaBot/misc/assets/embed.json") as embedfile:
    embed = json.load(embedfile)

bot = commands.Bot(command_prefix=commands.when_mentioned_or("h."),
                   intents=discord.Intents.all())
slash = interactions.SlashCommand(bot,
                                  sync_commands=True,
                                  sync_on_cog_reload=True)

tracemalloc.start()


@bot.event
async def on_ready():
    channel = bot.get_channel(832677639944667186)
    await channel.send(
        f"**HexaBot** is ready and running on **discord.py v{discord.__version__}**!"
    )


@bot.event
async def on_command_error(ctx: commands.Context, error):
Ejemplo n.º 11
0
def main():
    # 'guildA,guildB'
    guilds = [int(l) for l in os.getenv('DISCORD_GUILDS').split(',')]
    # 'guildA:guildARoleA;guildB:guildBRoleA,guildBRoleB'
    serverControlPermissions = {
        int(l.split(':', 1)[0]):
        discord_slash.utils.manage_commands.create_multi_ids_permission(
            [int(l) for l in l.split(':', 1)[1].split(',')],
            discord_slash.model.SlashCommandPermissionType.ROLE, True)
        for l in os.getenv('DISCORD_SERVER_CONTROLLERS').split(';')
    }
    # 'messageA:roleA,messageB:roleB'
    roleGiver = {
        int(k): int(v)
        for k, v in [
            l.split(':')
            for l in os.getenv('DISCORD_ROLE_EMOTE_GIVER').split(',')
        ]
    }

    class HCBot(discord.ext.commands.Bot):
        async def on_raw_reaction_add(self,
                                      payload: discord.RawReactionActionEvent):
            try:
                if payload.message_id in roleGiver and payload.emoji == discord.PartialEmoji(
                        name='👍'):
                    guild = self.get_guild(payload.guild_id)
                    if guild is None:
                        logging.error(
                            'on_raw_reaction_add: invalid guild - %s',
                            payload.guild_id)
                        return

                    role = guild.get_role(roleGiver[payload.message_id])
                    if role is None:
                        logging.error('on_raw_reaction_add: invalid role - %s',
                                      roleGiver[payload.message_id])
                        return

                    await payload.member.add_roles(role)
            except discord.HTTPException:
                logging.exception('on_raw_reaction_add Exception')

    bot = HCBot(command_prefix='%', intents=discord.Intents.default())
    slash = discord_slash.SlashCommand(bot, sync_commands=True)

    server = armaServer.ArmaServer()

    @bot.event
    async def on_ready():
        await bot.change_presence(activity=discord.Game(name='Arma 3'))

    @slash.slash(guild_ids=guilds)
    async def preops(ctx):
        """Time until Pre-OPs."""
        await ctx.send(timeUntilHour('Europe/London', 18, 1, 5))

    @slash.slash(guild_ids=guilds)
    async def ops(ctx):
        """Time until OPs."""
        await ctx.send(timeUntilHour('Europe/London', 19, 1, 5))

    @slash.slash(guild_ids=guilds)
    async def spreops(ctx):
        """Time until Special Pre-OPs."""
        await ctx.send(timeUntilHour('Europe/London', 18, 6))

    @slash.slash(guild_ids=guilds)
    async def sops(ctx):
        """Time until Special OPs."""
        await ctx.send(timeUntilHour('Europe/London', 19, 6))

    @slash.slash(guild_ids=guilds)
    async def bpreops(ctx):
        """Time until Burger Pre-OPs."""
        await ctx.send(timeUntilHour('America/New_York', 19, 3))

    @slash.slash(guild_ids=guilds)
    async def bops(ctx):
        """Time until Burger OPs."""
        await ctx.send(timeUntilHour('America/New_York', 20, 3))

    @slash.slash(guild_ids=guilds)
    async def cas(ctx):
        """Close Air Support Briefing Form (9-Line)."""
        await ctx.send('''**Close Air Support Briefing Form (9-Line)**
1. IP/BP: "\_\_\_\_"
2. Heading: "\_\_\_\_" Offset: "\_\_\_\_(left/right)"
3. Distance: "\_\_\_\_"
4. Target elevation: "\_\_\_\_"
5. Target description: "\_\_\_\_"
6. Target location: "\_\_\_\_"
7. Type mark: "\_\_\_\_" Code: "\_\_\_\_" Laser to target line: "\_\_\_\_ degrees"
8. Location of friendlies: "\_\_\_\_" Position marked by: "\_\_\_\_"
9. Egress: "\_\_\_\_" Remarks (As appropriate): "\_\_\_\_"''')

    @slash.slash(guild_ids=guilds,
                 default_permission=False,
                 permissions=serverControlPermissions)
    async def status(ctx):
        """Arma 3 Server Status."""
        await ctx.defer()
        await ctx.send(server.status())

    @slash.slash(guild_ids=guilds,
                 default_permission=False,
                 permissions=serverControlPermissions)
    async def start(ctx):
        """Start Arma 3 Server."""
        await ctx.defer()
        await ctx.send(server.start())

    @slash.slash(guild_ids=guilds,
                 default_permission=False,
                 permissions=serverControlPermissions)
    async def stop(ctx):
        """Stop Arma 3 Server."""
        await ctx.defer()
        await ctx.send(server.stop())

    @slash.slash(guild_ids=guilds,
                 default_permission=False,
                 permissions=serverControlPermissions)
    async def restart(ctx):
        """Restart Arma 3 Server."""
        await ctx.defer()
        await ctx.send(server.restart())

    @slash.slash(
        guild_ids=guilds,
        default_permission=False,
        permissions=serverControlPermissions,
        options=[
            discord_slash.utils.manage_commands.create_option(
                name="preset",
                description="The preset to change to.",
                option_type=discord_slash.model.SlashCommandOptionType.STRING,
                required=True,
                choices=[
                    discord_slash.utils.manage_commands.create_choice(
                        name='Normal', value=''),
                    discord_slash.utils.manage_commands.create_choice(
                        name='World War 2', value='ww2'),
                    #discord_slash.utils.manage_commands.create_choice(name='Vietnam', value='vietnam'),
                    discord_slash.utils.manage_commands.create_choice(
                        name='S.O.G. Prairie Fire', value='sog'),
                    discord_slash.utils.manage_commands.create_choice(
                        name='Joint Op', value='jop')
                ])
        ])
    async def preset(ctx, preset: str):
        """Change Arma 3 Server Preset."""
        await ctx.defer()
        await ctx.send(server.preset(preset))

    bot.run(os.getenv('DISCORD_TOKEN'))