The big security update.
This commit is contained in:
+2
-2
@@ -37,11 +37,11 @@ class Chatbot(object):
|
|||||||
if "DMChannel" in type(message.channel).__name__: #respond to messages in PM channels
|
if "DMChannel" in type(message.channel).__name__: #respond to messages in PM channels
|
||||||
yield from self.learnFromMessagesInChannel(message.channel.id, 1)
|
yield from self.learnFromMessagesInChannel(message.channel.id, 1)
|
||||||
yield from self.respondToMessage(message)
|
yield from self.respondToMessage(message)
|
||||||
elif message.channel.id == 139061614178598912: #don't abuse the "belangrijk" channel
|
elif message.channel.id == self.bot.hdChannels["belangrijk"]: #don't abuse the "belangrijk" channel
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
a = random.randint(0,999)
|
a = random.randint(0,999)
|
||||||
if message.channel.id == 137218228953939968 and a < 40: #shitpost channel
|
if message.channel.id == self.bot.hdChannels["shitpost"] and a < 40: #shitpost channel
|
||||||
yield from self.learnFromMessagesInChannel(message.channel.id, 10)
|
yield from self.learnFromMessagesInChannel(message.channel.id, 10)
|
||||||
yield from self.respondToMessage(message)
|
yield from self.respondToMessage(message)
|
||||||
elif a < 10: #all other channels
|
elif a < 10: #all other channels
|
||||||
|
|||||||
+5
-6
@@ -137,8 +137,7 @@ class Shitpost(object):
|
|||||||
Ja of Nee.. kom op nou.
|
Ja of Nee.. kom op nou.
|
||||||
"""
|
"""
|
||||||
#We halen dit op van de twitter account @gietitaloan die vertrouwen wij als de ultieme waarheid
|
#We halen dit op van de twitter account @gietitaloan die vertrouwen wij als de ultieme waarheid
|
||||||
#hahaha geheime tokens in de code hahahaha TODO
|
consumer = oauth.Consumer(key=self.bot.tokens["twitterKey"], secret=self.bot.tokens["twitterSecret"])
|
||||||
consumer = oauth.Consumer(key="eUotijxUEcTVpegNCIzEqz0be", secret="Opj95FAhRkpgVpo61PEJcConvYHgAk7TlouETk2NaSh6dvhCLu")
|
|
||||||
client = oauth.Client(consumer)
|
client = oauth.Client(consumer)
|
||||||
resp, content = client.request("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=gietitaloan&count=1", "GET")
|
resp, content = client.request("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=gietitaloan&count=1", "GET")
|
||||||
#TODO kijken of resp iets zinnigs teruggeeft.. of iets doen met een try of catch ofzow
|
#TODO kijken of resp iets zinnigs teruggeeft.. of iets doen met een try of catch ofzow
|
||||||
@@ -166,7 +165,7 @@ class Shitpost(object):
|
|||||||
params = dict(
|
params = dict(
|
||||||
template_id = '112898841', #de marku
|
template_id = '112898841', #de marku
|
||||||
username = 'Stroopwafel',
|
username = 'Stroopwafel',
|
||||||
password = 'ruyter118',
|
password = self.bot.passwords["imgflip"],
|
||||||
text0 = boven,
|
text0 = boven,
|
||||||
text1 = onder
|
text1 = onder
|
||||||
)
|
)
|
||||||
@@ -192,7 +191,7 @@ class Shitpost(object):
|
|||||||
params = dict(
|
params = dict(
|
||||||
template_id = '93296473', #de eriku
|
template_id = '93296473', #de eriku
|
||||||
username = 'Stroopwafel',
|
username = 'Stroopwafel',
|
||||||
password = 'ruyter118',
|
password = self.bot.passwords["imgflip"],
|
||||||
text0 = boven,
|
text0 = boven,
|
||||||
text1 = onder
|
text1 = onder
|
||||||
)
|
)
|
||||||
@@ -219,7 +218,7 @@ class Shitpost(object):
|
|||||||
params = {
|
params = {
|
||||||
'template_id': '121572521', #delfts blauw
|
'template_id': '121572521', #delfts blauw
|
||||||
'username': 'Stroopwafel',
|
'username': 'Stroopwafel',
|
||||||
'password': 'ruyter118',
|
'password': self.bot.passwords["imgflip"],
|
||||||
'text0': 'dummy0',
|
'text0': 'dummy0',
|
||||||
'text1': 'dummy1',
|
'text1': 'dummy1',
|
||||||
'font': 'arial',
|
'font': 'arial',
|
||||||
@@ -292,7 +291,7 @@ class Shitpost(object):
|
|||||||
params = dict(
|
params = dict(
|
||||||
template_id = '116231806', #de martijn
|
template_id = '116231806', #de martijn
|
||||||
username = 'Stroopwafel',
|
username = 'Stroopwafel',
|
||||||
password = 'ruyter118',
|
password = self.bot.passwords["imgflip"],
|
||||||
text0 = boven,
|
text0 = boven,
|
||||||
text1 = onder
|
text1 = onder
|
||||||
)
|
)
|
||||||
|
|||||||
+19
-3
@@ -7,6 +7,8 @@ import Cryptocoin
|
|||||||
import Chatbot
|
import Chatbot
|
||||||
import logging
|
import logging
|
||||||
import importlib
|
import importlib
|
||||||
|
import configparser
|
||||||
|
import base64
|
||||||
|
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
|
||||||
@@ -20,11 +22,25 @@ bot.add_cog(General.General(bot))
|
|||||||
bot.add_cog(Cryptocoin.Cryptocoin(bot))
|
bot.add_cog(Cryptocoin.Cryptocoin(bot))
|
||||||
bot.add_cog(Chatbot.Chatbot(bot))
|
bot.add_cog(Chatbot.Chatbot(bot))
|
||||||
|
|
||||||
tokenfile = open("stroopwafel.token","r")
|
#tokenfile = open("stroopwafel.token","r")
|
||||||
token = tokenfile.readline().strip()
|
#token = tokenfile.readline().strip()
|
||||||
|
config = configparser.ConfigParser()
|
||||||
|
config.read('stroopwafel.ini')
|
||||||
|
bot.tokens = config["tokens"]
|
||||||
|
bot.hdChannels = config["channels"]
|
||||||
|
#passwords are base64 encoded, which makes it like 1% safer
|
||||||
|
bot.passwords = {}
|
||||||
|
for pw in config["passwords"]:
|
||||||
|
try:
|
||||||
|
bot.passwords[pw] = (base64.standard_b64decode(config["passwords"][pw])).decode()
|
||||||
|
except:
|
||||||
|
print("Problem with decoding password!")
|
||||||
|
bot.passwords[pw] = config["passwords"][pw]
|
||||||
|
|
||||||
|
|
||||||
@bot.event
|
@bot.event
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def on_ready():
|
def on_ready():
|
||||||
print('Logged in as:\n{0} (ID: {0.id})'.format(bot.user))
|
print('Logged in as:\n{0} (ID: {0.id})'.format(bot.user))
|
||||||
|
|
||||||
bot.run(token)
|
bot.run(bot.tokens["discordbot"])
|
||||||
|
|||||||
Reference in New Issue
Block a user