Skip to content

Commit e7379a1

Browse files
committed
add gamedev plugin refactor code
1 parent 15d9ed1 commit e7379a1

File tree

4 files changed

+63
-6
lines changed

4 files changed

+63
-6
lines changed

main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def configBot(self):
109109
intents= hikari.Intents.ALL,
110110
help_slash_command=True,
111111
ignore_bots=False)
112-
self.bot.load_extensions("plugins.commands", "plugins.moderator", "plugins.admin", "plugins.WoW", 'plugins.calender', "plugins.linux")
112+
self.bot.load_extensions("plugins.commands", "plugins.moderator", "plugins.admin", "plugins.WoW", 'plugins.calender', "plugins.linux", "plugins.gamedev")
113113
tasks.load(self.bot)
114114
miru.install(self.bot)
115115
return self.bot

plugins/admin.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ async def adminCommands(ctx):
7474
@lightbulb.command('test', 'Test if you have admin role.')
7575
@lightbulb.implements(lightbulb.SlashSubCommand)
7676
async def adminSendMsg(ctx: lightbulb.Context):
77-
isAdmin = await checkAdmin(ctx.author.id, ctx.guild_id)
78-
if isAdmin:
77+
if not await checkAdmin(ctx.author.id, ctx.guild_id):
7978
return await ctx.respond("Du bist ein admin")
8079
else:
8180
return await ctx.respond("Du bist kein admin")
@@ -85,8 +84,7 @@ async def adminSendMsg(ctx: lightbulb.Context):
8584
@lightbulb.command('init', 'Start the first configuration for the bot')
8685
@lightbulb.implements(lightbulb.SlashSubCommand)
8786
async def adminInitBot(ctx: lightbulb.Context):
88-
isAdmin = await checkAdmin(ctx.author.id, ctx.guild_id)
89-
if not isAdmin:
87+
if not await checkAdmin(ctx.author.id, ctx.guild_id):
9088
return
9189

9290
channels = await admin_plugin.bot.rest.fetch_guild_channels(ctx.guild_id)

plugins/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def load_bot_setting():
5555
ROGUE_LIST = './data/rogue_list.txt'
5656
SHAMAN_LIST = './data/shaman_list.txt'
5757
WARLOCK_LIST = './data/warlock_list.txt'
58-
WARRIOR_LIST = './data/Warrior_list.txt'
58+
WARRIOR_LIST = './data/warrior_list.txt'
5959

6060
ROLE_DIC = {
6161
"Druid":"1081268640718004304",

plugins/gamedev.py

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import lightbulb
2+
import hikari
3+
from .commands import checkAdmin
4+
5+
6+
GAMECOMMANDS =[
7+
"**WASD** - Movement",
8+
"**WASD + Shift** - Run",
9+
"**Space** - Normal Attack",
10+
"**Q** - Double Attack",
11+
"**R** - Special Attack",
12+
"**F** - Take/Stick Sword (Combatstance)",
13+
"**E** - Interact",
14+
"**ESC** - Ingame Pause/Menu",
15+
"**F1** - Quicksave"
16+
]
17+
18+
19+
gamedev_plugin = lightbulb.Plugin('gamedev','Help Devs with my Gameproject')
20+
@gamedev_plugin.command
21+
@lightbulb.command('gamedev', 'All Gamedev commands.')
22+
@lightbulb.implements(lightbulb.SlashCommandGroup)
23+
async def gamedev_commands(ctx):
24+
pass
25+
26+
@gamedev_commands.child
27+
@lightbulb.command('keys', 'Ingame Keyboard Settings.', auto_defer=True, pass_options = True)
28+
@lightbulb.implements(lightbulb.SlashSubCommand)
29+
async def linux_basic(ctx: lightbulb.Context):
30+
coms = "**Game Ingame Keysettings:**\nHier sind die Ingame-Keyboardsettings, Formatierung:\n\n **Key** - **Action**\n\n"
31+
for command in GAMECOMMANDS:
32+
coms += f"{command}" +'\n'
33+
e = hikari.Embed(
34+
title="Game - Basiccommands",
35+
description=coms
36+
)
37+
e.set_thumbnail('./image/logo1.png')
38+
return await ctx.respond(embed=e)
39+
40+
@gamedev_commands.child
41+
@lightbulb.command('info', 'Information about my Gameproject', auto_defer=True, pass_options = True)
42+
@lightbulb.implements(lightbulb.SlashSubCommand)
43+
async def linux_basic(ctx: lightbulb.Context):
44+
coms = (f"**Gameproject Informationen:**\nHier die allgemeinen Informationen:\n\n"+
45+
f"Das Spiel wird in der Godot Engine 4 entwickelt. Ein Action-RPG im Style des Klassikers *Secret of Mana* für das *Super Nintendo Entertainment System.\n"+
46+
f"Die Grafik ist daher in *2D Pixelart*. Viele typische Elemente wie Quests, unterschiedliche Welten mit Dungeons und Monstern.\n"+
47+
f"Ein Kampfsystem mit verschiedenen Angriffen und Zaubern. Das Projekt ist noch in einer frühen Phase und daher noch nicht vollständig.\n\n"+
48+
f"Das Spiel ist auf Github zu finden:\n*https://www.github.com/sera619/Godot4-RPG*\n")
49+
e = hikari.Embed(
50+
title="Game - Basiccommands",
51+
description=coms
52+
)
53+
e.set_thumbnail('./image/logo1.png')
54+
return await ctx.respond(embed=e)
55+
56+
57+
58+
def load(bot):
59+
bot.add_plugin(gamedev_plugin)

0 commit comments

Comments
 (0)