27 lines
797 B
Python
27 lines
797 B
Python
import nextcord
|
|
from nextcord.ext import commands
|
|
|
|
from userinfo import parsedinfo
|
|
|
|
class LogCommands(commands.Cog):
|
|
def __init__(self, bot):
|
|
self.client = bot
|
|
|
|
@commands.command()
|
|
@commands.has_permissions(administrator = True)
|
|
async def setlogchannel(self, ctx: nextcord.Message, channel: nextcord.TextChannel):
|
|
print(ctx.author, channel)
|
|
|
|
guildInfo = await parsedinfo.find("guild", "id", ctx.guild.id)
|
|
|
|
if not guildInfo:
|
|
info = await parsedinfo.get("guild")
|
|
info.append({"id": ctx.guild.id, "log-channel": 0})
|
|
guildInfo = await parsedinfo.find("guild", "id", ctx.guild.id)
|
|
|
|
guildInfo["log-channel"] = channel.id
|
|
|
|
await parsedinfo.flush() # Yes
|
|
|
|
def setup(bot):
|
|
bot.add_cog(LogCommands(bot)) |