Removed the change Pycharm made for pep8 which caused the bot not to run, as the directoy was detected incorrectly
This commit is contained in:
parent
217407fbaa
commit
b082ce5f04
3 changed files with 34 additions and 19 deletions
7
bot.py
7
bot.py
|
@ -1,8 +1,4 @@
|
||||||
#!/usr/local/bin/python3.5
|
#!/usr/local/bin/python3.5
|
||||||
|
|
||||||
from discord.ext import commands
|
|
||||||
from cogs.utils import config
|
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
import traceback
|
import traceback
|
||||||
import logging
|
import logging
|
||||||
|
@ -12,6 +8,9 @@ import os
|
||||||
|
|
||||||
os.chdir(os.path.dirname(os.path.realpath(__file__)))
|
os.chdir(os.path.dirname(os.path.realpath(__file__)))
|
||||||
|
|
||||||
|
from discord.ext import commands
|
||||||
|
from cogs.utils import config
|
||||||
|
|
||||||
extensions = ['cogs.interaction',
|
extensions = ['cogs.interaction',
|
||||||
'cogs.core',
|
'cogs.core',
|
||||||
'cogs.mod',
|
'cogs.mod',
|
||||||
|
|
27
cogs/core.py
27
cogs/core.py
|
@ -4,7 +4,6 @@ from .utils import checks
|
||||||
from .utils import config
|
from .utils import config
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import os
|
|
||||||
import glob
|
import glob
|
||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
|
@ -21,11 +20,12 @@ class Core:
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@checks.custom_perms(send_messages=True)
|
@checks.custom_perms(send_messages=True)
|
||||||
async def calendar(self, month: str=None, year: int=None):
|
async def calendar(self, month: str = None, year: int = None):
|
||||||
"""Provides a printout of the current month's calendar
|
"""Provides a printout of the current month's calendar
|
||||||
Provide month and year to print the calendar of that year and month"""
|
Provide month and year to print the calendar of that year and month"""
|
||||||
|
|
||||||
# calendar takes in a number for the month, not the words, so we need this dictionary to transform the word to the number
|
# calendar takes in a number for the month, not the words
|
||||||
|
# so we need this dictionary to transform the word to the number
|
||||||
months = {
|
months = {
|
||||||
"january": 1,
|
"january": 1,
|
||||||
"february": 2,
|
"february": 2,
|
||||||
|
@ -65,7 +65,6 @@ class Core:
|
||||||
|
|
||||||
all_members = list(self.bot.get_all_members())
|
all_members = list(self.bot.get_all_members())
|
||||||
|
|
||||||
|
|
||||||
# We can pretty safely assume that the author is going to be in at least one channel with the bot
|
# We can pretty safely assume that the author is going to be in at least one channel with the bot
|
||||||
# So find the author based on that list
|
# So find the author based on that list
|
||||||
authors = []
|
authors = []
|
||||||
|
@ -79,7 +78,25 @@ class Core:
|
||||||
fmt['Total Members'] = len(all_members)
|
fmt['Total Members'] = len(all_members)
|
||||||
fmt['Description'] = self.bot.description
|
fmt['Description'] = self.bot.description
|
||||||
|
|
||||||
|
servers_playing_music = len([server_id for server_id, state in self.bot.get_cog('Music').voice_states.items() if
|
||||||
|
state.is_playing()])
|
||||||
|
hm_games = len([server_id for server_id, game in self.bot.get_cog('Hangman').games.items()])
|
||||||
|
ttt_games = len([server_id for server_id, game in self.bot.get_cog('TicTacToe').boards.items()])
|
||||||
|
count_battles = 0
|
||||||
|
for battles in self.bot.get_cog('Interaction').battles.values():
|
||||||
|
count_battles += len(battles)
|
||||||
|
|
||||||
information = "\n".join("{}: {}".format(key, result) for key, result in fmt.items())
|
information = "\n".join("{}: {}".format(key, result) for key, result in fmt.items())
|
||||||
|
information += "\n"
|
||||||
|
if servers_playing_music:
|
||||||
|
information += "Playing songs in {} different servers\n".format(servers_playing_music)
|
||||||
|
if hm_games:
|
||||||
|
information += "{} different hangman games running\n".format(hm_games)
|
||||||
|
if ttt_games:
|
||||||
|
information += "{} different TicTacToe games running\n".format(ttt_games)
|
||||||
|
if count_battles:
|
||||||
|
information += "{} different battles going on\n".format(count_battles)
|
||||||
|
|
||||||
await self.bot.say("```\n{}```".format(information))
|
await self.bot.say("```\n{}```".format(information))
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
|
@ -137,7 +154,7 @@ class Core:
|
||||||
|
|
||||||
@commands.command(pass_context=True)
|
@commands.command(pass_context=True)
|
||||||
@checks.custom_perms(send_messages=True)
|
@checks.custom_perms(send_messages=True)
|
||||||
async def roll(self, ctx, notation: str="d6"):
|
async def roll(self, ctx, notation: str = "d6"):
|
||||||
"""Rolls a die based on the notation given
|
"""Rolls a die based on the notation given
|
||||||
Format should be #d#"""
|
Format should be #d#"""
|
||||||
# Use regex to get the notation based on what was provided
|
# Use regex to get the notation based on what was provided
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
from .utils import checks
|
from .utils import checks
|
||||||
from .utils import config
|
from .utils import config
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
import re
|
import re
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
Loading…
Reference in a new issue