Compare commits
36 commits
renovate/p
...
master
Author | SHA1 | Date | |
---|---|---|---|
98f491860d | |||
a39ea9e50b | |||
5c0feca7b2 | |||
836d6b1d3d | |||
4c261a30d4 | |||
a344db3ad1 | |||
559d8c2169 | |||
91a75741bf | |||
f16042d81a | |||
be7db764ec | |||
016d2f3730 | |||
a526ec91f5 | |||
b0a3e48890 | |||
b65bd7a363 | |||
5948da8056 | |||
43a01a753b | |||
2a46a54637 | |||
74fe90b242 | |||
f9c496d158 | |||
e753423957 | |||
ee561c5356 | |||
4a029f3bcd | |||
f6e2e961f1 | |||
b5ec9bac92 | |||
a0aa24bb41 | |||
b2f1c795e6 | |||
5fdf2b666c | |||
37c9f0376a | |||
b4fbdc7628 | |||
749190bc61 | |||
a34af09beb | |||
81f84dddf4 | |||
7fa890eb28 | |||
36b6077d02 | |||
b4116bf6a0 | |||
65a7e9048e |
9 changed files with 138 additions and 210 deletions
81
.drone.yml
81
.drone.yml
|
@ -1,81 +0,0 @@
|
||||||
kind: pipeline
|
|
||||||
name: deploy
|
|
||||||
steps:
|
|
||||||
- name: docker
|
|
||||||
image: plugins/docker
|
|
||||||
settings:
|
|
||||||
username:
|
|
||||||
from_secret: DOCKER_USERNAME
|
|
||||||
password:
|
|
||||||
from_secret: DOCKER_PASSWORD
|
|
||||||
repo: secondhemd/shbot
|
|
||||||
tags: latest
|
|
||||||
when:
|
|
||||||
branch:
|
|
||||||
- master
|
|
||||||
event:
|
|
||||||
- push
|
|
||||||
- name: docker-build
|
|
||||||
image: plugins/docker
|
|
||||||
settings:
|
|
||||||
username:
|
|
||||||
from_secret: DOCKER_USERNAME
|
|
||||||
password:
|
|
||||||
from_secret: DOCKER_PASSWORD
|
|
||||||
repo: secondhemd/shbot
|
|
||||||
tags: latest
|
|
||||||
dry_run: true
|
|
||||||
when:
|
|
||||||
exclude:
|
|
||||||
branch:
|
|
||||||
- master
|
|
||||||
event:
|
|
||||||
- push
|
|
||||||
- name: dev docker
|
|
||||||
image: plugins/docker
|
|
||||||
settings:
|
|
||||||
username:
|
|
||||||
from_secret: DOCKER_USERNAME
|
|
||||||
password:
|
|
||||||
from_secret: DOCKER_PASSWORD
|
|
||||||
repo: secondhemd/shbot
|
|
||||||
tags: dev
|
|
||||||
when:
|
|
||||||
branch:
|
|
||||||
- dev
|
|
||||||
event:
|
|
||||||
- push
|
|
||||||
- name: deploy
|
|
||||||
image: appleboy/drone-ssh
|
|
||||||
settings:
|
|
||||||
host:
|
|
||||||
- s.ar21.de
|
|
||||||
username: root
|
|
||||||
key:
|
|
||||||
from_secret: DEPLOY_SSH_KEY
|
|
||||||
port: 22
|
|
||||||
command_timeout: 2m
|
|
||||||
script:
|
|
||||||
- cd /root && docker-compose pull shbot && docker-compose up -d shbot
|
|
||||||
when:
|
|
||||||
branch:
|
|
||||||
- master
|
|
||||||
event:
|
|
||||||
- push
|
|
||||||
- name: deploy dev
|
|
||||||
image: appleboy/drone-ssh
|
|
||||||
settings:
|
|
||||||
host:
|
|
||||||
- s.ar21.de
|
|
||||||
username: root
|
|
||||||
key:
|
|
||||||
from_secret: DEPLOY_SSH_KEY
|
|
||||||
port: 22
|
|
||||||
command_timeout: 2m
|
|
||||||
script:
|
|
||||||
- cd /root && docker-compose -f shbot-dev.yaml pull shbot-dev && docker-compose -f shbot-dev.yaml up -d shbot-dev
|
|
||||||
when:
|
|
||||||
branch:
|
|
||||||
- dev
|
|
||||||
event:
|
|
||||||
- push
|
|
|
@ -1,91 +0,0 @@
|
||||||
stages: # List of stages for jobs, and their order of execution
|
|
||||||
- build
|
|
||||||
- test
|
|
||||||
- deploy
|
|
||||||
|
|
||||||
docker-build-push:
|
|
||||||
# Use the official docker image.
|
|
||||||
image: docker:latest
|
|
||||||
stage: build
|
|
||||||
services:
|
|
||||||
- docker:dind
|
|
||||||
before_script:
|
|
||||||
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
|
||||||
script:
|
|
||||||
- docker build --pull -t "$CI_REGISTRY_IMAGE" .
|
|
||||||
- docker push "$CI_REGISTRY_IMAGE"
|
|
||||||
allow_failure: false
|
|
||||||
only:
|
|
||||||
- master
|
|
||||||
|
|
||||||
docker-build-push-dev:
|
|
||||||
# Use the official docker image.
|
|
||||||
image: docker:latest
|
|
||||||
stage: build
|
|
||||||
services:
|
|
||||||
- docker:dind
|
|
||||||
before_script:
|
|
||||||
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
|
||||||
script:
|
|
||||||
- docker build --pull -t "$CI_REGISTRY_IMAGE:dev" .
|
|
||||||
- docker push "$CI_REGISTRY_IMAGE:dev"
|
|
||||||
allow_failure: false
|
|
||||||
only:
|
|
||||||
- dev
|
|
||||||
- merge_requests
|
|
||||||
|
|
||||||
docker-build:
|
|
||||||
image: docker:latest
|
|
||||||
stage: build
|
|
||||||
services:
|
|
||||||
- docker:dind
|
|
||||||
before_script:
|
|
||||||
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
|
||||||
script:
|
|
||||||
- docker build --pull -t "$CI_REGISTRY_IMAGE" .
|
|
||||||
allow_failure: false
|
|
||||||
except:
|
|
||||||
- master
|
|
||||||
- dev
|
|
||||||
- merge_requests
|
|
||||||
|
|
||||||
include:
|
|
||||||
- template: Security/Container-Scanning.gitlab-ci.yml
|
|
||||||
- template: Security/SAST.gitlab-ci.yml
|
|
||||||
container_scanning:
|
|
||||||
variables:
|
|
||||||
DOCKER_IMAGE: "$CI_REGISTRY_IMAGE${tag}"
|
|
||||||
stage: test
|
|
||||||
allow_failure: false
|
|
||||||
|
|
||||||
deploy_dev:
|
|
||||||
stage: deploy
|
|
||||||
image: debian
|
|
||||||
before_script:
|
|
||||||
- apt-get update -qq
|
|
||||||
- 'which ssh-agent || ( apt-get install -qq openssh-client )'
|
|
||||||
- eval $(ssh-agent -s)
|
|
||||||
- ssh-add <(echo "$SSH_PRIVATE_KEY")
|
|
||||||
- mkdir -p ~/.ssh
|
|
||||||
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
|
|
||||||
script:
|
|
||||||
- ssh $SSH_SERVER "cd /root && docker-compose -f shbot-dev.yaml pull shbot-dev && docker-compose -f shbot-dev.yaml up -d shbot-dev && exit"
|
|
||||||
only:
|
|
||||||
- dev
|
|
||||||
- merge_requests
|
|
||||||
|
|
||||||
deploy_staging:
|
|
||||||
stage: deploy
|
|
||||||
image: debian
|
|
||||||
before_script:
|
|
||||||
- apt-get update -qq
|
|
||||||
- 'which ssh-agent || ( apt-get install -qq openssh-client )'
|
|
||||||
- eval $(ssh-agent -s)
|
|
||||||
- ssh-add <(echo "$SSH_PRIVATE_KEY")
|
|
||||||
- mkdir -p ~/.ssh
|
|
||||||
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
|
|
||||||
script:
|
|
||||||
- ssh $SSH_SERVER "cd /root && docker-compose pull shbot && docker-compose up -d shbot && exit"
|
|
||||||
only:
|
|
||||||
- master
|
|
||||||
|
|
42
.woodpecker/.build.yaml
Normal file
42
.woodpecker/.build.yaml
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
steps:
|
||||||
|
- name: docker
|
||||||
|
image: woodpeckerci/plugin-docker-buildx
|
||||||
|
settings:
|
||||||
|
registry: git.ar21.de
|
||||||
|
username:
|
||||||
|
from_secret: REGISTRY_USER
|
||||||
|
password:
|
||||||
|
from_secret: REGISTRY_PASS
|
||||||
|
repo: git.ar21.de/secondhemd/shbot
|
||||||
|
tags: latest
|
||||||
|
when:
|
||||||
|
- branch: master
|
||||||
|
event: [push, manual]
|
||||||
|
- name: docker-build
|
||||||
|
image: woodpeckerci/plugin-docker-buildx
|
||||||
|
settings:
|
||||||
|
registry: git.ar21.de
|
||||||
|
username:
|
||||||
|
from_secret: REGISTRY_USER
|
||||||
|
password:
|
||||||
|
from_secret: REGISTRY_PASS
|
||||||
|
repo: git.ar21.de/secondhemd/shbot
|
||||||
|
tags: latest
|
||||||
|
dry_run: true
|
||||||
|
when:
|
||||||
|
- branch:
|
||||||
|
exclude: [master, dev]
|
||||||
|
event: [push, manual]
|
||||||
|
- name: dev docker
|
||||||
|
image: woodpeckerci/plugin-docker-buildx
|
||||||
|
settings:
|
||||||
|
registry: git.ar21.de
|
||||||
|
username:
|
||||||
|
from_secret: REGISTRY_USER
|
||||||
|
password:
|
||||||
|
from_secret: REGISTRY_PASS
|
||||||
|
repo: git.ar21.de/secondhemd/shbot
|
||||||
|
tags: dev
|
||||||
|
when:
|
||||||
|
- branch: dev
|
||||||
|
event: [push, manual]
|
34
.woodpecker/.deploy.yaml
Normal file
34
.woodpecker/.deploy.yaml
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
skip_clone: true
|
||||||
|
steps:
|
||||||
|
- name: deploy
|
||||||
|
image: appleboy/drone-ssh
|
||||||
|
settings:
|
||||||
|
host:
|
||||||
|
- s.ar21.de
|
||||||
|
username: root
|
||||||
|
key:
|
||||||
|
from_secret: DEPLOY_SSH_KEY
|
||||||
|
port: 22
|
||||||
|
command_timeout: 2m
|
||||||
|
script:
|
||||||
|
- cd ~/compose/shbot && docker compose pull shbot && docker compose up -d shbot
|
||||||
|
when:
|
||||||
|
- branch: master
|
||||||
|
event: [push, manual]
|
||||||
|
- name: deploy dev
|
||||||
|
image: appleboy/drone-ssh
|
||||||
|
settings:
|
||||||
|
host:
|
||||||
|
- s.ar21.de
|
||||||
|
username: root
|
||||||
|
key:
|
||||||
|
from_secret: DEPLOY_SSH_KEY
|
||||||
|
port: 22
|
||||||
|
command_timeout: 2m
|
||||||
|
script:
|
||||||
|
- cd /root && docker compose -f shbot-dev.yaml pull shbot-dev && docker compose -f shbot-dev.yaml up -d shbot-dev
|
||||||
|
when:
|
||||||
|
- branch: dev
|
||||||
|
event: [push, manual]
|
||||||
|
depends_on:
|
||||||
|
- build
|
|
@ -1,4 +1,4 @@
|
||||||
FROM amd64/python:3.11.0-alpine3.16
|
FROM amd64/python:3.11.3-alpine3.16
|
||||||
|
|
||||||
WORKDIR ./
|
WORKDIR ./
|
||||||
ARG PUID=1000
|
ARG PUID=1000
|
||||||
|
|
14
README.md
14
README.md
|
@ -1,22 +1,22 @@
|
||||||
# SECOND BOT
|
# SECOND BOT
|
||||||
[![pipeline status](https://git.cxservers.com/aaron-riedel/shbot/badges/master/pipeline.svg)](https://git.cxservers.com/aaron-riedel/shbot/-/commits/master)
|
[![Build Status](https://drone.ar21.de/api/badges/secondhemd/shbot/status.svg)](https://drone.ar21.de/secondhemd/shbot)
|
||||||
|
|
||||||
der Bot für den SecondHemd Discord
|
der Bot für den SecondHemd Discord
|
||||||
|
|
||||||
# Latest
|
# Latest
|
||||||
## Build
|
## Build
|
||||||
```
|
```
|
||||||
docker build -t docker-registry.cxservers.com/aaron-riedel/shbot:latest .
|
docker build -t secondhemd/shbot:latest .
|
||||||
```
|
```
|
||||||
## Run
|
## Run
|
||||||
```
|
```
|
||||||
sudo docker run -e 'TOKEN=' -e 'PREFIX=$' -t docker-registry.cxservers.com/aaron-riedel/shbot:latest
|
sudo docker run -e 'TOKEN=' -e 'PREFIX=$' -t secondhemd/shbot:latest
|
||||||
```
|
```
|
||||||
## Docker compose
|
## Docker compose
|
||||||
```
|
```
|
||||||
services:
|
services:
|
||||||
bot:
|
bot:
|
||||||
image: docker-registry.cxservers.com/aaron-riedel/shbot:latest
|
image: secondhemd/shbot:latest
|
||||||
container_name: shbot
|
container_name: shbot
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
|
@ -27,17 +27,17 @@ services:
|
||||||
# Development
|
# Development
|
||||||
## Build
|
## Build
|
||||||
```
|
```
|
||||||
docker build -t docker-registry.cxservers.com/aaron-riedel/shbot:dev .
|
docker build -t secondhemd/shbot:dev .
|
||||||
```
|
```
|
||||||
## Run
|
## Run
|
||||||
```
|
```
|
||||||
sudo docker run -e 'TOKEN=' -e 'PREFIX=$' -t docker-registry.cxservers.com/aaron-riedel/shbot:dev
|
sudo docker run -e 'TOKEN=' -e 'PREFIX=$' -t secondhemd/shbot:dev
|
||||||
```
|
```
|
||||||
## Docker compose
|
## Docker compose
|
||||||
```
|
```
|
||||||
services:
|
services:
|
||||||
bot:
|
bot:
|
||||||
image: docker-registry.cxservers.com/aaron-riedel/shbot:dev
|
image: secondhemd/shbot:dev
|
||||||
container_name: shbot
|
container_name: shbot
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
|
|
40
bot.py
40
bot.py
|
@ -101,7 +101,7 @@ class Confirm(discord.ui.View):
|
||||||
|
|
||||||
@bot.slash_command(guild_ids=[261575556708040705])
|
@bot.slash_command(guild_ids=[261575556708040705])
|
||||||
@commands.has_role(member_role)
|
@commands.has_role(member_role)
|
||||||
async def roll(ctx,
|
async def roll(ctx,
|
||||||
dice: Option(str, "Würfel den/die du werfen willst. z.B. W20, 3d6", default="W20"),
|
dice: Option(str, "Würfel den/die du werfen willst. z.B. W20, 3d6", default="W20"),
|
||||||
):
|
):
|
||||||
"""Rolle einen oder mehrere Würfel"""
|
"""Rolle einen oder mehrere Würfel"""
|
||||||
|
@ -134,7 +134,7 @@ async def roll(ctx,
|
||||||
|
|
||||||
@bot.slash_command(guild_ids=[261575556708040705])
|
@bot.slash_command(guild_ids=[261575556708040705])
|
||||||
@commands.has_role(gm_role)
|
@commands.has_role(gm_role)
|
||||||
async def gmroll(ctx,
|
async def gmroll(ctx,
|
||||||
dice: Option(str, "Würfel den/die du werfen willst. z.B. W20, 3d6", default="W20"),
|
dice: Option(str, "Würfel den/die du werfen willst. z.B. W20, 3d6", default="W20"),
|
||||||
):
|
):
|
||||||
"""Rolle einen oder mehrere Würfel verdeckt"""
|
"""Rolle einen oder mehrere Würfel verdeckt"""
|
||||||
|
@ -178,7 +178,7 @@ class MyModal(Modal):
|
||||||
original_message = await interaction.channel.fetch_message(self.message_id)
|
original_message = await interaction.channel.fetch_message(self.message_id)
|
||||||
for x in list(emojitext):
|
for x in list(emojitext):
|
||||||
await original_message.add_reaction(alphabet[x])
|
await original_message.add_reaction(alphabet[x])
|
||||||
|
|
||||||
|
|
||||||
@bot.message_command(name="Emoji Text", guild_ids=[261575556708040705])
|
@bot.message_command(name="Emoji Text", guild_ids=[261575556708040705])
|
||||||
@commands.has_role(member_role)
|
@commands.has_role(member_role)
|
||||||
|
@ -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()
|
||||||
|
@ -414,7 +396,7 @@ async def hiebe(ctx, *, arg):
|
||||||
await user.create_dm()
|
await user.create_dm()
|
||||||
await user.dm_channel.send("HIEBE :punch: von {}".format(ctx.author.display_name))
|
await user.dm_channel.send("HIEBE :punch: von {}".format(ctx.author.display_name))
|
||||||
|
|
||||||
@bot.command(help="kickt Member ohne Rolle, die 30 Tage nicht online waren", usage="")
|
@bot.command(help="kickt Member ohne Rolle, die 7 Tage nicht online waren", usage="")
|
||||||
@is_admin()
|
@is_admin()
|
||||||
async def prune(ctx):
|
async def prune(ctx):
|
||||||
await ctx.message.delete()
|
await ctx.message.delete()
|
||||||
|
@ -427,8 +409,8 @@ async def prune(ctx):
|
||||||
await ctx.send(content="Zeit ausgelaufen", delete_after=5.0)
|
await ctx.send(content="Zeit ausgelaufen", delete_after=5.0)
|
||||||
elif view.value:
|
elif view.value:
|
||||||
await question.delete()
|
await question.delete()
|
||||||
deleted = await ctx.guild.prune_members(days=30)
|
deleted = await ctx.guild.prune_members(days=7)
|
||||||
await ctx.send(content='Ich habe {} Leichen beseitigt.'.format(deleted), delete_after=5.0)
|
await ctx.send(content='Ich habe {} Leiche(n) beseitigt.'.format(deleted), delete_after=5.0)
|
||||||
else:
|
else:
|
||||||
await question.delete()
|
await question.delete()
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
py-cord==2.2.2
|
py-cord==2.6.1
|
||||||
|
|
42
survey.py
Normal file
42
survey.py
Normal 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 = int(os.environ['SURVEY_CHANNEL'])
|
||||||
|
mention_id = int(os.environ['MENTION_ID'])
|
||||||
|
guild_id = int(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)
|
Loading…
Reference in a new issue