Some minor things ...
This commit is contained in:
parent
b0355cd332
commit
c28998b74a
3 changed files with 9 additions and 5 deletions
|
@ -1,20 +1,21 @@
|
||||||
# pybot-f test extension ...
|
# pybot-f test extension ...
|
||||||
|
# this code has been copied from the docs/github
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
from discord import app_commands
|
from discord import app_commands
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
|
||||||
class TestCog(commands.GroupCog, name="testcogparent"):
|
class TestCog(commands.GroupCog, name="testgrpcmds"):
|
||||||
def __init__(self, bot: commands.Bot) -> None:
|
def __init__(self, bot: commands.Bot) -> None:
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
super().__init__() # this is now required in this context.
|
super().__init__() # this is now required in this context.
|
||||||
|
|
||||||
@app_commands.command(name="sub1")
|
@app_commands.command(name="sub-1")
|
||||||
async def my_sub_command_1(self, interaction: discord.Interaction) -> None:
|
async def my_sub_command_1(self, interaction: discord.Interaction) -> None:
|
||||||
""" /parent sub-1 """
|
""" /parent sub-1 """
|
||||||
await interaction.response.send_message("Hello from sub command 1", ephemeral=True)
|
await interaction.response.send_message("Hello from sub command 1", ephemeral=True)
|
||||||
|
|
||||||
@app_commands.command(name="sub2")
|
@app_commands.command(name="sub-2")
|
||||||
async def my_sub_command_2(self, interaction: discord.Interaction) -> None:
|
async def my_sub_command_2(self, interaction: discord.Interaction) -> None:
|
||||||
""" /parent sub-2 """
|
""" /parent sub-2 """
|
||||||
await interaction.response.send_message("Hello from sub command 2", ephemeral=True)
|
await interaction.response.send_message("Hello from sub command 2", ephemeral=True)
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
# pybot-f 2nd test extension ... other type of commands (this time, nogroup commands)
|
# pybot-f 2nd test extension ... other type of commands (this time, nogroup commands)
|
||||||
# this code has been copied from the docs/github
|
# this code has been copied from the docs/github
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
from discord import app_commands
|
from discord import app_commands
|
||||||
|
@ -9,7 +11,7 @@ class Test2Cog(commands.Cog):
|
||||||
def __init__(self, bot: commands.Bot) -> None:
|
def __init__(self, bot: commands.Bot) -> None:
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
|
||||||
@app_commands.command(name="command-1")
|
@app_commands.command(name="testcmd-1")
|
||||||
async def my_command(self, interaction: discord.Interaction) -> None:
|
async def my_command(self, interaction: discord.Interaction) -> None:
|
||||||
""" /command-1 """
|
""" /command-1 """
|
||||||
await interaction.response.send_message("Hello from command 1!", ephemeral=True)
|
await interaction.response.send_message("Hello from command 1!", ephemeral=True)
|
||||||
|
|
|
@ -18,12 +18,13 @@ config = configparser.ConfigParser()
|
||||||
config.read('bot.ini')
|
config.read('bot.ini')
|
||||||
bottoken = config['General']['bottoken']
|
bottoken = config['General']['bottoken']
|
||||||
|
|
||||||
|
|
||||||
bot = commands.Bot(command_prefix='.', description=description, intents=intents)
|
bot = commands.Bot(command_prefix='.', description=description, intents=intents)
|
||||||
|
|
||||||
|
|
||||||
@bot.event
|
@bot.event
|
||||||
async def on_ready():
|
async def on_ready():
|
||||||
print(f'Logged in as {bot.user} (ID: {bot.user.id})')
|
print(f'pybot-f logged in as {bot.user} (ID: {bot.user.id})')
|
||||||
print('------')
|
print('------')
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue