async def execute_reset_day(bot: Bot): config_dto = ConfigDto() config_dto.name = config_dto.first_to_connect config_dto.get_config(config_dto) config_dto.value = 0 config_dto.save() member_dto = MemberDto() filters = [('first_to_voice_channel', 1)] member_dto.get_member_by_filters(filters) member_dto.first_to_voice_channel = 0 await member_dto.save(bot) member = bot.guild.get_member(member_dto.member_id) role = bot.guild.get_role(int(FIRST_TO_CONNECT_ROLE)) await member.remove_roles(role)
async def check_hit_and_runner(self, member_id: int): config_dto = ConfigDto() config_dto.name = config_dto.first_to_connect config_dto.get_config(config_dto) member_dto = MemberDto() member_dto.get_member(member_id) last_modified = datetime.datetime.timestamp(config_dto.modified) member_left = datetime.datetime.timestamp(member_dto.left_voice) if member_left - last_modified < TIME_TO_VALIDATE_FLAG: member_dto.first_to_voice_channel = 0 member_dto.xp += -10 config_dto.value = 0 config_dto.save() role = self.bot.guild.get_role(int(FIRST_TO_CONNECT_ROLE)) member = self.bot.guild.get_member(int(member_dto.member_id)) await member.remove_roles(role) await member_dto.save(self.bot) return True return False
async def edit_config(self, ctx, name, value): roles = ctx.author.roles role_ids = [] for role in roles: role_ids.append(role.id) if GODMODE_ROLE_ID not in role_ids: await ctx.send('You do not have permission to use this command') return config_dto = ConfigDto() config_dto.name = name config_dto.get_config(config_dto) if config_dto.value is None: await ctx.send(f'No config found with name {name}') return config_dto.value = value config_dto.save() await ctx.send( f'{config_dto.name} config has been saved. New value {config_dto.value}' )