testing with slash commands
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from discord.ext import commands
|
||||
from discord import app_commands
|
||||
import discord
|
||||
import os
|
||||
import asyncio
|
||||
@@ -16,9 +17,23 @@ async def load():
|
||||
if filename.endswith(".py"):
|
||||
await client.load_extension(f"cogs.{filename[:-3]}")
|
||||
|
||||
async def slashload():
|
||||
for filename in os.listdir("./slashcogs"):
|
||||
if filename.endswith(".py"):
|
||||
await client.load_extension(f"slashcogs.{filename[:-3]}")
|
||||
|
||||
@client.command()
|
||||
async def sync(ctx):
|
||||
if ctx.message.author.id == 262672220260663297:
|
||||
await client.tree.sync(guild=discord.Object(id=1100149380763373608))
|
||||
print('Command tree synced.')
|
||||
else:
|
||||
await ctx.send('You must be the botowner to use this command!')
|
||||
|
||||
async def main():
|
||||
async with client:
|
||||
await load()
|
||||
await slashload()
|
||||
await client.start(discordtoken.get())
|
||||
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user