def set_mode(mode): global config, date_ranges if mode != config['curr_mode']: config['curr_mode'] = mode helper.notify( "%s wallpapers are choosen to select random to set as your wallpaper" % (config['curr_mode'])) date_ranges = helper.get_range_dates(config['curr_mode']) refresh_menu() helper.save_config(config)
async def on_ready(self): """Execute when client is ready""" self.logger.info('Logged on as %s!', self.user) for guild in self.guilds: if guild.id not in self.config: self.logger.debug('Guild %s has no config, generating default', guild.name) self.logger.debug('config keys: %s', ", ".join(self.config.keys())) self.logger.debug('guild id: %s', guild.id) self.config[guild.id] = GuildConfig(guild.id, {}, "%") helper.save_config(self.config)
def set_auto_dowload(mode): global config assert (mode in [True, False]) if config['auto_download'] == mode: return config['auto_download'] = mode refresh_menu() helper.save_config(config) if mode: start_child()
def set_timer(minutes): global config, count_milliseconds temp_milliseconds = minutes * 60 * 1000 if temp_milliseconds != config['timer_milliseconds']: config['timer_milliseconds'] = temp_milliseconds helper.notify("The next wallpaper will be changed after %s" % (helper.string_label(minutes, 'minute'))) count_milliseconds = 0 refresh_menu() helper.save_config(config)
async def _select_vc(self, emoji: str, reaction: discord.Reaction, user: Union[discord.Member, discord.User]): assert (self.entry) if emoji not in self.entry.voice_chan: return False self.vcs.append(self.entry.voice_chan[emoji]) self.logger.debug("%d channel registered", len(self.vcs)) await reaction.message.edit(content=self._format_update_msg()) if len(self.vcs) >= 3 and reaction.message.guild: (self.config[reaction.message.guild.id].lobbies.update({ self.name: LobbyVC(self.name, self.vcs[0].id, self.vcs[1].id, self.vcs[2].id) })) helper.save_config(self.config) self.logger.debug("Updating configuration") return True return False