v2.1.0 - added fireboard cog and fixed a few tiny bugs/mistakes
This commit is contained in:
parent
2b4c6bcf14
commit
d2e272fc3a
8 changed files with 1784 additions and 10 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -12,3 +12,6 @@ received_memory.json
|
|||
translation_report.txt
|
||||
translationcompleteness.py
|
||||
modules/volta
|
||||
fireboard.db
|
||||
fireboard.db-shm
|
||||
fireboard.db-wal
|
1756
assets/cogs/fireboard.py
Normal file
1756
assets/cogs/fireboard.py
Normal file
File diff suppressed because it is too large
Load diff
14
bot.py
14
bot.py
|
@ -20,6 +20,7 @@ print(splashtext) # Print splash text (from modules/globalvars.py)
|
|||
start_checks()
|
||||
|
||||
import requests
|
||||
import asqlite
|
||||
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
|
@ -62,6 +63,9 @@ bot: commands.Bot = commands.Bot(
|
|||
allowed_mentions=discord.AllowedMentions(everyone=False, roles=False, users=False, replied_user=True)
|
||||
)
|
||||
|
||||
# Initialize database pool for fireboard functionality
|
||||
bot.fireboard_pool = None
|
||||
|
||||
# Load memory and Markov model for text generation
|
||||
memory: List[str] = load_memory()
|
||||
markov_model: Optional[markovify.Text] = load_markov_model()
|
||||
|
@ -115,6 +119,14 @@ async def on_ready() -> None:
|
|||
if launched:
|
||||
return
|
||||
|
||||
# Initialize database pool for fireboard functionality
|
||||
try:
|
||||
bot.fireboard_pool = await asqlite.create_pool("fireboard.db")
|
||||
print(f"{GREEN}Database pool initialized successfully{RESET}")
|
||||
except Exception as e:
|
||||
print(f"{RED}Failed to initialize database pool: {e}{RESET}")
|
||||
bot.fireboard_pool = None
|
||||
|
||||
await load_cogs_from_folder(bot)
|
||||
try:
|
||||
synced: List[discord.app_commands.AppCommand] = await bot.tree.sync()
|
||||
|
@ -473,7 +485,7 @@ async def stats(ctx: commands.Context) -> None:
|
|||
embed: discord.Embed = discord.Embed(title=f"{(_('command_stats_embed_title'))}", description=f"{(_('command_stats_embed_desc'))}", color=Colour(0x000000))
|
||||
embed.add_field(name=f"{(_('command_stats_embed_field1name'))}", value=f"{(_('command_stats_embed_field1value')).format(file_size=file_size, line_count=line_count)}", inline=False)
|
||||
embed.add_field(name=f"{(_('command_stats_embed_field2name'))}", value=f"{(_('command_stats_embed_field2value')).format(local_version=local_version, latest_version=latest_version)}", inline=False)
|
||||
embed.add_field(name=f"{(_('command_stats_embed_field3name'))}", value=f"{(_('command_stats_embed_field3value')).format(NAME=NAME, PREFIX=PREFIX, ownerid=ownerid, cooldown_time=cooldown_time, PING_LINE=PING_LINE, showmemenabled=showmemenabled, USERTRAIN_ENABLED=USERTRAIN_ENABLED, song=song, splashtext=splashtext)}", inline=False)
|
||||
embed.add_field(name=f"{(_('command_stats_embed_field3name'))}", value=f"{(_('command_stats_embed_field3value')).format(NAME=NAME, PREFIX=PREFIX, ownerid=ownerid, PING_LINE=PING_LINE, showmemenabled=showmemenabled, USERTRAIN_ENABLED=USERTRAIN_ENABLED, song=song, splashtext=splashtext)}", inline=False)
|
||||
|
||||
await send_message(ctx, embed=embed)
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ def register_name(NAME):
|
|||
if os.getenv("gooberTOKEN"):
|
||||
return
|
||||
# Name taken: print error and exit
|
||||
print(f"{RED}{(_('name_taken'))}{gv.RESET}")
|
||||
print(f"{gv.RED}{(_('name_taken'))}{gv.RESET}")
|
||||
quit()
|
||||
# Register the name
|
||||
response = requests.post(f"{gv.VERSION_URL}/register", json={"name": NAME}, headers={"Content-Type": "application/json"})
|
||||
|
|
|
@ -37,7 +37,7 @@ arch = platform.machine()
|
|||
slash_commands_enabled = True # 100% broken, its a newer enough version so its probably enabled by default.... fix this at somepoint or hard code it in goober central code
|
||||
launched = False
|
||||
latest_version = "0.0.0"
|
||||
local_version = "2.0.2"
|
||||
local_version = "2.1.0"
|
||||
os.environ['gooberlocal_version'] = local_version
|
||||
REACT = os.getenv("REACT")
|
||||
beta = False # this makes goober think its a beta version, so it will not update to the latest stable version or run any version checks
|
||||
|
|
|
@ -127,7 +127,7 @@ def check_requirements():
|
|||
"token": gooberTOKEN
|
||||
}
|
||||
try:
|
||||
requests.post(VERSION_URL + "/ping", json=payload)
|
||||
requests.post(VERSION_URL + "/ping", json=payload) # type: ignore
|
||||
except Exception as e:
|
||||
print(f"{RED}{(_('failed_to_contact')).format(url=VERSION_URL, error=e)}{RESET}")
|
||||
sys.exit(1)
|
||||
|
@ -173,7 +173,7 @@ def check_memory():
|
|||
if psutilavaliable == False:
|
||||
return
|
||||
try:
|
||||
memory_info = psutil.virtual_memory()
|
||||
memory_info = psutil.virtual_memory() # type: ignore
|
||||
total_memory = memory_info.total / (1024 ** 3)
|
||||
used_memory = memory_info.used / (1024 ** 3)
|
||||
free_memory = memory_info.available / (1024 ** 3)
|
||||
|
@ -193,7 +193,7 @@ def check_cpu():
|
|||
if psutilavaliable == False:
|
||||
return
|
||||
print((_('measuring_cpu')))
|
||||
cpu_per_core = psutil.cpu_percent(interval=1, percpu=True)
|
||||
cpu_per_core = psutil.cpu_percent(interval=1, percpu=True) # type: ignore
|
||||
for idx, core_usage in enumerate(cpu_per_core):
|
||||
bar_length = int(core_usage / 5)
|
||||
bar = '█' * bar_length + '-' * (20 - bar_length)
|
||||
|
|
|
@ -8,3 +8,4 @@ better_profanity
|
|||
python-dotenv
|
||||
dotenv
|
||||
pillow
|
||||
asqlite
|
|
@ -1,3 +1,5 @@
|
|||
The catbox.moe team
|
||||
Charlie's Computers
|
||||
ctih1
|
||||
- The catbox.moe team for memory.json file uploads
|
||||
- Charlie's Computers
|
||||
- ctih1
|
||||
- RestartB (for the Fireboard cog from his Titanium bot)
|
||||
- Claude 4 Sonnet (for slightly modifying main.py and fireboard.py to work with Goober)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue