-
Notifications
You must be signed in to change notification settings - Fork 0
/
cog.py
31 lines (25 loc) · 1.09 KB
/
cog.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""The cog for bf2042 portal"""
import discord
from discord.ext import commands
from discord import app_commands
from . import server_list
class BattleBit(commands.Cog, name="bb"):
"""Battlebit"""
def __init__(self, bot: commands.AutoShardedBot):
self.bot = bot
super().__init__()
group = app_commands.Group(name="bb", description="Battlebit cog")
group.allowed_installs = app_commands.AppInstallationType(guild=True, user=True)
@group.command(
name="serverlist",
description="List all the servers based on a searchterm for Battlebit.",
)
async def serverlist(self, interaction: discord.Interaction, servername: str) -> None:
"""Battlebit servers"""
await interaction.response.defer()
await server_list.main(interaction, servername)
@serverlist.error
async def tools_error(self, interaction: discord.Interaction, _error) -> None:
"""Error handling"""
embed = discord.Embed(color=0xE74C3C, description="Failed to get serverlist for battlebit")
await interaction.followup.send(embed=embed)