Skip to content

Commit 4cfe603

Browse files
committed
touchdown - The Eagle Has Landed
1 parent b068dc7 commit 4cfe603

35 files changed

+417
-137
lines changed

Discord_Rust_Team_bot/Discord_Rust_Team_bot.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def __init__(self):
105105
"discord_cogs.help_command",
106106
"discord_cogs.Rust.server_stats",
107107
"discord_cogs.Rust.ChannelHoper",
108-
"discord_cogs.Rust.Team_Checker",
108+
"discord_cogs.Rust.team_check",
109109
]
110110

111111
async def setup_hook(self):
@@ -196,6 +196,25 @@ async def on_ready(self):
196196

197197
Rust_info = await guild.create_text_channel("💻 Rust_info", category=category_Rust)
198198

199+
embed = discord.Embed(title="#rust-info", color=0x8080ff)
200+
embed.set_author(name=f"@{guild.name}",
201+
icon_url=f"https://i.imgur.com/sGX6nZz.png")
202+
embed.set_thumbnail(url="https://i.imgur.com/sdr9twR.png")
203+
all_commands = """`!rust help` - List of all commands
204+
`!rust cctv` - List of all CCTV codes
205+
`!rust pager` - List of all pager codes
206+
`!rust cost` - Important prices
207+
`!rust fert {Number of Fertilizers}` - How much Scrap from x Fertilizer
208+
`!rust diesel {Number of Diesel}` - Giant Excavator / Mining Quarry - Calculator
209+
`!rust sulfur {Number of sulphur}` - How much boom from x suflur
210+
`!rust raid` - Raid costs list
211+
`!rust bind` - Must-have Extra Bind's
212+
`!rust elec` - Must have Electronic Circuits
213+
"""
214+
embed.add_field(name="All Commands:",
215+
value=all_commands, inline=True)
216+
await Rust_info.send(embed=embed)
217+
199218
rust_info_channel_id = Rust_info.id
200219
rust_info_channel_name = Rust_info.name
201220
write_config(config_dir, "Channel",
Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
11
{
2-
"Teams": {
3-
"aaa": {
4-
"note": "bbb",
5-
"embed_id": 1106315540886212708,
6-
"Sub_Discord_ID_list": [],
7-
"Last_Status": true,
8-
"ThatsWutSheZed": {
9-
"ID": "977065329",
10-
"note": "https://steamcommunity.com/profiles/76561198048069955/"
11-
}
12-
}
13-
}
14-
}
2+
"Teams": {}
3+
}
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
[Client]
2-
guild_id = 1103399447100133386
2+
guild_id =
33
activity = Farm Sulfur
44
praefix = !
55

66
[Channel]
7-
admin_channel_id = 1106276696304390287
8-
delt_messages_channel_id = 1106276698628046948
9-
server_stats_channel_id = 1106276688062591097
10-
rust_info_channel_id = 1106276690314928240
11-
player_observation_channel_id = 1106276689207640184
12-
hopper_voice_channel_id = 1106276692852494446
13-
category_rust_id = 1106276686774939659
7+
admin_channel_id = 1
8+
delt_messages_channel_id = 1
9+
server_stats_channel_id = 1
10+
rust_info_channel_id = 1
11+
player_observation_channel_id = 1
12+
hopper_voice_channel_id = 1
13+
category_rust_id = 1
1414
player_observation_id = 1
1515

1616
[Rust]
1717
battlemetrics_server_id = 15343129
18-
rust_server_description_message_id = 1106277365140705300
19-
rust_server_embed_message_id = 1106277362846416976
18+
rust_server_description_message_id = 1
19+
rust_server_embed_message_id = 1
2020
rust_server_map_embed_message_id = 1
2121

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[Discord]
2-
token =
3-
application_id =
2+
token =
3+
application_id =

Discord_Rust_Team_bot/discord_cogs/Rust/Rust_info.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424

2525
guild = discord.Object(id=guild_id)
2626

