async def repost(self, ctx): guild = str(ctx.guild.id) channel_id = self.timers[guild]['settings']['timer_channel'] timer_channel = self.bot.get_channel(int(channel_id)) msg = await timer_channel.send("Timers go here") self.timers[guild]['settings']['timer_message'] = str(msg.id) f.save_json(timers_json, self.timers)
def __init__(self, bot): self.bot = bot self.timers = f.load_json(timers_json) for guild in self.bot.guilds: if str(guild.id) not in self.timers: self.timers[str(guild.id)] = { 'timers': {}, 'settings': { 'timer_channel': None, 'timer_message': None } } f.save_json(timers_json, self.timers) self.run_timers.start()
async def channel(self, ctx): guild = str(ctx.guild.id) msg = await ctx.send("Timers go here") self.timers[guild]['settings']['timer_channel'] = str(ctx.channel.id) self.timers[guild]['settings']['timer_message'] = str(msg.id) f.save_json(timers_json, self.timers)
async def remove(self, ctx, name): guild = str(ctx.guild.id) del self.timers[guild]['timers'][name] f.save_json(timers_json, self.timers)
async def create(self, ctx, name, *, time): guild = str(ctx.guild.id) self.timers[guild]['timers'][name] = { 'set_time': parse_time(time.split()) } f.save_json(timers_json, self.timers)