Initial commit

This commit is contained in:
2024-12-01 15:50:35 +00:00
parent 628bba5a37
commit 9746421550
1047 changed files with 190265 additions and 0 deletions

0
datastores/__init__.py Normal file
View File

Binary file not shown.

View File

@@ -0,0 +1,27 @@
import discord
from discord.ext import commands
import asyncio
class DataStore_Bot_Discord:
def __init__(self, token):
self.token = token
self.client = discord.Client(intents=discord.Intents.default())
@self.client.event
async def on_ready():
self.is_ready = True
async def post_message_to_channel(self, message, channel_id):
try:
task = asyncio.create_task(self.client.start(self.token))
await asyncio.sleep(2)
channel = self.client.get_channel(channel_id)
if not channel:
raise ValueError(f"Could not find channel with ID: {channel_id}")
await channel.send(message)
except Exception as e:
print(f"Error sending message: {e}")
finally:
await self.client.close()
task.cancel()

View File

@@ -0,0 +1,13 @@
from business_objects.bot_minecraft_bois import Bot_Minecraft_Bois
from datastores.datastore_bot_discord import DataStore_Bot_Discord
import os
import discord
from discord.ext import commands
import asyncio
class DataStore_Minecraft_Bois_Discussion(DataStore_Bot_Discord):
ID_CHANNEL_DISCUSSION = Bot_Minecraft_Bois.ID_CHANNEL_DISCUSSION
async def post_message_to_channel_discussion(self, message):
await self.post_message_to_channel(message, DataStore_Minecraft_Bois_Discussion.ID_CHANNEL_DISCUSSION)