This commit is contained in:
DasMoorhuhn 2023-03-02 23:55:49 +01:00
parent a53b4fa041
commit 58d0229899
2 changed files with 23 additions and 31 deletions

View File

@ -1,4 +1,4 @@
FROM python:3.11-alpine
FROM python:3.11.2-alpine
WORKDIR /app

View File

@ -5,7 +5,7 @@ import datetime
import secretHandler
from addons import ProgrammerExcuses
from addons import XKCD
from addons import RedditProgrammerHumor
#from addons import RedditProgrammerHumor
from models.xkcdComic import Comic
@ -18,8 +18,8 @@ from discord import Guild
from discord import Color
from discord.activity import Game
botVersion = "1.0.1"
botDate = "03.02.2023"
botVersion = "1.0.23"
botDate = "02.03.2023"
secret = secretHandler.secret()
token = secret.loadSecret("secret.txt")
@ -36,7 +36,7 @@ logger.addHandler(handler)
#Init Addons
programmerExcuses = ProgrammerExcuses()
redditProgrammerHumor = RedditProgrammerHumor()
#redditProgrammerHumor = RedditProgrammerHumor()
xkcd = XKCD()
class client(discord.Client):
@ -85,7 +85,7 @@ async def on_guild_join(guild: Guild):
@tree.command(name='excuse', description='Get a random excuse from programmer excuses')
@tree.command(name='excuse', description='Get a random excuse from programmingexcuses')
async def slash(interaction: Interaction):
await interaction.response.send_message(programmerExcuses.getExcuse())
@ -105,48 +105,40 @@ async def slash(interaction: Interaction):
embed.set_image(url=comic.img)
await interaction.response.send_message(embed=embed)
@tree.command(name='programmer-humor', description='Get a random Post from r/ProgrammerHumor')
async def slash(interaction: Interaction):
post = redditProgrammerHumor.getRandomPost()
await interaction.response.send_message("hi")
#@tree.command(name='programmer-humor', description='Get a random Post from r/ProgrammerHumor')
#async def slash(interaction: Interaction):
# post = redditProgrammerHumor.getRandomPost()
# await interaction.response.send_message("hi")
@tree.command(name="info", description="get info about this server")
@tree.command(name="info", description="get info about this bot")
async def slash(interaction: Interaction):
logger.info("Command: info")
timeNow = getDateTime()[2]
uptime = timeNow - startTime
serverString = \
f"""\
Owner: {interaction.guild.owner}
Name: {interaction.guild.name}
"""
botString = \
f"""\
Uptime: {int(round(uptime/60, 1))}m
Version: {botVersion} from {botDate}
Developer: DasMoorhuhn.py#2604
Sourcecode: https://gitlab.com/HendrikHeine/tux-discord-bot
"""
botString = ""
botString += f"Uptime : {int(round(uptime, 0))}s\n"
botString += f"Version : {botVersion} from {botDate}\n"
botString += f"Developer : DasMoorhuhn.py#2604\n"
botString += f"Sourcecode: https://gitlab.com/HendrikHeine/tux-discord-bot"
embed = discord.Embed(title=f"Info", description="about this Server", timestamp=datetime.datetime.utcnow(), color=Color.blue())
#embed.set_thumbnail(url=interaction.guild.icon)
embed.add_field(name="Server", value=serverString, inline=False)
embed.add_field(name="Bot", value=botString, inline=False)
await interaction.response.send_message(embed=embed)
@tree.command(name="help", description="List of all Commands")
async def slash(interaction: Interaction):
logger.info("Command: help")
commandListString = \
"""\
`/info`: Get infos about the server and the Bot\n
`/get-random-comic`: Not working yet\n
`/get-latest-comic`: Get latest comic from XKCD\n
`/help`: Get this view
"""
commandListString = ""
commandListString += "`/info` : Get infos about the server and the Bot\n"
commandListString += "`/help` : Get this view\n"
commandListString += "`/get-random-comic`: Get a randowm XCCD comic\n"
commandListString += "`/get-latest-comic`: Get latest comic from XKCD\n"
commandListString += "`/excuse` : Get a random excuse from programmingexcuses"
embed = discord.Embed(title=f"Help", description="List of commands", color=Color.blue())
#embed.set_thumbnail(url=interaction.guild.icon)
embed.add_field(name="Commands", value=commandListString, inline=True)