Skip to content

Commit

Permalink
Fixed ticket_type verification
Browse files Browse the repository at this point in the history
  • Loading branch information
user committed Jul 23, 2020
1 parent 8304d09 commit 3ef1c13
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions bot_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ def valid_token(token, tokens,sender):
h.update(token.encode("utf-8"))
msg = h.hexdigest()
print(msg)
print(tokens[msg])
if msg in tokens:
if tokens[msg] == 'unused':
return True, msg
Expand Down
11 changes: 6 additions & 5 deletions bot_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ async def process(self):
if is_admin(self.event.sender):
await self._notice()

async def _process_request(self, group):
"""!h $group $token"""
async def _process_request(self, ticket_type):
"""!h $ticket_type $token"""
if not self.args:
response = "You need to add your token after {}".format(self.command)
await send_text_to_room(self.client, self.room.room_id, response)
Expand All @@ -67,20 +67,21 @@ async def _process_request(self, group):
rooms = self.config.rooms
group = self.config.community
filename = "tokens.csv"
if group == "presenter":
if ticket_type == "presenter":
tokens = self.config.presenter_tokens
rooms = self.config.presenter_rooms
group = self.config.presenter_community
filename = "presenters.csv"
elif group == "volunteer":
print("presenter")
elif ticket_type == "volunteer":
tokens = self.config.volunteer_tokens
rooms = self.config.volunteer_rooms
group = self.config.volunteer_community
filename = "volunteers.csv"

valid, h = valid_token(token, tokens,self.event.sender)
if valid:
response = "Verified ticket. You should now be invited to the {} rooms.".format(group)
response = "Verified ticket. You should now be invited to the {} rooms.".format(ticket_type)
await send_text_to_room(self.client, self.room.room_id, response)
print(rooms)
for r in rooms:
Expand Down

0 comments on commit 3ef1c13

Please sign in to comment.