27-
rust_info_channel_id = read_config(config_dir, "Channel", "rust_info_channel_id")
27+
rust_info_channel_id = read_config(
28+
config_dir, "Channel", "rust_info_channel_id")
2829
if rust_info_channel_id == None:
2930
rust_info_channel_id = 1
3031
rust_info_channel_id = int(rust_info_channel_id)
@@ -53,8 +54,10 @@ async def send_info(self, ctx: commands.Context, first: str, second: str | None
5354
`!rust fert {Number of Fertilizers}` - How much Scrap from x Fertilizer
5455
`!rust diesel {Number of Diesel}` - Giant Excavator / Mining Quarry - Calculator
5556
`!rust sulfur {Number of sulphur}` - How much boom from x suflur
56-
`!rust raid` - Überfallkosten Liste
57-
`!rust bind` - Must-have Extra Bind's"""
57+
`!rust raid` - Raid costs list
58+
`!rust bind` - Must-have Extra Bind's
59+
`!rust elec` - Must have Electronic Circuits
60+
"""
5861
embed.add_field(name="All Commands:",
5962
value=all_commands, inline=True)
6063
await rust_info_channel.send(embed=embed)
@@ -361,6 +364,17 @@ async def send_info(self, ctx: commands.Context, first: str, second: str | None
361364
name="More", value="Steam Guide: [Must-have Extra Bind](https://steamcommunity.com/sharedfiles/filedetails/?id=2493654016)", inline=False)
362365
await rust_info_channel.send(embed=embed)
363366

367+
if first.lower() == "elec":
368+
369+
embed = discord.Embed(title="Must have Electronic Circuits",
370+
url="https://steamcommunity.com/sharedfiles/filedetails/?id=2375732344", description="a collection of my must-have Electronic Circuits for Rust!")
371+
embed.set_author(name=f"@{ctx.author}",
372+
icon_url=f"{display_avatar}")
373+
embed.set_thumbnail(
374+
url="https://steamuserimages-a.akamaihd.net/ugc/2039609591868400626/3DDEBD3AAF15EE8C54E98FE9805530E56FCC247B/?imw=128&imh=128&ima=fit&impolicy=Letterbox&imcolor=%23000000&letterbox=true")
375+
embed.add_field(name="Steam", value="Steam Guide: [Must-have Extra Bind](https://steamcommunity.com/sharedfiles/filedetails/?id=2375732344)", inline=False)
376+
await rust_info_channel.send(embed=embed)
377+
364378

365379
async def setup(bot: commands.Bot):
366380
await bot.add_cog(Rust_Info(bot))

Discord_Rust_Team_bot/discord_cogs/Rust/player_watch.py

Lines changed: 41 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
"""Full Doku on: https://github.com/NapoII/Discord_Rust_Team_bot"
22
-----------------------------------------------
3-
Diese COG ist für Spielerkarten, um die letzte Aktiviti zu sehen.
4-
e.g. :
5-
Wohnort ?
3+
This COG is for player cards to see the latest activiti.
64
Team note: ?
7-
aktualisiert vor 7 Minuten
5+
updated 7 minutes ago
86
FRED
9-
🔴 vor einem Monat
7+
🔴 one month ago
108
ServerZeit: 223.61h
119
note: Close by
1210
Player ID: 244928103
@@ -18,7 +16,7 @@
1816
from discord.ext import commands, tasks
1917
from discord.ui import Select, View
2018
from numpy import append
21-
import asyncio
19+
2220

2321
from util.__funktion__ import *
2422

@@ -64,11 +62,13 @@
6462
player_observation_channel_id = int(read_config(
6563
config_dir, "Channel", "player_observation_channel_id"))
6664

67-
Rust_Bot_Channel_ID = read_config(config_dir, "Channel", "player_observation_channel_id")
65+
Rust_Bot_Channel_ID = read_config(
66+
config_dir, "Channel", "player_observation_channel_id")
6867
if Rust_Bot_Channel_ID == None:
6968
Rust_Bot_Channel_ID = 1
7069
Rust_Bot_Channel_ID = int(Rust_Bot_Channel_ID)
7170

71+
7272
class New_player(commands.Cog):
7373
def __init__(self, bot: commands.Bot) -> None:
7474
self.bot = bot
@@ -82,24 +82,28 @@ async def choise_team(self, interaction: discord.Interaction, player_name: str,
8282
self.player_name = player_name
8383
self.player_note = player_note
8484

85-
thinking = self.bot.get_emoji(123456789) # replace with your thinking emoji ID
86-
85+
# replace with your thinking emoji ID
86+
thinking = self.bot.get_emoji(123456789)
8787

8888
# Send the embed with the thinking animation
89-
embed = discord.Embed(title="Adding player...", description=f"{thinking} Thinking...", color=discord.Color.blurple())
89+
embed = discord.Embed(
90+
title="Adding player...", description=f"{thinking} Thinking...", color=discord.Color.blurple())
9091
msg = await interaction.response.send_message(embed=embed, ephemeral=True, )
9192

92-
battlemetrics_server_id = read_config(config_dir, "Rust", "battlemetrics_server_id")
93+
battlemetrics_server_id = read_config(
94+
config_dir, "Rust", "battlemetrics_server_id")
9395

9496
if "id-" in player_name:
9597
player_id = player_name.split("id:")[1]
9698

9799
else:
98-
player_id = get_player_id_from_name(player_name, battlemetrics_server_id)
100+
player_id = get_player_id_from_name(
101+
player_name, battlemetrics_server_id)
99102

100103
if player_id == None:
101104
s_url = f"https://www.battlemetrics.com/players?filter%5Bsearch%5D={player_name}&filter%5BplayerFlags%5D=&filter%5Bservers%5D={battlemetrics_server_id}&sort=-lastSeen"
102-
embed=discord.Embed(title=f"No search results with {player_name}", url=s_url, description="Try to find the player by yourself and add the ID to the next request with `id:{battlemetrics_player_id}`.", color=0xff0000)
105+
embed = discord.Embed(title=f"No search results with {player_name}", url=s_url,
106+
description="Try to find the player by yourself and add the ID to the next request with `id:{battlemetrics_player_id}`.", color=0xff0000)
103107
await interaction.response.send_message(embed=embed, ephemeral=True)
104108
else:
105109
player_id = int(player_id)
@@ -143,23 +147,24 @@ async def choise_team(self, interaction: discord.Interaction, player_name: str,
143147
if player_online_status == False or player_online_status == "never_played":
144148
if player_online_status == "never_played":
145149
embed = discord.Embed(title=f"{Player_name}", url=f"https://www.battlemetrics.com/players/{player_id}",
146-
description=("❌ | ID: "+str(player_id)), color=0xff0000)
150+
description=("❌ | ID: "+str(player_id)), color=0xff0000)
147151
value = f"❌ `Never played on that Server` ❌ | note: `{player_note}`"
148152
embed.add_field(name=Player_name, value=value, inline=True)
149153
else:
150154
embed = discord.Embed(title=f"{Player_name}", url=f"https://www.battlemetrics.com/players/{player_id}",
151-
description=("🔴 | ID: "+str(player_id)), color=0xff0000)
155+
description=("🔴 | ID: "+str(player_id)), color=0xff0000)
152156
embed.add_field(name="Last Seen",
153157
value=f"{player_lastSeen}", inline=True)
154158
embed.add_field(
155159
name="Note", value=f"{player_note}", inline=True)
156160
embed.set_footer(text=f"Select team:")
157161
else:
158162
embed = discord.Embed(title=f"{Player_name}", url=f"https://www.battlemetrics.com/players/{player_id}",
159-
description=f"🟢 | ID: {player_id}", color=0xff8040)
163+
description=f"🟢 | ID: {player_id}", color=0xff8040)
160164
embed.add_field(name="Online since",
161165
value=f"{player_lastSeen}", inline=True)
162-
embed.add_field(name="Note", value=f"{player_note}", inline=True)
166+
embed.add_field(
167+
name="Note", value=f"{player_note}", inline=True)
163168
embed.set_footer(text=f"Select team:")
164169

