Skip to content
This repository has been archived by the owner on Sep 10, 2022. It is now read-only.

Story overhaul #75

Merged
merged 26 commits into from
Mar 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
786821e
Testing story mode
agraubert Jan 10, 2018
adfb144
Added basic story implimentation
agraubert Jan 10, 2018
678e22a
Story mode gets priority on message recognition
agraubert Jan 10, 2018
45af9db
Added separate story channel
agraubert Jan 10, 2018
eb093ca
Beymax will now delete other messages in the channel
agraubert Jan 10, 2018
255ad28
Added balance and fixed score
agraubert Jan 10, 2018
e4c4b28
Syntax error
agraubert Jan 10, 2018
7df7172
Merge branch 'config' into story
agraubert Jan 28, 2018
c1fd516
Updated story to use channel references
agraubert Jan 28, 2018
848f74a
Merge branch 'master' into story
agraubert Feb 1, 2018
c8f1647
XP now runs from level 2
agraubert Feb 1, 2018
67c8815
Added XP system
agraubert Feb 8, 2018
745f172
Working on story XP
agraubert Feb 20, 2018
e29f4e2
Refactored database to be async safe
agraubert Feb 21, 2018
236849a
Fixed database synchronization
agraubert Feb 21, 2018
9764d9d
Finished XP backend
agraubert Feb 21, 2018
d63775d
Finished economy implementation
agraubert Feb 21, 2018
53fca7e
Fixed up economy implementation
agraubert Feb 21, 2018
df75fe3
Added quoting
agraubert Feb 21, 2018
1ae5dd2
Merge pull request #66 from agraubert/economy
agraubert Feb 23, 2018
f5a2e0d
Added simple exception handling when failing to deliver a message
agraubert Feb 23, 2018
3aeecee
Added highscore and timeleft
agraubert Feb 23, 2018
a49d7d6
Reup now simply adds a day instead of being dumb
agraubert Feb 23, 2018
1b78b4f
Various fixes
agraubert Feb 27, 2018
b2ce378
Fixed more recognition in player
agraubert Feb 27, 2018
6068fce
Added dfrotz and games to install.md
agraubert Feb 28, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
dfrotz
games/
textplayer/
git.token
token.txt
_token.txt
permissions.yml
Expand Down
13 changes: 12 additions & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,18 @@ don't know what a shell is, you're going to have a bad time
rule), the fallback behavior is to allow the command if it is not an
**Underscore Command**. This is the lowest priority behavior, so it can be
overridden by any rule, including `defaults`.
4. Connect your bot to your **Server**
4. Get extras
1. If you plan on using the story/text game system, you'll need to get a few things first:
* dfrotz (put `dfrotz` in the same directory as `main.py`):
```bash
$ git clone https://github.com/DavidGriffith/frotz.git
$ cd frotz
$ make dumb
```
* Some `.z5` games (put them in a folder called `games` in the same directory
as `main.py`)
* You can get a good starter pack from [textplayer](https://github.com/danielricks/textplayer)
5. Connect your bot to your **Server**
1. At this point, your bot is configured and ready to work. Go back to the
[Discord Developers page](https://discordapp.com/developers/) from step 2.1
and navigate to your bot
Expand Down
50 changes: 25 additions & 25 deletions bots/birthday.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .core import CoreBot
from .utils import load_db, save_db
from .utils import Database
import asyncio
import re
import datetime
Expand All @@ -22,33 +22,33 @@ async def cmd_birthday(self, message, content):
)
else:
result = re.match(r'(\d{1,2})/(\d{1,2})/(\d{4})', content[1])
birthdays = load_db('birthdays.json')
birthdays[message.author.id] = {
'month': int(result.group(1)),
'day': int(result.group(2)),
'year': int(result.group(3))
}
await self.send_message(
message.channel,
"Okay, I'll remember that"
)
save_db(birthdays, 'birthdays.json')
async with Database('birthdays.json') as birthdays:
birthdays[message.author.id] = {
'month': int(result.group(1)),
'day': int(result.group(2)),
'year': int(result.group(3))
}
await self.send_message(
message.channel,
"Okay, I'll remember that"
)
birthdays.save()

@bot.add_task(43200) #12 hours
async def check_birthday(self):
birthdays = load_db('birthdays.json')
today = datetime.date.today()
for uid, data in birthdays.items():
month = data['month']
day = data['day']
if today.day == day and today.month == month:
await self.send_message(
self.fetch_channel('general'),
"@everyone congratulate %s, for today is their birthday!"
" They are %d!" % (
self.users[uid]['mention'] if uid in self.users else "someone",
today.year - data['year']
async with Database('birthdays.json') as birthdays:
today = datetime.date.today()
for uid, data in birthdays.items():
month = data['month']
day = data['day']
if today.day == day and today.month == month:
await self.send_message(
self.fetch_channel('general'),
"@everyone congratulate %s, for today is their birthday!"
" They are %d!" % (
self.users[uid]['mention'] if uid in self.users else "someone",
today.year - data['year']
)
)
)

return bot
Loading