diff --git a/Chatbot.py b/Chatbot.py index 9d83b66..3a3f21d 100644 --- a/Chatbot.py +++ b/Chatbot.py @@ -207,7 +207,7 @@ class Chatbot(commands.Cog): messageIterator = channel.history(limit=nrOfMessages, before=None, after=None, oldest_first=False, around=None) allMessages = [] for i in range(nrOfMessages): - msg = yield from messageIterator.next() + msg = yield from anext(messageIterator) allMessages.append(msg) i = 0 @@ -256,10 +256,10 @@ class Chatbot(commands.Cog): #Get previous message to respond to messageIterator = ctx.channel.history(limit=3, before=None, after=None, oldest_first=False, around=None) - messageToRespondTo = yield from messageIterator.next() #this will be the !reageer command. skip - messageToRespondTo = yield from messageIterator.next() + messageToRespondTo = yield from anext(messageIterator) #this will be the !reageer command. skip + messageToRespondTo = yield from anext(messageIterator) if messageToRespondTo.content.strip()[0] == '!' or messageToRespondTo.author.bot: #another chance - messageToRespondTo = yield from messageIterator.next() #but it's not a huge problem if he responds to himself + messageToRespondTo = yield from anext(messageIterator) #but it's not a huge problem if he responds to himself if messageToRespondTo.content.strip()[0] == '!': wordsToRespondTo = [] else: diff --git a/Points.py b/Points.py index 564f190..934d18b 100644 --- a/Points.py +++ b/Points.py @@ -15,6 +15,7 @@ class Points(commands.Cog): self.voice_states = {} self.BANK_ID = 42 + self.init() def __check(self, ctx): return True @@ -263,7 +264,8 @@ class Points(commands.Cog): np.save("pointscount.npy", pointsCount) # Add new/unknown members: - memberList = self.bot.get_channel(self.bot.hdChannels["shitpost"]).members + list_channel = self.bot.get_channel(self.bot.hdChannels["shitpost"]) + memberList = list_channel.members if list_channel else [] for member in memberList: # Give new members 100 points if member.id not in pointsCount.keys() and not member.bot: diff --git a/README.md b/README.md index 3f28ba3..0203486 100644 --- a/README.md +++ b/README.md @@ -25,5 +25,6 @@ Requirements: * `numpy` * `youtube_dl` * `ffmpeg-python` +* `caldav` Verder zoek je het zelf maar uit. \ No newline at end of file diff --git a/Stroopwafel.py b/Stroopwafel.py index 1086b15..43807a8 100644 --- a/Stroopwafel.py +++ b/Stroopwafel.py @@ -15,7 +15,18 @@ from discord.ext import commands logging.basicConfig(level=logging.INFO) -bot = commands.Bot(command_prefix=commands.when_mentioned_or('!'), description='Stroopwafel. Shitpost bot extraordinaire.', pm_help=True) +async def add_cogs(bot): + await bot.add_cog(Shitpost.Shitpost(bot)) + await bot.add_cog(General.General(bot)) + await bot.add_cog(Cryptocoin.Cryptocoin(bot)) + await bot.add_cog(Chatbot.Chatbot(bot)) + await bot.add_cog(Points.Points(bot)) + +intents = discord.Intents.default() +intents.message_content = True +intents.members = True + +bot = commands.Bot(command_prefix=commands.when_mentioned_or('!'), description='Stroopwafel. Shitpost bot extraordinaire.', pm_help=True, intents=intents) #Read configuration file: config = configparser.ConfigParser() @@ -24,6 +35,7 @@ bot.tokens = config["tokens"] bot.hdChannels = {} for channel in config["channels"]: #channelIDs must be integers bot.hdChannels[channel] = int(config["channels"][channel]) + #passwords are base64 encoded, which makes it like 1% safer bot.passwords = {} for pw in config["passwords"]: @@ -33,20 +45,9 @@ for pw in config["passwords"]: print("Problem with decoding password!") bot.passwords[pw] = config["passwords"][pw] -#bot.add_cog(Music.Music(bot)) -#TODO: Re-add music functions now that we require a stronger host -bot.add_cog(Shitpost.Shitpost(bot)) -bot.add_cog(General.General(bot)) -bot.add_cog(Cryptocoin.Cryptocoin(bot)) -bot.add_cog(Chatbot.Chatbot(bot)) -pointsBot = Points.Points(bot) -bot.add_cog(pointsBot) - @bot.event -@asyncio.coroutine -def on_ready(): +async def on_ready(): + await add_cogs(bot) print('Logged in as:\n{0} (ID: {0.id})'.format(bot.user)) - #TODO: find out how to do this properly: - pointsBot.init() bot.run(bot.tokens["discordbot"])