Compare commits

..

4 commits

Author SHA1 Message Date
a344db3ad1
add survey bot
All checks were successful
continuous-integration/drone/push Build is passing
2024-07-12 14:20:28 +02:00
559d8c2169
make hiebe and liebe visible in help 2024-07-12 13:07:08 +02:00
91a75741bf
remove old help and old yesno 2024-07-12 13:02:21 +02:00
f16042d81a
Update to pycord 2.6.0 and fix the embed 2024-07-12 12:59:26 +02:00
3 changed files with 48 additions and 24 deletions

28
bot.py
View file

@ -188,24 +188,6 @@ async def emoji_text(ctx, message: discord.Message):
modal.set_message_id(message.id) modal.set_message_id(message.id)
await ctx.interaction.response.send_modal(modal) await ctx.interaction.response.send_modal(modal)
@bot.command(help="veraltet", usage="", hidden=True)
@is_member()
async def yesno(ctx):
await ctx.message.delete()
await ctx.send(content="Sorry das geht so nicht. Der Befehl hat sich geändert in !vote... für mehr Informationen schreib bitte !help oder frage deinen Admin oder Apotheker. Liebste Grüße, SecondBot <3", delete_after=20.0)
@bot.command(help="Zeigt alte Hilfe", usage="")
@is_member()
async def helpme(ctx):
if admin(ctx):
admin_text = "\n\n!add = Hinzufügen einer Rolle mit Textchannel und hinzufügen von Usern zur Rolle\nNutzung: !add \"<Rolle>\" <User Mentions>\n\n!labor = bringt dich ins Labor :)\nNutzung: !labor\n\n!start = Starte ne Runde PnP\nNutzung: !start @Rolle\n\n!stop = Beende die gestartete Runde PnP\nNutzung: !stop\n\n!purge = Löschen von Nachrichten\nNutzung: !purge all|<Anzahl>|x minutes/hours/days/weeks\n\n!prune - kickt Member ohne Rolle, die 30 Tage nicht online waren\nNutzung: !prune"
else:
admin_text = ""
em = discord.Embed(title="Hilfe",description="!survey = Umfrage mit mehreren Antwortmöglichkeiten\nNutzung: !survey <Frage> | <Antwort1> | <Antwort2> ...\n\n!vote = Ja/Nein Umfrage\nNutzung: !vote <Frage>\n\n!love = zeige einem User Liebe\nNutzung: !love <@User1> <@User2> ...\n\n!roll = Rolle einen oder mehrere Würfel\nNutzung: !roll <anzahl_optional>W<seitenzahl> (z.B. !roll W20 oder !roll 10W6)%s" % admin_text, colour=0x00FF00)
if ctx.author.dm_channel == None:
await ctx.author.create_dm()
await ctx.author.dm_channel.send(embed=em)
@bot.command(help="Umfrage mit mehreren Antwortmöglichkeiten", usage="<Frage> | <Antwort1> | <Antwort2> ...") @bot.command(help="Umfrage mit mehreren Antwortmöglichkeiten", usage="<Frage> | <Antwort1> | <Antwort2> ...")
@is_member() @is_member()
async def survey(ctx, *, arg): async def survey(ctx, *, arg):
@ -219,7 +201,7 @@ async def survey(ctx, *, arg):
desc = desc + emojinumbers[z] + " - " + y + "\n" desc = desc + emojinumbers[z] + " - " + y + "\n"
z = z + 1 z = z + 1
em = discord.Embed(title=question, description=desc, colour=0x00E0FF) em = discord.Embed(title=question, description=desc, colour=0x00E0FF)
em.set_author(name=ctx.author.display_name, url=discord.Embed.Empty, icon_url=ctx.author.avatar.url) em.set_author(name=ctx.author.display_name, url=None, icon_url=ctx.author.avatar.url)
ask_msg = await ctx.send(content="||@everyone||",embed=em) ask_msg = await ctx.send(content="||@everyone||",embed=em)
a = 0 a = 0
for x in emojinumbers: for x in emojinumbers:
@ -244,7 +226,7 @@ async def surveyedit(ctx, *, arg):
desc = desc + emojinumbers[z] + " - " + y + "\n" desc = desc + emojinumbers[z] + " - " + y + "\n"
z = z + 1 z = z + 1
em = discord.Embed(title=question, description=desc, colour=0x00E0FF) em = discord.Embed(title=question, description=desc, colour=0x00E0FF)
em.set_author(name=ctx.author.display_name, url=discord.Embed.Empty, icon_url=ctx.author.avatar.url) em.set_author(name=ctx.author.display_name, url=None, icon_url=ctx.author.avatar.url)
survey_msg = await ctx.channel.fetch_message((int(survey_id))) survey_msg = await ctx.channel.fetch_message((int(survey_id)))
await survey_msg.edit(embed=em) await survey_msg.edit(embed=em)
@ -253,7 +235,7 @@ async def surveyedit(ctx, *, arg):
async def vote(ctx, *, arg): async def vote(ctx, *, arg):
await ctx.message.delete() await ctx.message.delete()
em = discord.Embed(description=arg, colour=0x00E0FF) em = discord.Embed(description=arg, colour=0x00E0FF)
em.set_author(name=ctx.author.display_name, url=discord.Embed.Empty, icon_url=ctx.author.avatar.url) em.set_author(name=ctx.author.display_name, url=None, icon_url=ctx.author.avatar.url)
ask_msg = await ctx.send(content="||@everyone||",embed=em) ask_msg = await ctx.send(content="||@everyone||",embed=em)
for x in ["", "", ""]: for x in ["", "", ""]:
await ask_msg.add_reaction(x) await ask_msg.add_reaction(x)
@ -396,7 +378,7 @@ async def purge(ctx, *, arg):
deleted = await ctx.channel.purge(limit=limit) deleted = await ctx.channel.purge(limit=limit)
await ctx.send(content='Ich habe {} Nachrichten gelöscht.'.format(len(deleted)), delete_after=5.0) await ctx.send(content='Ich habe {} Nachrichten gelöscht.'.format(len(deleted)), delete_after=5.0)
@bot.command(help="zeige einem User Liebe", usage="<@User1> <@User2> ...", hidden=True) @bot.command(help="zeige einem User Liebe", usage="<@User1> <@User2> ...")
@is_member() @is_member()
async def liebe(ctx, *, arg): async def liebe(ctx, *, arg):
await ctx.message.delete() await ctx.message.delete()
@ -405,7 +387,7 @@ async def liebe(ctx, *, arg):
await user.create_dm() await user.create_dm()
await user.dm_channel.send("❤️ von {}".format(ctx.author.display_name)) await user.dm_channel.send("❤️ von {}".format(ctx.author.display_name))
@bot.command(help="zeige einem User Hiebe", usage="<@User1> <@User2> ...", hidden=True) @bot.command(help="zeige einem User Hiebe", usage="<@User1> <@User2> ...")
@is_member() @is_member()
async def hiebe(ctx, *, arg): async def hiebe(ctx, *, arg):
await ctx.message.delete() await ctx.message.delete()

