OUTDATED NOW, ALL UPDATES ARE ON THE GITHUB REPO:
https://github.com/stephenwilde247/AthenaDiscordBot
I wanted to make a discord bot for the upcoming release of the MHmatters discord server. Now it’s nearly complete I wanted to share the code with . There is a lot of work to be done but so far this is it:
startBot.py
from intro import *
from inbound_messages import *
from startup_config import *
from updater import updateVersion
from timedtasks import *
intro()
updateVersion()
token_config()
timed_messages()
inboundandReplies()
VersionNumber.txt
Version: 0.0.2
inbound_messages.py
import discord
import random
from randomReplies import *
from swearlist import *
from server_info import *
from startup_config import *
from discord.ext import commands, tasks
from emoji_wl import *
from discord.ext import tasks
client = discord.Client()
bot = commands.Bot('!') # ! = PREFIX
def inboundandReplies():
print(f'****************** connected ********************\n{client}')
print('Listening for commands...')
@client.event
async def on_message(inbound):
username_allcase = str(inbound.author).split('#')[0]
username = str(inbound.author).split('#')[0]
user_inbound_message = inbound.content
channel = str(inbound.channel.name)
print(f'{username}: {user_inbound_message}: ({channel})')
# Just in a channel you specify from a list in server_info.py
if inbound.channel.name == channelNames[0]: # This is just for lobby as its 1
if user_inbound_message.lower() == 'cheese':
print("This was just for the lobby only")
elif user_inbound_message.lower() == 'pizza':
print("This was just for the lobby only")
# This does work but commented our for age reasons
# elif user_inbound_message.lower() == '!lotto':
# numbers = f'My guess to the UK lotto numbers this week are:\n{random.randrange(1, 59)} : : {random.randrange(1, 59)} : : {random.randrange(1, 59)} :: {random.randrange(1, 59)} :: {random.randrange(1, 59)} :: Bonus ball: {random.randrange(1, 59)} \nIf you win please donate to us a little ;-)'
# await inbound.channel.send(numbers)
# print(f'Lotto used by {username} in channel: {channel}')
# return
# This is the random function code
elif user_inbound_message.lower() == '!ping':
await inbound.channel.send(f'Pong + @{username_allcase}')
# all channels
if inbound.content.find("ye ") >= 0:
await inbound.channel.send(f"Ok, {username} ⬅ This person wants you to know its 'You're'\n"
f"In a sentence 'your' is in the context of your dog pooed on the floor.\n"
f"Whilst 'You're' context is: You're awesome.")
print(f'Your educate used by {username} in channel: {channel}')
return
elif user_inbound_message.lower() == '!uksuicide': # When someone types !fight
ukSuicideReply = f'{username} Get help now!, we are all here to listen but if its past our help ' \
f'please please please go here: https://mhmatters.life/viewtopic.php?t=7'
await inbound.channel.send(ukSuicideReply) # Replies with the string fightReplies
print(f'!Friend Command used by {username} sent to {channel}')
return # ends this section
elif user_inbound_message.lower() == '!hug':
await inbound.channel.send(f'I Hug @{username_allcase}# everything is going to be ok :)')
print(f'Lotto used by {username} in channel: {channel}')
return
elif user_inbound_message.lower() == '!channel': # When someone types !fight
chan1 = channel.upper()
nick2 = username.upper()
await inbound.channel.send(f" Seriously dude please stop using my CPU for pointless stuff open your eyes "
f"and see you are in: \n{chan1}.\nDo you even want me to tell you who you are??? "
f" tuff ima do it anyway... its *drumroll*...... \n{nick2}") # Replies with the string fightReplies
print(f'!Fight Command used by {username} sent to {channel}')
return # ends this section
elif user_inbound_message.lower() == 'hello': # somone says hello in chat
await inbound.channel.send(
f"Hello how are you {username}") # replies back with Hello how are you in a formatted string with username
return # Ends this statement
elif user_inbound_message.lower() == 'bye':
await inbound.channel.send(f"See you soon! {username}")
print(f'Said bye to {username} in channel: {channel}')
return
elif user_inbound_message.lower() == '!friends': # When someone types !fight
friendReplies = f'Right {username} Our main friends are: Energize join thier discord too' \
f' - https://discord.gg/5GZnbvgk2K' # makes fightReplies a random Choice from "fight" wordlist
await inbound.channel.send(friendReplies) # Replies with the string fightReplies
print(f'!Friend Command used by {username} sent to {channel}')
return # ends this section
elif user_inbound_message.lower() == '!fight': # When someone types !fight
fightReplies = random.choice(fight) # makes fightReplies a random Choice from "fight" wordlist
await inbound.channel.send(fightReplies) # Replies with the string fightReplies
print(f'!Fight Command used by {username} sent to {channel}')
return # ends this section
elif user_inbound_message.lower() == '!website': # When someone types !fight
websiteReplies = random.choice(website) # makes fightReplies a random Choice from "fight" wordlist
await inbound.channel.send(websiteReplies) # Replies with the string fightReplies
print(f'!Fight Command used by {username} sent to {channel}')
return # ends this section
elif any(word in user_inbound_message.lower() for word in curses):
await inbound.channel.purge(limit=1)
await inbound.channel.send(
f"Oi {username}: We have detected that you used a banned word in our channel,\n"
f"please retype your message without swearing or ill keep deleting it :rofl:")
print("Working")
return
elif user_inbound_message.lower() == '!defcon1':
await inbound.channel.purge(limit=100000000000)
await inbound.channel.send(f"{username}: Purged the chat! Now it's nice and clean {Discord_Emojis[6]}")
print("Working")
return
elif user_inbound_message.lower() == '!defcon1+clean':
await inbound.channel.purge(limit=100000000000)
print("Working")
return
client.run(TOKEN)
intro.py
Smiley = '\U0001f600'
def intro():
print(f'{Smiley}{Smiley}{Smiley} Talk Bot Written in Python by Stephen Wilde {Smiley}{Smiley}{Smiley}\n'
f' Released to you for free!\n Check out my website: https://stephenwilde.net')
print("\n\n Lets get started.....")
randomReplies.py
fight = [
"Lets take out the trash.... Oh wait you're too heavy for my motherboard to lift",
'Ugh fine... I hit you... You cry.... I win'
]
website = [
'Our website is https://mhmatters.life but you can download us on the App & Play store',
'You take an interest I like that here you go its https://mhmatters.life but we are also on Play and App store'
]
server_info.py
channelNames = [
'welcome', # used as syntax channelNames[0]
'💬︱lobby' # This will be channelNames[1] when you expend and so on add them as you like
# When adding channels a lot of people forget about the "," comma sign please don't do this or it breaks
]
#below must be an int
TimedChannel = ENTERYOURCHANNELID
startup_config.py
from pathlib import Path
def token_config():
path_to_file = 'token.txt'
path = Path(path_to_file)
print("************ Checking for Token File ************")
if path.is_file():
print(f'The file {path_to_file} exists')
return
else:
print(f'The file {path_to_file} does not exist so I am creating it\n')
token_in = input("Please enter your TOKEN: ")
with open(f'{path_to_file}', 'x') as f:
f.write(token_in)
token_config()
file = open("token.txt")
TOKEN = (file.read())
file.close()
swearlist.py
curses = [
'ahole',
'anus',
'ash0le',
'ash0les',
'asholes',
'ass',
'AssMonkey',
'Assface',
'assh0le',
'assh0lez',
'asshole',
'assholes',
'assholz',
'asswipe',
'azzhole',
'bassterds',
'bastard',
'bastards',
'bastardz',
'basterds',
'basterdz',
'Biatch',
'bitch',
'bitches',
'BlowJob',
'boffing',
'butthole',
'buttwipe',
'c0ck',
'c0cks',
'c0k',
'CarpetMuncher',
'cawk',
'cawks',
'Clit',
'cnts',
'cntz',
'cock',
'cockhead',
'cock-head',
'cocks',
'CockSucker',
'cock-sucker',
'crap',
'cum',
'cunt',
'cunts',
'cuntz',
'dick',
'dild0',
'dild0s',
'dildo',
'dildos',
'dilld0',
'dilld0s',
'dominatricks',
'dominatrics',
'dominatrix',
'dyke',
'enema',
'fuck',
'fucker',
'fag',
'fag1t',
'faget',
'fagg1t',
'faggit',
'faggot',
'fagit',
'fags',
'fagz',
'faig',
'faigs',
'fart',
'flippingthebird',
'fuck',
'fucker',
'fuckin',
'fucking',
'fucks',
'FudgePacker',
'fuk',
'Fukah',
'Fuken',
'fuker',
'Fukin',
'Fukk',
'Fukkah',
'Fukken',
'Fukker',
'Fukkin',
'g00k',
'gay',
'gayboy',
'gaygirl',
'gays',
'gayz',
'God-damned',
'h00r',
'h0ar',
'h0re',
'hoar',
'hoor',
'hoore',
'jackoff',
'jap',
'japs',
'jerk-off',
'jisim',
'jiss',
'jizm',
'jizz',
'knob',
'knobs',
'knobz',
'kunt',
'kunts',
'kuntz',
'Lesbian',
'Lezzian',
'Lipshits',
'Lipshitz',
'masochist',
'masokist',
'massterbait',
'masstrbait',
'masstrbate',
'masterbaiter',
'masterbate',
'masterbates',
'MothaFucker',
'MothaFuker',
'MothaFukkah',
'MothaFukker',
'MotherFucker',
'MotherFukah',
'MotherFuker',
'MotherFukkah',
'MotherFukker',
'mother-fucker',
'MuthaFucker',
'MuthaFukah',
'MuthaFuker',
'MuthaFukkah',
'MuthaFukker',
'n1gr',
'nastt',
'nigger;',
'nigur;',
'niiger;',
'niigr;',
'orafis',
'orgasim;',
'orgasm',
'orgasum',
'oriface',
'orifice',
'orifiss',
'packi',
'packie',
'packy',
'paki',
'pakie',
'paky',
'pecker',
'peeenus',
'peeenusss',
'peenus',
'peinus',
'pen1s',
'penas',
'penis',
'penis-breath',
'penus',
'penuus',
'Phuc',
'Phuck',
'Phuk',
'Phuker',
'Phukker',
'polac',
'polack',
'polak',
'Poonani',
'pr1c',
'pr1ck',
'pr1k',
'pusse',
'pussee',
'pussy',
'puuke',
'puuker',
'queer',
'queers',
'queerz',
'qweers',
'qweerz',
'qweir',
'recktum',
'rectum',
'retard',
'sadist',
'scank',
'schlong',
'screwing',
'semen',
'sex',
'sexy',
'Sh!t',
'sh1t',
'sh1ter',
'sh1ts',
'sh1tter',
'sh1tz',
'shit',
'shits',
'shitter',
'Shitty',
'Shity',
'shitz',
'Shyt',
'Shyte',
'Shytty',
'Shyty',
'skanck',
'skank',
'skankee',
'skankey',
'skanks',
'Skanky',
'slut',
'sluts',
'Slutty',
'slutz',
'son-of-a-bitch',
'tit',
'turd',
'va1jina',
'vag1na',
'vagiina',
'vagina',
'vaj1na',
'vajina',
'vullva',
'vulva',
'w0p',
'wh00r',
'wh0re',
'whore',
'xrated',
'xxx',
'b!+ch',
'bitch',
'blowjob',
'clit',
'arschloch',
'fuck',
'shit',
'ass',
'asshole',
'b!tch',
'b17ch',
'b1tch',
'bastard',
'bi+ch',
'boiolas',
'buceta',
'c0ck',
'cawk',
'chink',
'cipa',
'clits',
'cock',
'cum',
'cunt',
'dildo',
'dirsa',
'ejakulate',
'fatass',
'fcuk',
'fuk',
'fux0r',
'hoer',
'hore',
'jism',
'kawk',
'l3itch',
'l3i+ch',
'lesbian',
'masturbate',
'masterbat',
'masterbat3',
'motherfucker',
's.o.b.',
'mofo',
'nazi',
'nigga',
'nigger',
'nutsack',
'phuck',
'pimpis',
'pusse',
'pussy',
'scrotum',
'sh!t',
'shemale',
'shi+',
'sh!+',
'slut',
'smut',
'teets',
'tits',
'boobs',
'b00bs',
'teez',
'testical',
'testicle',
'titt',
'w00se',
'jackoff',
'wank',
'whoar',
'whore',
'damn',
'dyke',
'fuck',
'shit',
'@$$',
'amcik',
'andskota',
'arse',
'assrammer',
'ayir',
'bi7ch',
'bitch',
'bollock',
'breasts',
'butt-pirate',
'cabron',
'cazzo',
'chraa',
'chuj',
'Cock',
'cunt',
'd4mn',
'daygo',
'dego',
'dick',
'dike',
'dupa',
'dziwka',
'ejackulate',
'Ekrem',
'Ekto',
'enculer',
'faen',
'fag',
'fanculo',
'fanny',
'feces',
'feg',
'Felcher',
'ficken',
'fitt',
'Flikker',
'foreskin',
'Fotze',
'Fu(',
'fuk',
'futkretzn',
'gay',
'gook',
'guiena',
'h0r',
'h4x0r',
'helvete',
'hoer',
'honkey',
'Huevon',
'hui',
'injun',
'jizz',
'kanker',
'kike',
'klootzak',
'kraut',
'knulle',
'kuk',
'kuksuger',
'Kurac',
'kurwa',
'kusi',
'kyrpa',
'lesbo',
'mamhoon',
'masturbat',
'merd',
'mibun',
'monkleigh',
'mouliewop',
'muie',
'mulkku',
'muschi',
'nazis',
'nepesaurio',
'nigger',
'orospu',
'paska',
'perse',
'picka',
'pierdol',
'pillu',
'pimmel',
'piss',
'pizda',
'poontsee',
'poop',
'porn',
'p0rn',
'pr0n',
'preteen',
'pula',
'pule',
'puta',
'puto',
'qahbeh',
'queef',
'rautenberg',
'schaffer',
'scheiss',
'schlampe',
'schmuck',
'screw',
'sh!t',
'sharmuta',
'sharmute',
'shipal',
'shiz',
'skribz',
'skurwysyn',
'sphencter',
'spic',
'spierdalaj',
'splooge',
'suka',
'b00b',
'testicle',
'titt',
'twat',
'vittu',
'wank',
'wetback',
'wichser',
'wop',
'yed',
'zabourah'
]
timedtasks.py
from inbound_messages import *
from server_info import TimedChannel
def timed_messages():
@client.event
async def on_ready():
print("Timed messages running")
start_sending_messages.start()
@tasks.loop(minutes=15) # you can even use hours and minutes
async def start_sending_messages():
await client.get_channel(TimedChannel).send("I'm Timed Oh yeah!")
print('working')
updater.py
import urllib3
import webbrowser
file = open("VersionNumber.txt")
Version = (file.read())
file.close()
def updateVersion():
http = urllib3.PoolManager()
response = http.request('GET', 'https://wilde247.com/discordBot/version.txt')
data = response.data.decode('utf-8')
if data == Version:
print(f"Your version is up to date: {data}")
else:
print("Your version is not up to date do you want to update now?")
yesno = input('Type "yes" to visit the GitHub Repo update!: ')
if yesno == 'yes':
webbrowser.open('https://github.com/stephenwilde247/AthenaDiscordBot', new=2)
print("Please remember to view the readme as updating can remove any code you have added to respond too")
emoji_wl.py Please download this from here:
https://github.com/stephenwilde247/AthenaDiscordBot
as its a lot of lines.