165170
Team_list = Team_choice(file_path_Team_data)
@@ -204,16 +209,11 @@ async def my_callback(interaction):
204209
select.callback = my_callback
205210
view = View()
206211
view.add_item(select)
207-
212+
208213
if msg is not None:
209214
await msg.edit(embed=embed, view=view)
210215
else:
211-
await interaction.channel.send(embed=embed, delete_after=10, view=view)
212-
213-
214-
215-
216-
216+
await interaction.channel.send(embed=embed, delete_after=30, view=view)
217217

218218

219219
class Confirm_say(discord.ui.View):
@@ -250,7 +250,7 @@ class modal_New_team(ui.Modal, title="New Team",):
250250
log("modal_New_team: New_Team_name | New_team_note |")
251251

252252
async def on_submit(self, interaction: discord.Interaction):
253-
253+
254254
embed = discord.Embed(title=self.New_Team_name,
255255
description=self.New_team_note, color=0xc0c0c0)
256256
view = Confirm_say()
@@ -275,7 +275,6 @@ async def on_submit(self, interaction: discord.Interaction):
275275
Team_Card_embed_id = 0
276276
log(f'Confirmed... self.confirm_Button = {self.confirm_Button}')
277277

278-
279278
JSOn_data = open_JSOn_File(file_path_Team_data)
280279
JSOn_data = add_Team(JSOn_data, self.New_Team_name,
281280
self.New_team_note, Team_Card_embed_id)
@@ -286,7 +285,8 @@ async def on_submit(self, interaction: discord.Interaction):
286285

