Reverted reginaldCog
This commit is contained in:
parent
5f2a44ebb8
commit
7e80d6e304
@ -9,7 +9,6 @@ import aiohttp
|
|||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
import tempfile
|
import tempfile
|
||||||
import configparser
|
|
||||||
from openai import OpenAIError
|
from openai import OpenAIError
|
||||||
from redbot.core import Config, commands
|
from redbot.core import Config, commands
|
||||||
|
|
||||||
@ -17,11 +16,7 @@ from redbot.core import Config, commands
|
|||||||
class ReginaldCog(commands.Cog):
|
class ReginaldCog(commands.Cog):
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
config = configparser.ConfigParser()
|
self.config = Config.get_conf(self, identifier=71717171171717)
|
||||||
config.read('config.ini')
|
|
||||||
|
|
||||||
identifier_id = int(config['DEFAULT']['identifier_id'])
|
|
||||||
self.config = Config.get_conf(self, identifier=identifier_id)
|
|
||||||
default_global = {
|
default_global = {
|
||||||
"openai_model": "gpt-3.5-turbo"
|
"openai_model": "gpt-3.5-turbo"
|
||||||
}
|
}
|
||||||
@ -31,20 +26,18 @@ class ReginaldCog(commands.Cog):
|
|||||||
self.config.register_global(**default_global)
|
self.config.register_global(**default_global)
|
||||||
self.config.register_guild(**default_guild)
|
self.config.register_guild(**default_guild)
|
||||||
|
|
||||||
self.allowed_role_id = int(config['DEFAULT']['allowed_role_id'])
|
|
||||||
|
|
||||||
def has_allowed_role():
|
def has_allowed_role():
|
||||||
def predicate(ctx):
|
async def predicate(ctx):
|
||||||
return any(role.id == ctx.cog.allowed_role_id for role in ctx.author.roles)
|
kanium_role_id = 280260875678515200
|
||||||
|
return any(role.id == kanium_role_id for role in ctx.author.roles)
|
||||||
return commands.check(predicate)
|
return commands.check(predicate)
|
||||||
|
|
||||||
def has_admin_role():
|
def has_admin_role():
|
||||||
def predicate(ctx):
|
async def predicate(ctx):
|
||||||
has_admin_permission = ctx.author.guild_permissions.administrator
|
has_admin_permission = ctx.author.guild_permissions.administrator
|
||||||
return has_admin_permission
|
return has_admin_permission
|
||||||
return commands.check(predicate)
|
return commands.check(predicate)
|
||||||
|
|
||||||
|
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@commands.has_permissions(manage_guild=True)
|
@commands.has_permissions(manage_guild=True)
|
||||||
@commands.command(help="Set the OpenAI API key")
|
@commands.command(help="Set the OpenAI API key")
|
||||||
@ -184,4 +177,4 @@ class ReginaldCog(commands.Cog):
|
|||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
cog = ReginaldCog(bot)
|
cog = ReginaldCog(bot)
|
||||||
bot.add_cog(cog)
|
bot.add_cog(cog)
|
||||||
Loading…
x
Reference in New Issue
Block a user