View file

@ -1 +1 @@
py-cord==2.4.1 py-cord==2.6.0

42
survey.py Normal file
View file

@ -0,0 +1,42 @@
import discord
import asyncio
import time
import datetime
import random
import os
from os import system
from os import environ
from discord.ext import commands
from discord.commands import Option
from discord.commands import permissions
from discord.ui import InputText, Modal
def left(s, amount):
return s[:amount]
def right(s, amount):
return s[-amount:]
def mid(s, offset, amount):
return s[offset:offset+amount]
token = os.environ['TOKEN']
survey_channel = os.environ['SURVEY_CHANNEL']
mention_id = os.environ['MENTION_ID']
guild_id = os.environ['GUILD_ID']
runtime = 48
bot = discord.Bot(description=None)
@bot.event
async def on_ready():
print("Bot ready on Version %s..." % discord.__version__)
# build survey
po = discord.Poll(question="Wie habt ihr nächste Woche Zeit?", answers=[discord.PollAnswer(text="Montag", emoji="1\u20E3"), discord.PollAnswer(text="Dienstag", emoji="2\u20E3"), discord.PollAnswer(text="Mittwoch", emoji="3\u20E3"), discord.PollAnswer(text="Donnerstag", emoji="4\u20E3"), discord.PollAnswer(text="Freitag", emoji="5\u20E3"), discord.PollAnswer(text="Samstag", emoji="6\u20E3"), discord.PollAnswer(text="Sonntag", emoji="7\u20E3"), discord.PollAnswer(text="keine Zeit", emoji="")], duration=runtime, allow_multiselect=True)
# send message
msg = await bot.get_channel(survey_channel).send(content="||%s||"% bot.get_guild(guild_id).get_role(mention_id).mention ,poll=po)
await msg.create_thread(name="Diskussion")
# close connection
await bot.close()
bot.run(token)