287286
# add_player(dict, team, name, id, note):
288287

289-
JSOn_data = add_player(JSOn_data, self.New_Team_name, player_name_str, player_id_int, player_note_str)
288+
JSOn_data = add_player(
289+
JSOn_data, self.New_Team_name, player_name_str, player_id_int, player_note_str)
290290

291291
Fill_JSOn_File(file_path_Team_data, JSOn_data)
292292

@@ -332,12 +332,13 @@ async def on_submit(self, interaction: discord.Interaction):
332332
break
333333
#player_observation_channel_id = int(read_config(config_dir, "Channel", "player_observation_channel_id"))
334334
try:
335-
player_observation_channel = interaction.client.get_channel(player_observation_channel_id)
335+
player_observation_channel = interaction.client.get_channel(
336+
player_observation_channel_id)
336337
msg = await player_observation_channel.fetch_message(embed_ID_list[x])
337338
await msg.delete()
338-
log (f"No msg delt","blue")
339+
log(f"No msg delt", "blue")
339340
except:
340-
log (f"No msg to delt","blue")
341+
log(f"No msg to delt", "blue")
341342

342343
dictionary = {"Teams": {}}
343344
Fill_JSOn_File(file_path_Team_data, dictionary)
@@ -485,7 +486,8 @@ async def my_callback(interaction: discord.Interaction):
485486
JSOn_data = delt_Team(JSOn_data, Team_name)
486487
Fill_JSOn_File(file_path_Team_data, JSOn_data)
487488

488-
player_observation_channel = interaction.client.get_channel(player_observation_channel_id)
489+
player_observation_channel = interaction.client.get_channel(
490+
player_observation_channel_id)
489491
log(f"msg delt: {embed_id}: Team embed ({Team_name})")
490492
msg = await player_observation_channel.fetch_message(embed_id)
491493
await msg.delete()
@@ -641,19 +643,23 @@ async def myLoop(self, bot,):
641643
await User.send(embed=embed)
642644

643645
try:
644-
player_observation_channel = self.bot.get_channel(player_observation_channel_id)
646+
player_observation_channel = self.bot.get_channel(
647+
player_observation_channel_id)
645648
msg = await player_observation_channel.fetch_message(Team_embed_id)
646649
await msg.edit(embed=embed)
647-
log(f"Discord: Edit Embed from Team [{Team_Name}] msg.id: [{msg.id}]")
650+
log(
651+
f"Discord: Edit Embed from Team [{Team_Name}] msg.id: [{msg.id}]")
648652
except:
649653
try:
650654
JSOn_data = open_JSOn_File(file_path_Team_data)
651-
player_observation_channel = self.bot.get_channel(player_observation_channel_id)
655+
player_observation_channel = self.bot.get_channel(
656+
player_observation_channel_id)
652657
Team_Card_embed = await player_observation_channel.send(embed=embed, view=Sub_button())
653658
Team_Card_embed_id = (Team_Card_embed.id)
654659
JSOn_data["Teams"][Team_Name]["embed_id"] = Team_Card_embed_id
655660
Fill_JSOn_File(file_path_Team_data, JSOn_data)
656-
log(f"Discord: send new Embed from Team [{Team_Name}] msg.id: [{Team_Card_embed_id}]")
661+
log(
662+
f"Discord: send new Embed from Team [{Team_Name}] msg.id: [{Team_Card_embed_id}]")
657663
except:
658664
pass
659665

0 commit comments

Comments
 (0)