Skip to content

Commit

Permalink
added minions
Browse files Browse the repository at this point in the history
  • Loading branch information
PointlessUser committed Oct 18, 2023
1 parent bcff76f commit faa0eec
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
3 changes: 3 additions & 0 deletions Connect4Bot/Connect4/CheckInput.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from kik_unofficial.datatypes.xmpp.chatting import IncomingGroupChatMessage
from .Connect4Game import Connect4Game
import random

from pickle import load, dump

Expand Down Expand Up @@ -134,6 +135,8 @@ def take_action(games: dict[Connect4Game], action: int, chat_message: IncomingGr
return 'Invalid action'
move = int(message)

if random.randint(0, 1000) == 0:
return "That's a horrible move, tf are you doing?"
return play_move(move, games, chat_message)

if action == 102:
Expand Down
23 changes: 13 additions & 10 deletions Connect4Bot/start.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import yaml
import cProfile
import random

from functools import partial

Expand Down Expand Up @@ -51,7 +52,7 @@ def __init__(self, creds: dict):
self.groupJID = None

# start bot
self.client = KikClient(self, username, password, kik_node, device_id, android_id, logging=True, debug=True)
self.client = KikClient(self, username, password, kik_node, device_id, android_id, enable_logging=True, log_level=1)
# self.client = KikClient(self, username, password, kik_node, logging=True)
self.client.wait_for_messages()

Expand All @@ -65,7 +66,9 @@ def bump(self, bumpJID):
print("Bump")
if bumpJID in bumps and bumps[bumpJID]["bump"]:
bump = bumps[bumpJID]
self.client.send_chat_message(bumpJID, getQuote(bump['bumpCount']))
gif = "minion"+random.choice([" ", "s "]) + random.choice(["Happy", "Sad", "Angry", "Laughing", "Crying", "Dancing", "Dabbing", "Sleeping", "Singing","Bored", "Excited"])
self.client.send_gif_image(bumpJID, gif, self.tenor_key)
# self.client.send_chat_message(bumpJID, getQuote(bump['bumpCount']))
bump["bumpCount"] += 1
bump["timer"].reset()

Expand All @@ -87,13 +90,13 @@ def on_group_message_received(self, chat_message: IncomingGroupChatMessage):
# if display name is needed, get it
if output == 'Display name needed':
self.chat_message = chat_message
# if self.senderName == '3ajrtbkk3ybdun2wucyhedbwpapsxtxupbnlhnghlbxaugdblerq_a':
# self.play_with_custom_display_name("Yvaine")
# elif self.senderName == 'vbalbn4l5embfll4sfd3b2tnfih2hvmsgm7s7t3z6emnh53wvhxq_a':
# self.play_with_custom_display_name("Ahri")
# else:
# self.client.xiphias_get_users_by_alias(self.senderJID)
self.client.xiphias_get_users_by_alias(self.senderJID)
if self.senderName == '3ajrtbkk3ybdun2wucyhedbwpapsxtxupbnlhnghlbxaugdblerq_a':
self.play_with_custom_display_name("Yvaine")
elif self.senderName == 'vbalbn4l5embfll4sfd3b2tnfih2hvmsgm7s7t3z6emnh53wvhxq_a':
self.play_with_custom_display_name("Ahri")
else:
self.client.xiphias_get_users_by_alias(self.senderJID)
#self.client.xiphias_get_users_by_alias(self.senderJID)
# if message isnt invalid action or display name needed, send message
elif output != '':
if type(output) is tuple:
Expand Down Expand Up @@ -156,4 +159,4 @@ def on_disconnected(self):
if __name__ == "__main__":
def my_function():
main()
cProfile.run('my_function()')
cProfile.run('my_function()')

0 comments on commit faa0eec

Please sign in to comment.