forked from c0de/BaseballBot
Fix linting issues with client
This commit is contained in:
parent
b154efb6cc
commit
e0dc0e6b78
@ -2,6 +2,16 @@
|
|||||||
# Copyright 2022 - c0de <c0de@c0de.dev>
|
# Copyright 2022 - c0de <c0de@c0de.dev>
|
||||||
# Licensed under the MIT License (https://opensource.org/licenses/MIT)
|
# Licensed under the MIT License (https://opensource.org/licenses/MIT)
|
||||||
|
|
||||||
|
# pylint: disable=wrong-import-position
|
||||||
|
|
||||||
|
"""
|
||||||
|
A discord bot that hosts Ghostball/Braveball.
|
||||||
|
|
||||||
|
A discord game where players guess the pitch speed
|
||||||
|
from a fantasy baseball pitcher, and whoever is
|
||||||
|
closer gets more points
|
||||||
|
"""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
@ -12,16 +22,24 @@ import game
|
|||||||
|
|
||||||
|
|
||||||
class GhostBallClient(discord.Client):
|
class GhostBallClient(discord.Client):
|
||||||
|
"""
|
||||||
|
Implementation of a Discord client that will monitor
|
||||||
|
a channel for messages, and if it recieves a message
|
||||||
|
defined in the Game object, and pass it along
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(GhostBallClient, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
with game.Game() as self.game:
|
with game.Game() as self.game:
|
||||||
self.game.discord = self
|
self.game.discord = self
|
||||||
|
|
||||||
async def on_ready(self):
|
async def on_ready(self):
|
||||||
|
"""Method called when connected to Discord"""
|
||||||
print("Logged on as", self.user)
|
print("Logged on as", self.user)
|
||||||
|
|
||||||
async def on_message(self, message):
|
async def on_message(self, message):
|
||||||
|
"""Method called when a message is recieved"""
|
||||||
# Don't respond to ourself
|
# Don't respond to ourself
|
||||||
if message.author == self.user:
|
if message.author == self.user:
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user