After LARP Zomer Festival cleanup commit

This commit is contained in:
2021-07-12 01:22:54 +02:00
parent e279cb2433
commit f3df7cc110
6 changed files with 16 additions and 42 deletions

View File

@@ -8,5 +8,5 @@ Standard diceroller which works with the 1dX notation. See `!help roll` for more
`# GIF embeds` `# GIF embeds`
For servers that want to disable embeds for any reason (triggers, unwanted imagery, etc), this function will make sure that (for specific channels configured in the config) gif URLs are picked up by the bot and embedded. This whole functionality is used for a problem that shouldn't be there in the first place, but because GIFs are linked to the Embed setting in Discord, for some servers this might pose a solution. For servers that want to disable embeds for any reason (triggers, unwanted imagery, etc), this function will make sure that (for specific channels configured in the config) gif URLs are picked up by the bot and embedded. This whole functionality is used for a problem that shouldn't be there in the first place, but because GIFs are linked to the Embed setting in Discord, for some servers this might pose a solution.
`# LARP Zomer Festival Babbelbingo` `# LARP Platform Babbelbingo`
For the LARP Zomer Festival babbelbingo, you can use the `!bingo` command anywhere on the LARP Platform Discord Server. You will get a Babbelbingo card in PM. You can use the `!bingo` command again for a new card if your old one is done or if you want a new one with other questions. For the LARP Platform babbelbingo, you can use the `!bingo` command anywhere on the LARP Platform Discord Server. You will get a babbelbingo card in PM. You can use the `!bingo` command again for a new card if your old one is done or if you want a new one with other questions.

View File

@@ -2,8 +2,6 @@
import discord import discord
from discord.ext import commands from discord.ext import commands
# from discord.ext.commands import bot
from discord.utils import get
import logging import logging
from jeevesbot import bothelp, functions, env, babbelbingo from jeevesbot import bothelp, functions, env, babbelbingo
@@ -17,25 +15,13 @@ logger.addHandler(handler)
# setup discord.py bot # setup discord.py bot
intents = discord.Intents().all() intents = discord.Intents().all()
client = commands.Bot(command_prefix='!', intents=intents) bot = commands.Bot(command_prefix='!', intents=intents)
e = discord.Embed() e = discord.Embed()
# listen for emojis (set message id and role id in env.py) @bot.event
@client.event
async def on_raw_reaction_add(payload):
message = await client.get_channel(payload.channel_id).fetch_message(payload.message_id)
guild_id = payload.guild_id
guild = discord.utils.find(lambda g: g.id == guild_id, client.guilds)
member = discord.utils.get(guild.members, id=payload.user_id)
role = guild.get_role(env.EMOJIREACTROLE)
reaction = discord.utils.get(message.reactions, emoji="☎️")
if message.id in env.EMOJIREACTMSG and reaction is not None:
await member.add_roles(role)
@client.event
async def on_message(message): async def on_message(message):
# we do not want the bot to reply to itself # we do not want the bot to reply to itself
if message.author == client.user: if message.author == bot.user:
return return
if message.content.startswith('!help'): if message.content.startswith('!help'):
parameters = message.content.split(' ', 1) parameters = message.content.split(' ', 1)
@@ -93,7 +79,7 @@ async def on_message(message):
name = message.author.name name = message.author.name
bingocard = babbelbingo.bingo(name) bingocard = babbelbingo.bingo(name)
guild_id = message.guild.id guild_id = message.guild.id
guild = discord.utils.find(lambda g: g.id == guild_id, client.guilds) guild = discord.utils.find(lambda g: g.id == guild_id, bot.guilds)
member = discord.utils.get(guild.members, id=message.author.id) member = discord.utils.get(guild.members, id=message.author.id)
role = discord.utils.get(guild.roles , name='babbelbingo') role = discord.utils.get(guild.roles , name='babbelbingo')
await message.author.send(file=discord.File(bingocard)) await message.author.send(file=discord.File(bingocard))
@@ -108,11 +94,11 @@ async def on_message(message):
msg = 'https://bunq.me/larpzomerfestival' msg = 'https://bunq.me/larpzomerfestival'
await message.channel.send(msg) await message.channel.send(msg)
@client.event @bot.event
async def on_ready(): async def on_ready():
print('### Active with id %s as %s ###' % (client.user.id,client.user.name) ) print('### Active with id %s as %s ###' % (bot.user.id,bot.user.name) )
activity = discord.Activity(name='!help', type=discord.ActivityType.listening) activity = discord.Activity(name='!help', type=discord.ActivityType.listening)
await client.change_presence(activity=activity) await bot.change_presence(activity=activity)
if __name__ == '__main__': if __name__ == '__main__':
client.run(env.TOKEN) bot.run(env.TOKEN)

