fix(voicefix): Don't delete webhook on update.
This commit is contained in:
15
cog.py
15
cog.py
@@ -436,11 +436,14 @@ class VoiceFixCog(LionCog):
|
|||||||
return
|
return
|
||||||
|
|
||||||
hook = discord.Webhook.from_url(webhook, client=self.bot)
|
hook = discord.Webhook.from_url(webhook, client=self.bot)
|
||||||
await self.data.LinkHook.table.delete_where(channelid=channel.id)
|
existing = await self.data.LionHook.fetch(channel.id)
|
||||||
await self.data.LinkHook.create(
|
if existing:
|
||||||
channelid=channel.id,
|
await existing.update(webhookid=hook.id, token=hook.token)
|
||||||
webhookid=hook.id,
|
else:
|
||||||
token=hook.token,
|
await self.data.LinkHook.create(
|
||||||
)
|
channelid=channel.id,
|
||||||
|
webhookid=hook.id,
|
||||||
|
token=hook.token,
|
||||||
|
)
|
||||||
self.hooks[channel.id] = hook
|
self.hooks[channel.id] = hook
|
||||||
await ctx.reply(f"Webhook for {channel.mention} updated!")
|
await ctx.reply(f"Webhook for {channel.mention} updated!")
|
||||||
|
|||||||
Reference in New Issue
Block a user