async def on_raw_reaction_add(payload): json_file = loads(read('config.json')) single_roles_orientations = json_file['autoroles'][ 'single_roles_orientations'] single_roles_colors = json_file['autoroles']['single_roles_colors'] single_roles_hugel = json_file['autoroles']['single_roles_hugel'] guild = client.get_guild(payload.guild_id) channel = client.get_channel(payload.channel_id) message = await channel.fetch_message(payload.message_id) member = guild.get_member(payload.user_id) if not channel == vrb.autoroles_chan1 and not channel == vrb.autoroles_chan2 or member == client.user: return if len(message.content.split('\n')) > 1: role_name = message.content.split('\n')[-1].split(' - ')[0][2:-2] elif len(message.embeds) == 0: role_name = message.content.split(' - ')[0][2:-2] else: role_name = message.embeds[0].fields[0].name role = get(guild.roles, name=role_name) if role.id in single_roles_colors and chk_list_cohesion( [role.id for role in member.roles], single_roles_colors): for role_id in same_pos_in_lists([role.id for role in member.roles], single_roles_colors): try: await member.remove_roles(guild.get_role(role_id)) except: pass if role.id in single_roles_orientations and chk_list_cohesion( [role.id for role in member.roles], single_roles_orientations): for role_id in same_pos_in_lists([role.id for role in member.roles], single_roles_orientations): try: await member.remove_roles(guild.get_role(role_id)) except: pass if role.id in single_roles_hugel and chk_list_cohesion( [role.id for role in member.roles], single_roles_hugel): for role_id in same_pos_in_lists([role.id for role in member.roles], single_roles_hugel): try: await member.remove_roles(guild.get_role(role_id)) except: pass await member.add_roles(role)
async def skick(ctx, member: Member): global silent_ban_kick_user silent_ban_kick_user = member if not chk_list_cohesion(ctx.author.roles, vrb.management): return await member.kick(reason=ctx.author.name) await ctx.send(f'Pomyślnie wyrzuciłem {member.name}')
async def addrole(ctx, member: Member, *, role: Role): if not chk_list_cohesion(ctx.author.roles, vrb.management): await ctx.send('Nie masz uprawnień') return await member.add_roles(role, reason=ctx.author.name) await ctx.send( f'Pomyślnie nadano rolę {role.name} użytkownikowi {member.name}')
async def sban(ctx, member: Member): global silent_ban_kick_user silent_ban_kick_user = member if not chk_list_cohesion(ctx.author.roles, vrb.management): return await member.ban(reason=ctx.author.name, delete_message_days=0) await ctx.send(f'Pomyślnie zbanowałem {member.name}')
async def kick(ctx, member: Member): global kicked_user kicked_user = member if not chk_list_cohesion(ctx.author.roles, vrb.management): await ctx.send('Nie masz uprawnień') return await member.kick(reason=ctx.author.name) await ctx.send(f'Pomyślnie wyrzuciłem {member.name}')
async def nrole(ctx, member: Member, color: Color, *, name): if not chk_list_cohesion(ctx.author.roles, vrb.management): await ctx.send('Nie masz uprawnień') return rol = await ctx.guild.create_role(name=name, colour=color) await member.add_roles(rol, reason=ctx.author.name) await ctx.send( f'Pomyślnie stworzono rolę {name} i nadano ją użytkownikowi {member.name}' )
async def bliad(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 json_add('config.json', ['black_list', str(id)], id) await ctx.send(choice(odpowiedzi))
async def rinf(ctx, *, role: Role): if not chk_list_cohesion(ctx.author.roles, vrb.management): await ctx.send('Nie masz uprawnień') return e = Embed(color=role.color, timestamp=ctx.message.created_at) e.set_author(name=f"informacje o roli {role.name}") e.set_footer(text=f"Na prosbe {ctx.author}", icon_url=ctx.author.avatar_url) e.add_field(name="Nazwa roli:", value=role.name, inline=False) e.add_field(name="Kolor roli:", value=role.color, inline=False) e.add_field(name="ID roli:", value=role.id, inline=False) e.add_field(name="ilosc uzytkownikow z rola:", value=str(len(role.members)), inline=False) await ctx.send(embed=e)
async def mute(ctx, member: Member, *, mtime): if not chk_list_cohesion(ctx.author.roles, vrb.management): if ctx.author == member: pass else: await ctx.send('Nie masz uprawnień') return if chk_list_cohesion(member.roles, vrb.management): await ctx.send( 'Nie zmutuje nikogo z zarządu <:wtfkitus:593015681084030997>') return try: wtime = 0 for i in mtime.split(' '): if 'd' in i: wtime += int(i.strip('d')) * 86400 elif 'h' in i: wtime += int(i.strip('h')) * 3600 elif 'm' in i: wtime += int(i.strip('m')) * 60 except: await ctx.send('Twój argument jest inwalidą') return chan_roles_id = [] for i in member.roles: if i in vrb.role_nsfw or i in vrb.orientations or i == vrb.futrzak: await member.remove_roles(i) chan_roles_id.append(i.id) await member.add_roles(vrb.izolatka) acttime = time() date = datetime.fromtimestamp(acttime + wtime).strftime('%d/%m/%Y, %H:%M') json_add('config.json', ['izolatki', str(member.id)], { 'roles': chan_roles_id, 'time': time() + int(wtime) }) await ctx.send(f'pomyślnie nadałem izolatkę {member.mention} do {date}') await member.send(f'Zostałeś wyciszony na serwerze do {date}')
async def ban(ctx, member: Member): temp = False if not chk_list_cohesion(ctx.author.roles, vrb.management): if ctx.author == member: await ctx.send('No skoro tak ładnie prosisz') temp = True else: await ctx.send('Nie masz uprawnień') return if temp: await member.send('Nie no wracaj xD\nhttps://discord.gg/RY6wV3B') await member.ban(reason=ctx.author.name, delete_message_days=0) await ctx.send(f'Pomyślnie zbanowałem {member.name}') if temp: await member.unban()
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 rlist(ctx): if not chk_list_cohesion(ctx.author.roles, vrb.management): return await ctx.message.delete() role_list = '' licznik = 0 for r in ctx.guild.roles[::-1]: if r.name == '@everyone': continue counter = 0 for member in ctx.guild.members: if r in member.roles: counter += 1 role_list += (f'\n{r.id} - {counter} {r.name}') if licznik == 20: await ctx.channel.send(f'```{role_list}```') role_list = '' licznik = 0 licznik += 1
async def set_event(ctx, chan: TextChannel, data, *, opis): if not chk_list_cohesion(ctx.author.roles, vrb.management): await ctx.send('Nie masz uprawnień') return event_timestamp = mktime( datetime.strptime(data, '%H/%d/%m/%Y').timetuple()) def check(m): return m.content == 'tak' and m.author == ctx.author and m.channel == ctx.channel confirmation_date = datetime.fromtimestamp(event_timestamp).strftime( '%H godzina %d dnia %m miesiaca %Y roku') await ctx.send( f"Wpisz tak aby potwierdzić, że datą wydarzenia ma być {confirmation_date}" ) try: await client.wait_for('message', timeout=30.0, check=check) except TimeoutError: await ctx.channel.send('Czas minął') return embed = Embed( title= 'Przypominajka o evencie!\nZareaguj a bot w dniu eventu przypomni Ci o nim na pw!', timestamp=ctx.message.created_at) embed.add_field(name=opis.split(' /// ')[0], value=' '.join(opis.split(' /// ')[1:])) message = await chan.send(embed=embed) await message.add_reaction('❤️') json_add( 'events.json', ['all', 'events'], { str(event_timestamp): { 'desc': opis, 'cid': message.channel.id, 'mid': message.id } }, True) await ctx.send('Poprawnie dodałem wydarzenie do przypominajki')
async def rcount(ctx, *, role: Role): if not chk_list_cohesion(ctx.author.roles, vrb.management): await ctx.send('Nie masz uprawnień') return mem_list = [] for member in ctx.guild.members: if role in member.roles: mem_list.append(member) e = Embed(color=role.color, timestamp=ctx.message.created_at) e.set_author(name=f"informacje o roli {role.name}") e.set_footer(text=f"Na prosbe {ctx.author}", icon_url=ctx.author.avatar_url) e.add_field(name="Nazwa roli:", value=role.name, inline=False) for y in range(0, len(mem_list), 15): role_members = [] for member in mem_list[y:y + 15]: role_members.append(member.name) e.add_field(name='Użytkownicy z rolą', value='\n'.join(role_members), inline=False) print(len(mem_list)) await ctx.send(embed=e)
async def on_message(message): await client.process_commands(message) if message.author != client.user and not message.mention_everyone: if message.author.id == vrb.geralt_id: if 'pizda' in message.content.lower() or 'pizdo' in message.content.lower() or 'pizdą' in message.content.lower() or 'pizdy' in message.content.lower(): await message.channel.send('Pizda <:harold:625405098255843331>', file=discord_file(f'resources/gerwazy_pizda{randint(1,3)}.png', 'gerwazy.png', True)) if message.content.lower().startswith("rawr"): await message.channel.send(choice(["RAWRR!", 'ror'])) if message.content.lower().startswith("awoo"): await message.channel.send(f'*Awo{randint(3, 19)*"o"}!*') if message.content.split(' ')[0].lower() == "f": num = loads(read('config.json'))['counters']['f'] + 1 if vrb.fem in message.author.roles: ending = "oddała" else: ending = "oddał" dedycation = message.content.split(' ')[1:] if len(dedycation) > 0: if 'dla' in [i.lower() for i in dedycation]: dedycation = ' '.join(dedycation) else: dedycation = 'dla ' + ' '.join(dedycation) if randint(1, 40) == 10: F = discord_file('resources/f.jpg', 'f.jpg', False) if len(dedycation) == 0: await message.channel.send(f"{message.author.display_name} {ending} honory\nHonory oddane w sumie: {num}", file=F) else: await message.channel.send(f'{message.author.display_name} {ending} honory {dedycation}\nHonory oddane w sumie: {num}', file=F) else: if len(dedycation) == 0: await message.channel.send(f"{message.author.display_name} {ending} honory\nHonory oddane w sumie: {num}") else: await message.channel.send(f'{message.author.display_name} {ending} honory {dedycation}\nHonory oddane w sumie: {num}') json_add('config.json', ['counters', 'f'], num) if "owo whats this" in message.content or "owo what's this" in message.content: owo_whats_this = discord_file('resources/owo.gif', 'owo.gif', False) await message.channel.send(file=owo_whats_this) if message.content.lower() == "whym": await message.channel.send("Whymming in progress") async for msg in message.channel.history(limit=5): if msg.content == "Whymming in progress": break for i in range(9): await msg.edit(content=f'Whymming in progress{(i%3+1)*"."}') sleep(1) await msg.edit(content='Whymming complete!', delete_after=5) bad_words = loads(read('config.json'))['bad_words'] bad_words_num = loads(read('config.json'))['counters']['bad_words'] if chk_list_cohesion(bad_words, [i.lower() for i in message.content.split(' ')]): counter = 0 for word in message.content.split(' '): if word.lower() in bad_words: counter += 1 bad_words_num += counter json_add('config.json', ['counters', 'bad_words'], bad_words_num) if message.content == '.u w u': await message.delete() await message.channel.send('u w u') async for msg in message.channel.history(limit=5): if msg.content == "u w u": break for i in range(10): if i%2 == 0: await msg.edit(content='u w u') else: await msg.edit(content='u w u') sleep(0.5) await msg.delete() if message.content.count('kobiet') > 0: num = randint(1,100) if num == 50: await message.channel.send('jezu fuj, weź, kobiety <:tfu:614167432172535831>') if len(message.mentions) > 7: mentions_no_duplicates = [] for i in message.mentions: if not i in mentions_no_duplicates: mentions_no_duplicates.append(i) if len(mentions_no_duplicates) > 10: message_member = message.guild.get_member(message.author.id) try: message_member.remove_roles(vrb.futrzak) except: pass try: message_member.remove_roles(vrb.nowy) except: pass await message_member.add_roles(vrb.izolatka) for i in vrb.nsfw_chans: try: await message_member.remove_roles(i) except: pass await vrb.tech_chan.send(f'{message.author.mention} oznaczyl wiecej niz 10 osob i dostal izloatke') if len(message.mentions) > 0 and client.get_user(614628305047388161) != message.author and message.content[0] != '-' and message.author != client.user: for member in message.mentions: if str(member.status) == 'idle': async for msg in message.channel.history(limit=25): if msg.author.id == member.id: return json_file = loads(read('commands/zw.json')) if str(member.id) in json_file['dnd']: info = json_file['dnd'][str(member.id)] e = Embed(color=member.color, timestamp=message.created_at) e.set_author(name=f"Użytkownik afk") e.set_thumbnail(url=member.avatar_url) e.add_field(name=f"{member.display_name} jest afk, zostawił wiadomość", value=info) e.set_footer(text='Wiadomość została zostawiona', icon_url=member.avatar_url) await message.channel.send(embed=e) if message.content.lower() in responses and message.author != client.user: await message.channel.send(responses[message.content.lower()])
async def restart(ctx): if not chk_list_cohesion(ctx.author.roles, vrb.management): return await ctx.send('Restartowanie...') await client.change_presence(activity=Game(name='restart...')) print('\n\n\n\n\nRESTART\n\n\n\n\n') execl(executable, executable, *argv)
async def loop_30(): guild = vrb.guild #nadawanie ról dzielących for i in guild.members: if i.bot: continue for r in vrb.dividing_roles: if not r in i.roles: await i.add_roles(r) #usuwanie zabitego for i in guild.members: for r in i.roles: if r.name == 'Zabity': await i.remove_roles(r) #ogarnianie roli "Nie Gra" for i in guild.members: if i.bot: continue user_games = search_in_list(i.roles[::-1], vrb.dividing_games, vrb.dividing_channels) user_games = user_games[1:-1] if vrb.nie_gra in user_games and len(user_games) > 1: await i.remove_roles(vrb.nie_gra) elif len(user_games) == 0: await i.add_roles(vrb.nie_gra) #nadawanie orientacji jak ktos nie ma for i in guild.members: if i.bot: continue if vrb.futrzak in i.roles: if not chk_list_cohesion(vrb.orientations, i.roles): await i.add_roles(vrb.nie_zarucham) #usuwanie ról od kanałów jak ktoś ma widzi wszystko for i in guild.members: if vrb.widzi_wszystko in i.roles: if chk_list_cohesion(vrb.role_nsfw[:-1], i.roles): for r in vrb.role_nsfw[:-1]: await i.remove_roles(r) #usuwanie ról od hugów jak ktoś ma nie lubi czułości for i in guild.members: if vrb.czulosc in i.roles: if chk_list_cohesion(vrb.hugel[:-1], i.roles): for r in vrb.hugel[:-1]: await i.remove_roles(r) #ogarnianie kolorów for i in guild.members: try: if len( search_in_list(i.roles[::-1], vrb.dividing_colors, vrb.dividing_forfun)) > 3: for r in search_in_list(i.roles[::-1], vrb.dividing_colors, vrb.dividing_forfun)[1:-2]: await i.remove_roles(r) await i.send( 'Wybrałeś więcej niż jedną rolę od koloru, zostały Ci one usunięte, możesz je nadać z powrotem na kanale <#596020200080408596>' ) except: pass
async def uinf(ctx, *, member: Member): if not chk_list_cohesion(ctx.author.roles, vrb.management): await ctx.send('Nie masz uprawnień') return await ctx.send(embed=user_info(ctx.author, member, False))