View File

@@ -10,9 +10,7 @@ typing-extensions
pylint pylint
gspread gspread
oauth2client oauth2client
Pillow
# needs this version, otherwise TypeErrors will break stuff # needs this version, otherwise TypeErrors will break stuff
yarl==1.4.2 yarl==1.4.2
# babbelbingo
Pillow

View File

@@ -1,17 +1,13 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from collections import defaultdict
import time import time
import discord import discord
from discord.ext import commands from discord.ext import commands
import sys import sys
import ast import ast
import itertools from ..jeevesbot import env
from discord.utils import get
from pyasn1.type.constraint import PermittedAlphabetConstraint ## Standalone script for emoji-vvdd
# general @ test = 749399756752814105
# setup discord.py bot # setup discord.py bot
intents = discord.Intents().all() intents = discord.Intents().all()
@@ -32,7 +28,7 @@ async def score(question, score):
async def run_script(params): async def run_script(params):
params = params params = params
channel = client.get_channel(790908319005933598) # vvdd 729667183126511617 # tech 790908319005933598 # test 749399756752814105 channel = client.get_channel(729667183126511617) # vvdd 729667183126511617 # tech 790908319005933598 # test 749399756752814105
emoji_numbers = ['1', '2', '3', '4', '5', '6', '7', '8', '9'] emoji_numbers = ['1', '2', '3', '4', '5', '6', '7', '8', '9']
question = params[0] # string question = params[0] # string
answers = ast.literal_eval(params[1]) # list answers = ast.literal_eval(params[1]) # list
@@ -72,6 +68,7 @@ async def run_script(params):
f.set_author(name='Jeeves', icon_url='https://cdn.hippogrief.nl/jeevesbot/jeeves.jpg') f.set_author(name='Jeeves', icon_url='https://cdn.hippogrief.nl/jeevesbot/jeeves.jpg')
f.add_field(name=question, value='\u200b', inline=False) f.add_field(name=question, value='\u200b', inline=False)
f.add_field(name=hoogste_score, value=score, inline=False) f.add_field(name=hoogste_score, value=score, inline=False)
f.set_footer(text="Je mag blijven doorstemmen, deze tussenstand zal niet worden bijgewerkt meer verder.")
f.set_thumbnail(url='https://cdn.hippogrief.nl/jeevesbot/logo.jpg') f.set_thumbnail(url='https://cdn.hippogrief.nl/jeevesbot/logo.jpg')
message = await channel.send(embed=f) message = await channel.send(embed=f)
@@ -85,4 +82,4 @@ async def on_ready():
await run_script(params) await run_script(params)
if __name__ == '__main__': if __name__ == '__main__':
client.run('ODE5NjMyNDg1MjU5ODA0NzU0.YEpcPA.I-i1tDIV1vP7FW6-8cA7YLH5lN4') client.run(env.TOKEN)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

View File

