Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Casino] mebership_updater error #258

Open
ColorOfSilence opened this issue Apr 30, 2022 · 3 comments
Open

[Casino] mebership_updater error #258

ColorOfSilence opened this issue Apr 30, 2022 · 3 comments

Comments

@ColorOfSilence
Copy link

ColorOfSilence commented Apr 30, 2022

I noticed an issue when trying to get the auto-membership assignment working. We first noticed that the membership wasn't doing what it was supposed to do every 5 minutes. We had edited/added VIP and set the requirement to be 1,000,000 credits (just for testing and messing around).

I looked at the wiki and noticed it said that both economy/bank and casino had to be in the same mode so we switched them both to Global. After doing that and resetting some of the balances the auto-updated still wasn't working.

I checked the logs and saw this (user altered):

[2022-04-26 17:53:41] [ERROR] red.jumper-plugins.casino: Casino error in membership_updater:
Traceback (most recent call last):
  File "/foo/bar/Red-DiscordBot/data/neko/cogs/CogManager/cogs/casino/casino.py", line 809, in membership_updater
    await self.global_updater()
  File "/foo/bar/Red-DiscordBot/data/neko/cogs/CogManager/cogs/casino/casino.py", line 833, in global_updater
    await self.process_user(memberships, user_obj, _global=True)
  File "/foo/bar/Red-DiscordBot/data/neko/cogs/CogManager/cogs/casino/casino.py", line 875, in process_user
    if requirements["Credits"] and bal < requirements["Credits"]:
UnboundLocalError: local variable 'bal' referenced before assignment

This is on a basically stock Casino cog, only a few cooldown and payout changes.

@aikaterna
Copy link
Collaborator

Hi there, I don't support edited code, so please don't open issues for code that isn't 100% what is on this repo. Cooldown and payout changes can be done within the casino configuration commands if needs be under the casinoset command and also looking at the set settings for it under casino info.

That being said, here are some tips for your situation:

  • make sure the base that you started editing from is on at least a37ddc9, as there were fixes to membership assignments for the server based non global economy mode

  • Casino memberships are not added to people that are not recorded in the Config file for the cog. A user must have a game completed or some other interaction with casino that writes them to the settings file for the cog before the auto membership assignment will work on them. This is not a bug - it is intentionally designed this way so that bots with hundreds of thousands of users don't get bogged down by the bot writing settings/memberships for every single user, who may or may not use casino in the first place.

  • From your error, you are either missing

    bal = await bank.get_balance(user)
    in your edit, or you are somehow getting that error with casino being in global mode while your Red economy is in local mode. I was not able to repro what your error is in my testing with an unedited copy of the cog, so if you have any special settings or situations you are aware of where I could repro this myself, please let me know. You can see if your console has the error [red.jumper-plugins.casino] Casino is in global mode, while economy is in local mode. Economy must be global if Casino is global. Either change casino back to local with the casinoset mode command or make your economy global with the bankset toggleglobal command. to check to see if the cog settings are different from bank settings. Alternatively use bankset showsettings and look for Bank scope, then use casino info and look for Global being true or false and see if the global/server-based settings on both match.

  • Give 3af00ab a try and see if this helps, and make sure your global/local modes are matched up when you do.

@ColorOfSilence
Copy link
Author

Sorry, I guess my comment wasn't clear, what I meant when I said "only a few cooldown and payout changes."
Was that we changed them using the casinoset command and the likes, through Discord, not by editing the script itself.

I was just trying to be verbose in what was done in case that somehow caused an issue, I should have worded it better.

I'll take a look at your suggetions and see if we can fix it, thanks so much for your quick response.

We did change both Casino and the economy to be global as the wiki suggested but that error popped up so that's why I opened an issue.

It could be that it's just not up to date. I'll look at that commit and try to see if I can pinpoin the issue.

Again, thanks for the quick response.

@aikaterna
Copy link
Collaborator

Hi there, I thought I'd check in with you on your issue to see if this can be closed or if you have additional information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants