async def on_member_join(member): global member_join_time member_join_time = time() json_file = loads(read('config.json')) black_lista = [ json_file['black_list'][key] for key in json_file['black_list'] ] if member.id in black_lista: await member.ban() json_rem('config.json', ['black_list', str(member.id)]) return image = discord_file('resources/join.gif', 'Witamy.gif', False) await vrb.ver_chan.send( f"Witamy serdecznie {member.display_name} na serwerze FurHeaven. Celem tego miejsca jest zrzeszanie osob interesujacych sie tematyka furry. Jest tu sporo osob z ktorymi mozna pogadac na przerozne tematy. Mamy nadzieje, ze bedzie Ci tu z nami milo :grin:\nOdpowiedz tylko na pięć pytań.\n1. Ile masz lat?\n2. Czy jestes futrzakiem?\n3. Czy przeczytales regulamin i bedziesz go przestrzegac?\n4. Mężczyzna/Kobieta?\n5. Skąd masz zaproszenie?\n\nJeżeli odpowiedziałeś/aś na pytania a nikt z moderacji ani administracji jeszcze nic nie zrobił, oznacz kogoś z nich, na pewno od razu przeprowadzą weryfikację :3", file=image) image = discord_file('resources/join.mp4', 'Witamy.mp4', False) await vrb.main_chan.send( f"<@{member.id}> wlasnie wbil/a na serwer! Zaraz powinien/na do nas dolaczyc.", file=image) for role in vrb.dividing_roles: await member.add_roles(role) await vrb.commands_chan.send(embed=user_info(vrb.host, member, True)) sleep(5) await vrb.ver_chan.send(f'<@{member.id}>') msg = await vrb.ver_chan.send(vrb.host.mention) await msg.delete()
async def loop_10m(): now = datetime.now().timestamp() json_file = loads(read('events.json')) events = json_file['all']['events'] for event in events: print(now, float(event), now > float(event)) if now > float(event): temp = 0 chan = client.get_channel(events[event]['cid']) msg = await chan.fetch_message(events[event]['mid']) opis = events[event]['desc'] embed = Embed(title='Przypominajka o evencie!', timestamp=datetime.utcnow()) embed.add_field(name=opis.split(' /// ')[0], value=' '.join(opis.split(' /// ')[1:])) react_num = len(msg.reactions) for react in msg.reactions: async for user in react.users(limit=None, after=None): if user == client.user: continue try: await user.send(embed=embed) temp += 1 except: pass json_rem('events.json', ['all', 'events', event]) await vrb.host.send( f'Wysłano wiadomości przypominające do {temp} osób, zareagowało {react_num} osób\n**Nie zapomnij pousuwać 3 części kodu z tej komendy po przeprowadzeniu testu!**' )
async def blire(ctx, id): if not chk_list_cohesion(ctx.author.roles, vrb.management): await ctx.send('Nie masz uprawnień') return try: id = int(id) except: await ctx.send('to nie liczba') return try: json_rem('config.json', ['black_list', str(id)]) except: await ctx.send( 'W mojej bazie danych nie odnotowałem wpisu z podanym id') return await ctx.send(choice(odpowiedzi))
async def zw(ctx, *, info): if info == 'delete': try: json_rem('commands/zw.json', ['dnd', str(ctx.author.id)]) await ctx.send('Pomyślnie usunąłem twoje zw') except: await ctx.send('Aktualnie nie masz żadnego ustawionego zw') elif info == 'check': try: user_zw = loads(read('commands/zw.json'))['dnd'][str( ctx.author.id)] await ctx.send(f'Oto twoje obecne zw```{user_zw}```') except: await ctx.send('Aktualnie nie masz żadnego ustawionego zw') else: json_add('commands/zw.json', ['dnd'], {str(ctx.author.id): info}, True) await ctx.send('Pomyślnie zaktualizowałem twoje zw')
async def loop_1(): json_file = loads(read('config.json')) invitki = json_file['user_invs'] #reset zaproszen if datetime.now().strftime('%H') == '05': for i in invitki: json_rem('config.json', ['user_invs', i]) #zapisywanie permisji kanałów for channel in vrb.guild.text_channels: if loads(read('commands/for_host/silence.json'))['silenced'] != True: json_add('commands/for_host/silence.json', ['saved_perms'], {str(channel.id): {}}, True) for role in channel.changed_roles: perms = dict(channel.overwrites_for(role)) sorted_perms = {} for perm in perms: if perms[perm] != None: sorted_perms[perm] = perms[perm] json_add('commands/for_host/silence.json', ['saved_perms', str(channel.id)], {str(role.id): sorted_perms}, True)
async def loop_6(): json_file = loads(read('config.json')) put_in_box = json_file['put_in_box'] for i in put_in_box: json_rem('config.json', ['put_in_box', i])
async def remove_twitch(ctx): try: json_rem('twitch.json', ['users', str(ctx.author.id)]) except: await ctx.send( 'Nie mam zapisanego żadnego kanału twitch pod twoim kontem')