mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-27 13:34:28 +00:00
Start work on roll and dice commands
This commit is contained in:
parent
1982987bf1
commit
8965238a98
6 changed files with 70 additions and 1 deletions
|
@ -3,11 +3,12 @@ async-timeout==3.0.1
|
|||
attrs==19.3.0
|
||||
bcrypt==3.1.7
|
||||
certifi==2019.9.11
|
||||
cffi==1.13.0
|
||||
cffi==1.13.01
|
||||
chardet==3.0.4
|
||||
Click==7.0
|
||||
cryptography==2.8
|
||||
dateparser==0.7.2
|
||||
dice==2.4.2
|
||||
discord.py==1.2.4
|
||||
dnspython==1.15.0
|
||||
dnspython3==1.15.0
|
||||
|
|
7
royalnet/packs/rpg/__init__.py
Normal file
7
royalnet/packs/rpg/__init__.py
Normal file
|
@ -0,0 +1,7 @@
|
|||
# This is a template Pack __init__. You can use this without changing anything in other packages too!
|
||||
|
||||
from .commands import available_commands
|
||||
from .tables import available_tables
|
||||
|
||||
__all__ = ["commands", "tables", "available_commands", "available_tables"]
|
||||
|
10
royalnet/packs/rpg/commands/__init__.py
Normal file
10
royalnet/packs/rpg/commands/__init__.py
Normal file
|
@ -0,0 +1,10 @@
|
|||
# Imports go here!
|
||||
|
||||
|
||||
# Enter the commands of your Pack here!
|
||||
available_commands = [
|
||||
|
||||
]
|
||||
|
||||
# Don't change this, it should automatically generate __all__
|
||||
__all__ = [command.__class__.__qualname__ for command in available_commands]
|
15
royalnet/packs/rpg/commands/dice.py
Normal file
15
royalnet/packs/rpg/commands/dice.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
import typing
|
||||
import random
|
||||
import dice
|
||||
from royalnet.commands import *
|
||||
|
||||
|
||||
class DiceCommand(Command):
|
||||
name: str = "dice"
|
||||
|
||||
description: str = "Roll a dice, using 'dice'."
|
||||
|
||||
aliases = ["d"]
|
||||
|
||||
async def run(self, args: CommandArgs, data: CommandData) -> None:
|
||||
...
|
26
royalnet/packs/rpg/commands/roll.py
Normal file
26
royalnet/packs/rpg/commands/roll.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
import typing
|
||||
import random
|
||||
from royalnet.commands import *
|
||||
|
||||
|
||||
class RollCommand(Command):
|
||||
name: str = "roll"
|
||||
|
||||
description: str = "Roll a dice, from N to M (defaults to 1-100)."
|
||||
|
||||
aliases = ["r", "random"]
|
||||
|
||||
async def run(self, args: CommandArgs, data: CommandData) -> None:
|
||||
first: typing.Optional[str] = args.optional(0)
|
||||
second: typing.Optional[str] = args.optional(1)
|
||||
if second:
|
||||
minimum = int(first)
|
||||
maximum = int(second)
|
||||
elif first:
|
||||
minimum = 1
|
||||
maximum = int(first)
|
||||
else:
|
||||
minimum = 1
|
||||
maximum = 100
|
||||
result = random.randrange(minimum, maximum+1)
|
||||
await data.reply(f"🎲 Dice roll [{minimum}-{maximum}]: {result}")
|
10
royalnet/packs/rpg/tables/__init__.py
Normal file
10
royalnet/packs/rpg/tables/__init__.py
Normal file
|
@ -0,0 +1,10 @@
|
|||
# Imports go here!
|
||||
|
||||
|
||||
# Enter the tables of your Pack here!
|
||||
available_tables = [
|
||||
|
||||
]
|
||||
|
||||
# Don't change this, it should automatically generate __all__
|
||||
__all__ = [table.__class__.__qualname__ for table in available_tables]
|
Loading…
Reference in a new issue