@@ -1,7 +0,0 @@
<svg width="217" height="98" viewBox="0 0 217 98" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="152" height="50" rx="3" fill="#1F090E"/>
<path d="M32.304 32.68V37H18.256V13.688H23.664V32.68H32.304ZM60.1885 28.088L58.0285 21.704C57.8685 21.2987 57.6978 20.824 57.5165 20.28C57.3352 19.7253 57.1538 19.128 56.9725 18.488C56.8125 19.1387 56.6418 19.7413 56.4605 20.296C56.2792 20.8507 56.1085 21.3307 55.9485 21.736L53.8045 28.088H60.1885ZM68.7805 37H64.5885C64.1192 37 63.7405 36.8933 63.4525 36.68C63.1645 36.456 62.9458 36.1733 62.7965 35.832L61.4205 31.768H52.5565L51.1805 35.832C51.0632 36.1307 50.8498 36.4027 50.5405 36.648C50.2418 36.8827 49.8685 37 49.4205 37H45.1965L54.2205 13.688H59.7565L68.7805 37ZM91.0025 24.648C91.7385 24.648 92.3625 24.5573 92.8745 24.376C93.3972 24.184 93.8238 23.9227 94.1545 23.592C94.4852 23.2613 94.7252 22.8773 94.8745 22.44C95.0238 21.992 95.0985 21.512 95.0985 21C95.0985 19.976 94.7625 19.176 94.0905 18.6C93.4292 18.024 92.3998 17.736 91.0025 17.736H88.8265V24.648H91.0025ZM102.49 37H97.5945C96.6878 37 96.0372 36.6587 95.6425 35.976L91.7705 29.208C91.5892 28.92 91.3865 28.712 91.1625 28.584C90.9385 28.4453 90.6185 28.376 90.2025 28.376H88.8265V37H83.4185V13.688H91.0025C92.6878 13.688 94.1225 13.864 95.3065 14.216C96.5012 14.5573 97.4718 15.0373 98.2185 15.656C98.9758 16.2747 99.5252 17.0053 99.8665 17.848C100.208 18.6907 100.378 19.608 100.378 20.6C100.378 21.3573 100.277 22.072 100.074 22.744C99.8718 23.416 99.5732 24.04 99.1785 24.616C98.7838 25.1813 98.2932 25.688 97.7065 26.136C97.1305 26.584 96.4638 26.952 95.7065 27.24C96.0585 27.4213 96.3892 27.6507 96.6985 27.928C97.0078 28.1947 97.2852 28.5147 97.5305 28.888L102.49 37ZM125.474 25.128C126.882 25.128 127.895 24.792 128.514 24.12C129.132 23.448 129.442 22.5093 129.442 21.304C129.442 20.7707 129.362 20.2853 129.202 19.848C129.042 19.4107 128.796 19.0373 128.466 18.728C128.146 18.408 127.735 18.1627 127.234 17.992C126.743 17.8213 126.156 17.736 125.474 17.736H122.658V25.128H125.474ZM125.474 13.688C127.116 13.688 128.524 13.8853 129.698 14.28C130.882 14.664 131.852 15.1973 132.61 15.88C133.378 16.5627 133.943 17.368 134.306 18.296C134.668 19.224 134.85 20.2267 134.85 21.304C134.85 22.4667 134.663 23.5333 134.29 24.504C133.916 25.4747 133.346 26.3067 132.578 27C131.81 27.6933 130.834 28.2373 129.65 28.632C128.476 29.016 127.084 29.208 125.474 29.208H122.658V37H117.25V13.688H125.474Z" fill="white"/>
<rect x="51" y="49" width="165" height="48" rx="2" fill="white"/>
<path d="M73.205 73.838C74.173 73.838 74.8697 73.607 75.295 73.145C75.7203 72.683 75.933 72.0377 75.933 71.209C75.933 70.8423 75.878 70.5087 75.768 70.208C75.658 69.9073 75.4893 69.6507 75.262 69.438C75.042 69.218 74.7597 69.0493 74.415 68.932C74.0777 68.8147 73.6743 68.756 73.205 68.756H71.269V73.838H73.205ZM73.205 65.973C74.3343 65.973 75.3023 66.1087 76.109 66.38C76.923 66.644 77.5903 67.0107 78.111 67.48C78.639 67.9493 79.0277 68.503 79.277 69.141C79.5263 69.779 79.651 70.4683 79.651 71.209C79.651 72.0083 79.5227 72.7417 79.266 73.409C79.0093 74.0763 78.617 74.6483 78.089 75.125C77.561 75.6017 76.89 75.9757 76.076 76.247C75.2693 76.511 74.3123 76.643 73.205 76.643H71.269V82H67.551V65.973H73.205ZM93.3953 79.03V82H83.7373V65.973H87.4553V79.03H93.3953ZM105.966 75.873L104.481 71.484C104.371 71.2053 104.254 70.879 104.129 70.505C104.004 70.1237 103.88 69.713 103.755 69.273C103.645 69.7203 103.528 70.1347 103.403 70.516C103.278 70.8973 103.161 71.2273 103.051 71.506L101.577 75.873H105.966ZM111.873 82H108.991C108.668 82 108.408 81.9267 108.21 81.78C108.012 81.626 107.862 81.4317 107.759 81.197L106.813 78.403H100.719L99.7729 81.197C99.6923 81.4023 99.5456 81.5893 99.3329 81.758C99.1276 81.9193 98.8709 82 98.5629 82H95.6589L101.863 65.973H105.669L111.873 82ZM125.285 68.921H120.775V82H117.057V68.921H112.547V65.973H125.285V68.921ZM133.114 68.833V72.892H138.592V75.763H133.114V82H129.374V65.973H139.692V68.833H133.114ZM159.615 73.981C159.615 75.1397 159.413 76.2177 159.01 77.215C158.614 78.2123 158.053 79.0813 157.327 79.822C156.601 80.5553 155.725 81.131 154.698 81.549C153.679 81.967 152.546 82.176 151.299 82.176C150.052 82.176 148.916 81.967 147.889 81.549C146.862 81.131 145.982 80.5553 145.249 79.822C144.523 79.0813 143.958 78.2123 143.555 77.215C143.159 76.2177 142.961 75.1397 142.961 73.981C142.961 72.8223 143.159 71.7443 143.555 70.747C143.958 69.7497 144.523 68.8843 145.249 68.151C145.982 67.4177 146.862 66.842 147.889 66.424C148.916 66.006 150.052 65.797 151.299 65.797C152.546 65.797 153.679 66.0097 154.698 66.435C155.725 66.853 156.601 67.4287 157.327 68.162C158.053 68.8953 158.614 69.7607 159.01 70.758C159.413 71.7553 159.615 72.8297 159.615 73.981ZM155.809 73.981C155.809 73.189 155.706 72.4777 155.501 71.847C155.296 71.209 154.999 70.67 154.61 70.23C154.229 69.79 153.759 69.4527 153.202 69.218C152.645 68.9833 152.01 68.866 151.299 68.866C150.58 68.866 149.939 68.9833 149.374 69.218C148.817 69.4527 148.344 69.79 147.955 70.23C147.574 70.67 147.28 71.209 147.075 71.847C146.87 72.4777 146.767 73.189 146.767 73.981C146.767 74.7803 146.87 75.499 147.075 76.137C147.28 76.7677 147.574 77.303 147.955 77.743C148.344 78.183 148.817 78.5203 149.374 78.755C149.939 78.9823 150.58 79.096 151.299 79.096C152.01 79.096 152.645 78.9823 153.202 78.755C153.759 78.5203 154.229 78.183 154.61 77.743C154.999 77.303 155.296 76.7677 155.501 76.137C155.706 75.499 155.809 74.7803 155.809 73.981ZM169.217 73.508C169.723 73.508 170.152 73.4457 170.504 73.321C170.863 73.189 171.157 73.0093 171.384 72.782C171.611 72.5547 171.776 72.2907 171.879 71.99C171.982 71.682 172.033 71.352 172.033 71C172.033 70.296 171.802 69.746 171.34 69.35C170.885 68.954 170.178 68.756 169.217 68.756H167.721V73.508H169.217ZM177.115 82H173.749C173.126 82 172.678 81.7653 172.407 81.296L169.745 76.643C169.62 76.445 169.481 76.302 169.327 76.214C169.173 76.1187 168.953 76.071 168.667 76.071H167.721V82H164.003V65.973H169.217C170.376 65.973 171.362 66.094 172.176 66.336C172.997 66.5707 173.665 66.9007 174.178 67.326C174.699 67.7513 175.076 68.2537 175.311 68.833C175.546 69.4123 175.663 70.043 175.663 70.725C175.663 71.2457 175.593 71.737 175.454 72.199C175.315 72.661 175.109 73.09 174.838 73.486C174.567 73.8747 174.229 74.223 173.826 74.531C173.43 74.839 172.972 75.092 172.451 75.29C172.693 75.4147 172.92 75.5723 173.133 75.763C173.346 75.9463 173.536 76.1663 173.705 76.423L177.115 82ZM198.68 65.973V82H195.402V72.782C195.402 72.5693 195.406 72.3383 195.413 72.089C195.428 71.8397 195.45 71.5867 195.479 71.33L191.222 79.569C191.09 79.8257 190.91 80.02 190.683 80.152C190.463 80.284 190.21 80.35 189.924 80.35H189.418C189.132 80.35 188.875 80.284 188.648 80.152C188.428 80.02 188.252 79.8257 188.12 79.569L183.863 71.308C183.885 71.572 183.903 71.8323 183.918 72.089C183.933 72.3383 183.94 72.5693 183.94 72.782V82H180.662V65.973H183.5C183.661 65.973 183.801 65.9767 183.918 65.984C184.043 65.9913 184.153 66.0133 184.248 66.05C184.343 66.0867 184.428 66.1453 184.501 66.226C184.582 66.2993 184.659 66.4057 184.732 66.545L188.857 74.674C189.004 74.9527 189.143 75.2423 189.275 75.543C189.414 75.8437 189.546 76.1517 189.671 76.467C189.796 76.1443 189.924 75.829 190.056 75.521C190.195 75.213 190.342 74.9197 190.496 74.641L194.61 66.545C194.683 66.4057 194.757 66.2993 194.83 66.226C194.911 66.1453 194.999 66.0867 195.094 66.05C195.189 66.0133 195.296 65.9913 195.413 65.984C195.538 65.9767 195.681 65.973 195.842 65.973H198.68Z" fill="#1F090E"/>
<rect x="51" y="49" width="165" height="48" rx="2" stroke="#1F090E" stroke-width="2"/>
</svg>

Before

Width:  |  Height:  |  Size: 7.4 KiB