Skip to content

Commit

Permalink
fix player delt and polish some embeds
Browse files Browse the repository at this point in the history
  • Loading branch information
NapoII committed Feb 15, 2024
1 parent c242f58 commit 3d5bfc4
Show file tree
Hide file tree
Showing 21 changed files with 314 additions and 299 deletions.
6 changes: 3 additions & 3 deletions Discord_Rust_Team_bot/config/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ rust_ultras_role_id = 0

[git]
git_link = https://github.com/NapoII/Discord_Rust_Team_Bot
last_git_comment = New Moon rise
last_git_commit_date = Wed Feb 14 00:51:53 2024 +0100
last_git_branch = main
last_git_comment = The Eagle Has Landed
last_git_commit_date = Wed Feb 14 03:37:20 2024 +0100
last_git_branch = HEAD -> main, o/main

[rust]
battlemetrics_server_id = 11434376
Expand Down
1 change: 1 addition & 0 deletions Discord_Rust_Team_bot/config/json/channel_data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{

}
2 changes: 1 addition & 1 deletion Discord_Rust_Team_bot/config/token.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[discord]
discord_bot_name =
token =
application_id =
application_id =
4 changes: 2 additions & 2 deletions Discord_Rust_Team_bot/discord_cogs/admin/pre_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
# construct the path to the config.ini file relative to the current directory
config_dir = os.path.join(bot_folder, "config", "config.ini")

json_path_server_channel_data = os.path.join(current_dir, "server_channel_data.json")
json_path_server_channel_data = os.path.join(current_dir, "json","server_channel_data.json")

bot_cmd_channel = read_config(config_dir, "channels", "bot_cmd_channel_id")

Expand Down Expand Up @@ -204,7 +204,7 @@ async def setup_ticket_system(self, bot):
# Send informational messages to the channel
embed_text = f"🔒 Please make sure to adjust the role settings for\n<#{category_admin_id}>\nto restrict channel visibility to authorized users,\ninstead of allowing it to be visible to everyone. 🔓"
embed = discord.Embed(title="Attention!",description=embed_text, color=0x8080ff)
embed.set_thumbnail(url=my_image_url.piktogramm.attention())
embed.set_thumbnail(url=my_image_url.piktogramm.attention)
await bot_cmd_channel.send(embed=embed)

gif_url_expl = img_url.example.discord_role_rights
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
bot_folder = os.path.dirname(bot_path)
config_dir = os.path.join(bot_folder, "config", "config.ini")
category_rust_id = read_config(config_dir, "categorys", "category_rust_id", "int")
json_path = os.path.join(bot_folder, "config", "channel_data.json")
json_path = os.path.join(bot_folder, "config", "json","channel_data.json")
content = {}
json_path = if_json_file_404(json_path, content)


json_rust_help_commands_data_dir = os.path.join(bot_folder, "config","channel_hopper_commands.json")
json_rust_help_commands_data_dir = os.path.join(bot_folder, "config","json", "channel_hopper_commands.json")

guild_id = read_config(config_dir, "client", "guild_id", "int")
if guild_id == None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,24 @@


###



def player_exists(json_dir, player_name):
with open(json_dir, 'r') as f:
data = json.load(f)
for team, players in data.items():
if player_name in players:
return True
return False


def if_team_in_json(json_dir, team_name):
with open(json_dir, 'r') as f:
data = json.load(f)
return team_name in data


def delt_all_Player_subs(JSOn_data, Player_ID):
"""Args:
- JSOn_data: a dictionary containing information about Rust teams and players.
Expand Down Expand Up @@ -189,19 +207,22 @@ def get_all_Player_from_a_Team(JSOn_data, Team):
>>> get_all_Player_from_a_Team(JSOn_data, "Team1")
['Player1', 'Player2']
"""

Team_list = list(JSOn_data.keys())
Team_list_len = len(Team_list)
x = -1
while True:
x = x + 1
if x == Team_list_len:
break

Team_Player_list = list(JSOn_data[f"{Team}"].keys())
Team_Player_list.remove('note')
Team_Player_list.remove('embed_id')
Team_Player_list.remove('Sub_Discord_ID_list')
Team_Player_list.remove("Last_Status")
try:
Team_Player_list = list(JSOn_data[f"{Team}"].keys())
Team_Player_list.remove('note')
Team_Player_list.remove('embed_id')
Team_Player_list.remove('Sub_Discord_ID_list')
Team_Player_list.remove("Last_Status")
except:
pass

return Team_Player_list

Expand Down
Loading

0 comments on commit 3d5bfc4

Please sign in to comment.