initial release of suggestionsbot
This commit is contained in:
		
							parent
							
								
									3fd5693986
								
							
						
					
					
						commit
						6dbda5e502
					
				
							
								
								
									
										46
									
								
								suggestionsbot/discord_suggestions.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								suggestionsbot/discord_suggestions.py
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,46 @@ | |||||||
|  | import discord | ||||||
|  | from discord.ext import commands | ||||||
|  | from settings import token | ||||||
|  | import datetime | ||||||
|  | 
 | ||||||
|  | client = discord.Client() | ||||||
|  | #shit api. got switched like 1 year ago so like every single discusison about it is outdated.  | ||||||
|  | 
 | ||||||
|  | def get_suggestion_type(msg): | ||||||
|  |     suggestion_type = "GENERIC" | ||||||
|  |     if msg.startswith('!ze'): | ||||||
|  |         suggestion_type = "ZOMBIE ESCAPE" | ||||||
|  |         msg = msg.replace('!ze', '') | ||||||
|  |     elif msg.startswith('!mg'): | ||||||
|  |         suggestion_type = "MINIGAME" | ||||||
|  |         msg = msg.replace('!mg', '') | ||||||
|  |     elif msg.startswith('!zr'): | ||||||
|  |         suggestion_type = "ZOMBIE RIOT" | ||||||
|  |         msg = msg.replace('!zr', '') | ||||||
|  |     elif msg.startswith('!forum'): | ||||||
|  |         suggestion_type = "FORUM" | ||||||
|  |         msg = msg.replace('!forum', '') | ||||||
|  |     elif msg.startswith('!discord'): | ||||||
|  |         suggestion_type = "DISCORD" | ||||||
|  |         msg = msg.replace('!discord', '') | ||||||
|  |     elif msg.startswith('!meta'): | ||||||
|  |         suggestion_type = "META" | ||||||
|  |         msg = msg.replace('!meta', '') | ||||||
|  |     return suggestion_type, msg.strip() | ||||||
|  | 
 | ||||||
|  | @client.event | ||||||
|  | async def on_message(message): | ||||||
|  |     if message.author.bot: | ||||||
|  |         return | ||||||
|  |     if message.channel.name == 'suggestion-box': #suggestion-box | ||||||
|  |         channel = client.get_channel(872925751295504476) #872925751295504476 | ||||||
|  |         message_content = message.content | ||||||
|  |         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}\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""" | ||||||
|  |         await message.channel.purge(limit=1) | ||||||
|  |         await message.channel.send(send_channel_msg) | ||||||
|  |         await channel.send(send_msg) | ||||||
|  | 
 | ||||||
|  | client.run(token) | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user