updating suggestiongs bot and the autism bot on discord

This commit is contained in:
christian
2021-09-17 16:03:11 +02:00
parent 78532929ae
commit 5dee2a8e65
5 changed files with 1330 additions and 442 deletions
+13 -4
View File
@@ -1,11 +1,13 @@
import discord
from discord.ext import commands
from discord.ext.tasks import loop
from discord import HTTPException
from settings import token
import time
import datetime
client = discord.Client()
ignore_list = []
ignore_list = [846756271910158378]
#shit api. got switched like 1 year ago so like every single discusison about it is outdated.
def get_suggestion_type(msg):
@@ -35,7 +37,7 @@ async def on_message(message):
if message.author.bot:
return
if message.author.id in ignore_list:
msg = f'{message.author.name} Your suggestion was ignored because you made too many shitty suggestions already. Do not post in this channel anymore.'
msg = f'{message.author.name} Your suggestion was ignored because you made too many shitty suggestions already. Do not post in this channel anymore because your retarded.'
await message.channel.send()
return
if message.channel.name == 'suggestion-box': #suggestion-box
@@ -44,12 +46,13 @@ async def on_message(message):
suggestion_type, message_content = get_suggestion_type(message_content)
now = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
send_msg = f"""```DISCORD USER ID: {message.author.id}\nUSERNAME: {message.author}\nTYPE: {suggestion_type}\nTIME: {now}\nSTATUS: No admin interested yet (mark with an emote to prevent suggestion deletion within 48 hours)\nSUGGESTION: {message_content}```"""
send_channel_msg = f"""{message.author} your suggestion was sent to admins as type: {suggestion_type}. Specify Suggestion types by appending your message with one of the following commands: !ze !zr !mg !forum !discord !meta"""
send_channel_msg = f"""{message.author} your suggestion was sent to admins as type: {suggestion_type}. Specify Suggestion types by appending your message with one of the following commands: !ze !zr !mg !forum !discord !meta. \nSpamming the suggestion channel with useless crap will lead to ban."""
await message.channel.send(send_channel_msg)
await channel.send(send_msg)
@loop(seconds = 10)
async def check_suggestions_to_delete():
global client
for channel in client.get_all_channels():
if channel.name == 'suggestion-admin':
msgs_history = channel.history()
@@ -79,7 +82,13 @@ async def check_suggestions_to_delete():
if user.name not in user_reactions:
user_reactions.append(user.name)
final_msg = f'{first_part}STATUS: Admins interested in topic:{user_reactions}\n{suggestion}{last_part}'
await msg.edit(content=final_msg)
try:
await msg.edit(content=final_msg)
except HTTPException:
time.sleep(300)
client = discord.Client()
check_suggestions_to_delete.start()
client.run(token)
#the entire syntax that is visisble from python3 terminal is not very well displayed in the docs of discord.py and nobody has the current syntax in any suggestions anywhere on the internet. almost every single thing is out of date reee
if __name__ == '__main__':