async def rment(ctx, *, role: Role): if not ctx.channel == vrb.game_chan: await ctx.send('To nie jest kanał od gier') return if not role in search_in_list(ctx.guild.roles[::-1], vrb.dividing_games, vrb.dividing_channels)[2:-1]: await ctx.send('To nie jest rola od gier') return await ctx.message.delete() roles = loads(read('commands/role_mentions.json'))['roles'] c_time = time() if not str(role.id) in list(roles): json_add('commands/role_mentions.json', ['roles'], {str(role.id): c_time}) await role.edit(mentionable = True) await ctx.send(f'{ctx.author.mention} wzmienia {role.mention}') await role.edit(mentionable = False) return for r_id in roles: if r_id == str(role.id): if c_time - roles[r_id] >= 3600: json_add('commands/role_mentions.json', ['roles'], {r_id: c_time}) await role.edit(mentionable = True) await ctx.send(f'{ctx.author.mention} wzmienia {role.mention}') await role.edit(mentionable = False) return else: how_long = int((3600 - (c_time - roles[r_id])) / 60) await ctx.send(f'Musisz jeszcze poczekać {how_long} minut aby znów oznaczyć tą rolę') return
async def exclude(ctx, *, role: Role): if not vrb.adm_role in ctx.author.roles: return json_file = loads(read('config.json')) excluded = json_file['autoroles']['excluded'] excluded.append(role.id) json_add('config.json', ['autoroles'], {'excluded': excluded}, True) await ctx.send('Pomyślnie dodałem rolę do wykluczonych')
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 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 putinbox(ctx, *, member: Member): json_file = loads(read('config.json')) put_in_box = json_file['put_in_box'] if ctx.author.id in [put_in_box[key] for key in put_in_box]: await ctx.send( 'Wyczerpałeś swój limit wkładania futrzaków do pudełek na dziś') return if member.bot: if member.id == client.user.id: await ctx.send('Ja ne ce do pudeuka :<') else: await ctx.send( 'Nie wsadzaj bota do pudełka :< on sam potem z niego nie umie wyjść' ) return json_add('config.json', ['put_in_box', str(ctx.author.id)], ctx.author.id) await ctx.send(f'*<@{ctx.author.id}> wkłada <@{member.id}> do pudełka* uwu' ) await member.edit(nick=f'{member.display_name} in a box')
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 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 twitch(ctx, twitch_id, link): try: int(twitch_id) except: await ctx.send( 'Twoje ID jakimś cudem nie jest liczbą, jeżeli masz problem ze znalezieniem ID swojego twitchowego konta, użyj tego rozszerzenia:\n*https://chrome.google.com/webstore/detail/twitch-username-and-user/laonpoebfalkjijglbjbnkfndibbcoon*' ) return if 'https://www.twitch.tv/' in link: json_add( 'twitch.json', ['users', str(ctx.author.id)], { "id": int(twitch_id), "channel_link": link, "notyficated": 'no', "message_id": None }) else: await ctx.send( 'Podaj pełny link do swojego kanału, łącznie z https://www.') return await ctx.send('Pomyślnie dodałem twój kanał do listy obserwowanych kanów')
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 inv(ctx): json_file = loads(read('config.json')) user_invs = json_file['user_invs'] await ctx.message.delete() if ctx.author.id in [user_invs[key] for key in user_invs]: await ctx.send( 'Już dziś prosiłeś o jedno zaproszenie\nJeżeli chcesz więcej, poproś o nie kogoś z zarządu' ) return await ctx.channel.create_invite(max_age=1800, max_uses=1) zapki = await ctx.channel.invites() for i in zapki: if i.inviter == client.user and i.created_at.strftime( '%M') == datetime.now().strftime('%M'): inv = i.code json_add('config.json', ['user_invs', str(ctx.author.id)], ctx.author.id) await ctx.author.send( f'Oto zaproszenie dla ciebie https://discord.gg/{inv}\nWażne 30 minut, jedno użycie' ) await vrb.tech_chan.send( f'Wysłałem zaproszenie do {ctx.author.name} aka {ctx.author.display_name}' )
async def silence(ctx, arg): if ctx.author != vrb.host or not vrb.kanclerz in ctx.author.roles: await ctx.send('Nie masz uprawnień') return if arg == 'on': letters = ascii_letters safety_string = ''.join(choice(letters) for i in range(6)) await ctx.send( f'Wpisz ten ciąg znaków aby potwierdzić decyzję o zablokowaniu wszystkich kanałów serwera\n``{safety_string}``' ) def check(m): return m.content == safety_string and m.author == ctx.author and m.channel == ctx.channel try: await client.wait_for('message', timeout=15.0, check=check) except TimeoutError: await ctx.channel.send('Czas minął') return loading = await ctx.send('``Wyciszanie trwa\n' + 25 * '-' + '``') loading_counter = 0 json_add('commands/for_host/silence.json', ['silenced'], True) for channel in ctx.guild.text_channels: loading_progress = int(loading_counter / len(ctx.guild.channels) * 25) for role in channel.changed_roles: await channel.set_permissions(role, overwrite=None) await channel.set_permissions(ctx.guild.default_role, read_messages=False) await loading.edit(content='``Wyciszanie trwa\n' + loading_progress * '#' + (25 - loading_progress) * '-' + '``') loading_counter += 1 silenced = await ctx.guild.create_text_channel( name='inf kryzysowa', overwrites={ ctx.guild.default_role: PermissionOverwrite(send_messages=False) }) await silenced.send( 'Przepraszamy ale wystąpiła sytuacja kryzysowa i serwer będzie niedostępny przez pewien okres czasu.\nAdministracja zajmuje się sytuacją i powinna wam przekazać więcej informacji.' ) await loading.edit(content='``Done\n' + 25 * '#' + '``') if arg == 'off': all_chans = loads( read('commands/for_host/silence.json'))['saved_perms'] loading = await ctx.send('``Odciszanie trwa\n' + 25 * '-' + '``') loading_counter = 0 for chan_id in all_chans: channel = client.get_channel(int(chan_id)) await channel.set_permissions(ctx.guild.default_role, overwrite=None) for role_id in all_chans[chan_id]: perms = all_chans[chan_id][role_id] role = ctx.guild.get_role(int(role_id)) if len(perms) == 0: continue await channel.set_permissions(role, **perms) loading_progress = int(loading_counter / len(ctx.guild.channels) * 25) await loading.edit(content='``Odciszanie trwa\n' + loading_progress * '#' + (25 - loading_progress) * '-' + '``') loading_counter += 1 await loading.edit(content='``Done\n' + 25 * '#' + '``') json_add('commands/for_host/silence.json', ['silenced'], False)
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()])