-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix HTML stuff and add embed for move
- Loading branch information
Showing
9 changed files
with
85 additions
and
4,607 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
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 |
---|---|---|
@@ -1,111 +1,29 @@ | ||
import discord | ||
from random import randint | ||
from src.module import character | ||
|
||
import re | ||
|
||
MOVE_NOT_FOUND_TITLE = 'Move not found' | ||
|
||
|
||
def move_embed(character, move): | ||
def move_embed(character :character, move :dict): | ||
"""Returns the embed message for character and move""" | ||
embed = discord.Embed(title=character['proper_name'], | ||
embed = discord.Embed(title=character.name, | ||
colour=0x00EAFF, | ||
url=character['online_webpage'], | ||
description='**Move: ' + move['Command'] + '**') | ||
embed.set_thumbnail(url=character['portrait']) | ||
|
||
block = "Block" | ||
counterhit = "Counter hit" | ||
|
||
if 'Throw' in move['Tags']: | ||
block = "On Break" | ||
counterhit = "Break Type" | ||
|
||
embed.add_field(name='Property', value=move['Hit level']) | ||
embed.add_field(name='Damage', value=move['Damage']) | ||
|
||
result = re.match('^\d', move['Start up frame']) | ||
|
||
if result: | ||
embed.add_field(name='Startup', value='i' + move['Start up frame']) | ||
else: | ||
embed.add_field(name='Startup', value=move['Start up frame']) | ||
|
||
embed.add_field(name=block, value=move['Block frame']) | ||
embed.add_field(name='Hit', value=move['Hit frame']) | ||
embed.add_field(name=counterhit, value=move['Counter hit frame']) | ||
|
||
if 'Recovery' in move: | ||
embed.add_field(name='On whiff', value=move['Recovery']) | ||
if 'Notes' in move and move['Notes'] and not move['Notes'] == "-": | ||
embed.add_field(name='Notes', value=move['Notes']) | ||
if 'Gif' in move and move['Gif'] and not move['Gif'] == "-": | ||
embed.add_field(name='Gif', value=move['Gif'], inline=False) | ||
if 'Tags' in move and move['Tags'] and not move['Tags'] == "-": | ||
embed.add_field(name='Tags', value=move['Tags'], inline=False) | ||
|
||
random_value = randint(0, 2) | ||
if random_value == 2: | ||
embed.add_field(name='Dev Note', | ||
value='**IMPORTANT** \n The bot for T7 will shutdown on the 25th Jan 2024', | ||
inline=False) | ||
|
||
return embed | ||
|
||
|
||
def move_list_embed(character, move_list, move_type): | ||
"""Returns the embed message for a list of moves matching to a special move type""" | ||
desc_string = '' | ||
move_list.sort() | ||
for move in move_list: | ||
desc_string += move + '\n' | ||
|
||
embed = discord.Embed(title=character['proper_name'] + ' ' + move_type.lower() + ':', | ||
colour=0x00EAFF, | ||
description=desc_string) | ||
return embed | ||
|
||
|
||
def error_embed(err): | ||
embed = discord.Embed(title='Error', | ||
colour=0xFF4500, | ||
description=err) | ||
return embed | ||
|
||
|
||
def success_embed(message): | ||
embed = discord.Embed(title='Success', | ||
colour=0x3ddb2c, | ||
description=message) | ||
return embed | ||
|
||
|
||
def similar_moves_embed(similar_moves, character_name): | ||
for i in range(len(similar_moves)): | ||
similar_moves[i] = f'**{i + 1}**. {similar_moves[i]}' | ||
|
||
embed = discord.Embed(title=MOVE_NOT_FOUND_TITLE, colour=0xfcba03, | ||
description='Similar moves from {}\n{}' | ||
.format(character_name, '\n'.join(similar_moves))) | ||
return embed | ||
description='**Move: ' + move['input'] + '**') | ||
embed.set_thumbnail(url=character.portrait) | ||
embed.set_footer(text=move['name']) | ||
|
||
embed.add_field(name='Target', value=move['target']) | ||
embed.add_field(name='Damage', value=move['damage']) | ||
|
||
def help_embed(): | ||
text = "**Slash command** \n" \ | ||
"/fd <character> <move>\t\t\t- get frame data of a move from a character \n" \ | ||
"/last-updates\t\t\t- get the messages of some latest updates\n" \ | ||
"/feedback <message>\t\t\t- send message including sender name to the devs \n\n" \ | ||
"**Direct Ping** \n " \ | ||
"@discordbot <character> <move>\t\t\t- get frame data of a move from a character \n\n" | ||
embed = discord.Embed(title='Commands', description=text, colour=0x37ba25) | ||
embed.set_author(name='Author: Tib#1303') | ||
embed.add_field(name='Startup', value=move['startup']) | ||
|
||
return embed | ||
embed.add_field(name="Block", value=move['on_block']) | ||
embed.add_field(name='Hit', value=move['on_hit']) | ||
embed.add_field(name="CH", value=move['on_ch']) | ||
embed.add_field(name="Notes", value=move['notes']) | ||
|
||
|
||
def thank_embed(): | ||
text = "\n\n" \ | ||
"Much thanks and love especially to T7Chicken Team, Ruxx, BKNR, Vesper, Maxwell and Evil. \n\n" \ | ||
"This project won't be possible without you guys <3" | ||
embed = discord.Embed(title='Commands', description=text, colour=0x37ba25) | ||
embed.set_author(name='Author: Tib') | ||
return embed | ||
return embed |
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,21 @@ | ||
from src.resources import const | ||
from src.module import character | ||
|
||
|
||
def correct_character_name(alias: str): | ||
# check if input in dictionary or in dictionary values | ||
if alias in const.CHARACTER_ALIAS: | ||
return alias | ||
|
||
for key, value in const.CHARACTER_ALIAS.items(): | ||
if alias in value: | ||
return key | ||
|
||
return None | ||
|
||
def get_character_by_name(name :str, character_list :[]) -> character.Character: | ||
for character in character_list: | ||
if character.name == name: | ||
return character | ||
|
||
|
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,10 +1,10 @@ | ||
[ | ||
{ | ||
"name": "azucena", | ||
"portrait": "x" | ||
"portrait": "https://i.imgur.com/yeyRqH2.jpg" | ||
}, | ||
{ | ||
"name": "bryan", | ||
"portrait": "x" | ||
"portrait": "https://i.imgur.com/PV9xTeM.jpg" | ||
} | ||
] |
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