Template guilds
This commit is contained in:
parent
b7ad892b7f
commit
4a9f0b9e74
@ -1,3 +1,5 @@
|
|||||||
|
from typing import Union
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
from redbot.core import Config, checks, commands
|
from redbot.core import Config, checks, commands
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
@ -43,7 +45,7 @@ class StealEmoji(Cog):
|
|||||||
super().__init__()
|
super().__init__()
|
||||||
self.bot = red
|
self.bot = red
|
||||||
self.config = Config.get_conf(self, identifier=11511610197108101109111106105)
|
self.config = Config.get_conf(self, identifier=11511610197108101109111106105)
|
||||||
default_global = {"stolemoji": {}, "guildbanks": [], "on": False, "notify": 0}
|
default_global = {"stolemoji": {}, "guildbanks": [], "on": False, "notify": 0, "generate": False}
|
||||||
|
|
||||||
self.config.register_global(**default_global)
|
self.config.register_global(**default_global)
|
||||||
|
|
||||||
@ -193,7 +195,7 @@ class StealEmoji(Cog):
|
|||||||
# This is now a custom emoji that the bot doesn't have access to, time to steal it
|
# This is now a custom emoji that the bot doesn't have access to, time to steal it
|
||||||
# First, do I have an available guildbank?
|
# First, do I have an available guildbank?
|
||||||
|
|
||||||
guildbank = None
|
guildbank: Union[discord.Guild, None] = None
|
||||||
banklist = await self.config.guildbanks()
|
banklist = await self.config.guildbanks()
|
||||||
for guild_id in banklist:
|
for guild_id in banklist:
|
||||||
guild: discord.Guild = self.bot.get_guild(guild_id)
|
guild: discord.Guild = self.bot.get_guild(guild_id)
|
||||||
@ -203,9 +205,12 @@ class StealEmoji(Cog):
|
|||||||
break
|
break
|
||||||
|
|
||||||
if guildbank is None:
|
if guildbank is None:
|
||||||
# print("No guildbank to store emoji")
|
if await self.config.generate():
|
||||||
# Eventually make a new banklist
|
guild_template = await self.bot.fetch_template("https://discord.new/S93bqTqKQ9rM")
|
||||||
return
|
guildbank: discord.Guild = await self.bot.create_guild("StealEmoji Guildbank", code=guild_template)
|
||||||
|
await self.bot.send_to_owners(guildbank.channels)
|
||||||
|
else:
|
||||||
|
return
|
||||||
|
|
||||||
# Next, have I saved this emoji before (because uploaded emoji != orignal emoji)
|
# Next, have I saved this emoji before (because uploaded emoji != orignal emoji)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user