forked from Setlerr/IBC_Discord_Bot
-
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.
added saving data to json file
- Loading branch information
Showing
10 changed files
with
178 additions
and
85 deletions.
There are no files selected for viewing
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,4 +1,5 @@ | ||
./cogs.pyc | ||
./cogs/setting.py | ||
apikeys.py | ||
*.pyc | ||
*~ | ||
|
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import nextcord | ||
import json | ||
|
||
from pathlib import Path | ||
from nextcord.ext import commands | ||
|
||
intents = nextcord.Intents.all() | ||
|
||
class Export(commands.Cog): | ||
|
||
def __init__(self,client): | ||
self.client=client | ||
#Export players from json file to activity channel | ||
@commands.command() | ||
async def export(self,ctx): | ||
await ctx.message.delete() | ||
channel_id = ctx.channel.id | ||
raw_data = Path("./data.json").read_text() | ||
print(raw_data) | ||
Current_games = json.loads(raw_data) | ||
print("current_Games") | ||
print(Current_games) | ||
Channel_name = str(Current_games[str(channel_id)]["Channel_name"]) | ||
Author_name = str(str(Current_games[str(channel_id)]["Author_name"])) | ||
Players= Current_games[str(channel_id)]["Players"] | ||
List_of_players = "**Gracze zapisani:**\n" | ||
for player in Players: | ||
List_of_players += str(player) +"\n" | ||
Message_content = f"**Nazwa kanału:** {Channel_name}\n\n**Autor zapisów/misji:** {Author_name}\n\n{List_of_players}\n\n" | ||
print(Message_content) | ||
channel = ctx.get_channel(1008094444660203540) | ||
await channel.send(Message_content) | ||
|
||
|
||
def setup(client): | ||
client.add_cog(Export(client)) |
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
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 @@ | ||
{"990936184937119815": {"message_id": "1012782819140976725", "Channel_name": "xd", "Author": "<@!276390407565344779>", "Author_name": "Setler", "Players": ["Setler", "TheAdaamek", "Apollo", "MiszczuZPolski", "Ruku"]}} |
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,2 +1,3 @@ | ||
join_leave_channel = 982713233758634004 | ||
logs_channel = 989940887259840562 | ||
logs_channel = 989940887259840562 | ||
activity_channel = 1008094444660203540 |