Skip to content
This repository has been archived by the owner on Jul 9, 2022. It is now read-only.

Commit

Permalink
9th commit - January 23, 2021 (01R8-210123)
Browse files Browse the repository at this point in the history
  • Loading branch information
tretdm committed Jan 23, 2021
1 parent 4e21b8f commit 0ef46a4
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 6 deletions.
2 changes: 1 addition & 1 deletion discord_bot/bot_d.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ async def on_message(message):
if message.content.startswith(botconfig['prefix'] + 'photo') or message.content.startswith(guild_result[6] + 'photo'):
await photo_cmd(bot, discord, message, botconfig, os, platform, datetime, one_result, localization, unix_time_millis, unsplash, time_diff, bot_data_result, cursor, connection, embed_color, reddit, prefix)
if message.content.startswith(botconfig['prefix'] + 'calc') or message.content.startswith(guild_result[6] + 'calc'):
await calc_cmd(bot, discord, message, botconfig, os, platform, datetime, one_result, localization, numexpr, prefix)
await calc_cmd(bot, discord, message, botconfig, os, platform, datetime, one_result, localization, numexpr, prefix, embed_color)
if message.content.startswith(botconfig['prefix'] + 'feedback') or message.content.startswith(guild_result[6] + 'feedback'):
await feedback_cmd(bot, discord, message, botconfig, os, platform, datetime, one_result, localization, embed_color, prefix)
if message.content.startswith(botconfig['prefix'] + 'weather') or message.content.startswith(guild_result[6] + 'weather'):
Expand Down
36 changes: 36 additions & 0 deletions discord_bot/d_author_cmds/tnews.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from .tnews_list import tnews_list
async def get_tnews(bot, discord, message, botconfig, platform, os, datetime, one_result, localization, args, unix_time_millis, connection, cursor, embed_color):
news_title = ""
news_text = ""
tnews_content = discord.Embed(title=localization[1][6][0], description=localization[1][6][1] + tnews_list['title']['one'] + "\n" + tnews_list['title']['two'], color=embed_color)
tnews_content.set_footer(text=tnews_list['footer'])
msg = await message.channel.send(embed=tnews_content)
await msg.add_reaction(emoji="1⃣")
await msg.add_reaction(emoji="2⃣")
@bot.event
async def on_reaction_add(reaction, user):
channel = reaction.message.channel
if reaction.emoji == "1⃣" and user.id != bot.user.id:
news_title = tnews_list['title']['non-unicode']['one']
news_text = tnews_list['news']['one']
tnews_text_content = discord.Embed(title=news_title, description=news_text, color=embed_color)
tnews_text_content.set_image(url=tnews_list['images']['one'])
await msg.edit(embed=tnews_text_content)
if reaction.emoji == "2⃣" and user.id != bot.user.id:
news_title = tnews_list['title']['non-unicode']['two']
news_text = tnews_list['news']['two']
tnews_text_content = discord.Embed(title=news_title, description=news_text, color=embed_color)
tnews_text_content.set_image(url=tnews_list['images']['two'])
await msg.edit(embed=tnews_text_content)
if reaction.emoji == "3⃣" and user.id != bot.user.id:
news_title = tnews_list['title']['non-unicode']['three']
news_text = tnews_list['news']['three']
tnews_text_content = discord.Embed(title=news_title, description=news_text, color=embed_color)
tnews_text_content.set_image(url=tnews_list['images']['three'])
await msg.edit(embed=tnews_text_content)
if reaction.emoji == "4️⃣" and user.id != bot.user.id:
news_title = tnews_list['title']['non-unicode']['four']
news_text = tnews_list['news']['four']
tnews_text_content = discord.Embed(title=news_title, description=news_text, color=embed_color)
tnews_text_content.set_image(url=tnews_list['images']['four'])
await msg.edit(embed=tnews_text_content)
21 changes: 21 additions & 0 deletions discord_bot/d_author_cmds/tnews_list.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
tnews_list = {
'title': {
'non-unicode': {
'one': 'Релиз Vision 01R5 (8 января 2021 г.)',
'two': 'Бот теперь доступен в одном из мониторингов',
'three': 'Падение сервисов Google и его последствия',
'four': 'Чем отличается бот Vision от фейков (или клонов)?'
},
'one': '1⃣ Скоро новый релиз - VisionOne 01R8 (21 января 2021 г.)',
'two': '2⃣ Наш саппорт-сервер VisionOne уже открыт!',
},
'news': {
'one': 'Скоро будет размещен новый релиз бота VisionOne - 01R8, сегодня или завтра, пока все будет полностью протестировано.\n\n**Изменения**:\n1. Будет добавлена ручная смена префикса бота.\n2. Будет добавлена глобальная система уровней\n3. Станет возможным задавать свои приветственные и прощальные сообзения для Вашего сервера.',
'two': 'Перейти можно по нашей ссылке в `=info`.',
},
'images': {
'one': '',
'two': 'https://cdn.discordapp.com/attachments/787270057952542720/797275961337839716/Screenshot_2021-01-09-08-29-34.png',
},
'footer': 'Актуально на 21 января 2020 г.'
}
4 changes: 2 additions & 2 deletions discord_bot/d_commands/calc.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
async def calc_cmd(bot, discord, message, botconfig, os, platform, datetime, one_result, localization, numexpr, prefix):
async def calc_cmd(bot, discord, message, botconfig, os, platform, datetime, one_result, localization, numexpr, prefix, embed_color):
args = message.content.split();
no_args = discord.Embed(title=localization[1][9][0], description=str(localization[1][9][4]).format(prefix), color=botconfig['accent1'])
no_args.add_field(name=localization[1][9][6], value=localization[1][9][7], inline=False)
if " ".join(args[1:]) == "" or " ".join(args[1:]) == " " or " ".join(args[1:]) == None:
return await message.channel.send(embed=no_args)
calc_content = discord.Embed(title=localization[1][9][0], color=botconfig['accent1'])
calc_content = discord.Embed(title=localization[1][9][0], color=embed_color)
calc_content.add_field(name=localization[1][9][1], value="```py\n" + " ".join(args[1:]) + "```", inline=False)
try:
result = str(numexpr.evaluate(" ".join(args[1:])))
Expand Down
13 changes: 12 additions & 1 deletion discord_bot/d_commands/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,18 @@ async def get_user(bot, discord, message, botconfig, platform, os, datetime,
if one_result[3] == 0:
your_timezone = ""
try:
a_user = await message.guild.fetch_member(subargs)
search_results = 0
ids = []
member_name_lower = ""
if " ".join(args[2:]).isdigit() == True:
a_user = await message.guild.fetch_member(subargs)
else:
for member in message.guild.members:
member_name_lower = member.name.lower()
if member_name_lower.startswith(" ".join(args[2:]).lower()) or member.name.startswith(" ".join(args[2:])):
search_results = 1
ids.append(member.id)
a_user = await message.guild.fetch_member(ids[0])
except:
a_user = message.author
try:
Expand Down
2 changes: 1 addition & 1 deletion discord_bot/d_events/new_level.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ async def message_to_xp(bot, discord, message, botconfig, platform, os, datetime
lv=math.floor(lvch)
print(((one_result[9]) * (50 + ((one_result[9]) * 10))) * (one_result[9] + 1))
if one_result[9] < lv:
if message.content.startswith(botconfig['prefix']) is False or message.content.startswith(guild_result[6]) is False:
if message.content.startswith(botconfig['prefix']) is False and message.content.startswith(guild_result[6]) is False and one_result[9] > 0:
new_level_msg = discord.Embed(title=localization[1][18][0], description=str(localization[1][18][1]).format('<@' + str(message.author.id) + '>', lv), color=embed_color)
await message.channel.send(embed=new_level_msg)
cursor.executemany('UPDATE users SET level=? where userid=?', [(lv, message.author.id)])
Expand Down
2 changes: 1 addition & 1 deletion discord_bot/discord_botconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
'accent1': 0xd7832a,
'accent2': 0xcb3532,
'accent3': 0x6eda5f,
'version': '01R8-210121',
'version': '01R8-210123',
'owner': '741883312108339231',
'logs_channel': 788723868255649832,
'unsplash_ak': os.environ['UNSAKEY'],
Expand Down

0 comments on commit 0ef46a4

Please sign in to comment.