Skip to content

Commit

Permalink
Merge pull request #8 from hhollenstain/re-write
Browse files Browse the repository at this point in the history
re-write fixing missing dependencies
  • Loading branch information
hhollenstain authored Oct 10, 2018
2 parents e544640 + 0b6bcd0 commit e11ad71
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM python:3.6-alpine
COPY . /app
WORKDIR /app

RUN apk add ffmpeg gcc musl-dev libffi-dev git make opus-dev
RUN apk add ffmpeg gcc musl-dev libffi-dev libxml2-dev libxslt-dev git make opus-dev
RUN make live

CMD ["tamago"]
5 changes: 4 additions & 1 deletion tamago/lib/plugins/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from discord import Game
from discord.ext import commands
from tamago import VERSION
from tamago.lib import utils

LOG = logging.getLogger(__name__)

Expand All @@ -12,8 +13,10 @@ def __init__(self, client):
self.client = client

async def on_ready(self):
await self.client.change_presence(status=discord.Status.idle, activity=Game(name='Bots "R" Us'))
await self.client.change_presence(status=discord.Status.idle, activity=Game(name='Waking up, making coffee...'))
LOG.info('Logged in as {}'.format(self.client.user.name))
self.client.loop.create_task(utils.change_status(self.client))
self.client.loop.create_task(utils.list_servers(self.client))

async def on_command_error(self, ctx, error):
if isinstance(error, commands.CommandInvokeError):
Expand Down
14 changes: 4 additions & 10 deletions tamago/lib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

LOG = logging.getLogger(__name__)
BLOCKED_USERS = os.getenv('BLOCKED_USERS') or '123456'
GAMES = os.getenv('GAMES').split(",") or 'TamagoBot!'

def parse_arguments():
"""parsing arguments.
Expand Down Expand Up @@ -44,19 +45,12 @@ def predicate(ctx):
return commands.check(predicate)

async def change_status(client):
status = ['God = Ginger',
'Expresso is lame!',
'Vern\'s woah',
'Loonix the fool',
'Stomper the unibawler!',
]

await client.wait_until_ready()
sts = cycle(status)
sts = cycle(GAMES)

while not client.is_closed:
while not client.is_closed():
current_status = next(sts)
await client.change_presence(game=discord.Game(name=current_status))
await client.change_presence(status=discord.Status.idle, activity=Game(name=current_status))
await asyncio.sleep(30)

async def list_servers(client):
Expand Down
2 changes: 0 additions & 2 deletions tamago/tamago_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ def main():
for extension in EXTENSIONS:
plugin.load(extension, tamago)

tamago.loop.create_task(utils.change_status(tamago))
tamago.loop.create_task(utils.list_servers(tamago))
tamago.run(TOKEN)

if __name__ == '__main__':
Expand Down

0 comments on commit e11ad71

Please sign in to comment.