This repository has been archived by the owner on Jul 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fifth commit - January 13, 2021 (01R7-210113)
- Loading branch information
Showing
18 changed files
with
1,023 additions
and
281 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
import base64 | ||
import binascii | ||
|
||
async def decoder(bot, discord, message, botconfig, os, platform, datetime, one_result, localization, embed_color, args, binary): | ||
if " ".join(args[2:]) == "" or " ".join(args[2:]) == " " or " ".join(args[2:]) == None: | ||
no_args = discord.Embed(title=localization[1][14][0], description=localization[1][14][8], color=embed_color) | ||
return await message.channel.send(embed=no_args) | ||
decoder_content = discord.Embed(title=localization[1][14][0], description=localization[1][14][1] + "\n\n" + localization[1][14][3], color=embed_color) | ||
msg = await message.channel.send(embed=decoder_content) | ||
await msg.add_reaction(emoji="1️⃣") | ||
await msg.add_reaction(emoji="2️⃣") | ||
await msg.add_reaction(emoji="3️⃣") | ||
await msg.add_reaction(emoji="4️⃣") | ||
@bot.event | ||
async def on_reaction_add(reaction, user): | ||
channel = reaction.message.channel | ||
if reaction.emoji == "1️⃣" and user.id != bot.user.id: | ||
try: | ||
result = base64.standard_b64decode(" ".join(args[2:]).encode('ascii')).decode('ascii') | ||
except: | ||
result = localization[1][14][6] | ||
decoder_result_content = discord.Embed(title=str(localization[1][14][0]), color=embed_color) | ||
decoder_result_content.add_field(name=str(localization[1][14][4]), value='```' + str(result) + '```', inline=True) | ||
await msg.edit(embed=decoder_result_content) | ||
if reaction.emoji == "2️⃣" and user.id != bot.user.id: | ||
try: | ||
result = base64.b32decode(" ".join(args[2:]).encode('ascii')).decode('ascii') | ||
except: | ||
result = localization[1][14][6] | ||
decoder_result_content = discord.Embed(title=localization[1][14][0], color=embed_color) | ||
decoder_result_content.add_field(name=str(localization[1][14][4]), value='```' + str(result) + '```', inline=True) | ||
await msg.edit(embed=decoder_result_content) | ||
if reaction.emoji == "3️⃣" and user.id != bot.user.id: | ||
try: | ||
result = base64.b16decode(" ".join(args[2:]).encode('ascii')).decode('ascii') | ||
except: | ||
result = localization[1][14][6] | ||
decoder_result_content = discord.Embed(title=localization[1][14][0], color=embed_color) | ||
decoder_result_content.add_field(name=str(localization[1][14][4]), value='```' + str(result) + '```', inline=True) | ||
await msg.edit(embed=decoder_result_content) | ||
if reaction.emoji == "4️⃣" and user.id != bot.user.id: | ||
try: | ||
result = str(binary.decode(" ".join(args[2:]))) | ||
except Exception as e: | ||
print(e) | ||
result = localization[1][14][6] | ||
decoder_result_content = discord.Embed(title=localization[1][14][0], color=embed_color) | ||
decoder_result_content.add_field(name=str(localization[1][14][4]), value='```' + str(result) + '```', inline=True) | ||
await msg.edit(embed=decoder_result_content) | ||
|
||
async def encoder(bot, discord, message, botconfig, os, platform, datetime, one_result, localization, embed_color, args, binary): | ||
if " ".join(args[2:]) == "" or " ".join(args[2:]) == " " or " ".join(args[2:]) == None: | ||
no_args = discord.Embed(title=localization[1][14][0], description=localization[1][14][8], color=embed_color) | ||
return await message.channel.send(embed=no_args) | ||
decoder_content = discord.Embed(title=localization[1][14][0], description=localization[1][14][2] + "\n\n" + localization[1][14][3], color=embed_color) | ||
msg = await message.channel.send(embed=decoder_content) | ||
await msg.add_reaction(emoji="1️⃣") | ||
await msg.add_reaction(emoji="2️⃣") | ||
await msg.add_reaction(emoji="3️⃣") | ||
await msg.add_reaction(emoji="4️⃣") | ||
@bot.event | ||
async def on_reaction_add(reaction, user): | ||
channel = reaction.message.channel | ||
if reaction.emoji == "1️⃣" and user.id != bot.user.id: | ||
try: | ||
result = base64.standard_b64encode(" ".join(args[2:]).encode('ascii')).decode('ascii') | ||
except: | ||
result = localization[1][14][6] | ||
decoder_result_content = discord.Embed(title=localization[1][14][0], color=embed_color) | ||
decoder_result_content.add_field(name=str(localization[1][14][4]), value="```" + str(result) + "```", inline=True) | ||
await msg.edit(embed=decoder_result_content) | ||
if reaction.emoji == "2️⃣" and user.id != bot.user.id: | ||
try: | ||
result = base64.b32encode(" ".join(args[2:]).encode('ascii')).decode('ascii') | ||
except: | ||
result = localization[1][14][6] | ||
decoder_result_content = discord.Embed(title=localization[1][14][0], color=embed_color) | ||
decoder_result_content.add_field(name=str(localization[1][14][4]), value="```" + str(result) + "```", inline=True) | ||
await msg.edit(embed=decoder_result_content) | ||
if reaction.emoji == "3️⃣" and user.id != bot.user.id: | ||
try: | ||
result = base64.b16encode(" ".join(args[2:]).encode('ascii')).decode('ascii') | ||
except: | ||
result = localization[1][14][6] | ||
decoder_result_content = discord.Embed(title=localization[1][14][0], color=embed_color) | ||
decoder_result_content.add_field(name=str(localization[1][14][4]), value="```" + str(result) + "```", inline=True) | ||
await msg.edit(embed=decoder_result_content) | ||
if reaction.emoji == "4️⃣" and user.id != bot.user.id: | ||
try: | ||
args_str = " ".join(args[2:]) | ||
result = "" | ||
for letter in list(args_str): | ||
try: | ||
result += binary.encode()[letter] | ||
except Exception as e: | ||
print(e) | ||
result += '' | ||
except Exception as e: | ||
result = localization[1][14][6] | ||
print(e) | ||
try: | ||
decoder_result_content = discord.Embed(title=localization[1][14][0], color=embed_color) | ||
decoder_result_content.add_field(name=str(localization[1][14][4]), value='```' + str(result) + '```', inline=True) | ||
await msg.edit(embed=decoder_result_content) | ||
except: | ||
decoder_result_content = discord.Embed(title=localization[1][14][0], color=embed_color) | ||
decoder_result_content.add_field(name=str(localization[1][14][4]), value=localization[1][14][7], inline=True) | ||
try: | ||
await msg.edit(content=str('```' + str(result) + '```'), embed=decoder_result_content) | ||
except: | ||
await msg.edit(content='', embed=decoder_result_content) | ||
async def get_help(bot, discord, message, botconfig, os, platform, datetime, one_result, localization, embed_color): | ||
help_content = discord.Embed(title=localization[1][14][0], description=localization[1][14][5], color=embed_color) | ||
await message.channel.send(embed=help_content) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
async def guilds_cmd(bot, discord, message, botconfig, os, platform, datetime, one_result, localization, guild_result, intents, embed_color): | ||
accessdenied_msg = discord.Embed(title="Доступ запрещен", description="Эта команда защищена владельцем бота, поэтому она недоступна.", color=botconfig['accent2']) | ||
if str(message.author.id) != botconfig['owner']: | ||
return await message.channel.send(embed=accessdenied_msg) | ||
try: | ||
guild_list = "" | ||
for bot_guild in bot.guilds: | ||
guild_list += str(bot.guilds.index(bot_guild) + 1) + ". " + str(bot_guild.name) + " | Members: " + str(bot_guild.member_count) + "\n" | ||
except Exception as e: | ||
guild_list = "Обнаружено исключение!\n" + str(e) | ||
finally: | ||
await message.channel.send("```" + guild_list + "```") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,38 @@ | ||
async def help_cmd(bot, discord, message, botconfig, platform, os, datetime, one_result, localization, embed_color): | ||
help_content = discord.Embed(title=botconfig['name'], description=str(botconfig['name'] + localization[1][0][0]), color=embed_color) | ||
help_content.add_field(name=str(localization[1][0][1][0]), value=str(localization[1][0][1][1]), inline=True) | ||
help_content.add_field(name=str(localization[1][0][2][0]), value=str(localization[1][0][2][1]), inline=True) | ||
help_content.add_field(name=str(localization[1][0][3][0]), value=str(localization[1][0][3][1]), inline=True) | ||
help_content.add_field(name=str(localization[1][0][4][0]), value=str(localization[1][0][4][1]), inline=True) | ||
help_content.set_footer(text='Ver. ' + botconfig['version']) | ||
await message.channel.send(embed=help_content) | ||
import random | ||
|
||
|
||
async def help_cmd(bot, discord, message, botconfig, platform, os, datetime, | ||
one_result, localization, embed_color): | ||
if localization[0] == "Russian": | ||
tips = [ | ||
'Для просмотра авторской информационной программы "Новости Тинеликса" достаточно написать команду `tnews`?', | ||
'Все наши ссылки находятся в `info`?', | ||
'Узнать погоду можно в `weather`?', | ||
'Просмотреть рандомные фото можно в `photo`? Вдруг пригодится поставить обои на свой рабочий стол?', | ||
'Что в версии 01R5 (9 января 2020 г.) появилась команда `codec` для зашифровки и расшифровки текста?' | ||
] | ||
else: | ||
tips = ['All our links on `info` command'] | ||
lucky_num = random.randint(0, len(tips) - 1) | ||
|
||
help_content = discord.Embed(description=str(botconfig['name'] + localization[1][0][0]).format( | ||
botconfig['prefix'], tips[lucky_num]), | ||
color=embed_color) | ||
help_content.add_field( | ||
name=str(localization[1][0][1][0]), | ||
value=str(localization[1][0][1][1]), | ||
inline=True) | ||
help_content.add_field( | ||
name=str(localization[1][0][2][0]), | ||
value=str(localization[1][0][2][1]), | ||
inline=True) | ||
help_content.add_field( | ||
name=str(localization[1][0][3][0]), | ||
value=str(localization[1][0][3][1]), | ||
inline=True) | ||
help_content.add_field( | ||
name=str(localization[1][0][4][0]), | ||
value=str(localization[1][0][4][1]), | ||
inline=True) | ||
help_content.set_footer(text='Ver. ' + botconfig['version']) | ||
await message.channel.send(embed=help_content) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
async def info_cmd(bot, discord, message, botconfig, platform, os, datetime, one_result, localization, embed_color): | ||
info_content = discord.Embed(title=botconfig['name'], color=embed_color) | ||
info_content.add_field(name=str(localization[1][15][0]), value=str(localization[1][15][1]), inline=False) | ||
info_content.add_field(name=str(localization[1][15][2]), value=str("Python with discord.py library"), inline=True) | ||
info_content.add_field(name=str(localization[1][15][3]), value="Tinelix (`" + bot.get_user(int(botconfig['owner'])).name + "#" + str(bot.get_user(int(botconfig['owner'])).discriminator) + "`)", inline=True) | ||
info_content.add_field(name=str(localization[1][15][4]), value=str(localization[1][15][5]), inline=True) | ||
info_content.add_field(name=str(localization[1][15][6]), value=str(localization[1][15][7]), inline=True) | ||
info_content.set_footer(text="© Tinelix, 2020-2021") | ||
await message.channel.send(embed=info_content) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
def remove_outer_symbols(s): | ||
left = s.index("[") | ||
right = s.rindex("]", left) | ||
return s[:left] + s[left+1:right] + s[right+1:] | ||
|
||
async def poll_cmd(bot, discord, message, botconfig, platform, os, datetime, one_result, localization, unix_time_millis, embed_color, connection, cursor): | ||
args = message.content.split(" "); | ||
args2 = message.content.split("-[]"); | ||
parameter_option = "" | ||
args_str = " ".join(args[1:]) | ||
emoji_number = { | ||
'0': '0️⃣', | ||
'1': '1️⃣', | ||
'2': '2️⃣', | ||
'3': '3️⃣', | ||
'4': '4️⃣', | ||
'5': '5️⃣', | ||
'6': '6️⃣', | ||
'7': '7️⃣', | ||
'8': '8️⃣', | ||
'9': '9️⃣' | ||
} | ||
try: | ||
question_rindex = args_str.rindex('-o', 0) | ||
question = args_str[:question_rindex] | ||
options_str = "" | ||
options = [] | ||
endtimeerr = "" | ||
endtime = 0 | ||
for args_index in args: | ||
try: | ||
endtime = int(unix_time_millis(datetime.datetime.strptime(args_index, '%Y-%m-%d=%H:%M'))) | ||
endtimeerr = "" | ||
except Exception as e: | ||
print(e) | ||
endtimeerr = "Error" | ||
for args_index in args: | ||
if args_index == "-o": | ||
parameter_option += '-o' | ||
for args_index in args2: | ||
try: | ||
index = args_str.index('[') + 6 | ||
rindex = args_str.rindex(']') + 7 | ||
options_str += remove_outer_symbols(args_index[index:rindex]) | ||
options = options_str.split("],[") | ||
except: | ||
pass | ||
if endtime < (unix_time_millis(datetime.datetime.utcnow()) + one_result[3]): | ||
endtime = 0 | ||
|
||
option_str = "" | ||
for opt in options: | ||
option_str += emoji_number[str(options.index(opt))] + " " + options[options.index(opt)] + "\n" | ||
if args[1] == "" or args[1] == None or args[2] == "" or parameter_option != '-o' or options == [] or args[2] == None or endtimeerr == "Error": | ||
no_args = discord.Embed(title=localization[1][16][0], description=localization[1][16][4], color=embed_color) | ||
return await message.channel.send(embed=no_args) | ||
if endtime == 0: | ||
no_args = discord.Embed(title=localization[1][16][0], description=localization[1][16][5], color=embed_color) | ||
return await message.channel.send(embed=no_args) | ||
poll = [(message.id, message.author.id, endtime - one_result[3])] | ||
cursor.executemany("INSERT OR REPLACE INTO polls VALUES(?, ?, ?);", poll) | ||
connection.commit() | ||
cursor.execute("SELECT * FROM polls WHERE msgid='" + str(message.id) + "';") | ||
poll_result = cursor.fetchone() | ||
poll_content = discord.Embed(title=question, description=localization[1][16][2].format(str(datetime.datetime.fromtimestamp((poll_result[2] + one_result[3]) / 1000))) + "\n\n" + option_str, color=embed_color) | ||
msg = await message.channel.send(embed=poll_content) | ||
for opt in options: | ||
emoji = emoji_number[str(options.index(opt))] | ||
await msg.add_reaction(emoji=emoji) | ||
except Exception as e: | ||
print(e) | ||
no_args = discord.Embed(title=localization[1][16][0], description=localization[1][16][4], color=embed_color) | ||
await message.channel.send(embed=no_args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.