1
0
Fork 0
mirror of synced 2024-05-20 12:32:26 +12:00

Added a calendar command

This commit is contained in:
phxntxm 2016-07-18 18:25:03 -05:00
parent 2807f91a7b
commit e90c764428

View file

@ -10,7 +10,8 @@ import json
import random
import discord
import re
import calendar
import datetime
class Core:
"""Core commands, these are the not 'complicated' commands."""
@ -18,6 +19,37 @@ class Core:
def __init__(self, bot):
self.bot = bot
@commands.command()
@checks.customPermsOrRole("send_message")
async def calendar(self, month: str=None, year: int=None):
"""Provides a printout of the current date
Provide month and year to print the calendar of that year and month"""
months = {
"january": 1,
"february": 2,
"march": 3,
"april": 4,
"may": 5,
"june": 6,
"july": 7,
"august": 8,
"september": 9,
"october": 10,
"november": 11,
"december": 12
}
if month is None:
month = datetime.date.today().month
else:
month = months.get(month)
if month is None:
await self.bot.say("Please provide a valid Month!")
return
if year is None:
year = datetime.datetime.today().year
cal = calendar.TextCalendar().formatmonth(year, month)
await self.bot.say("```{}```".format(cal))
@commands.command()
@checks.customPermsOrRole("none")
async def addbot(self):