Try to move to disnake

This commit is contained in:
2022-07-02 20:15:43 +03:00
parent bab5d68a88
commit 000bf54038

View File

@@ -3,11 +3,13 @@ import logging
import sys import sys
import threading import threading
import discord import discord
import disnake
from disnake import OptionChoice, OptionType, Option
import lib import lib
from os import path from os import path
from discord.ext import commands from discord.ext import commands
from dislash import InteractionClient, Option, OptionType, OptionChoice
bot_owner = 386629192743256065 bot_owner = 386629192743256065
@@ -15,7 +17,6 @@ lib.Commands.chech_json()
intents = discord.Intents.default() intents = discord.Intents.default()
intents.members = True intents.members = True
bot = commands.Bot(command_prefix=lib.Commands.determine_prefix, guild_subscriptions=True, intents=intents) bot = commands.Bot(command_prefix=lib.Commands.determine_prefix, guild_subscriptions=True, intents=intents)
inter_client = InteractionClient(bot, sync_commands=True)
threading.current_thread().name = "main" threading.current_thread().name = "main"
logging.basicConfig(stream=sys.stdout, filemode='w', level='INFO', logging.basicConfig(stream=sys.stdout, filemode='w', level='INFO',
format='%(asctime)s - %(levelname)s - %(threadName)s - %(message)s') format='%(asctime)s - %(levelname)s - %(threadName)s - %(message)s')
@@ -42,14 +43,14 @@ async def on_ready():
logging.info('We have logged in as {0.user}'.format(bot)) logging.info('We have logged in as {0.user}'.format(bot))
@inter_client.slash_command( @bot.slash_command(
name="cog", name="cog",
description="Work with cogs", description="Work with cogs",
options=[ options=[
Option( Option(
"what_do", "what_do",
description="Specify what do with cogs", description="Specify what do with cogs",
type=OptionType.STRING, type=OptionType.string,
required=True, required=True,
choices=[ choices=[
OptionChoice("load", "load"), OptionChoice("load", "load"),